- content hugging and how it works
- Any: can have any type class, struct etc
- AnyObject: can only have class.
- mutating is used inside a struct to make the variable inside it change to a new value.
- subclasses cant change stored property like
let leg = 6
var eyes = 2
they can only change computed properties like
var name: String {
return “”
}
by using the “override” keyword in the subclass
override var name: String {
return “ants”
}
1. Structures vs Classes
Use a structure when:
If you intend to encapsulate a few relatively simple data types then you should use structures.
If you intend that the values to be copied rather than be referenced then you should use structures.
If the properties stored by the structures are themselves value types.
The structure does not need to inherit properties or behaviors from an existing type.
- In computed properties the computation is get {} by default unless set is explicitly mentioned
- We can use same IBAction for multiple button, we have to set class as UIButton and add sender tag on story and can access through tags to perform operations.
- Quiz app 3 has all about orientation constraints
2. View Controller Lifecycle
very important project must study, has everything about view controller lifecycle methods.
- current context means the root view will appear in the background