Рет қаралды 2,594
Hello guys, welcome to another video! Today we will continue with the Generics series talking about where clauses to constraint our associated type to a specific domain and modularize our code with the powers of generics and Swift's type inference. Also, in the end, I have a challenge for you: Merge two stacks and generate a new one, let's see if you got the idea about where clauses 👌🏼. Let me know in the comments if your solution was different from mine 😉!
Before continue I recommend you to watch the previous episodes:
Part 1 (Generics) : • Swift Generics: The Ke...
Part 2 (Associated types): • Generics in Swift: Pro...
Started code for this video: gist.github.com/pitt500/c759b...
Content:
0:00 - Intro
0:35 - What are where clauses?
5:25 - Contextual Where Clauses
11:45 - Challenge: Merge two stacks
19:11 - Outro
------
References:
- docs.swift.org/swift-book/Lan...
- developer.apple.com/videos/pl...
- www.swiftbysundell.com/basics...
Final code showed in this video: github.com/pitt500/swift-and-...
------
Other videos in the channel:
- Protocols in Swift: • Protocols
- UIKit in SwiftUI: • UIKit in SwiftUI
- Struct vs Classes: • Structs vs classes in ...
-----
Don't forget to subscribe to the channel, like it, and follow me on social media:
Twitter:
/ swiftandtips
/ pitt500
Finally, ask me for a video you would like to see next 😄!
Credits:
- Music by Wataboi from pixabay.com/
- Video edited with LumaFusion