[Swift] Type casting
Upcasting (as)Permalink
- Child instance as parent class
- Safe casting
Downcasting (as! as?)Permalink
- Parent instance as! child class
Return to primitive type. Use when you are confident that you will succeed
- Parent instance as? child class
Return to optional type. Use if you are unsure of success