I have a simple class like this.
public class User {
let id: Int
let firstName: String
let lastName: String
let email: String?
init(id: Int, firstName: String, lastName: String) {
self.id = id
self.firstName = firstName
self.lastName = lastName
}
}
This compiled just fine in previous Swift version. In Swift 1.2, I get the following compilation error.
Return from initializer without initializing all stored properties
Why is that and how can I resolve it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…