Skip to content
Example of using Coordinators and Container View Controllers to compose code in iOS
Branch: master
Clone or download
dennis-walsh
dennis-walsh Update to Swift 5
Latest commit 06cca59 Apr 20, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ContainerViewControllers.xcodeproj Update to Swift 5 Apr 20, 2019
ContainerViewControllers
images
.gitignore initial commit Apr 11, 2019
Container.png resize repo images Apr 12, 2019
InteractiveContainer.png resize repo images Apr 12, 2019
README.md Update README.md Apr 13, 2019
ScrollingContainer.png
ScrollingStackView.png resize repo images Apr 12, 2019

README.md

Example of using Coordinators and Container View Controllers in iOS

You can find the related blog post on Medium at Container View Controllers Redux

Points of Interest

In general the sample code covers the use of container view controller in iOS development to illustrate the concepts of separation of concerns, composition, and the application controller pattern.

Coordinators

The app uses the concept of Coordinators to handle the navigation flow of the app.

Basic View Controller Containment

The sample code uses view controller containment to combine an image loading view controller and a table view controller to form a screen of content.

Scrolling Container View Controller

The sample code shows an example of a scrolling container view controller. The container view controller overrides load view to use a UIScrollView where it displays the contents of injected view controllers

StackView Controller

The sample code shows an example an example of a stack view container view controller. Similar to the scrolling view controller, this view controller overrides loadView to implement a UIStackView that holds the contents of two view controllers. The stack view controller is then added to a scrolling view controller to allow content scrolling.

Card Container View Controller

The sample code shows an example of using a container view controller to hold a screen of content and interactively display a separate card view controller. This example illustrates an alternative to coordinators by encapsulating the functionality of two view controllers into a single view controller. This concept could be extend to encapsulte application flows in a container view controller.

Container Scrolling Container Scrolling StackView Interactive Container

You can’t perform that action at this time.