- Reference semantics
- Immutability
- Value semantics
- Value types in practice
- Mixing value types and reference types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // ContentView.swift | |
| // DeleteMe | |
| // | |
| // Created by Chris Eidhof on 02.02.21. | |
| // | |
| import SwiftUI | |
| /* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Beyond Crusty: Real-World Protocols | |
| ## Slide 1 | |
| Who here saw last WWDC's talk Protocol-Oriented Programming in Swift? The Crusty talk? | |
| It is without a doubt the most important Swift talk. You have to watch it. It is probably the best talk I've ever seen at WWDC. And it's entire point is that subclassing is a needless complexity and that the right solution to most problems is protocols. Apple goes so far as to say that Swift is the first Protocol-Oriented Programming language. | |
| Now, I take some exception to that. I don't think Swift is the first Protocol-Oriented Programming language. I think Go is much more "protocol-oriented" than Swift today, but that's a debate for beer later. Swift clearly is protocol-oriented, and that's great. | |
| ## Slide 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let color = "blue" | |
| let num = 42 | |
| localized("Colorless green ideas sleep furiously.") | |
| localized("Colorless \(color) ideas sleep furiously.") | |
| localized("\(num.formatted("%05d")) colorless green ideas sleep furiously.") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Link: <https://gist.github.com/jellybeansoup/db7b24fb4c7ed44030f4> | |
| # | |
| # A command-line script for incrementing build numbers for all known targets in an Xcode project. | |
| # | |
| # This script has two main goals: firstly, to ensure that all the targets in a project have the | |
| # same CFBundleVersion and CFBundleShortVersionString values. This is because mismatched values | |
| # can cause a warning when submitting to the App Store. Secondly, to ensure that the build number | |
| # is incremented appropriately when git has changes. | |
| # |
PS: If you liked this talk or like this concept, let's chat about iOS development at Stitch Fix! #shamelessplug
Speaker: David Abrahams. (Tech lead for Swift standard library)
-
"Crusty" is an old-school programmer who doesn't trust IDE's, debuggers, programming fads. He's cynical, grumpy.
-
OOP has been around since the 1970's. It's not actually new.
-
Classes are Awesome
- Encapsulation
- Access control
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) { | |
| // I'm the background thread | |
| dispatch_async(dispatch_get_main_queue()) { | |
| // I'm the UI thread | |
| } | |
| } |