Swift Quiz
summary
Three quick surprises: method bodies dispatch at runtime but default argument resolution is static so a subclass method can print its implementation while using the base class default; structs can mutate constants by reassigning self to a new value (the trick compiles and updates a let property); and an empty enum is actually Never, a real type representing impossible code paths used by fatalError and allowing otherwise empty generics to compile.
AI-written summary · about
chapters (5)
- 0:00Swift Quiz
- 0:23Overridden methods and default value of arguments
- 4:19Constant Property and Mutating Method
- 7:18Empty Enum
- 11:08The Swift compiler is smart enough to understand it and adapt the errors and warnings it will emit in consequence








