UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

DAY 18

Project 1, part three


You just finished building your first SwiftUI app, and all being well you were surprised by how easy it was. You might even be wondering why I spent so long talking about structs, closures, optionals, and more, when really we ended up doing some fairly simple code.

Well, first keep in mind that this is only the first project, and I kept it deliberately simple so you can get moving quickly with your own code. Trust me, things will get more complex – in fact tomorrow you’ll be set free with your own project, so don’t get too comfortable!

Second, though, you have been using advanced features. In fact, without realizing it you’ve actually been using all the most advanced features Swift has to offer. We’ve actually been using closures all the time – just look at code like this:

Picker("Tip percentage", selection: $tipPercentage) {
    ForEach(tipPercentages, id: \.self) {
        Text($0, format: .percent)
    }
}

Did you notice that $0 in there? That’s shorthand syntax for closure parameters, because we’re inside a closure.

Anyway, now that the app is complete it’s time for a quick recap what you learned, a short test to make sure you’ve understood what was taught, then your first challenges – exercises designed to get you writing your own code as quickly as possible.

I do not provide the answers to these challenges. This is intentional: I want you to figure it out by yourself rather than just looking at someone else’s work. As Marvin Phillips said, “the difference between try and triumph is a little umph.”

Today you should work through the wrap up chapter for project 1, complete its review, then work through all three of its challenges.

Once you’re done, tell other people: you’ve completed your first SwiftUI project, you’ve passed the test, and you’ve even extended it with your own code.

You should be proud of what you’ve accomplished – good job!

Share your progress!

If you use Twitter, the button below will prepare a tweet saying you completed today, along with a celebratory graphic, the URL to this page, and the challenge hashtag. Don't worry – it won't be sent until you confirm on Twitter!

Need help? Tweet me @twostraws!

 

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

100 Days of SwiftUI


The 100 Days of SwiftUI is a free collection of videos, tutorials, tests, and more to help you learn SwiftUI faster. Click here to learn more, or watch the video below.

Back to 100 Days of SwiftUI

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.