Xcode 6.3.1: UIFontDescriptor has strange initializers in Swift generated header

Originator:natecook
Number:rdar://20886714 Date Originated:09-May-2015 12:17 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 6.3.1 (6D1002)
Classification:Other Bug Reproducible:Always
 
UIFontDescriptor has some strange initializer signatures in the Swift generated header:

    // Instantiation
    init!(fontAttributes attributes: [NSObject : AnyObject]!) -> UIFontDescriptor
    init(name fontName: String, size: CGFloat) -> UIFontDescriptor
    init(name fontName: String, matrix: CGAffineTransform) -> UIFontDescriptor
    // ….
    init!(fontAttributes attributes: [NSObject : AnyObject]?)

Those first three have a return type, which isn’t legal syntax in Swift. It looks to me like this is happening because those inits are bridging UIFontDescriptor factory methods, which have a syntax like:

    + (UIFontDescriptor *)fontDescriptorWithName:(NSString *)fontName

Note that it has a (UIFontDescriptor *) return type instead of the typical (instancetype) — the bridging seems to be tripping up on that. Happily, the initializers still work fine from actual Swift code:

    let descriptor = UIFontDescriptor(name: "Helvetica", size: 16)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!