~/talk

Separation of concerns: Refactoring view controllers live

Talkat Swift Heroes 2018 · on Friday, 2018-11-09· [frontend-architecture, ios]
slides:none on file

Live refactoring of a Swift app converts a 73-line view controller into 32 lines by extracting concrete pieces: a Bundle extension for JSON decoding, an attributed-title computed property moved into the Project model, a reusable ProjectDataSource class, a DetailView UIView subclass with a closure-based readAction, a NavigationDelegate for WKWebView plus a WKWebView URL-loading extension, and a MainCoordinator that boots the app (removes storyboard) and calls MainCoordinator.start(). All pieces compile and run live, demonstrating smaller, testable modules.

AI-written summary · about

  1. 0:00Introduction and speaker intro
  2. 2:25MVC problems and talk overview
  3. 9:54Live coding project setup
  4. 10:15Extracting bundle decoding logic
  5. 14:11Moving attributed string formatting
  6. 15:56Creating reusable table data source
  7. 20:13Refactoring view creation to UIViews
  8. 26:10Extracting WebKit navigation delegate
  9. 29:06Adding URL loading extension
  10. 31:13Introducing coordinator pattern
  11. 36:37Implementing coordinator protocol
  12. 39:29Making view controllers storyboardable
  13. 40:39Integrating coordinator with view controllers
  14. 42:06Summary and refactoring benefits
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.