Programming the Split View Controller
Master Split View Controllers in Professional iOS Applications
Core iOS Development Concepts
Split View Controller
A container view controller that manages two side-by-side view controllers, typically used in iPad applications for master-detail interfaces.
Master-Detail Pattern
An architectural pattern where a master view displays a list of items, and a detail view shows information about the selected item.
View Controller Communication
The process of passing data and coordinating behavior between different view controllers in an iOS application.
This exercise builds on the previous Split View Controller setup. You should have completed exercises B1-B2 or use the provided starter project to follow along.
Use UIDevice.current.model.range(of: "iPad") to detect iPad devices and execute platform-specific code paths in universal iOS applications.
iPhone vs iPad Navigation Patterns
| Feature | iPhone | iPad |
|---|---|---|
| Navigation Method | Segues between views | Split view selection |
| View Controller Creation | New instance per segue | Single persistent instance |
| Data Passing | prepare method | Direct property assignment |
Creating Custom Split View Controller
Create New Class
Generate a new Cocoa Touch Class file inheriting from UISplitViewController, named MySplitViewController.
Assign to Storyboard
In Main_iPad.storyboard, select the Split View Controller and set its class to MySplitViewController in the Identity inspector.
Implement Connection Logic
Add code to viewDidLoad that connects the master and detail view controllers through property references.
Split view controllers create view controllers once, unlike segues that create new instances. Move view updating logic from viewDidLoad to a reusable method.
RefreshView Method Approach
Initial State Configuration
Provides immediate visual feedback and context for users
Ensures detail view shows relevant content instead of placeholders
Makes it clear which item is currently selected in the master view
Verify the initial state works correctly in the target environment
The split view controller now properly handles row selection, data passing, and initial state configuration for a professional iPad user experience.
Key Takeaways



