Build your second iOS app with SwiftUI
Вставка
- Опубліковано 22 сер 2024
- Donate to my fundraising effort here: justgiving.com/...
Assets: hws.dev/coolbe...
Final project: hws.dev/coolbe...
In this livestream I'll show you how to build a complete SwiftUI app from scratch, building on the concepts introduced in my first livestream. Along the way I'll be answering questions that you might have, and also providing quizzes to help test your learning.
To follow along, you'll need to install Xcode from the Mac App Store. I'll be using Xcode 13.2, but any version of Xcode after 13.0 should be fine.
I strongly encourage you to watch my previous livestream, "Build your first iOS app with SwiftUI", because you'll need all those concepts here too: • Build your first iOS a...
As well as helping folks learn more SwiftUI, this livestream is also taking place in aid of Julian House - a UK charity that provides support for vulnerable and at-risk individuals. These include men, women and young people experiencing homelessness, women and children escaping domestic abuse, adults with learning difficulties and people who need support after leaving prison.
FIRST! HAPPY BIRTHDAY PAUL. You are a hero of mine and please keep up with this fantastic work!
You are a real hero. Doing a charity stream on your birthday. What a guy. Thanks for being so generous. I'm just starting this video but I'm sure you are just as thorough as you were last year. I'm putting your bday on my calendar. Lol
you know when you press play it makes the quiz full screen and we cannot even see the chat window so their answers don't matter. :) You didn't do it with these quizzes I guess but you did last year lol
Very very happy belated birthday and thank you for being a great role model for the iOS community. You and many others have really helped me more than I could ever imagine. I appreciate it tons.
I found when trying to use previews set it up first. I have much better luck with passing any example information in first to the preview and then writing out all the code and occasionally hitting command, option, p and r to resume it. Starting it up right away usually makes it cooperate better. It is a shame that they can be quite flaky though. Also, the “see this, not for you” had me dying of laughter. It is the perfect pitch to a freemium app model. Entice new users.
Thank you Paul....
We're waiting for this year app! Don't forget us :)
Loving this series thanks so much Paul and happy birthday! Maybe for "Build your third iOS app", if you can teach how to take photos and videos and make use of other sensors on the iPhone?
Thank you very much Paul. It is a pleasure to watch your videos.
thanks, nice tutorial. It would be nice if it shows date of the order in history. I will try to add that.
hello !i have a problem with image on programm, i see "hello world!" after implementation of all cod until 30 min of video:(
31:03
Hi Paul, I watched this video and the previous one of last year in a row, it's just amazing. Great pedagogy, makes SwiftUI a charm to learn. I've been programming in Swift for 4 years now, using UIKit and I'm really considering moving to SwiftUI completely now that SwiftUI has become so rich (which wasn't the case a couple of years back). Thanks again. When can I be notified when you do a live? is it through the BELL in your youtube channel? Thanks a bunch... BTW, love your dogs too ;)
done with the 1st one, ok im on for the 2nd one..
Love your stuff Paul! Thank you!!!!
Really enjoyed and learnt a lot. Thank you Sir!
Happy Birthday Sir
Paul, thank so much for these tutorials, they are incredibly useful ... even if it's your fault now I always say D-D-D-D too 😂
Great content as always, thanks Paul! 😃
I'll have to convert it to tea... the drink/elixir of the gods..
Hey Paul, I have better luck with the preview if I do a build before I try to unpause the preview. Happy birthday, happy solstice, happy new year
P.S. Thank you, thank you, thank you! 🙏
Is there a way for you in UA-cam Studio to temporarily disable the chat during quizzes?
I got that error from 17:00 but only after maybe 1hr video tutorial and how to fix that error? fatalError("menu.json is missing or corrupt.")
I’m getting the fatal error message when I try to init the class menu
The file is definitely there.
I’m doing this in Playgrounds 4.1 on my iPad
Has there been a change in the JSONdecoder since Paul recorded this or is it a shortcoming of Playgrounds.
Are you saying that there’s a tip an hour into the video it tells how to fix this error?
Any ideas would be appreciated
thanks
Annoyingly, mine was working last night. I closed my laptop, passed out, woke up, it was ALREADY RUNNING in the sim, closed the sim, cmd+R -- fatal error! can't find the menu json. WUT!
I missed this live, but it's great stuff Paul, thanks. I'm wondering about the difference between calling Type() and calling Type.init - presumably both create a new object of type Type?
Correction, Type() and Type.init() are the same. But that wasn't the question.
I'm answering my own question here, but I thought it's worth doing in case anyone else had the same query:
Type() and Type.init() create a new struct/object
But Type.init (without the parentheses) is a reference to the constructor. So, at 1:45:26 it is used in line 40, and it's used in place of a callback/closure. 'content' takes a closure or function that returns a view - and this requirement is satisfied by MenuView.init
yes for the most part they are the same, especially went it comes to *init* ializing classes
@@hoagy_ytfc Is there a specific reason to use Type.init instead of Type() in this case? I've not seen it done that way before.
Hi Paul! Just finished my first app with you, now onto this one! Loving learning from you! But many troubles with this one... Mainly, and namely: This worked last night. Tried again this morning -- magically cannot load menu.json. This is incredibly frustrating!
EDIT:
Well, I've something. It's not quite clear yet, but...
When following a tutorial in a language you know nothing about, do not allow your OCD to change variable names because that's how you would do it. *Why? Something you don't see or understand might be dependent on those exact spellings!* In this case, I renamed variables that we were dumping from JSON into (those in Menu class for example) to snake_case, not realizing they were being used literally to find a matching string in the JSON. I had a mysterious error that wasn't immediately clear due to our `catch` -> `fatalError` statement in Menu.swift. I'm an idiot. My OCD really needs to chill.
What I'm currently not clear on is where we tied those variable NAMES to the JSON entries with same name. I would expect to define those variables as strings, then search for a matching string in the json, as you iterate over the whole thing (python is the only language I know, and I started in Jan 22).
Is the fact that our variable names were taken literally inherent to the decoding of JSON in swift? Is it expecting a swift-defined struct to put the items from JSON in, and the way it knows which JSON item is which is by the names of corresponding vars of the exact same name defined in the struct?
can you share code please?
Can anyone tell me how to change it so instead of the all the drinks being on the same screen, you make it so that each category eg, coffee, tea is a button that takes you to a list of all the drinks in that category? cheers
Great video, one thing though: when trying the .searchable() part on the iPad and an iPad Simulator I can't get the search field to pop up the keyboard, works fine on an iPhone and an iPhone simulator. Does anyone else have the same issues?
Maybe you should get a 2nd screen for the chat.
Hey Paul, while I was making this project the menu.json suddenly started giving the fatal error. I deleted the file and copied it again to the app folder but still it is giving me the error and the build is failing.
How did you know you needed to use the .tag()? Why do we need it?
Hi, can't download assets... link doesn't work
Yes it does. It downloads a ZIP file with the images and JSON
I've been having some trouble with this one. I have copied the code correct and got an error for .indices I had to fix with "id: \.self". But now I'm having issues with the app actually running and I'm only 50 minutes in. I have an error at @main on the main app file that READ "Thread 1: EXC_BAD_ACCESS (code=2, address=0x7ff7bb19cff8)" I see a lot of stuff here that means absolutely nothing to me as far as this error goes.
Do you think this was made with an older swift code or Xcode that is not quite compatible with what I'm writing now? (cause I've triple-checked my code to make sure I have the same as you do. but I may check again.) I'm in Xcode 13.4.6 and Swift 5 and SwiftUI.
I can run the app but it is missing several pictures on the menu screen that are in the assets page. It also gives me an error "No image named 'flat white' found in asset catalog for..." But I have checked the file names and even rewrote the names and added them to the project again.
I don't know if it is my computer's lack of power either. I am using a 2014 Mac mini with a 2.6 GHz Dual-Core Intel Core i5, 8GB RAM and a 500GB SSD (with 250GB free). No other open applications except for safari and Xcode. I'm not sure what I'm doing wrong and I'm not sure if I should even continue with this project at this point? Or do I need a better computer? Any response is greatly appreciated. I am determined to learn more one way or another.