First time poster - I hope I get this right and don't waste anybody's time.
I'm new to Xcode and Swift as well.
When I 'create' (I hope that's the right word) a 'struct', why do I have to init it? Isn't it enough just to add constants and let that be the end of it?
struct User {
let name:String
let email:String
let followers:Int
let isActive:Bool
// init(name:String, email:String, followers:Int, isActive:Bool) {
// self.name = name
// self.email = email
// self.followers = followers
// self.isActive = isActive
// }
func logStatus() {
if isActive == true {
print ("\(name) is working hard.")
} else {
print ("\(name) has left Earth.")
}
}
}
Thanks,
Ryan Ashton
Hong Kong