Apologies
You must be signed in to watch this lesson.
Setting up the Foundation with UITabBarController
AppStore JSON APIs
To kick off our project, we'll go ahead and implement the foundation of our application by building a custom UITabBarController. This will be a very straightforward lesson where we create our tab bar controller subclass, along with importing the proper icon images into our project. Once we set this up, we'll be in a good position to build out our first list using a UICollectionViewController in the next lesson.

Xcode 11.3+ SceneDelegate Update 4/20/2020

As most of you are probably aware by now, starting with Xcode 11.3, Single View Application projects are now created with a SceneDelegate file. This file is used to manange the scenes in your application and thus also contains the entry point of your app. Because of this change, we'll need to go about setting up our project using SceneDelegate instead of AppDelegate. More specifically, you want to leave AppDelegate alone and instead make the following changes in SceneDelegate:

class SceneDelegate: UIResponder, UIWindowSceneDelegate {    var window: UIWindow?        func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {        if let windowScene = scene as? UIWindowScene {            let window = UIWindow(windowScene: windowScene)            window.rootViewController = MainTabBarController()            self.window = window window.makeKeyAndVisible()        }    }}

Comments (27)
richardbranson
5 years ago
So, We don't need to use these lines of code anymore :- window = UIWindow() window?.makeKeyAndVisible()
Brian Voong
5 years ago
richardbranson
5 years ago
Oh! That's the key. Well, it seems like I will be using these 2 lines of code as I always delete Main.storyboard file after creating the project.
ZpecterZ80
5 years ago
I also deleted the Main.storyboard and added those lines to my AppDelegate, but the main view does not fit the entire window size. Do you know why?
nombienombie
5 years ago
Did you delete the launch screen storyboard too? I believe you need to keep this scene
ZpecterZ80
5 years ago
Yes, I deleted all storyboards from my project.
tonytech
5 years ago
that was my mistake i deleted Main from the project. so i had to add those extra lines
ZpecterZ80
5 years ago
I have figured out how to fix my problem. It doesn't matter if we delete all storyboards from the project or not, all we need is this key inside our Info.plist: <key>UILaunchStoryboardName</key> <string>LaunchScreen</string> Adding this key to my plist file, solved my problem. Hope this helps.
ezechinwa
5 years ago
Thanks B... You are the best
tonytech
5 years ago
best investment i ever made was purchasing this course thanks brian.
Brian Voong
5 years ago
nguyentruongky
5 years ago
Hi Brian, this is the first time I purchased. I have no idea why I only can view the overview video (https://www.letsbuildthatapp.com/course_video?id=4682). All others don't have any option to view.
Brian Voong
5 years ago
nguyentruongky
5 years ago
Sorry, it works on Safari. I just use Chrome so forgot to check on Safari. Thanks.
Brian Voong
5 years ago
vamshi7
4 years ago
Why is there no provision to fast forward/ move backward in the video player? :/
axel2018prena
4 years ago
Hi Brian, i have been working on adding UItabbarcontroller to my project that i am working on, but the icons do not show on tab bar of each controller
Brian Voong
4 years ago
axel2018prena
4 years ago
drag and drop the icons in the assets, but they are not showing when i add them to ImageName the icons are present in the assets
axel2018prena
4 years ago
the icons are present in the assets
axel2018prena
4 years ago
drag and drop the icons in the assets, but they are not showing when i add them to ImageName
Brian Voong
4 years ago
stonypig1
4 years ago
since now swift 5 is out, if we choose swift 5, will it backward compatible with 4.2? would you briefly explain how this setting works. thanks
Brian Voong
4 years ago
stonypig1
4 years ago
thanks
sarakupan
4 years ago
Hi Biran, I'm often interrupted when watching video, please fix this problem. You can add subtitle below video like Youtube, thanks.
cantona
4 years ago
the download project button just download a png file where can i download the entire project?
Chad-michael Muirhead
4 years ago
go to the last video (video 47) and there is the actual file download link
cantona
4 years ago
Hi brian i've just started the tutorial by why don't use storyboard? i hope you use otherwise be difficult to full as I'm​ comfortable to have control over design
Brian Voong
4 years ago
Chad-michael Muirhead
4 years ago
Hey how long did it take you to get this good with Swift?
Brian Voong
4 years ago
Chad-michael Muirhead
4 years ago
ight cool ye im gonna keep practicing , thanks again for the great vids
mistr8
4 years ago
Just to mention, the search icon in the Tab Bar icons link is a @2x icon while the other 2 (Apps and Today) are @3x resolution. The "Download Project" link has the correct @3x version of all the 3 icons. You could fix that!
inforsrinivasan@gmail.com
4 years ago
Hi, In Xcode 11, the UIWindow object is not available for me in app delegate.
Brian Voong
4 years ago
inforsrinivasan@gmail.com
4 years ago
thanks a lot brian :)
Yan Cervantes
4 years ago
Hi Everyone!!! I do this... looks like some different... func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { guard let scene = (scene as? UIWindowScene) else { return } window = UIWindow(frame: scene.coordinateSpace.bounds) window?.windowScene = scene window?.makeKeyAndVisible() let view = ViewController() let navigation = UINavigationController(rootViewController: view) window?.rootViewController = navigation }
dneckles
4 years ago
Hi, can someone explain to me, why would the uiviewcontroller determine the title on top. but it not determine the buttonname (tabbarItem) on the bottom, which is controlled by the Navcontroller. i thought either navcontroller control both properties or that the uiviewcontroller control both property especially since both names are the same.
Brian Voong
4 years ago
dneckles
4 years ago
Makes perfect sense now Brian. Thank you!
johnniefujita
4 years ago
Probably nobody will do this, but i was kind of tired of initiating UICollectionViews and didn't bother creating a base class for facilitating my work. And ended up passing a same UICollectionViewFlowLayout into multiple CollectionViewControllers... I don't need to say that it was a pain in the back to trace this error back, when just the transitions from one of the sharing cotrollers to the other would make the application to crash. If it helps at least one other person to do not follow this dumb mistake, it is worth. Bye!
chibuike
4 years ago
hello Brian, I got the Xcode 11.1 and I've been following your steps in the video. On my simulator I just have a white screen. I downloaded the project and it worked perfectly, but when I copied it to mine, I had a white screen.
David Shi
4 years ago
Hey I had the same issue and found that instead of loading the rootViewController in the AppDelegate you have to now load it into the SceneDelegate. In SceneDelegate.swift, there is the following function which you want to load the rootViewController in: func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { window?.rootViewController = BaseTabBarController() guard let _ = (scene as? UIWindowScene) else { return } } So it seems like they changed the function in app delegate for didFinishLaunchingWithOptions.
David Shi
4 years ago
Actually I just noticed that this problem was already discussed if you scroll down.
Jose Jonas Abesamis
4 years ago
Hey Brian, I know I already bought this and I just remembered that you've been doing SwiftUI lately. My question is, should I still learn this project? Will you being doing a big SwiftUI tutorial soon? Thanks for the help. Jonas
Brian Voong
4 years ago
Jose Jonas Abesamis
4 years ago
thanks brian!
Tokyojogo
4 years ago
Hi Brian, Will you be updating this project to show the new way of making collectionViews? Looking forward. Thanks.
xtrasmal
4 years ago
Hi Brian, thank you for the content. I am new to Swift, but have over 15 years of experience in programming and find your course very nice to get started with Swift. In my understanding, the UITabBarController creates its own hierarchy per tab, which is decoupled from other navigation hierarchies. So my guess is that there are two uses of the tabbar: 1). use it as you described and 2). build one without UITabBarController when you need a single viewcontroller hierarchy. While I was playing I was wondering if you know how to skip the usage of the UITabBarController completely, by building a custom UINavigationController? I came across something that looks like what I am talking about, plus I think this person had the same thought(http://aplus.rs/2018/tabbarcontroller-using-coordinators/). The difference is, that that person has mastered the dark arts of Swift already, and I do not :D So I can't figure out how to complete the example code on that website.
Ally Makongo
4 years ago
Hi Brian, running this on iOS 13 does not give you the titles on navigation bar. Did you notice?
Brian Voong
4 years ago
AbrahamCuautle
3 years ago
Yeap. I was facing the same problem. Just add the following lines: if #available(iOS 13.0, *){ let apperence = UINavigationBarAppearance() apperence.configureWithDefaultBackground() navigationBar.scrollEdgeAppearance = apperence navigationBar.compactAppearance = apperence navigationBar.standardAppearance = apperence }
SLEsserman
3 years ago
Has this been updated?
Brian Voong
3 years ago
SLEsserman
3 years ago
Thank you Brian! Stay safe
SLEsserman
3 years ago
Have the rest all been updated?
SLEsserman
3 years ago
Does this have to be built on Swift4.2 for it to work? And if so, why was this not advertised?
grim_reaper
3 years ago
I love code refactoring ?
ezechinwa
3 years ago
Hi Brain, Is it safe to assume that UICollectionViewController is suitable for List items (Vertically or Horizontally) ? If not,what are some powerful use cases in your experience?
Brian Voong
3 years ago
ezechinwa
3 years ago
thanks Brian for taking your time and replying. means a lot to me :)
ezechinwa
3 years ago
HELP & SUPPORT