~/talk

Practical Generics in Swift

Talkat 360|iDev 2016 · 2016-09-14..09-17· [swift]
slides:none on file

Claim: generics cut duplicate code while keeping Swift’s strong type safety. Specific demos show a swapping function generalized into a type-parameter, a Stack<T> struct with protocol constraints, a Result<T> enum for network success/error handling, and a generic data source driving two different table views from one class. Code uses Swift (Swift 3 features like type parameters), the sample app builds and runs, and the examples behave as shown without runtime crashes.

AI-written summary · about

  1. 0:00Start
  2. 1:49Have we ever had anything like Generics?
  3. 3:13The Book Example - Swapping Values
  4. 10:48A Generic Stack Data Structure
  5. 12:02The Code for a Simple Generic Stack
  6. 13:09Using the Stack
  7. 14:08Constraining Generic Types
  8. 15:38Creating and Adopting a Protocol
  9. 16:49Constraints in Action
  10. 18:15A Standard Network Request
  11. 21:17Network Request with Completion Handler
  12. 23:21Network Request with Result Enum
  13. 25:19Processing the Result Response
  14. 25:50Handling the Error cases with Result
  15. 26:52Handling the Success case with Result
~/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.