Cast Swift Dictionary to CFDictionary

4.5k Views Asked by At

What is the right way to cast Dictionary in Swift 3 to a CFDictionary? Is it legal to write like this?

 var dictionary:Dictionary<NSString, Int> = [:]

and then

 dictionary as CFDictionary
1

There are 1 best solutions below

2
On BEST ANSWER

Yes you can do that. your solution will work and you can also do it like this.

var dictionary = [

    key:value

] as CFDictionary

You can refer further from here