Hello guys, welcome to another video! Today we will talk about Generics in Swift. Why are they so important? Why not using Any for everything? How to use a generic type? and... How can we use generics in SwiftUI?... Let's find out!
BackgroundGradientView: https://gist.github.com/pitt500/e4876b3618a3fc2fb60ba6e36e594064
Content:
0:00 - Intro
0:35 - What are generics?
5:50 - Why not using Any instead of generics?
9:39 - Type Constraints
12:22 - Generic Types
15:52 - Extending a generic type
17:13 - Using generics in SwiftUI
22:52 - Outro
------
References:
- https://docs.swift.org/swift-book/LanguageGuide/Generics.html
- https://developer.apple.com/videos/play/wwdc2018/406
- https://www.swiftbysundell.com/basics/generics/
Source code showed in this video: https://github.com/pitt500/swift-and-tips/tree/main/Generics
------
Other videos in the channel:
- Protocols in Swift: https://youtube.com/playlist?list=PLHWvYoDHvsOX_H712wbhzSW0xqHsFy2j9
- UIKit in SwiftUI: https://youtube.com/playlist?list=PLHWvYoDHvsOX8vB95YIkv_r5e5IXWcyu2
- Struct vs Classes: https://youtu.be/zOeC7pxOIhk
-----
Don't forget to subscribe to the channel, like it, and follow me on social media:
Twitter:
https://twitter.com/swiftandtips
https://twitter.com/pitt500
Finally, ask me for a video you would like to see next
BackgroundGradientView: https://gist.github.com/pitt500/e4876b3618a3fc2fb60ba6e36e594064
Content:
0:00 - Intro
0:35 - What are generics?
5:50 - Why not using Any instead of generics?
9:39 - Type Constraints
12:22 - Generic Types
15:52 - Extending a generic type
17:13 - Using generics in SwiftUI
22:52 - Outro
------
References:
- https://docs.swift.org/swift-book/LanguageGuide/Generics.html
- https://developer.apple.com/videos/play/wwdc2018/406
- https://www.swiftbysundell.com/basics/generics/
Source code showed in this video: https://github.com/pitt500/swift-and-tips/tree/main/Generics
------
Other videos in the channel:
- Protocols in Swift: https://youtube.com/playlist?list=PLHWvYoDHvsOX_H712wbhzSW0xqHsFy2j9
- UIKit in SwiftUI: https://youtube.com/playlist?list=PLHWvYoDHvsOX8vB95YIkv_r5e5IXWcyu2
- Struct vs Classes: https://youtu.be/zOeC7pxOIhk
-----
Don't forget to subscribe to the channel, like it, and follow me on social media:
Twitter:
https://twitter.com/swiftandtips
https://twitter.com/pitt500
Finally, ask me for a video you would like to see next
- Категория
- Язык программирования Swift
Комментариев нет.