~/talk

Writing Swift code with great testability

Talkat Mobius 2017 Piter · 2017-04-21..04-22· [swift]
slides:none on file

Shows three concrete practices: replace singletons with constructor dependency injection (but keep default arguments to retain convenience), standardize error outputs with a typed enum so tests cover predictable exits, and prefer injecting real test data (preloaded images) over heavy mocks — except where system state must be faked, e.g. add a Screen protocol to mock UIScreen.scale. Demonstrations include refactored FileLoader and ImageLoader, tests run cleanly and catch regressions; uses SwiftPlates for framework setup.

AI-written summary · about

  1. 0:00Introduction and speaker background
  2. 6:21Why unit testing matters
  3. 11:59Design code for testability
  4. 19:22API boundaries with access control
  5. 26:47Mocking strategies and alternatives
  6. 38:02Summary and final tips
  7. 41:12Q&A session
~/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.