Hosts: Darryl H. Thomas, Chad Etzel and John Sextro
Audio Engineer and Post-Producer: Darryl H. Thomas
Released Wednesday, May 27, 2015
— Podcast Concierge (@podcastrec) May 17, 2015
@iOhYesPodcast oh man such an info dump. I think you guys should have a blog for the homework 🙂
— Ashton (@AshtonDev) May 21, 2015
- Automatic Reference Counting
- Same old ARC we know and (mostly) love
- Applies only to instances of class types, as value types aren’t stored and passed by reference
- Use weak references to avoid reference cycles whenever it’s possible for that reference to be nil at some point. If a reference will always have a value, use unowned instead.
- All weak references must have an optional type.
- All unowned references must have a non-optional type
- In scenarios where one class depends on another, consider using weak implicitly unwrapped optionals instead of unowned references.
- As with Objective-c, strong reference cycles are possible when a class instance has a closure property that captures the instance
- Swift uses “closure capture lists” to solve this
- Example: [unowned self] in … or [weak self] in …
- Use unowned references when the closure and captured instance will always refer to each other and will always be deallocated at the same time
- Use weak references when the captured instance may become nil at some point.
- Weak references are always optionals.
- Similar to using the __weak/__strong pattern in Objective-c, but considerably cleaner
- Did anyone manage to add something other than self to a capture list??
- Homework: Can you add something other than self to a capture list?
- Optional Chaining
- Process for querying and calling properties, methods and subscripts on an optional that might be nil
- If the optional is nil, the call returns nil
- Law of Demeter
- Multiple optional queries can be chained together
- Similar to messaging nil in Objective-c, but in a way that works for any type and can be checked for success or failure
- Generic Functions
- Generic Types
- Classes, structures and enumerations that can work with any type, similar to Array and Dictionary
- Both use a placeholder type, indicated with a placeholder typename within angle brackets (eg: <T>). Type parameters should always have UpperCamelCase names.
- Type constraints
- Limits the usable types by specifying a class or protocol a type must descend from or implement, respectively
- Associated types via typealias
- These are basically generics for protocols, right?
- Where clause
- Basically type constraints for associated types
- I was really worried they were going to throw some crazy syntax at us to “simplify” writing the where
- Automatic Reference Counting
- Sensi WiFi Thermostat offer code saveonsensi
- My daughter installing the Sensi Thermostat on YouTube.
- Let’s Build Swift.Array – Mike Ash
Describes how to implement value semantics and the use of the isUniquelyReferenced API introduced in Swift 1.2
Alternative Show Titles
- Turns out
- Garbage Collection
- John accepted
- Deadly embrace
- Retain hug of death
- Go away
- I’m no longer interested in you
- I hate thinking
- Scare away Ruby developers
- Demeter defeater
- ipso facto math
- I don’t know what T is
- The dreaded T
- Monad land
- T Soup
- Advanced Age
- You can pry my header files from my cold, dead fingers
- So there
- With great power comes great responsibility
- Broom Closets
- All arrows point to “No!”