Apologies
You must be signed in to watch this lesson.
Project Clean Up and File Organization
SwiftUI Mastery Travel Discovery
Cleaning up your codebase is a must whenever you are creating your applications. In this video, I'll introduce a few easy concepts of structuring your files so that others can make sense of how to navigate your codebase.

Comments (4)
Christopher J. Roura
3 years ago
Something else that I think is a nice add on is to use the previewLayout of sizeThatFits. With your idea of keeping the DiscoverView() below you can see just the elements alone in the top and then the full layout below. Thanks as always for your tips and tricks. struct PopularDestinationsView_Previews: PreviewProvider { static var previews: some View { PopularDestinationsView() .previewLayout(.sizeThatFits) .padding() DiscoverView() } }
MaxApp
3 years ago
very nice!
iTollMouS
3 years ago
Damn!!! super nice! . Makes the project easier to grasp and understand it . I thank you so much !
jch-duran
3 years ago
Thanks for sharing! ?
MaxApp
3 years ago
Hey Brian, Are we using the MVC design for this project? Thanks
Brian Voong
3 years ago
Christopher J. Roura
3 years ago
I apologize for polluting the comments but I think this is a nice fix. The nav bar currently animates to a small nav bar which has a gray background and just looks off with the design to me. My fix is to create a custom nav bar appearance and to completely hide the small nav bar view entirely. Below is the code: init() { let navAppearance = UINavigationBarAppearance() navAppearance.configureWithTransparentBackground() navAppearance.backgroundColor = .none navAppearance.titleTextAttributes = [ .foregroundColor: UIColor.clear, // .font : UIFont.systemFont(ofSize: 22, weight: .heavy) ] navAppearance.largeTitleTextAttributes = [.foregroundColor: UIColor.white] UINavigationBar.appearance().standardAppearance = navAppearance UINavigationBar.appearance().compactAppearance = navAppearance UINavigationBar.appearance().scrollEdgeAppearance = navAppearance UINavigationBar.appearance().tintColor = .white }
Christopher J. Roura
3 years ago
Update: I realized this fails because it changes all the nav appearances so when we later need the inline nav bar it will be invisible. My new attempt at a solution to this is to hide the nav bar in the discover view and introduce a text in the main scroll view. I am working on a way to animate the text to be hidden when the scrollview reaches a certain height.
jacquesj
2 years ago
Hey guys, after I refactored my code I am having a weird bug, everything looks just as it did before in the preview, but when I build to my physical device now, the UI is wrong. The corner radius isn't working on the discover card (top of the zstack holding the other views below the search bar) and the z stack isn't working. My fonts also all turned white. I cleaned my project, rebuild, quit xcode, but the bug won't go away.
jacquesj
2 years ago
zzz had to restart my computer and it fixed all the bugs besides the font color, for that I just had to go to all the views and add .foregroundColor(.black), I think this is because my phone is running darkmode
HELP & SUPPORT