Great tutorial. Since this just came out, might as well get these out of the way: change “occured” to “occurred”, “might into” to might run into", “throwing throwing” to “throwing” and add a link to part 2. Also, is there another tutorial that goes into throwing errors more? That is where my weakness lies. Again thanks for the great tutorial.
I think it’s worth mentioning that the default memberwise initializer has an access level of private if any property of the structure is private. It is internal else. So if you want a public initializer you have to implement one – so the automagic does not work if you want to use the structure from within another module/package even if the structure and all it’s properties are public. It’s not quite obvious to spot if you just see the source code and rely on automagic. [The Swift Programming Language (Swift 2.2): Access Control: Initializers]
Very informative tutorial. Sometimes Swift’s strict compiler makes you frustrating when it comes to initializing. Good to know what’s really going on now so we could easily figure them out.
"As you can see, phase 1 begins with the call to the delegating initializer init(temperatureCelsius:pressureAtmospheric:) during which self cannot be used. "
I don’t understand this part…why can’t “self” be used…it works fine when I used self in the playground and it works.
i am trying to get an error back from throwing init, but for some reason i am getting the warning on catch block. please see attached, am i missing something?
This tutorial is more than six months old so questions regarding it are no longer supported for the moment. We will update it as soon as possible. Thank you! :]