Created
September 22, 2018 23:05
-
-
Save mlaster/9afe90715ade6154d2549d1299ce8338 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func createXPCDictionary(_ inDictionary: [String: Any?]) -> xpc_object_t { | |
var keyArray: [UnsafePointer<Int8>] = [] | |
var valueArray: [xpc_object_t?] = [] | |
for (key, value) in inDictionary { | |
keyArray.append(key) | |
let xo: xpc_object_t? = xpc_string_create(value as! String) | |
valueArray.append(xo) | |
} | |
precondition(keyArray.count == valueArray.count) | |
let keys: UnsafePointer<UnsafePointer<Int8>> = UnsafePointer(keyArray) | |
let values: UnsafePointer<xpc_object_t?> = UnsafePointer(valueArray) | |
print("keys: \(keys)") | |
print("values: \(values)") | |
print("count: \(keyArray.count)") | |
return xpc_dictionary_create(keys, values, keyArray.count) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment