Xcode-beta (7A120f): Generated initializers are not public on public types

Originator:owensd
Number:rdar://21461071 Date Originated:19-Jun-2015 08:59 AM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode-beta (7A120f)
Classification:Enhancement Reproducible:Always
 
If I define a type:

public struct Token {
    public let token: Character
    public let content: String
    
    public let column: Int
    public let line: Int
}

The generated init() is only available at the module level. This requires me to write this:

public struct Token {
    public init(token: Character, content: String, column: Int, line: Int) {
        self.token = token
        self.content = content
        self.column = column
        self.line = line
    }
    
    public let token: Character
    public let content: String
    
    public let column: Int
    public let line: Int
}

There really needs to be a better way.

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!