Where's the Sandwich assets & code? wwdc20-10119

I see a Code section on Developer app - but it has just a few snippets of code - not the assets that he drug into the project.

Where are the assets & starter code?

hmm... can not attach a image of the Code section of Developer.

Accepted Reply

I've started a GitHub project with the initial files - I've included some image assets and the Sandwich.swift data file.

https://github.com/davidakoontz/Sandwichs-iOS14-WWDC-Tutorial/


Replies

Well - no answer yet...

Here's a version of Sandwich.swift you can copy & paste.

//

//  Sandwich.swift

//  Sandwich

//

//  Created by David on 6/23/20.

//  Copyright © 2020 Life Works IQ Consulting. All rights reserved.

//



import Foundation



struct Sandwich {

    var id = UUID()

    var name: String

    var ingredientCount: Int

    var isSpicy: Bool = false

    

    var imageName: String { return name }

    var thumbnailName: String { return name + "Thumb"}

}



let testData = [

    Sandwich(name: "Club", ingredientCount: 4, isSpicy: false),

    Sandwich(name: "Pastrami on rye", ingredientCount: 4, isSpicy: true),

    Sandwich(name: "French dip", ingredientCount: 3, isSpicy: false),

    Sandwich(name: "Banh mi", ingredientCount: 5, isSpicy: true),

    Sandwich(name: "Ice cream sandwich", ingredientCount: 2, isSpicy: false),

    Sandwich(name: "Croque madame", ingredientCount: 4, isSpicy: false),

    Sandwich(name: "Hot dog", ingredientCount: 2, isSpicy: true),

    Sandwich(name: "Fluffernutter", ingredientCount: 2, isSpicy: false),

    Sandwich(name: "Avocado toast", ingredientCount: 3, isSpicy: true),

    Sandwich(name: "Gua bao", ingredientCount: 4, isSpicy: true),

]
Sure would be sweet to have the sandwich images ....
Searching GitHub... I found this:

GitHub bymarting Sandwiches

Here are the images.

You will need to download them one by one, or download the whole project, and drag them out of the folder.
One thing to note is that this is NOT the full project from the WWDC. The images will not display perfectly square and aligned. You will also notice the full list of sandwiches is also missing in the sandwich testData. But you don't need it. The points in this project/video are still valid.
I've started a GitHub project with the initial files - I've included some image assets and the Sandwich.swift data file.

https://github.com/davidakoontz/Sandwichs-iOS14-WWDC-Tutorial/


thx
Well it looks like some of us had the same idea! I put together a GitHub project with just the files Jacob dragged in and an assets catalog with a bunch of matching sandwich images from Unsplash prepared and loaded in. Will look a different but should be able to use these as resources for a code along. Check the README for details.

Intro to SwiftUI WWDC20-10119 Resources

Hope it helps someone out!
Finished up the app today - noted some weird difference with the Edit / Add button tool bar. The tool bar is at the bottom of the screen (not top :^)

https://github.com/davidakoontz/Sandwichs-iOS14-WWDC-Tutorial
I typed in the code myself, and also downloaded this sample.
In both case, the "Spicy" label's icon did not line up with the text.
Perhaps Jacob was using a newer build?
SANDWICH APP ISSUES
  • Add & Edit button appear on bottom bar. FIX = code below

  • Preview perfectly works, but when i run it on the Simulator it reads 0 sandwiches.

  • Zoom animations don’t work when there are more than 1 preview (ContentView). FIX = comment out extra windows

  • “Add” button disappears.

  • “<Sandwiches” back button only works for sandwich titles less than 10 letters. all other either read “<Back” or  “<“

  • “flame.fill” icon not vertically aligning with text. 

Code Block
.navigationTitle("Sandwiches")
.toolbar {
ToolbarItem(placement: .navigationBarLeading){
Button("Add", action: makeSandwich)
}
#if os(iOS)
ToolbarItem(placement: .navigationBarTrailing){
EditButton()
}
#endif
}


Just built my 2nd iOS app in Xcode12b4 using this intro to SwiftUI tutorial - this is such a game changer over my 1st app in Xcode 10 years ago!

Thank you for checking in assets into GitHub!
I import sandwiches resources, but failed to load pictures in correct size, does anyone knows how to reset it ?

thanks