xcode8-beta6

AnyObject not working in Xcode8 beta6?

别说谁变了你拦得住时间么 提交于 2019-11-26 02:00:06
问题 In Xcode8 beta6, the following code will cause a warning: \'is\' test is always true. But it won\'t print pass. struct TestStruct { } //warning: \'is\' test is always true if TestStruct() is AnyObject { print(\"pass\") } And the following code will cause a warning: Conditional cast from \'T\' to \'AnyObject\' always succeeds public static func register<T>(_ protocolType: T.Type, observer: T) { //Warning: Conditional cast from \'T\' to \'AnyObject\' always succeeds guard let object = observer