We’ve arrived at day 79 of the 100 Days of SwiftUI! Yesterday, we were challenged to expand on our milestone challenge by implementing MapKit. Today, we’re moving on to our next project, which is called “Hot Prospects“. Let’s take a look!
Hot Prospects SwiftUI app introduction
In this project we’re going to build Hot Prospects, which is an app to track who you meet at conferences. You’ve probably seen apps like it before: it will show a QR code that stores your attendee information, then others can scan that code to add you to their list of possible leads for later follow up.
Reading custom values from the environment with @EnvironmentObject
When we need to pass data through a chain of views, we could use an
@ObservedObject like we’ve been doing up until now. However, let’s say that we want to pass an object from view A to view E. We need to go through B, C and D, but those views don’t use the object. How can we resolve this in a more elegant matter? By using an @EnvironmentObject.
Creating tabs with TabView and tabItem()
Navigation views are great for letting us create hierarchical stacks of views that let users drill down into data, but they don’t work so well for showing unrelated data. For that we need to use SwiftUI’s
TabView, which creates a button strip across the bottom of the screen, where tapping each button shows a different view.
That’s it for day 79! We’re going to continue this project tomorrow, so high time to recharge. See you then!