SlideShare a Scribd company logo
Swift Thinking
@NatashaTheRobot
@NatashaTheRobot
• Swift Newsletter -
swiftnews.curated.co
• NatashaTheRobot.com
Learning…
Work with Others
Teach
Put Your Stuff Out
There
Expose Yourself to
Advanced Topics
Celebrate
Breakthroughs
@ashsmash
Learning…
• Value Types
• Optionals?!
• Testing
Value Types
• structs
• enums
• (tuples)
class Person {
let name: String
var age: Int
init(name: String, age: Int) {
self.name = name
self.age = age
}
}
let taylorSwift = Person(name: "Taylor Swift", age: 25)
func timeTravelToBirthdayForPerson(var person: Person) {
person.age += 1
()
}
timeTravelToBirthdayForPerson(taylorSwift)
taylorSwift.age // 26
let taylorSwift = Person(name: "Taylor Swift", age: 25)
func timeTravelToBirthdayForPerson(person: Person) {
person.age += 1
🎉🎂🎁🎈💥()
}
timeTravelToBirthdayForPerson(taylorSwift)
taylorSwift.age // 26
let taylorSwift = Person(name: "Taylor Swift", age: 25)
func timeTravelToBirthdayForPerson(var person: Person) {
person.age += 1
🎉🎂🎁🎈💥()
}
timeTravelToBirthdayForPerson(taylorSwift)
taylorSwift.age // 26
struct Person {
let name: String
var age: Int
// NO INIT NEEDED
}
let taylorSwift = Person(name: "Taylor Swift", age: 25)
func timeTravelToBirthdayForPerson(var person: Person) {
person.age += 1
()
}
timeTravelToBirthdayForPerson(taylorSwift)
taylorSwift.age // 25
let taylorSwift = Person(name: "Taylor Swift", age: 25)
func timeTravelToBirthdayForPerson(var person: Person) {
person.age += 1
🎉🎂🎁🎈💥()
}
timeTravelToBirthdayForPerson(taylorSwift)
taylorSwift.age // 25
let taylorSwift = Person(name: "Taylor Swift", age: 25)
func timeTravelToBirthdayForPerson(var person: Person) {
person.age += 1
🎉🎂🎁🎈💥()
}
timeTravelToBirthdayForPerson(taylorSwift)
taylorSwift.age // 25
let taylorSwift = Person(name: "Taylor Swift", age: 25)
func timeTravelToBirthdayForPerson(var person: Person) {
person.age += 1
🎉🎂🎁🎈💥()
}
timeTravelToBirthdayForPerson(taylorSwift)
taylorSwift.age // 25
@andy_matuschak
• Functional Swift Conference: Functioning as a
Functionalist
• Realm: Controlling Complexity in Swift
–Functional Swift Book
“Almost all types in Swift are value types,
including arrays, dictionaries, numbers,
booleans, tuples, and enums. Classes are the
exception rather than the rule.”
$ grep -e "^struct " swift.md | wc -l
87
$ grep -e "^enum " swift.md | wc -l
8
$ grep -e "^class " swift.md | wc -l
4
Optionals?!
–Sunset Lake Software
“~40% of bugs shipped to customers in the last
three years would have been caught
immediately by using Swift”
Objc.io Issue 13
struct Person {
let name: String
var age: Int
}
struct PersonViewModel {
var name: String?
var age: String?
}
class ViewController: UIViewController, UITextFieldDelegate {
@IBOutlet weak var nameTextField: UITextField!
@IBOutlet weak var ageTextField: UITextField!
var personViewModel = PersonViewModel()
override func viewDidLoad() {
super.viewDidLoad()
}
func textFieldDidEndEditing(textField: UITextField) {
personViewModel.name = nameTextField.text
personViewModel.age = ageTextField.text
}
}
struct PersonViewModel {
var name: String?
var age: String?
enum InputError: ErrorType {
case InputMissing
case AgeIncorrect
}
func createPerson() throws -> Person {
guard let age = age, let name = name else {
throw InputError.InputMissing
}
guard let ageFormatted = Int(age) else {
throw InputError.AgeIncorrect
}
return Person(name: name, age: ageFormatted)
}
}
class ViewController: UIViewController, UITextFieldDelegate {
var personViewModel = PersonViewModel()
// ... truncated ... //
@IBAction func onSubmitButtonTap(sender: AnyObject) {
view.endEditing(true)
do {
let person = try personViewModel.createPerson()
print("Success! Person created. (person)")
} catch PersonViewModel.InputError.InputMissing {
print("Input missing!")
} catch PersonViewModel.InputError.AgeIncorrect {
print("Age Incorrect!")
} catch {
print("Something went wrong, please try again!")
}
}
}
Failable initializers, revisited
@jesse_squires
Testing
• Performance Tests
• Asynchronous Tests
• Xcode CI Improvements
• UI Tests
• Code Coverage
Still Learning…
• Value Types
• Optionals?!
• Testing
To Learn…
• do
• guard
• defer
• error handling
• protocol extensions
• print
• pattern matching
• early exits
• UI Testing
• WatchOS
• UIStackView
• Security
• Complications
• Continuous Integration
• App Thinning
• Crash Logs
• Objective-C Generics

More Related Content

Viewers also liked

Ux och design som konverterar del 1
Ux och design som konverterar   del 1Ux och design som konverterar   del 1
Ux och design som konverterar del 1
Wipcore
 
Design Thinking for Advanced Manufacturing _ Industry Recommendations_Dec 2014
Design Thinking for Advanced Manufacturing _ Industry Recommendations_Dec 2014 Design Thinking for Advanced Manufacturing _ Industry Recommendations_Dec 2014
Design Thinking for Advanced Manufacturing _ Industry Recommendations_Dec 2014 Jane Cockburn
 
The Semantic Web – A Vision Come True, or Giving Up the Great Plan?
The Semantic Web – A Vision Come True, or Giving Up the Great Plan?The Semantic Web – A Vision Come True, or Giving Up the Great Plan?
The Semantic Web – A Vision Come True, or Giving Up the Great Plan?Martin Hepp
 
De Empreendedor à Empresário
De Empreendedor à EmpresárioDe Empreendedor à Empresário
De Empreendedor à Empresário
Fernando Tomé
 
1 spattern matching using biometric techniques
1 spattern matching using biometric techniques1 spattern matching using biometric techniques
1 spattern matching using biometric techniques
Presentaionslive.blogspot.com
 
Big Data World presentation - Sep. 2014
Big Data World presentation - Sep. 2014Big Data World presentation - Sep. 2014
Big Data World presentation - Sep. 2014
Wing Yuen Loon
 
RASPBIAN JESSIE WITH PIXEL
RASPBIAN JESSIE WITH PIXELRASPBIAN JESSIE WITH PIXEL
RASPBIAN JESSIE WITH PIXEL
Tsuyoshi Horigome
 
An ontologyforopenrubricexchangeontheweb
An ontologyforopenrubricexchangeonthewebAn ontologyforopenrubricexchangeontheweb
An ontologyforopenrubricexchangeonthewebbpanulla
 
Actielijst 201304
Actielijst 201304Actielijst 201304
Actielijst 201304Kees Dekker
 

Viewers also liked (10)

Ux och design som konverterar del 1
Ux och design som konverterar   del 1Ux och design som konverterar   del 1
Ux och design som konverterar del 1
 
Design Thinking for Advanced Manufacturing _ Industry Recommendations_Dec 2014
Design Thinking for Advanced Manufacturing _ Industry Recommendations_Dec 2014 Design Thinking for Advanced Manufacturing _ Industry Recommendations_Dec 2014
Design Thinking for Advanced Manufacturing _ Industry Recommendations_Dec 2014
 
The Semantic Web – A Vision Come True, or Giving Up the Great Plan?
The Semantic Web – A Vision Come True, or Giving Up the Great Plan?The Semantic Web – A Vision Come True, or Giving Up the Great Plan?
The Semantic Web – A Vision Come True, or Giving Up the Great Plan?
 
De Empreendedor à Empresário
De Empreendedor à EmpresárioDe Empreendedor à Empresário
De Empreendedor à Empresário
 
1 spattern matching using biometric techniques
1 spattern matching using biometric techniques1 spattern matching using biometric techniques
1 spattern matching using biometric techniques
 
Big Data World presentation - Sep. 2014
Big Data World presentation - Sep. 2014Big Data World presentation - Sep. 2014
Big Data World presentation - Sep. 2014
 
RASPBIAN JESSIE WITH PIXEL
RASPBIAN JESSIE WITH PIXELRASPBIAN JESSIE WITH PIXEL
RASPBIAN JESSIE WITH PIXEL
 
An ontologyforopenrubricexchangeontheweb
An ontologyforopenrubricexchangeonthewebAn ontologyforopenrubricexchangeontheweb
An ontologyforopenrubricexchangeontheweb
 
Van Godtsenhoven Karen
Van Godtsenhoven KarenVan Godtsenhoven Karen
Van Godtsenhoven Karen
 
Actielijst 201304
Actielijst 201304Actielijst 201304
Actielijst 201304
 

Similar to AltConf 2015: Swift Thinking

Extreme Swift
Extreme SwiftExtreme Swift
Extreme Swift
Movel
 
Getting Started With Kotlin Development - Rivu
Getting Started With Kotlin Development - Rivu Getting Started With Kotlin Development - Rivu
Getting Started With Kotlin Development - Rivu
CodeOps Technologies LLP
 
Why Kotlin is your next language?
Why Kotlin is your next language? Why Kotlin is your next language?
Why Kotlin is your next language?
Aliaksei Zhynhiarouski
 
Embedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaEmbedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaJevgeni Kabanov
 
Functional Scala 2020
Functional Scala 2020Functional Scala 2020
Functional Scala 2020
Alexander Ioffe
 
More expressive types for spark with frameless
More expressive types for spark with framelessMore expressive types for spark with frameless
More expressive types for spark with frameless
Miguel Pérez Pasalodos
 
Dev Day Andreas Roth.pdf
Dev Day Andreas Roth.pdfDev Day Andreas Roth.pdf
Dev Day Andreas Roth.pdf
CarolinaMatthies
 
Simple class and object examples in java
Simple class and object examples in javaSimple class and object examples in java
Simple class and object examples in java
Harish Gyanani
 
Maintainable JavaScript 2012
Maintainable JavaScript 2012Maintainable JavaScript 2012
Maintainable JavaScript 2012
Nicholas Zakas
 
AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokusHamletDRC
 
Idioms in swift 2016 05c
Idioms in swift 2016 05cIdioms in swift 2016 05c
Idioms in swift 2016 05c
Kaz Yoshikawa
 
Type-Safe MongoDB query (Lift Rogue query)
Type-Safe MongoDB query (Lift Rogue query)Type-Safe MongoDB query (Lift Rogue query)
Type-Safe MongoDB query (Lift Rogue query)
Knoldus Inc.
 
Type-Safe MongoDB query (Lift Rogue query)
Type-Safe MongoDB query (Lift Rogue query)Type-Safe MongoDB query (Lift Rogue query)
Type-Safe MongoDB query (Lift Rogue query)
Abdhesh Kumar
 
Modernizes your objective C - Oliviero
Modernizes your objective C - OlivieroModernizes your objective C - Oliviero
Modernizes your objective C - Oliviero
Codemotion
 
Classes
ClassesClasses
Classes
SV.CO
 
All Aboard The Scala-to-PureScript Express!
All Aboard The Scala-to-PureScript Express!All Aboard The Scala-to-PureScript Express!
All Aboard The Scala-to-PureScript Express!
John De Goes
 
Swift + GraphQL
Swift + GraphQLSwift + GraphQL
Swift + GraphQL
Sommer Panage
 
An Introduction to Scala (2014)
An Introduction to Scala (2014)An Introduction to Scala (2014)
An Introduction to Scala (2014)
William Narmontas
 

Similar to AltConf 2015: Swift Thinking (20)

Scala introduction
Scala introductionScala introduction
Scala introduction
 
Intro toswift1
Intro toswift1Intro toswift1
Intro toswift1
 
Extreme Swift
Extreme SwiftExtreme Swift
Extreme Swift
 
Getting Started With Kotlin Development - Rivu
Getting Started With Kotlin Development - Rivu Getting Started With Kotlin Development - Rivu
Getting Started With Kotlin Development - Rivu
 
Why Kotlin is your next language?
Why Kotlin is your next language? Why Kotlin is your next language?
Why Kotlin is your next language?
 
Embedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaEmbedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for Java
 
Functional Scala 2020
Functional Scala 2020Functional Scala 2020
Functional Scala 2020
 
More expressive types for spark with frameless
More expressive types for spark with framelessMore expressive types for spark with frameless
More expressive types for spark with frameless
 
Dev Day Andreas Roth.pdf
Dev Day Andreas Roth.pdfDev Day Andreas Roth.pdf
Dev Day Andreas Roth.pdf
 
Simple class and object examples in java
Simple class and object examples in javaSimple class and object examples in java
Simple class and object examples in java
 
Maintainable JavaScript 2012
Maintainable JavaScript 2012Maintainable JavaScript 2012
Maintainable JavaScript 2012
 
AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokus
 
Idioms in swift 2016 05c
Idioms in swift 2016 05cIdioms in swift 2016 05c
Idioms in swift 2016 05c
 
Type-Safe MongoDB query (Lift Rogue query)
Type-Safe MongoDB query (Lift Rogue query)Type-Safe MongoDB query (Lift Rogue query)
Type-Safe MongoDB query (Lift Rogue query)
 
Type-Safe MongoDB query (Lift Rogue query)
Type-Safe MongoDB query (Lift Rogue query)Type-Safe MongoDB query (Lift Rogue query)
Type-Safe MongoDB query (Lift Rogue query)
 
Modernizes your objective C - Oliviero
Modernizes your objective C - OlivieroModernizes your objective C - Oliviero
Modernizes your objective C - Oliviero
 
Classes
ClassesClasses
Classes
 
All Aboard The Scala-to-PureScript Express!
All Aboard The Scala-to-PureScript Express!All Aboard The Scala-to-PureScript Express!
All Aboard The Scala-to-PureScript Express!
 
Swift + GraphQL
Swift + GraphQLSwift + GraphQL
Swift + GraphQL
 
An Introduction to Scala (2014)
An Introduction to Scala (2014)An Introduction to Scala (2014)
An Introduction to Scala (2014)
 

More from Natasha Murashev

Digital Nomad: The New Normal
Digital Nomad: The New NormalDigital Nomad: The New Normal
Digital Nomad: The New Normal
Natasha Murashev
 
Build Features Not Apps
Build Features Not AppsBuild Features Not Apps
Build Features Not Apps
Natasha Murashev
 
Build Features Not Apps
Build Features Not AppsBuild Features Not Apps
Build Features Not Apps
Natasha Murashev
 
The Secret Life of a Digital Nomad
The Secret Life of a Digital NomadThe Secret Life of a Digital Nomad
The Secret Life of a Digital Nomad
Natasha Murashev
 
How to Win on the Apple Watch
How to Win on the Apple WatchHow to Win on the Apple Watch
How to Win on the Apple Watch
Natasha Murashev
 
Hello watchOS2
Hello watchOS2 Hello watchOS2
Hello watchOS2
Natasha Murashev
 
Practical Protocol-Oriented-Programming
Practical Protocol-Oriented-ProgrammingPractical Protocol-Oriented-Programming
Practical Protocol-Oriented-Programming
Natasha Murashev
 
Protocol Oriented MVVM - Auckland iOS Meetup
Protocol Oriented MVVM - Auckland iOS MeetupProtocol Oriented MVVM - Auckland iOS Meetup
Protocol Oriented MVVM - Auckland iOS Meetup
Natasha Murashev
 
Protocol-Oriented MVVM (extended edition)
Protocol-Oriented MVVM (extended edition)Protocol-Oriented MVVM (extended edition)
Protocol-Oriented MVVM (extended edition)
Natasha Murashev
 
Protocol-Oriented MVVM
Protocol-Oriented MVVMProtocol-Oriented MVVM
Protocol-Oriented MVVM
Natasha Murashev
 
The Zen Guide to WatchOS 2
The Zen Guide to WatchOS 2The Zen Guide to WatchOS 2
The Zen Guide to WatchOS 2
Natasha Murashev
 
HealthKit Deep Dive
HealthKit Deep DiveHealthKit Deep Dive
HealthKit Deep Dive
Natasha Murashev
 
Hello, WatchKit
Hello, WatchKitHello, WatchKit
Hello, WatchKit
Natasha Murashev
 
Hello, WatchKit
Hello, WatchKitHello, WatchKit
Hello, WatchKit
Natasha Murashev
 
Unleash the Power of Playgrounds
Unleash the Power of PlaygroundsUnleash the Power of Playgrounds
Unleash the Power of Playgrounds
Natasha Murashev
 
Hello, WatchKit
Hello, WatchKitHello, WatchKit
Hello, WatchKit
Natasha Murashev
 
Swift Thinking
Swift ThinkingSwift Thinking
Swift Thinking
Natasha Murashev
 
Funcitonal Swift Conference: The Functional Way
Funcitonal Swift Conference: The Functional WayFuncitonal Swift Conference: The Functional Way
Funcitonal Swift Conference: The Functional Way
Natasha Murashev
 
Intro To Swift
Intro To SwiftIntro To Swift
Intro To Swift
Natasha Murashev
 
HealthKit: Getting Ready for the New Year
HealthKit: Getting Ready for the New YearHealthKit: Getting Ready for the New Year
HealthKit: Getting Ready for the New Year
Natasha Murashev
 

More from Natasha Murashev (20)

Digital Nomad: The New Normal
Digital Nomad: The New NormalDigital Nomad: The New Normal
Digital Nomad: The New Normal
 
Build Features Not Apps
Build Features Not AppsBuild Features Not Apps
Build Features Not Apps
 
Build Features Not Apps
Build Features Not AppsBuild Features Not Apps
Build Features Not Apps
 
The Secret Life of a Digital Nomad
The Secret Life of a Digital NomadThe Secret Life of a Digital Nomad
The Secret Life of a Digital Nomad
 
How to Win on the Apple Watch
How to Win on the Apple WatchHow to Win on the Apple Watch
How to Win on the Apple Watch
 
Hello watchOS2
Hello watchOS2 Hello watchOS2
Hello watchOS2
 
Practical Protocol-Oriented-Programming
Practical Protocol-Oriented-ProgrammingPractical Protocol-Oriented-Programming
Practical Protocol-Oriented-Programming
 
Protocol Oriented MVVM - Auckland iOS Meetup
Protocol Oriented MVVM - Auckland iOS MeetupProtocol Oriented MVVM - Auckland iOS Meetup
Protocol Oriented MVVM - Auckland iOS Meetup
 
Protocol-Oriented MVVM (extended edition)
Protocol-Oriented MVVM (extended edition)Protocol-Oriented MVVM (extended edition)
Protocol-Oriented MVVM (extended edition)
 
Protocol-Oriented MVVM
Protocol-Oriented MVVMProtocol-Oriented MVVM
Protocol-Oriented MVVM
 
The Zen Guide to WatchOS 2
The Zen Guide to WatchOS 2The Zen Guide to WatchOS 2
The Zen Guide to WatchOS 2
 
HealthKit Deep Dive
HealthKit Deep DiveHealthKit Deep Dive
HealthKit Deep Dive
 
Hello, WatchKit
Hello, WatchKitHello, WatchKit
Hello, WatchKit
 
Hello, WatchKit
Hello, WatchKitHello, WatchKit
Hello, WatchKit
 
Unleash the Power of Playgrounds
Unleash the Power of PlaygroundsUnleash the Power of Playgrounds
Unleash the Power of Playgrounds
 
Hello, WatchKit
Hello, WatchKitHello, WatchKit
Hello, WatchKit
 
Swift Thinking
Swift ThinkingSwift Thinking
Swift Thinking
 
Funcitonal Swift Conference: The Functional Way
Funcitonal Swift Conference: The Functional WayFuncitonal Swift Conference: The Functional Way
Funcitonal Swift Conference: The Functional Way
 
Intro To Swift
Intro To SwiftIntro To Swift
Intro To Swift
 
HealthKit: Getting Ready for the New Year
HealthKit: Getting Ready for the New YearHealthKit: Getting Ready for the New Year
HealthKit: Getting Ready for the New Year
 

Recently uploaded

When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 

Recently uploaded (20)

When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 

AltConf 2015: Swift Thinking

  • 2. @NatashaTheRobot • Swift Newsletter - swiftnews.curated.co • NatashaTheRobot.com
  • 6. Put Your Stuff Out There
  • 10. Learning… • Value Types • Optionals?! • Testing
  • 13. class Person { let name: String var age: Int init(name: String, age: Int) { self.name = name self.age = age } }
  • 14. let taylorSwift = Person(name: "Taylor Swift", age: 25) func timeTravelToBirthdayForPerson(var person: Person) { person.age += 1 () } timeTravelToBirthdayForPerson(taylorSwift) taylorSwift.age // 26
  • 15. let taylorSwift = Person(name: "Taylor Swift", age: 25) func timeTravelToBirthdayForPerson(person: Person) { person.age += 1 🎉🎂🎁🎈💥() } timeTravelToBirthdayForPerson(taylorSwift) taylorSwift.age // 26
  • 16. let taylorSwift = Person(name: "Taylor Swift", age: 25) func timeTravelToBirthdayForPerson(var person: Person) { person.age += 1 🎉🎂🎁🎈💥() } timeTravelToBirthdayForPerson(taylorSwift) taylorSwift.age // 26
  • 17. struct Person { let name: String var age: Int // NO INIT NEEDED }
  • 18. let taylorSwift = Person(name: "Taylor Swift", age: 25) func timeTravelToBirthdayForPerson(var person: Person) { person.age += 1 () } timeTravelToBirthdayForPerson(taylorSwift) taylorSwift.age // 25
  • 19. let taylorSwift = Person(name: "Taylor Swift", age: 25) func timeTravelToBirthdayForPerson(var person: Person) { person.age += 1 🎉🎂🎁🎈💥() } timeTravelToBirthdayForPerson(taylorSwift) taylorSwift.age // 25
  • 20. let taylorSwift = Person(name: "Taylor Swift", age: 25) func timeTravelToBirthdayForPerson(var person: Person) { person.age += 1 🎉🎂🎁🎈💥() } timeTravelToBirthdayForPerson(taylorSwift) taylorSwift.age // 25
  • 21. let taylorSwift = Person(name: "Taylor Swift", age: 25) func timeTravelToBirthdayForPerson(var person: Person) { person.age += 1 🎉🎂🎁🎈💥() } timeTravelToBirthdayForPerson(taylorSwift) taylorSwift.age // 25
  • 22.
  • 23. @andy_matuschak • Functional Swift Conference: Functioning as a Functionalist • Realm: Controlling Complexity in Swift
  • 24. –Functional Swift Book “Almost all types in Swift are value types, including arrays, dictionaries, numbers, booleans, tuples, and enums. Classes are the exception rather than the rule.”
  • 25. $ grep -e "^struct " swift.md | wc -l 87 $ grep -e "^enum " swift.md | wc -l 8 $ grep -e "^class " swift.md | wc -l 4
  • 27.
  • 28. –Sunset Lake Software “~40% of bugs shipped to customers in the last three years would have been caught immediately by using Swift”
  • 30.
  • 31. struct Person { let name: String var age: Int }
  • 32. struct PersonViewModel { var name: String? var age: String? }
  • 33. class ViewController: UIViewController, UITextFieldDelegate { @IBOutlet weak var nameTextField: UITextField! @IBOutlet weak var ageTextField: UITextField! var personViewModel = PersonViewModel() override func viewDidLoad() { super.viewDidLoad() } func textFieldDidEndEditing(textField: UITextField) { personViewModel.name = nameTextField.text personViewModel.age = ageTextField.text } }
  • 34. struct PersonViewModel { var name: String? var age: String? enum InputError: ErrorType { case InputMissing case AgeIncorrect } func createPerson() throws -> Person { guard let age = age, let name = name else { throw InputError.InputMissing } guard let ageFormatted = Int(age) else { throw InputError.AgeIncorrect } return Person(name: name, age: ageFormatted) } }
  • 35. class ViewController: UIViewController, UITextFieldDelegate { var personViewModel = PersonViewModel() // ... truncated ... // @IBAction func onSubmitButtonTap(sender: AnyObject) { view.endEditing(true) do { let person = try personViewModel.createPerson() print("Success! Person created. (person)") } catch PersonViewModel.InputError.InputMissing { print("Input missing!") } catch PersonViewModel.InputError.AgeIncorrect { print("Age Incorrect!") } catch { print("Something went wrong, please try again!") } } }
  • 38. • Performance Tests • Asynchronous Tests • Xcode CI Improvements • UI Tests • Code Coverage
  • 39.
  • 40.
  • 41.
  • 42.
  • 43. Still Learning… • Value Types • Optionals?! • Testing
  • 44. To Learn… • do • guard • defer • error handling • protocol extensions • print • pattern matching • early exits • UI Testing • WatchOS • UIStackView • Security • Complications • Continuous Integration • App Thinning • Crash Logs • Objective-C Generics