Diploma in Apple Development 🍎👩🏻‍💻: Coding One: Lecture 7: Extensions, Generics, Errors and SwiftUI Navigation
Back to slide index.
👋🏻 Hi!
First, don't forget to confirm your attendance using the Seats Mobile app!
Second, I'm going to start every lecture with a meditation from the fantastic Sitting Still Like a Frog book, all read by Myla Kabat-Zinn. If you don't want to participate that's completely fine.
Let's start with a Keynote from Swift Data Collections, "Extensions". Once we've finished that, what does the Swift Book say about Extensions?
Let's continue with a Keynote from Swift Data Collections, "Generics". Once we've finished that, what does the Swift Book say about Generics?
Let's watch a WWDC video:
"Embrace Swift Generics" (28 mins)
"Generics are a fundamental tool for writing abstract code in Swift. Learn how you can identify opportunities for abstraction as your code evolves, evaluate strategies for writing one piece of code with many behaviors, and discover language features in Swift 5.7 that can help you make generic code easier to write and understand."
What does the Swift Book say about Error Handling?
Let's watch another WWDC video:
"The SwiftUI cookbook for navigation" (27 mins)
"The recipe for a great app begins with a clear and robust navigation structure. Join the SwiftUI team in our proverbial coding kitchen and learn how you can cook up a great experience for your app. We'll introduce you to SwiftUI's navigation stack and split view features, show you how you can link to specific areas of your app, and explore how you can quickly and easily restore navigational state."
This is a good example of where Apple's API has changed, see this whole article about how to migrate (update) your code to the new navigation types.
Let's go through the example code from that WWDC session.
Homework:
  1. Review today's content.
  2. Complete the two playgrounds from Swift Data Collections: Lab - Extensions.playground and Generics.playground. Don't forget completed versions can be found in the Teacher.zip download. Check the wiki for download links.
  3. Slack me with any problems or queries. See you on Friday for the next Spatial lecture, the next ML lecture is first, on Thursday from 0930.
Thanks!
Back to slide index.