Hopefully this project has shown you how to take the skills you know – SwiftUI’s forms, pickers, steppers, and navigation – and build them into an app that sends all the user’s data off to a server and processes the response.
You might not realize this yet, but the skills you learned in this project are the most important skills for the vast majority of iOS developers: take user data, send it to a server, and process the response probably accounts for half the non-trivial apps in existence. Yes, what data gets sent and how it’s used to update the UI varies massively, but the concepts are identical.
Anyone can sit through a tutorial, but it takes actual work to remember what was taught. It’s my job to make sure you take as much from these tutorials as possible, so I’ve prepared a short review to help you check your learning.
Click here to review what you learned in this project.
One of the best ways to learn is to write your own code as often as possible, so here are three ways you should try extending this app to make sure you fully understand what’s going on.
placeOrder()
fails – for example if there is no internet connection – show an informative alert for the user. To test this, try commenting out the request.httpMethod = "POST"
line in your code, which should force the request to fail.Order
class so it saves data such as the user's delivery address to UserDefaults
. This takes a little thinking, because @AppStorage
won't work here, and you'll find getters and setters cause problems with Codable
support. Can you find a middle ground?Hacking with Swift+ subscribers can get a complete video solution for this checkpoint here: Solution to Cupcake Corner. If you don’t already subscribe, you can start a free trial today.
GO FURTHER, FASTER Unleash your full potential as a Swift developer with the all-new Swift Career Accelerator: the most comprehensive, career-transforming learning resource ever created for iOS development. Whether you’re just starting out, looking to land your first job, or aiming to become a lead developer, this program offers everything you need to level up – from mastering Swift’s latest features to conquering interview questions and building robust portfolios.
Link copied to your pasteboard.