~/talk

Polymorphism with Protocols

Talkat iOS Conf SG 2017 · 2017-10-19..10-20· [ios]
slides:none on file

Shows a concrete Swift refactor: a messy class-based expression tree with optionals becomes protocols + structs so nodes are value types, eliminating shared mutable state. Implements a tree evaluator (prints 10 for 23+4, 100 after adding a power node) and a simple UIImage renderer via protocol extensions* and draw helpers. Uses Xcode Playground, Swift stdlib pow, and protocol requirements for evaluate(); the refactor reduces conditionals, makes unit testing easier, and preserves runtime polymorphism via protocol conformance.

AI-written summary · about

  1. 0:00Start
  2. 0:46Need for a Good Api Design
  3. 1:35Three Characteristics of Good Api Design
  4. 2:05What Kind of Data Structure Can We Use To Express a Mathematical Formula
  5. 2:39First Naive Approach
  6. 6:01Evaluate Function
  7. 7:20Abstract Class
  8. 19:58String Interpolation
~/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.