Answer the question
In order to leave comments, you need to log in
How to initialize Unmanaged CFString?
Good afternoon.
I'm slowly learning Swift and got stuck on, it seems, little things, but I got stuck thoroughly.
Here is an example code:
import Foundation
import SystemConfiguration
var serviceID: Unmanaged<CFString> = .passRetained(NSString())
var userOptions: Unmanaged<CFDictionary> = .passRetained(NSDictionary())
let res = SCNetworkConnectionCopyUserPreferences(nil, &serviceID, &userOptions)
print("Res", res)
if res {
print(serviceID.takeRetainedValue() as NSString)
print(userOptions.takeRetainedValue() as NSDictionary)
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question