Be careful when converting CFDictionary to your own Swift dictionary. Bridging is actually quite expensive, as I just found out in my own code (cheers for profiling!), So if it is called quite often (as it was for me), this can be a big problem.
Remember that CFDictionary is free on NSDictionary with NSDictionary . So the fastest thing you can do is something like this:
let cfDictionary: CFDictionary = <code that returns CFDictionary> if let someValue = (cfDictionary as NSDictionary)["some key"] as? TargetType {
source share