Why does SomeStruct() is AnyObject return true? [duplicate]
问题 This question already has an answer here : Why is casting a struct to AnyObject not a compile error in swift? (1 answer) Closed last year . I'm a bit confused by the usage of AnyObject. Let me provide a few examples. AnyObject NSObject() is AnyObject ^ true (as expected) class MyClass {} MyClass() is AnyObject ^ true (as expected) class MyClass {} MyClass.self is AnyObject ^ true (as expected) String() is AnyObject ^ true (as NOT expected) struct MyStruct {} MyStruct() is AnyObject ^ true (as