// Designated init | |
init?(name: String, height: String, weight: String) { | |
if name.isEmpty || height.isEmpty || weight.isEmpty { return nil } | |
self.name = name | |
self.height = height | |
self.weight = weight | |
} | |
// Convenience init | |
convenience init?(firstName: String, lastName: String, height: String, weight: String) { | |
let fullName = "\(firstName) \(lastName)" | |
if fullName.isEmpty || height.isEmpty || weight.isEmpty { return nil } | |
self.init(name: fullName, height: height, weight: weight) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment