swift 4.2 官方文档学习笔记(十三)- is and as (Type Casting),Nested Type
1 min readDec 18, 2018
- is checker: use is to identify actual subclass type:
2. Downcasting: as! as?(not sure downcasting will success)
3. Any 和 AnyObject
Nested Types
枚举常被用于为特定类或结构体实现某些功能。类似地,枚举可以方便的定义工具类或结构体,从而为某个复杂的类型所使用。为了实现这种功能,Swift 允许你定义嵌套类型,可以在支持的类型中定义嵌套的枚举、类和结构体。