|
Hi everyone, I am on project 8 now and finishing off the challenge section. I got a bit confused as to why my app doesn't run (blank white screen) when Xcode says that it compiles my codes successfully. underneath at the debugger output, it shows nothing. has anyone experienced this before and what exactly went wrong? Thank you! |
|
|
|
The code loaded okay. The debugger output did come up with not loading one of the files, but I fixed that and it compiles without further warning in the debugger. screen remained blanked and white. I just wonder if there is a chance maybe its a fault with the canvas or the console preview. Or it generally boils down to my codes to cause an unknown error? |
TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts! Sponsor Hacking with Swift and reach the world's largest Swift community! |
|
|
|
okay. Its a really long one, divided in 4 sections for loading_data, ContentView, MissionView and AstroView loading data
ContentView
MissionView
and Lastly, AstroView - showing astronaut detail after clicking from missionView
here you go! |
|
Your problem might be in your ContentView. In your list you have a NavLink. Inside your Navlink you have an image and a vstack. This is whats causing it i believe. Its not showing because it doesnt know what to do with whats inside NavLink. To fix, put the image and vstack inside a hstack and that should do it. Dave |
|
I have run the project as is. And First are you talking about the canvas (on the side)? This will not show with
change that to
then you should see the MoonShot missions. When you run in simulator it crash with your However I will say that this project is different code from Moonshot that Paul did in his tutorial So you may want to relook at it. |
|
re @Newy11527, Thanks for the advice. I believe its definitely to do with my codes. I tried your VStack method, it didn't work. I will just do a one-to-one comparison with paul's to see what exactly the program may be. re @NigelGee, I changed ContentView() to Text in the preview in the hope that it'll at least show a simple text on the canvas, that didn't work, changing it back to ContentView didn't work as well. It was one of the things I tried to see if it's a fault with Xcode instead of my codes. And yes my codes are different from Paul's because paul's one is confusing to me as to how he uses var names across different views. oh and btw the fatalError("Cannot load into astronaut role") part, this only came up once, and since fixed, the code compiles every time okay without any errors popping up anymore in debugger output. update1: I sorted my code, its now working. It has to do with each individual views being self-sufficient to run on their own. Thank you guys. In case anyone is interested. here are the working codes. I finished the challenges as well but I had a workaround with the missions attended. Getting all the missions attended was what broke my code in the first place. astroViewEachAstro (3rd view)
MissionView (2nd View)
ContentView (1st View)
Data_management page
|
|
Glad you got it sorted. Just a couple of notes about your project.
As I said it great work that you got it to work, just some food(code) for thought going forward. 👍🏻 |
|
re @NigelGee , thanks for the feedback, the JSON request might have been called more than it shoud, but that seemed the only way I could get my console to run, else the code compiles, but the preview gives error. The var names from paul are the same, differentiated by lowercase and uppercase, that's the part I found confusing. CrewAndRole and CrewRole, even though repeated, the words involved are different. I guess eventually I'd have to get used to the small and big case difference in vars of the same name. I am sure Paul would have taught us with codes under some sort of industrial protocol on how they name their vars |
TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.