Memberwise Initializers and Custom Inits
Understanding auto-generated memberwise inits and writing custom initializers.
Welcome
Swift structs get a free *memberwise initialiser* that accepts all stored properties. But you can customise or extend this with your own initialiser logic.
Auto-generated Memberwise Init
```swift
struct Point {
var x: Double
var y: Double
}
let p = Point(x: 3.0, y: 4.0) // auto-generated init
```
No need to write `init` yourself — the compiler provides one.
All lessons in this course
- Memberwise Initializers and Custom Inits
- Stored Properties and Property Observers
- Computed Properties in Structs
- Mutating Methods and Copy-on-Write Semantics