Hi there,
Currently, we are working on the enterprise project that using data in ~/Library/Preferences/com.apple.dock.plist to get detail design of the original Dock (as autohide, orientation).
It still has been worked until macOS 13.* as description as below:
But, It has been changed in macOS 14.*
Is there any alternative method to do that in macOS 14.* and later?
Post
Replies
Boosts
Views
Activity
I want to low the MenuBar brightness in OS X, even though not to change the general brightness.
I have no clue to do that. Is there any solution?
Hi There,
I have found a suspicious memory leak when I use Scroll View, List or anything else to list a View.
This is Scroll view with Lazy Grid define:
struct TravelingView1: View {
var body: some View {
ScrollView {
LazyVGrid(columns: [GridItem(.flexible())]) {
ForEach(0..<10) {_ in
Rectangle()
.frame(height: 20)
}
}
}
.frame(height: 200)
}
}
And Button Style in the View as:
struct ScreenView1: View {
@ObservedObject var drawRadioButtonViewModel: DrawRadioButtonViewModel1
var body: some View {
RadioButton(type: .radioButton, toggle: drawRadioButtonViewModel.isRadioCheck,
identifier: "Quick Split",
radioWidth: 302,
action: { [weak drawRadioButtonViewModel] in
drawRadioButtonViewModel?.updateToggleCheck()
},
label: {})
.offset(x: -CGFloat(100)/2, y: CGFloat(100))
Button(drawRadioButtonViewModel.isRadioCheck ? "Checked" : "Unchecked", action: { [weak drawRadioButtonViewModel] in
drawRadioButtonViewModel?.updateToggleCheck()
})
.offset(x: -CGFloat(100)/2, y: CGFloat(100) + 30)
}
}
With Button Style as:
struct RadioButton<Content: View>: View {
let type: Button_styles
let toggle: Bool
var isDisable: Bool = false
let identifier: String
var radioWidth: Int
let action: () -> Void
let label: () -> Content
enum Button_styles {
case radioButton
case checkBox
}
init(type: Button_styles, toggle: Bool, isDisable: Bool = false, identifier: String, radioWidth: Int, action: @escaping () -> Void, @ViewBuilder label: @escaping () -> Content) {
self.type = type
self.action = action
self.radioWidth = radioWidth
self.label = label
self.toggle = toggle
self.isDisable = isDisable
self.identifier = identifier
}
init(action: @escaping () -> Void, @ViewBuilder label: @escaping () -> Content) {
self.init(type: .radioButton, toggle: Bool(), isDisable: Bool(), identifier: String(), radioWidth: Int(), action: action, label: label)
}
var body: some View {
Button(action: action, label: label)
.buttonStyle(RadioButtonStyle(toggle: toggle,
isDisable: isDisable,
identifier: identifier,
radioWidth: radioWidth,
action: action))
}
}
struct RadioButtonStyle: ButtonStyle {
var toggle: Bool
var isDisable: Bool
var identifier: String
var radioWidth: Int
var action: () -> Void
func makeBody(configuration _: Configuration) -> some View {
ZStack {
if isDisable {
DisableRadioButton(identifier: identifier, radioWidth: radioWidth, action: action)
} else {
if toggle {
SelectedRadioButton(identifier: identifier, radioWidth: radioWidth, action: action)
} else {
NormalRadioButton(identifier: identifier, radioWidth: radioWidth, action: action)
}
}
}
}
}
struct SelectedRadioButton: View {
var identifier: String
var radioWidth: Int
var action: () -> Void
var body: some View {
let offsetX = radioWidth / 2 + 20/2 + 12
ZStack {
Image("common_check_on")
.frame(width: CGFloat(20), height: CGFloat(20))
Text(identifier)
.shadow(color: .black.opacity(0.75), radius: 1, x: 1, y: 1)
.font(.system(size: 15))
.frame(width: CGFloat(radioWidth), height: CGFloat(20), alignment: .leading)
.offset(x: CGFloat(offsetX), y: 0)
.foregroundColor(.black)
.onTapGesture {
action()
}
}
}
}
struct NormalRadioButton: View {
var identifier: String
var radioWidth: Int
var action: () -> Void
var body: some View {
let offsetX = radioWidth / 2 + 20/2 + 12
ZStack {
Image("common_check_off")
.frame(width: CGFloat(20), height: CGFloat(20))
Text(identifier)
.shadow(color: .black.opacity(0.75), radius: 1, x: 1, y: 1)
.font(.system(size: 15))
.frame(width: CGFloat(radioWidth), height: CGFloat(20), alignment: .leading)
.offset(x: CGFloat(offsetX), y: 0)
.foregroundColor(.black)
.onTapGesture {
action()
}
}
}
}
struct DisableRadioButton: View {
var identifier: String
var radioWidth: Int
var action: () -> Void
var body: some View {
let offsetX = radioWidth / 2 + 20/2 + 12
ZStack {
Image("common_check_off")
.frame(width: CGFloat(20), height: CGFloat(20))
Text(identifier)
.font(.system(size: 15))
.frame(width: CGFloat(radioWidth), height: CGFloat(20), alignment: .leading)
.offset(x: CGFloat(offsetX), y: 0)
.foregroundColor(.gray)
.onTapGesture {
action()
}
}
}
}
I don't have any clue to find out where cause this leak. Could you please re-check it?
Git: https://github.com/KuroPiii/SuspiciousMemoryLeaksLazyGrid
I want to ping to IPV6 via local-link address, which needs to get the current active Network Interface like Wi-Fi or Ethernet via adapter connection.
Like:
ping6 fe80::122b:41ff:feb3:6a20%en0
With en0 is the Wi-Fi Interface.
I have tried :
private func getAllNetInterfaceName() -> [String] {
let interfaces = SCNetworkInterfaceCopyAll() as? [SCNetworkInterface] ?? []
return interfaces.compactMap { SCNetworkInterfaceGetBSDName($0) as? String }.filter { !$0.isEmpty }
}
It returns the array of the current Interfaces, but I still can not get which one is currently connected.
Did you have any clue?
Currently, We are developing a MacOS application and the app can connect successfully to a server "X.X.X.X:YYYY" with default TCP Option and none TLS by NWConnection.
Note: the host name without any "http/https" or "ws/wss". If we add one of them before host name, the connection will be fail to connect.
After the client connected to the server. Server will send a message for client contains "TLS".
We have two certificate files from server so how can we setup the connection with those certificates for SSL Handshake after the connection has been established?
We have a MFC App using the logic as description below:
Open socket with TCP.
Get the sever receive message.
Get Handshake context if the message contains "TLS", Client credentials.
Perform Client Handshake with the context above.
Verify the Server CA with *.der and *.cer format
About Certificate Authority, I used these lines of code to add to the keychain for testing:
let rootCertPath = "***/enterprise_der.cer"
let rootCertData = NSData(contentsOfFile: rootCertPath)
let rootCert = SecCertificateCreateWithData(kCFAllocatorDefault, rootCertData!)
//var result: CFTypeRef1
let dict = NSDictionary.init(objects: [kSecClassCertificate, rootCert!], forKeys: [kSecClass as! NSCopying, kSecValueRef as! NSCopying])
err = SecItemAdd(dict, nil)
The CA is automatically add to the login Keychain.
I have tried to use the
let tlsOptions = NWProtocolTLS.Options()
sec_protocol_options_set_min_tls_protocol_version(
tlsOptions.securityProtocolOptions,
.TLSv12)
but my app dose not connect to the IP totally.
func connect(toHost host: String, port: UInt16 = broadcastPort) -> Void) {
connection = NWConnection(host: .init(host), port: .init(integerLiteral: port), using: NWParameters(tls: nil, tcp: .init()))
connection?.stateUpdateHandler = { ... }
self.connection?.start(queue: .main)
}
Is there any solution for this case? I have tried several guidelines in StackOverFlow but It doesn't work or being deprecated.