In Swift 1.2 I had a C function with the following signature:
__nonnull CFArrayRef FDCreateSupportedAudioFileExtensions() CF_RETURNS_RETAINED;I know that this function returns an array of
CFStringRef instances, so I called it from Swift like this:let supportedAudioTypes = FDCreateSupportedAudioFileExtensions() as! [String]and everything worked as expected. However, in Swift 2 this code fails at runtime due to the forced cast (
EXC_BAD_INSTRUCTION). I'm able to get things working with the following:let supportedAudioTypes = FDCreateSupportedAudioFileExtensions() as NSArray as! [String]I'm unsure what changed from Swift 1.2 to 2.0. Is this a bug in the current version of Swift or have I missed something? Everything I've read implies that CFTypes are toll-free bridged to their Swift counterparts so I'm not sure why what used to work is now failing.