Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// Designated init
init?(name: String, height: String, weight: String) {
if name.isEmpty || height.isEmpty || weight.isEmpty { return nil } = 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
You can’t perform that action at this time.