Avatar
omochimetaru 8/4/2020 12:45 PM
type(of: v)P なのに as? P.Type が 失敗するの・・・?
12:47 PM
@swift-main protocol P {} extension Int: P {} func checkT<T>(_ t: T) { let tIsP1 = type(of: t) == P.self print("tIsP1=\(tIsP1)") let tIsP2 = type(of: t) is P.Type print("tIsP2=\(tIsP2)") } let a: P = 1 checkT(a)