Post

Replies

Boosts

Views

Activity

Failable Initializer
Hello. Is this the correct way to write a failable initializer with two parameters?: struct User { var name: String var stepsToday: Int init(name: String, stepsToday: Int) { self.name = name self.stepsToday = stepsToday } init?(name: String?, stepsToday: Int?){ if let name = name { self.name = name } else { return nil } if let stepsToday = stepsToday { self.stepsToday = stepsToday } else { return nil } } }
2
0
663
Jul ’23
M1 optimized apps
Hi there. I just started my journey into programming. I’m confused about the Arm architecture. Say I only want to develop apps for MacOS written in Swift. Does it mean that my app will automatically be optimized for M1? I hear a lot about how other larger apps are still not optimized. So if they were written for Intel chips, what language did they use. Or how do you write code for M1? Thank you.
1
0
981
Apr ’22