This document discusses refreshing an app for iOS 7. It recommends adopting a modular approach to reduce bloated view controllers by splitting them into categories, using composition over subclassing, and making views data-aware. New iOS 7 APIs like custom view controller transitions require less code. The evolution is an opportunity to rethink an app's architecture and organization for a more maintainable codebase.
2. Going iOS 7+
● Impressive adoption rate: ~60% in less
than a week
● Older versions of apps are available on
iTunes
● Users expect their apps to be native to
the iOS 7 ecosystem
● Awesome new APIs
3. New APIs
● Text Kit
● UIKit Dynamics
● Multitasking
● Custom View Controller Transitions
4. Custom View Controller Transitions
● Pre iOS 7, you could have implemented
this functionality yourself
● Required hacks, manually managing
the process
● Using the new API, these types of
transitions require much less code and
effort
5. iOS 7 as an Engineering Refresh
● You’re going to be rethinking and
revamping almost every part of your
app’s experience
● Given this, an iOS 7 update is the
perfect opportunity to rethink your
app’s architecture and organization.
8. A Modular Approach (cont.)
Editor
Photo Selection
and Sharing
Content Analytics
9. Thin View Controllers
● One of the biggest problems was
bloated View Controllers
● Four Techniques:
○ Using modern APIs
○ Splitting View Controllers into categories
○ Composition over Subclassing
○ Data aware views
11. Categorizing View Controllers
● View controllers can have many
different roles at once
● Group different aspects of the
Controller’s functionality into
categories
● Reduces the number of lines per file,
improves organization and code clarity
13. Composition over Subclassing
● Organize frequently used design
patterns into template objects
● Allows for code reuse for slices of
common functionality in objects that
do not share an inheritance chain
14. Collection View Data Source
● AFCollectionViewDataSource
● Takes an array of data objects and
UICollectionViewCell subclass
implementing the
AFCollectionViewDataSourceView
protocol
● Multi-Section versions too!
15. Selection Controller
● Creates a Collection View, initializes
the Layout and the Data Source
● Provides a common interface for View
Controllers to receive selection events
● Everything is centered around data
objects
16. Data Aware Views
● Certain views are designed solely to
represent a piece of data, i.e. an Effect
pack
● These views should be able to
configure themselves to represent a
particular data object
● Removes the configuration from the
View Controller
17. Results
● Content View Controller Hierarchy
○ From 4 layers of subclasses to 2
○ Reduced the amount of code by more than
half
● Overall, reduced the code base by over
25%
● Improved compile times and developer
productivity