var a: Int = 3 print(a) // 3 print(a is AnyObject) // true print(type(of: a) is AnyObject.Type) // false var b: AnyObject = a as AnyObject print(b) // 3
先週の型の互換性と is
as
の振る舞いが一致しない件、そういえばこんな例もあるvar s: String = "" print(s is NSString) // true print(type(of: s) is NSString.Type) // false