Wrapping the Implementation
Like table views, a page view controller uses a delegate and data source to set the behavior and contents of its presentation. Unlike with table views, it’s simplest to wrap these items into a custom class to hide their details from applications. The code needed to support a page view implementation is rather quirky—but highly reusable. A wrapper lets you turn your attention away from fussy coding details to specific content-handling concerns.
In the standard implementation, the data source is responsible for providing page controllers on demand. It returns the next and previous view controllers in relationship to a given one. The delegate handles reorientation events and animation callbacks, setting the page view ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access