Example iOS app demonstrating how to use a UITabBar
with the iOS Coordinator pattern.
There are many ways of implementing a Coordinator in your app. My preferred way of doing the Coordinator pattern at the moment is with this library which this project uses.
This project is meant to demonstrate 1 thing: how to show a UITabBar
in your app where each screen of the tab hosts a child coordinator.
Here is an overview on how to do this:
- (link to source) Create a main coordinator the the
AppDelegate
starts and shows the first ViewController of the app. SinceUITabBarController
is aUIViewController
, our TabBar will be our ViewController this coordinator starts. - (link to source) Have your
UITabBarController
instantiate a child coordinator for each tab. The ViewControllers of ourUITabBarController
are the root ViewControllers of each of these coordinators. - Done! The rest of the implementation of this app demonstrate the coordinator pattern more then how to use coordinators with a tab bar.
- Clone the repo to your machine.
pod install
- Open workspace on your machine. Compile and run app.
- Levi Bostian - GitHub, Twitter, Website/blog
This project is open to pull requests to improve the project. To keep this project small, pull requests will only be merged if the changes fit into the vision of this project. Bug fixes, updating dependencies, documentation is always welcome.
Inspiration for this project comes from this doc that gave me the idea of referencing the ViewControllers within each child coordinator. Thanks!