Basic init rules in Swift

I kept wondering whether you’re supposed to call the parent init method before or after your code and I found a basic answer:

init() {
    // Put values into your instance variables and constants

    super.init()

    // Other initialization code, such as calling methods, goes here
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *