SwiftUI - How to do Navigation in your Swift UI app

  Рет қаралды 79,851

CodeWithChris

CodeWithChris

Күн бұрын

In this SwiftUI video, you'll learn how to display a list of data, navigate between two views and pass data between them.
𝗩𝗶𝗱𝗲𝗼 𝗧𝗶𝗺𝗲 𝗦𝘁𝗮𝗺𝗽𝘀:
00:00 Intro
00:34 Preview of the Final App
04:40 Starting with Apple's Project
09:46 Building the Rows
17:23 Building the List
23:48 The NavigationView
32:31 Implementing the MapView
33:40 Implementing the CircleImage
37:09 Set the NavigationBar Title
39:25 Running the App
41:19 Outro
I'm following and learning from Apple’s own SwiftUI tutorials and I highly recommend that you give them a read as well:
⚡ developer.apple.com/tutorials...
I'll be publishing more SwiftUI content and tutorials in the coming days so make sure you're subscribed and you won’t miss a beat:
⚡kzfaq.info...
SwiftUI is a new declarative framework to build user interfaces for apps across all of Apple’s platforms including iOS and the new iPadOS.
I’m super excited about Swift UI because it addresses the biggest concern I had with teaching programmatic UIs to beginners: that they would get lost and get discouraged.
SwiftUI is both intuitive and easy to grasp and it offers the maintainability and flexibility of a UI built with code. I’m going to start adopting it into my beginner material and I think you guys are going to really like it!
#swiftui #codewithchris

Пікірлер: 226
@CodeWithChris
@CodeWithChris 5 жыл бұрын
QOTD ⚡Did you install Xcode 11 or macOS Catalina beta on your machine? Let me know by leaving a comment!👇 Kick start your own app with my free 7 Day App Action Plan ➡️ bit.ly/7dplan
@elzoguarnieri3207
@elzoguarnieri3207 5 жыл бұрын
No I have not yet. I’m actually going through your courses and my question is: shoutI stop and start studying Swift UI or keep going through the courses?
@CodeWithChris
@CodeWithChris 5 жыл бұрын
If your focus is to make an app for iPhone only, the course is still 100% valid because Swift and SwiftUI are 2 different things. Swift will still be used to write the brain of the app. Now SwiftUI is the new kid on the block that allows you to skip the storyboard to make your app cross platform from iPhone to iPad and to Mac! I don't think Apple introduced Swift 5.x to trash it 3 months later with SwiftUI. Everything you still learn now and tomorrow will still be useful ! @AdrienVillez
@ipioneerit7755
@ipioneerit7755 5 жыл бұрын
@@CodeWithChris to show a title on the list, put the .navigationBarTitle on the actual list within the NavigationView
@marymuthonimarete7440
@marymuthonimarete7440 4 жыл бұрын
I did yesterday and I am trying to follow your tutorial. Thanks for helping us Chris, with these tutorials.
@braninpodolski7862
@braninpodolski7862 5 жыл бұрын
Love SwiftUI. For a complete beginner to coding, this is easier than anything before!
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Glad you feel that way, for others it's a bit scary! @AdrienVillez
@yessicamiguel5977
@yessicamiguel5977 3 жыл бұрын
Your voice really calm me and makes me feel like programming is actually easy. (but everybody knows it's not, so thank you).
@CodeWithChris
@CodeWithChris 3 жыл бұрын
So grateful for your kindness, Yessica! :-) -Arthur
@zachdenney
@zachdenney 5 жыл бұрын
I'm running beta software on my MBP, watch, and phone-- definite bugs, but tolerable at the moment. really appreciate your tutorials as i learn swift. thank you !
@CodeWithChris
@CodeWithChris 5 жыл бұрын
The Betas are less deadly than they were like 5 years ago! Good luck on the new SwiftUI projects! @AdrienVillez
@AM-gt9uo
@AM-gt9uo 3 жыл бұрын
Thank you so much for this. This filled a few gaps that I couldn't get from the official tutorial, especially the use and syntax of closures to initialise a List was completely random when I first looked at it.
@CodeWithChris
@CodeWithChris 3 жыл бұрын
Glad to know this, Arjun! All the best and keep on having fun! -Arthur
@devhopes
@devhopes 5 жыл бұрын
Awesome video :-). I installed the Betas on my machine and so far so good :-). Keep on keeping on
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Hey Liz, I had my doubts too but I gotta say, they’re working better than I though haha
@DJPeachUK
@DJPeachUK 5 жыл бұрын
Awesome video again! Would love to see parsing the json data from a server rather than having it local.. Keep up the great vids! 🙌🏻
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Yes, we will work our way from simple to more complex with this series! @AdrienVillez
@nihalchaudhary1090
@nihalchaudhary1090 5 жыл бұрын
great sir plz do not stop to make such tutorial i m your regular student ,its help me a lot thank you ...love you sir
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Thank you for all your support! 🙌 -Kat
@nelglezmusic
@nelglezmusic 5 жыл бұрын
Awesome tutorial!
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Thank you! @AdrienVillez
@giannis6924
@giannis6924 4 жыл бұрын
That was awesome thank you so much!!!
@CodeWithChris
@CodeWithChris 4 жыл бұрын
You are so welcome! 🙌
@bodyhanger7137
@bodyhanger7137 5 жыл бұрын
I installed Xcode 11 but not Catalina. I’m gonna install it on a different partition Chris, that way it does not interfere with my main OS. Later, when it’s officially released, I can reclaim the space used when I install Catalina over Mojave and Xcode 11 over top of Xcode 10. Hope that made sense mate. Thanks for these tutorials in SwiftUI Chris, the more I work with it the more I’m liking it. Definitely a game changer..👍👍👍
@akshatvv
@akshatvv 3 жыл бұрын
very nice video, thanks !!
@CodeWithChris
@CodeWithChris 3 жыл бұрын
Cheers, Akshat! Glad we could help! -Arthur
@ivarara
@ivarara 3 жыл бұрын
Great lecture thanks, I learned a lot
@CodeWithChris
@CodeWithChris 3 жыл бұрын
Yes, awesome to know this, Ivar! Keep on going! :-) -Arthur
@wesleyduits1515
@wesleyduits1515 4 жыл бұрын
Hi Chris, I wanted to try SwiftUI as soon as Xcode11 came out. Only it didn't work without OSCatalina, I couldn't wait to try SwiftUI so i installed my first beta on my MBP. I made OSCatalina run on a USB-stick, you never know. It runs good but I can't run Xcode files from my desktop. My files have to be put in a different folder. That took me a while to find out, thanks to the mighty internet. I started learning Swift from Swift 3 so I am not new but definitely not a pro. SwiftUI puts me back a few steps. Your tutorials help me a lot, keep it up.
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Thanks for your support! Glad you found the tutorials helpful, It means a lot! -Kat
@srram
@srram 4 жыл бұрын
identified(by:).. is deprecated now. The change I made was List(landmarkData, id: \.id). The rest stayed the same
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Thank you for the contribution, I'm sure it will help some people who may have read your comment :) - Francis
@TheOnlyHelix
@TheOnlyHelix 4 жыл бұрын
This took me a while to figure out, I should've looked at the comments first!
@thatomathibe2327
@thatomathibe2327 4 жыл бұрын
I tried this, but it's still not working.
@EpicGamerAbhay
@EpicGamerAbhay 5 жыл бұрын
Nice Job😎👍👌
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Thank you! All credits go to Apple, we are just live coding it for you! @AdrienVillez
@catneedslogic9836
@catneedslogic9836 2 жыл бұрын
Hey Chris can you make a video on how to make different scenes per say for very new beginners. You do a really good job explaining, you're a serious inspiration to me! Wish I had a teacher like you Edit: What I mean is like how to have a start screen and then something else.
@CodeWithChris
@CodeWithChris 2 жыл бұрын
Hello, feel free to post your suggestion here: app.productstash.io/codewithchris#/ideas. Thanks for learning with us! -Arthur
@curt8806
@curt8806 4 жыл бұрын
swift is the most convoluted programming language ever
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Oh I see, thanks for sharing your opinion. :-) -Arthur
@curt8806
@curt8806 4 жыл бұрын
CodeWithChris hey Chris. Can you show how to do the same thing if the Json file is obtained from an http post request?!
@ykgreene
@ykgreene 5 жыл бұрын
Another great lesson. Can you teach this same lesson using Swift 5 UIkit.
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Swift 5 is not dead, we can still make UI elements in Swift. @AdrienVillez
@Abbici
@Abbici 4 жыл бұрын
Nice to see all your examples. Have one explain to select a bluetooth attachment? Thank you.
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, sorry but there is no video or tutorials about "file sharing", maybe you can check articles online like this one medium.com/if-let-swift-programming/managing-files-in-ios-dfcdfdc1f426 - Francis
@Abbici
@Abbici 4 жыл бұрын
@@CodeWithChris Thank you and sorry for the bother
@arsalanhashemi4469
@arsalanhashemi4469 4 жыл бұрын
nice
@txbgould
@txbgould 5 жыл бұрын
Chris, do you know if SwiftUI will completely replace all we have learned previously or will we be able to leverage that?
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Swift will never go away. SwiftUI is just the newer way to write UI. You still need Swift to write the logic and the brain of your apps. @AdrienVillez
@pierremarais7669
@pierremarais7669 4 жыл бұрын
Hi Chris thanks for the Great videos, what about using a sqlite database within SwiftUI, let us know, thanks
@CodeWithChris
@CodeWithChris 3 жыл бұрын
Hello, should be possible to use SQLite is already built-in on the ios app, SwiftUI and storyboard uses the same language swift so its not really any different how you code (unless its UI related) - Francis
@user-tr8sy8vy6q
@user-tr8sy8vy6q 2 жыл бұрын
Hi Chris! Thanks for such nice tutorials! Could you please advice - I couldn't find your video you mentioned at 1:07 (App with landmarks) Is it available now somewhere? Thanks
@CodeWithChris
@CodeWithChris 2 жыл бұрын
"Hello, yes you should be able to access the updated version of official apple tutorial here developer.apple.com/tutorials/swiftui - Francis"
@vin5718
@vin5718 3 жыл бұрын
Advised to still check Apple's tutorial after or while watching the explaination, some function had changed, both in how to use them and the name as well. Might get confused if you are trying this out in 2020
@CodeWithChris
@CodeWithChris 3 жыл бұрын
Hey, thanks for mentioning that! - Kat
@srzurka
@srzurka 3 жыл бұрын
Thanks for all the videos you make. They are fantastic. If you wanted to let the user swipe between each child view (the location view in this case) how would you do that? Going from the list to the detail is great and well supported but it seems like there would be lots of use cases where the user would like to easily go to the next detail/child view without having to go back to the list.
@CodeWithChris
@CodeWithChris 3 жыл бұрын
"Hello, you can try adding gestures and save ""previous"" selection so you can trigger the navigation from there, however it should not probably work if you just opened the app and did not make a selection yet and actually navigationview already implements a ""swipe"" feature already, try running it on your phone and try swiping after a selection it should work - Francis"
@srzurka
@srzurka 3 жыл бұрын
@@CodeWithChris Thank you!
@arshiyasinha4136
@arshiyasinha4136 4 жыл бұрын
Could you also do a video on JSON parsing in a Navigation View?
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Thanks for the suggestion! It's on our list. :) Kat
@danielwatson6529
@danielwatson6529 4 жыл бұрын
Hi Chris! thanks for everything so far. I have also been using thise apple Tuts. Although Ive struggled with this one - after the beginning of project, after downloading the project files, all my Apple Developer fields where a mess and I had to copy and paste, and update my Tut 1 files - not the best way but I leaned quite a bit by experimenting with how the program ran as i updated a sheet at a time. However what went wrong? i really dont understand, my apple developer dfetails are fine for tut 1 and are fine when i start with my own projects - but something was seriously wrong - is it a bug with Xcode or am i missing something?
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, we created a forum to help people with the tutorials. Could you share this to our CodeCrew Community codecrew.codewithchris.com/ with more details or screenshots if possible? Thanks!
@mahtabhasan8513
@mahtabhasan8513 3 жыл бұрын
Pretty good to enhance the view interactively - thanks for good demo But still we need to work around swiftui. I am recently started using it and comparing all the time UIKIt. i have gone through your many videos old & semi old.
@CodeWithChris
@CodeWithChris 3 жыл бұрын
Yup, we will release more SwiftUI tutorials. Thanks for learning with us! :-) -Arthur
@saefurukawa5148
@saefurukawa5148 4 жыл бұрын
Hi Chris, thank you for your awesome video !! I have a question. I created similar pages (not exactly the same but the same function) and I noticed that when I navigate to the second page, there is a huge blank on the top of the screen, so it's dragging everything else down. This does not appear if I access straight to the second page without the navigation function. Do you know how to fix it?? Thanks!
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, i think its because of the navigation link, maybe it would be better to present it instead using a segue - Francis
@jeffhogan702
@jeffhogan702 4 жыл бұрын
fixed it I had to read the Apple Doc. I had to use .resizable() and .frame
@CodeWithChris
@CodeWithChris 4 жыл бұрын
If you got stuck and went to the Doc, well you are now a Pro! @AdrienVillez
@kennykim7856
@kennykim7856 4 жыл бұрын
Chris, NavigationLink requires me to put a label name..? not just destination:LandmarkDetail, which label should I put it in or is this even a correct NavigationLink data type?
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, according to the documentation developer.apple.com/documentation/swiftui/navigationlink it seems it got updated to have a "label" which is also a view, you can just simply label: { EmptyView() }) as a "hack" to make it work - Francis
@modernarts3266
@modernarts3266 5 жыл бұрын
If i was to make a table view in SwiftUI, Would I need a JSON file along with the other locations?
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, it really depends on what you want to display on your tableview, if its just a simple list you can either make it a json file or you can even hardcode it, ideally you just want to plan out what data you want to display first - Francis
@tommytom4443
@tommytom4443 3 жыл бұрын
I've never learned how to use Swift, UIKit, or anything like it, I'd only learned c# through Unity. Your tutorials are really helping me out because going through the apple tutorials alone are very daunting and frankly frustrating as I don't know the language
@CodeWithChris
@CodeWithChris 3 жыл бұрын
Awesome to know, thank you so much! :-) -Arthur
@jackylegs222
@jackylegs222 4 жыл бұрын
Hi Chris, I’ve updated my Mac to OS Catalina 10.15. and I’m still having trouble displaying my canvas. It is ticked and shows up on the right and side but appears to time out. Any thoughts on what could be causing this?
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, we might need more info to help you with your problem, and also some screenshots, please head on over to codecrew.codewithchris.com for more support - Francis
@RyuuzakiJulio
@RyuuzakiJulio 5 жыл бұрын
How about design a custom control with SwiftUI? Like a Knob or something more than List, Images and Text that everyone is doing?
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Hey Julio! Yes, we will definitely continue to explore more of SwiftUI once we are done reviewing what Apple published! @AdrienVillez
@RyuuzakiJulio
@RyuuzakiJulio 5 жыл бұрын
CodeWithChris seems like you can do custom shapes with GeometryReader. But I can’t find the PanGesture to be able to get angles.
@shiwanshumishra6378
@shiwanshumishra6378 4 жыл бұрын
Hii Chris , i want to make custom URL like a user , input string into the text-field and which is grab from UI and append into my URL domain. after grabbing from the user. I want to open it using button click.
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, what should be simple you only need maybe a randomizer for the ""user"", a textfield to get the extra data to append, and maybe webkit or alamofire to open the web address - Francis
@DanielBurchfield
@DanielBurchfield 3 жыл бұрын
The landmark.image(size: size) parameter no longer exists in the data file. I had to use resizeable().frame() to adust the size of the image.
@CodeWithChris
@CodeWithChris 3 жыл бұрын
Hello, yes, this was because because this video was made on the early release of SwiftUI, there have been a handful of changes since then, its best to check documentation and online forums if old code does not work anymore - Francis
@abdullahajmal9020
@abdullahajmal9020 5 жыл бұрын
Hey Chris, Does Swift UI use the same syntaxes as programmatic Swift?
@CodeWithChris
@CodeWithChris 5 жыл бұрын
In Swift you have to add the x and y coordinate or an element with its height and width. In SwiftUI it's more or less like a placement. (that's how I see it!) @AdrienVillez
@abdullahajmal9020
@abdullahajmal9020 5 жыл бұрын
@Nathaniel Day Oh ok thanks
@nikolaveljic64
@nikolaveljic64 5 жыл бұрын
Hi! Can we use swift ui with storyboard? And how? Like use one view from Swift UI and others from storyboard?
@hcri
@hcri 5 жыл бұрын
UI does not use storyboard. and it is not interchangeable
@raddemojsovski548
@raddemojsovski548 5 жыл бұрын
Weirdly you have to put the navigationBarTitle inside the closure for NavigationView like this NavigationView { List(users) { user in NavigationButton(destination: DetailView(user: user)) { MyRow(user: user) } } .navigationBarTitle(Text("Title")) }
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Thanks for your input, I will test this out! @AdrienVillez
@newbiegeek8407
@newbiegeek8407 3 жыл бұрын
Hey chris can you make a swift cheat sheet about what each modifier does
@CodeWithChris
@CodeWithChris 3 жыл бұрын
We have a Swift Cheat Sheet here codewithchris.com/swift-cheat-sheet/ - Kat
@txbgould
@txbgould 5 жыл бұрын
I installed macOS Catalina and Xcode beta 11. Xcode is almost unusable. I can't get a project to load. I can create a new one but I can't open it again once I close and come back to it. macOS Catalina is also buggy (but beta so understand.). MacBook Air won't sleep in Catalina
@CodeWithChris
@CodeWithChris 5 жыл бұрын
During the edit of this video, I had to cut or shorten some bugs and crash yet. Now Chris is using an iMac from 2015 with an OK hardware. Maybe older or smaller hardware will have an even harder time to deal with a beta version. Don't worry, September is close by! @AdrienVillez
@chhatrasalsinghbundela1648
@chhatrasalsinghbundela1648 4 жыл бұрын
@Chris I have designed a SplashScreen with SwiftUI because I need to make api calls to my server to refresh's the authToken. So, I need to show the splash screen 1st time onlyAfter showing the splash screen will navigate to home page and the user should not be able to navigate back to splash screen. So, Its like I need to remove to splash screen from view stack after navigating to homepage. Can you help me with that? Reference to any article/video will be helpful. Thanks.
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, the splash screen on ios is usually just used to show the app logo, i suggest making your splash screen and just ""present"" it to screen on top of your current ViewController so that you can dismiss it easily afterward and will not leave a trace to nagivate into - Francis
@georgh.9814
@georgh.9814 4 жыл бұрын
It seems that my xcode version is very buggy. When i declared the landmark:Landmark property, xcode does not know the Type Landmark but does not display any error. When i build the project, xcode crash. Time for an update :D
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, you can ask about that here (bit.ly/CodeCrewCommunity). There might be others who have experienced the same. -Kat
@Smellycat093
@Smellycat093 4 жыл бұрын
How would I swap out my own firebase data for this data and make it a read/write to list?
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, yes you can use firebase in swiftUI you just need to set it up the same way that you set it up for regular storyboard apps via cocoapods, the codes sill be the same as they are using the same library - Francis
@Smellycat093
@Smellycat093 4 жыл бұрын
@@CodeWithChris thanks for the reply. How would I parse the firebase data to be represented as you have in this video? Would I still need the data.swift file?
@tomcyclope
@tomcyclope 5 жыл бұрын
hey chris, So i tried to install xcode 11 on my macbook air however, i have some issue with the feature canvas. In fact its not appear like it should be. I tried everything but for now, i dont have the answer for this. editor => canvas doesn't work. i think its a bug between xcode 10.2.1 and 11 which are install or maybe doesnt work for macbook air because not enough powerful for this or maybe 13" so too small ... i really dont know.
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Hey Tommy, you can’t see the canvas unless you install Catalina beta unfortunately!
@tomcyclope
@tomcyclope 5 жыл бұрын
@@CodeWithChris ahhh ok. Thank you very much !!!
@LKSKO3
@LKSKO3 4 жыл бұрын
Hello, I have now learned how to use tab bar controller, but can't solve one thing and that thing is that how to add on the main tab bar controller some label, background or anything I want. Thanks for answer.
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, try checking the documentation developer.apple.com/documentation/uikit/uitabbarcontroller and see if there are any properties that you can change - Francis
@aVEzPz
@aVEzPz 3 жыл бұрын
I have an imagepicker set up and would like to open a new view when the image is selected.. any ideas on how I might accomplish this? preferably without using navigationlinks
@CodeWithChris
@CodeWithChris 3 жыл бұрын
Hello, you can just do a custom pop-up dialog or something that has a UIImage inside so you can just display the image from there and just open it using "present" - Francis
@aganeto1
@aganeto1 3 жыл бұрын
I cant find the mentioned video previous to this one, called Swift Full Tutorial. Where is it ?
@CodeWithChris
@CodeWithChris 3 жыл бұрын
Hello, you might be looking for this app tutorial kzfaq.info/sun/PLMRqhzcHGw1ZkH8RuznGMS0NZs0jWQQ5a or this beginners tutorial kzfaq.info/sun/PLMRqhzcHGw1b89DXHOVA77ozWXWmuBkWX - Francis
@avneetsingh2010
@avneetsingh2010 3 жыл бұрын
Hey Chris... How can we implement side menu in landing page just after login screen and navigate to its items... Without login screen I've implemented but not sure after login screen...
@CodeWithChris
@CodeWithChris 3 жыл бұрын
"Hello, yes it should be possible though it shouldn't work since the user hasn't logged in yet - Francis"
@jeffhogan702
@jeffhogan702 4 жыл бұрын
landmark.image(forSize: 50) doesn't compile error saying "none function"////// the image shows but it's big = landmark.image. I recently installed Xcode11 wondering if a different name for "forSize:"and forSize Int doesnt show in image drop box
@jeffhogan702
@jeffhogan702 4 жыл бұрын
Jerome Payne yep I did I’m on Building List and Navigation :) Thank You!!!! For your reply your awesome
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Looks like Jerome took the Payne out of this issue! @AdrienVillez
@icykol
@icykol 4 жыл бұрын
@Jerome Payne Thank you!
@kushalpokhrel5188
@kushalpokhrel5188 4 жыл бұрын
I jump definition image and compare with his code, mine didn't have func image. I guess forSize is not defined in the project file I downloaded. So couldn't access it.
@amolnikam1840
@amolnikam1840 4 жыл бұрын
Please take on session on Combine framework.
@CodeWithChris
@CodeWithChris 4 жыл бұрын
We'll get to that Amol. Thanks for the suggestion. -Kat
@MrMrchan1997
@MrMrchan1997 4 жыл бұрын
HEY Chris, when i created the LandmarkRow.swift I can't click the button of resume . The error said that Signing for "Landmarks" requires a development team. Select a development team in the Signing & Capabilities editor. That's mean i need to register an apple developer account and pay $99 for it ?
@MrMrchan1997
@MrMrchan1997 4 жыл бұрын
And also it said that failedToGetInstalledApplicationInfoAfterInstalling
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, it's hard to troubleshoot via YT comments. We created a forum to help people with the tutorials. Could you share this to our CodeCrew Community codecrew.codewithchris.com/ with screenshots if possible? Thanks! -Kat
@lorentmustafa9920
@lorentmustafa9920 4 жыл бұрын
Cant seem to fix the problem with landmark.image :/ Any solutions? I have the latest of the apple resource code for this project.
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, i would be better to follow the apple documentation of this now because some codes got updated, don't worry its the same project developer.apple.com/tutorials/swiftui/ - Francis
@nataliam341
@nataliam341 4 жыл бұрын
I have a question: Why are they called swift files if we are coding in swiftui?
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Because SwiftUI is just Swift code (behind the scene) and if they had different file extensions, we wouldn't be able to mix them in a project @AdrienVillez
@daniphilip777
@daniphilip777 4 жыл бұрын
Hello, how can I add a search bar in the app demonstrated in the video?
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, maybe you can add a textfield and have a state called searchterm, so anything that you type on the textfield triggers the list to refresh base on the value of the textfield - Francis
@japonska2009
@japonska2009 Жыл бұрын
i was wondering, why we never used any @State with properties we created in different views. I though you must put @State var ____ when you make a property in SwiftUI
@laurens2598
@laurens2598 5 жыл бұрын
Did you installed the 10.15 beta on a second partition?
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Hey Laurens, I installed it on a spare MacBook I had! If I only had one machine, I don’t think I would risk it lol
@laurens2598
@laurens2598 5 жыл бұрын
CodeWithChris I’ve done a dual boot on my MacBook and it works very well! And SwiftUI ist awesome!
@danaililiev7362
@danaililiev7362 4 жыл бұрын
On start of your application, if the user is logged in - load some view called HomeView, if the user is not logged in load LoginView, the user should be able to logout at any point, which should again load the LoginView. How would you tackle that in SwiftUI? Note that HomeView is not the initial view, so if you are logged in you actually skip 2 views, InitialView and LoginView and go straight to HomeView. How would you tackle this if the user just logged in and logouts, or logged in, closed the application then started it again and logged out?
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, as long as you set your navigationlink it should be fine going from one page to another as long as you tell it to move there - Francis
@danaililiev7362
@danaililiev7362 4 жыл бұрын
@@CodeWithChris Do you mean instead of doing dismiss on current view twice I should just navigate directly to where I want? Doesn't that put many views on top of each other (new to mobile programming, sorry for my silly question)?
@felixizarra8513
@felixizarra8513 3 жыл бұрын
List initialization updated to August 2020: List(landmarkData, id: \.id) { landmark in LandmarkRow(landmark: landmark)}
@CodeWithChris
@CodeWithChris 3 жыл бұрын
Hello, yes there have been quite a few changes since this video was last posted, this video was made way back when SwiftUI was just annouced so its quite early stage. there will probably be some changes in the future as well - Francis
@icykol
@icykol 4 жыл бұрын
Hi Chris, I am getting this error (@34:48) --> Cannot call value of non-function type 'Image', when I am trying to build CircleImage.swift. And related to that, I am getting this error (@35:45) --> 'Int' is not convertible to 'CGFloat?', when I am trying to build LandmarkDetail.swift (this error was refer to '.frame(height: 300)' OR line 18 in your LandmarkDetail.swift file @35.45). Can you please help?
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello! Sorry to see you are having trouble. Could you post your question (with code sample and/or screenshots) in our community group here (bit.ly/CodeCrewCommunity). Make sure to check the posting guidelines (bit.ly/CWCHowToAskForHelp) so we can help you the best as we can! Thanks for being a CodeCrew member! -Kat
@panagiotisvavelidis153
@panagiotisvavelidis153 3 жыл бұрын
@@CodeWithChris Having the same problem.
@ananyamehan3014
@ananyamehan3014 4 жыл бұрын
Hey, I am getting this error --> compiling failed: no type names 'LandmarkRow_Previews' in module 'Landmarks', when I am trying to run the LandmarkRow canvas. Can you please help? Thank you!
@josephching2922
@josephching2922 4 жыл бұрын
Command + Shift + K and then reopen the project. Apple developer forum thread #122341
@therdgf
@therdgf 4 жыл бұрын
Same here. I guess the global variable is not being called
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Might help forums.developer.apple.com/thread/122341 -Kat
@therdgf
@therdgf 4 жыл бұрын
@@CodeWithChris Thank you very much
@ananyamehan3014
@ananyamehan3014 4 жыл бұрын
CodeWithChris Thank you!
@medichiswq2148
@medichiswq2148 4 жыл бұрын
I am a nuby, that's why I have no idea what to do: updated Xcode to 11 version and found out that canvas is available only on macOS 10.15 (which is Catalina)...should I change Mojave to Catalina or just wait for a miracle update?))
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, if you really want to program SwiftUI then you should really update to catalina, who know if there is even a "miracle update" that will come cuz there wasn't one for swift 5 on Sierra ;) - Francis
@glenreidy
@glenreidy 4 жыл бұрын
Another difficult one. Here's a beginners question for you. Does SwiftUI use more code than UIKit (with storyboard) so that one page of code looks neater?
@glenreidy
@glenreidy 4 жыл бұрын
Gave up just over half way. Too much. Not because of the video but the content in general. I also tried the apple tutorial. It's not making any sense to me yet. I think I'll try something a little easier or I'll just burn out and loose interest in SwiftUI.
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, since. SwiftUI relies heavily in coding, then yes it would require more info how to make your app/UI look for cleaner and better, but for making simple design UI then using the default values should be fine for practice - Francis
@nikaiobishvili6149
@nikaiobishvili6149 2 ай бұрын
Hello, I am new in SwiftUI, but used be a developer in UIKit. I downloaded file from site but the starter file is not full version for starting. :( I wanted to do parallel
@RichardGetzPhotography
@RichardGetzPhotography 5 жыл бұрын
1:03 you should add this to the card (i) so we can select it. Currently only 'SwiftUI Basics for Beginners (2019)' is there. Actually I do not see 'SwiftUI Full Tutorial' in your video list. Also, the SwiftUI Basics for Beginners (2019) is xCode 11. I hope all your new projects are not predicated on upgrading to a beta app and os?
@CodeWithChris
@CodeWithChris 5 жыл бұрын
SwiftUI has to be recorded with Xcode 11. Now Xcode 11 is gonna come out in less than 3 months so, it's nice to already have recorded with Xcode 11. Regarding the regular Swift and UIKit, it doesn't make a difference. @AdrienVillez
@RichardGetzPhotography
@RichardGetzPhotography 5 жыл бұрын
@@CodeWithChris so all these lessons can be done on the current xCode 10 without the need to using beta software?
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Unfortunately SwiftUI is only available on Xcode 11. I won't be touching SwiftUI very much until X11 gets released officially in Sept. For now, i'm focused on material that can be done on X10!
@TheRsaker14
@TheRsaker14 4 жыл бұрын
Can’t find navigationbutton in swiftui beta 5,6 Can you help ?
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, SwiftUI is fast changing because its in BETA, it seems that NavigationButton is now depreciated and has been replaced by NavigationLink - Francis
@TheRsaker14
@TheRsaker14 4 жыл бұрын
Tnx
@Taziamoma
@Taziamoma 3 жыл бұрын
Whenever I download the "Building Lists and Navigation" and extract it, the project file in there is "CreatingAndCombiningViews". The layout and information looks different from yours. Do you still have the original for download?
@CodeWithChris
@CodeWithChris 3 жыл бұрын
"Hello, you can just check out the tutorial over at the apple website developer.apple.com/tutorials/swiftui/ - Francis"
@ismaakova
@ismaakova 4 жыл бұрын
navigationBarTitle should be after List: List {}.navigationBarTitle () 38:08
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, thanks for mentioning that. - Kat
@TheZourop
@TheZourop 5 жыл бұрын
What is the difference between struct and class ?
@suryakoppula1965
@suryakoppula1965 2 жыл бұрын
Hi Chris, The Data.swift file is missing in the package, so to get that what can I do?
@CodeWithChris
@CodeWithChris 2 жыл бұрын
Hello, kindly post your question on our CodeCrew forum so that our tech support staff can assist you: codecrew.codewithchris.com. Thank you! -Arthur
@arindamsantra8537
@arindamsantra8537 4 жыл бұрын
Want more swift ui tutorial
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Stay tuned! :) - Kat
@schlingelgen
@schlingelgen 3 жыл бұрын
I’ve seen many tutorials where the NavigationBarTitle is appended one level below the NavigationView - for example in the LandmarkList it would get appended on the closing curly bracket of the List - why is that?
@CodeWithChris
@CodeWithChris 3 жыл бұрын
Hello, becuase the navigationBarTitle is an attribute of the NavigationView, so it should be inside (or appended after the bracket). think of it as an attribute of the class like lets say the class is Person and it has a "name" attribute, so to access and set the attribute you should do Person.name. Same logic goes for this but its just a bit longer with more content - Francis
@schlingelgen
@schlingelgen 3 жыл бұрын
@@CodeWithChris Many thanks for answering even a year after the video got uploaded!
@icykol
@icykol 4 жыл бұрын
Hi Chris, I am getting this error (@20:24) --> Value of type '[Landmark]' has no member 'identified', when I am trying to run the LandmarkList canvas. Can you please help?
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello! Sorry to see you are having trouble. You should consider posting your question (with code sample and/or screenshots) in our community group that can be found here (bit.ly/CodeCrewCommunity). Make sure to check the posting guidelines (bit.ly/CWCHowToAskForHelp) like that we can help you the best as we can! Thanks for being a CodeCrew member! @AdrienVillez
@davidhedelin7987
@davidhedelin7987 4 жыл бұрын
Use this code instead (identified is deprecated in xcode 11 5 and above): List (landmarkData, id: \.id) { (landmark) -> LandmarkRow in
@holycrosscv
@holycrosscv 4 жыл бұрын
@@davidhedelin7987 Thanks David, this helps. I still get an error though, "'_' had no member id"
@user-yk8qs3yh1w
@user-yk8qs3yh1w 4 жыл бұрын
@@holycrosscv Me, too! btw have you solved this problem yet?
@holycrosscv
@holycrosscv 4 жыл бұрын
@@user-yk8qs3yh1w Yeah, this got it working on my project: ``` List(landmarkData) { landmark in NavigationLink(destination: LandmarkDetail(landmark: landmark)) { LandmarkRow(landmark: landmark) } } ```
@EthanZemelman
@EthanZemelman 3 жыл бұрын
The navigation bar title wasn't working because you tried to add it to the NavigationView. You have to add it to the list inside the NavigationView
@CodeWithChris
@CodeWithChris 3 жыл бұрын
Hello, thank you for the input, there was also been a lot of changes on this video because this was taken directly from the apple documentation example. There has been quite a few changes since then - Francis
@georgh.9814
@georgh.9814 4 жыл бұрын
It also seems that apple changed the tutorial files.
@CodeWithChris
@CodeWithChris 4 жыл бұрын
That's Apple. 😀 Kat
@kevinpiip3427
@kevinpiip3427 4 жыл бұрын
the LandmarkRow.swift is fucked up for some reason... when i create that file and try to run the preview it just gives me an error
@norberthaubner9515
@norberthaubner9515 4 жыл бұрын
I don't know where I keep going wrong but I always get the following error. Cannot preview in this file -- JSON Practice.app May have crashed It musst have something to do with the JSON file, Data file or Decodable file! Any idea what this could be, I can't seem to find an answer anywhere to help. Here is the project on GitHub: github.com/zenocode/JSON-Practice/tree/master/JSON%20Practice Thanks for the help
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, we created a forum for people needing coding help. Could you share this to our CodeCrew Community codecrew.codewithchris.com/ with more details or screenshots if possible? Thanks! -Kat
@norberthaubner9515
@norberthaubner9515 4 жыл бұрын
Thanks for the reply @CodeWithChris
@tomson8780
@tomson8780 4 жыл бұрын
14:15 I haven't got forSize func in my code... And when in writing it in I'm getting a error.
@caseynance7318
@caseynance7318 4 жыл бұрын
I had the same problem and I figured out if you go to the apple tutorial page it shows you you have to set up the image like this: landmark.image .resizable() .frame(width: 50, height: 50)
@tomson8780
@tomson8780 4 жыл бұрын
@@caseynance7318 i check apple documentation and change something and it's working fine
@user-yk8qs3yh1w
@user-yk8qs3yh1w 4 жыл бұрын
@@tomson8780 Hey another thing I have run into is the List part, in the official document it wrote " id: /.id", but when I wrote in Xcode I got an alert said, "Type '_' has no member 'id'". Have you run into this, too?
@tomson8780
@tomson8780 4 жыл бұрын
@@user-yk8qs3yh1w nope
@user-yk8qs3yh1w
@user-yk8qs3yh1w 4 жыл бұрын
@@tomson8780 Thanks.
@alfatrox00
@alfatrox00 5 жыл бұрын
You should put the navigationBarTitle on the List, not on the NavigationView I think Try it
@CodeWithChris
@CodeWithChris 5 жыл бұрын
OK, let's try that, BRB! @AdrienVillez
@hendrin2379
@hendrin2379 5 жыл бұрын
it's really works!
@aprilsamson8962
@aprilsamson8962 3 жыл бұрын
how to get data from database instead of json file?
@CodeWithChris
@CodeWithChris 3 жыл бұрын
Hello, most of the time data from an outside database (online) can only be accessed by a JSON return/response, perhaps you are looking for something local like CoreData? kzfaq.info/sun/PLMRqhzcHGw1aDYKmCuqXQ_IqpWpJlpoJ3 - Francis
@danialmk8991
@danialmk8991 5 жыл бұрын
How can I get macOS Catalina beta? since Xcode 11 is not fully functional on OS Mojave. pls advise.
@hcri
@hcri 5 жыл бұрын
it is available in the download section for developers. developer.apple.com
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Thanks Robert! @AdrienVillez
@danialmk8991
@danialmk8991 5 жыл бұрын
@@hcri Thanks Robert!
@jason_bourne17
@jason_bourne17 3 жыл бұрын
how navigate back to a specific view A->B->C->D->B
@CodeWithChris
@CodeWithChris 3 жыл бұрын
Hello, yes it would be possible to do it you can refer to this stackoverflow answer stackoverflow.com/a/7516468 its possible that might be a bit different codewise but the logic stays the same - Francis
@ayanemay6298
@ayanemay6298 5 жыл бұрын
I feel like apple decided to enter the home by climbing all the the trees and through window, ignoring perfectly working, comfortable door( SwiftUi is totally a mess to me, sure we can memorize a hundred ways to get what we want, but why? when we learn something, we forget something. The old way worked, it did have a preview too, even if it was not live it sure does not make this better for me, this is not like swift at all. Why would they do something like this when they made swift in the first place. So far - I really hope SwiftUi will be only an alternative. this is just a new way to fill our memory with something (
@CodeWithChris
@CodeWithChris 5 жыл бұрын
My first look at SwiftUI was also a big Wow, and I'm still really confused about it... Now, I haven't been coding for a loooong time and I'm focused more on video editing than Xcode so, I can't really say it's hard or complicated since I never put my hands on... Give it a couple of months or even a year and SwiftUI should be more mature then! @AdrienVillez
@mayaa6910
@mayaa6910 3 жыл бұрын
Its saying I don't have permission to view it can some one please help me!
@CodeWithChris
@CodeWithChris 3 жыл бұрын
Hello, in which part are you getting that error message? - Kat
@mayaa6910
@mayaa6910 3 жыл бұрын
@@CodeWithChris at the beginning when I first open the Xcode file and then it says you don't have permission to to access read me or sample code and its not letting me run the previews so im pretty confused
@sheevBL
@sheevBL 5 жыл бұрын
more
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Mooooooooooore!!!!!!! @AdrienVillez
@Sniiigel
@Sniiigel 3 жыл бұрын
I think it should be NavigationLink("Title of choice") and not NavigationLink(Text("Title of choice")), but I'm not sure
@CodeWithChris
@CodeWithChris 3 жыл бұрын
Hello, there have been some changes (improvements) ever since SwiftUI was released so expect things to be easier or more simple to use, its best to check the documentation for this - Francis
@yoelcera243
@yoelcera243 11 ай бұрын
this tutorial was too complicated for someone who is barely starting to code, to me it was a mess how Chris was modifying the archive given by apple.
@CodeWithChris
@CodeWithChris 11 ай бұрын
We are here to help, if you are brand new to iOS and coding in general, take this 8 Steps Tutorial: kzfaq.info/sun/PLMRqhzcHGw1Y5Cluhf7pKRNZtKaA3Q4kg @AdrienVillez
@curt8806
@curt8806 5 жыл бұрын
Wtf did I just watch.
@CodeWithChris
@CodeWithChris 5 жыл бұрын
If you come from Swift, it's a little shock I have to admit! @AdrienVillez
@buck4mt
@buck4mt 4 жыл бұрын
Ha - I'm glad I'm not the only one that felt this way. I thought I was understanding up until this video... and now I feel like "landmark" is the answer to everything, but I have no idea how or why. It is amazing to watch Chris have an error - and then go to the code and comprehend why there was an error and fix it... meanwhile, I'm scratching my head and feeling lost. I guess I'm not ready for this level yet. Hopefully when I circle back, it will make more sense.
@littlepig3697
@littlepig3697 4 жыл бұрын
erm excuse me i cant get the forSize working, can u pls help
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello! Are you still experiencing this problem? Could you share your question in our community group here (bit.ly/CodeCrewCommunity)? Just check the posting guidelines (bit.ly/CWCHowToAskForHelp) so we can help you the best as we can! Thanks! Kat
@bookmarkmonaco4255
@bookmarkmonaco4255 4 жыл бұрын
@@CodeWithChris Hello there, Apple has changed this class. Right now the working code is: landmark.image .resizable() .frame(width: 50, height: 50)
@bookmarkmonaco4255
@bookmarkmonaco4255 4 жыл бұрын
Hello there, Apple has changed class. Right now the working code is: landmark.image .resizable().frame(width: 50, height: 50)
@theodorenelson8568
@theodorenelson8568 4 жыл бұрын
@@bookmarkmonaco4255 OMG thank you for posting this. Been pulling out my hair trying to change the data.Swift file to match the one Chris is using in this tutorial.
SwiftUI - How To Handle User Input Tutorial
45:45
CodeWithChris
Рет қаралды 37 М.
How to Make an App in 8 Days (2024) - Full Walkthrough
3:00:49
CodeWithChris
Рет қаралды 615 М.
Я нашел кто меня пранкует!
00:51
Аришнев
Рет қаралды 4,4 МЛН
WHO LAUGHS LAST LAUGHS BEST 😎 #comedy
00:18
HaHaWhat
Рет қаралды 18 МЛН
Data Flow in a SwiftUI App
33:15
CodeWithChris
Рет қаралды 52 М.
What is JSON - JSON Parsing in Swift
24:15
CodeWithChris
Рет қаралды 73 М.
The Complete Guide to NavigationView in SwiftUI
39:18
Paul Hudson
Рет қаралды 129 М.
Navigation in SwiftUI & iOS 16
18:12
CodeWithChris
Рет қаралды 31 М.
Xcode Tutorial - Step by Step for Beginners
56:52
CodeWithChris
Рет қаралды 324 М.
Basic SwiftUI Layout Containers and UI Elements
14:30
CodeWithChris
Рет қаралды 37 М.