Recreating the Sandwiches SwiftUI WWDC Code

Without the Hot Dogs References

Image for post
Image for post
Photo by Mae Mu on Unsplash

Remember that Video with Sandwiches at WWDC. This post uses assets from a wonderful GitHub repo.

And we are trying to recreate the WWDC code to create the following:

Image for post
Image for post

Difficulty: Beginner | Easy | Normal | Challenging
This article has been developed using Xcode 12.0, and Swift 5.3

Terminology

SwiftUI: A simple way to build user interfaces across Apple platforms

Prerequisites:

You will be expected to be aware how to make a SwiftUI project

With that all said, let’s get started!

Setup

This setup gives us a new project; I’ve called mine “RecreateSandwiches” but you are free to call yours whatever you would like.

Image for post
Image for post

I will then show the classes that I’ve created in turn. If you’d like to skip to the repo.

Oh, and note that the iPad version works in portrait rather than landscape mode.

ContentView and SandwichCell

SandwichDetail

SandwichStore

Sandwich

Conclusion

If you’d like to go through the WWDC Video you’ve now got the code to help you!

This is a good thing for everyone concerned, and I’ll leave my repo up for people use in the future.

If you’ve any questions, comments or suggestions please hit me up on Twitter

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store