Generic Types
generic protocol
Generic code is turned to specialized code at compile time.
Sundell โฉ Discover Generics
TensorFlow โฉ Protocol-oriented programming & generics
AppCode โฉ ่ฉณ่งฃ Swift ๅ็จฎ Type Polymorphism #todo
Master Swift Generics: A practical guide to code reuse
Swift in Depth, Ch. 7, Generics
Hashable - type parameter ๆ generic type ๆฌ่บซๆๆๅฟ ้ ๆฏ Hashable, ไพๅฆ๏ผ็ถไฝ Dictionary ็ Key ๆๆฏ็ถไฝ Set ็ๅ ็ด ใ
operator (~=) - generic operator (for pattern matching)
ๅ๏ผใ ๅฏไปฅๅฎ็พฉ S<A> ๅๅฎ็พฉ S<A, B> ๅโใ
S<A>
S<A, B>
็ญ๏ผใ ไธ่กโ๏ธ(redeclaration of S) ใ
redeclaration of S
Last updated 2 years ago