Convert CFString to String in case statement

With the following code:


import Cocoa
let foo = "public.file-url"
let bar = kUTTypeFileURL as String
switch foo {
case kUTTypeFileURL as String:
    print("File URL")
default:
    print("Not a file URL")
}


Why do I get the error "'CFString' is not implicitly convertible to 'String'" for the case statement? It works if I rewrite the case statement as


case kUTTypeFileURL as NSString as String:


but with the bar variable this double casting was not neccessary.

Convert CFString to String in case statement
 
 
Q