SlideShare a Scribd company logo
Tips and Tricks for Swift
Dot Swift 2016
Adam Gask
March 2016
Overview
• Dependancy Management - left-pad (Gate?)
• Closures & Error Handling - Live Coding Demo
• Swift 2.2 - All the deprecation warnings
• Swift 3 & Roadmap - All the breaking changes
• Swift Stack
• Pizza! -🍕+ 🍻
• Dot Swift Recap
Dependancy Management
• left-pad (Gate?)
Dependancy Management
Dependancy Management
• TLDR:
• Azer Koçulu
• Naming issue with Azer's ‘Kik’ npm package
• Legal issues were raised
• ‘Kik’ module was transfered to Kik
• left-pad was removed (along with 272 others)
And that's how JavaScript app development works in 2016. ®
Dependancy Management
Dependancy Management
• Cocoapods
• Carthage
Dependancy Management
Dependancy Management
• Cocoapods
• Carthage
• Checking all dependancies into source control
• Just write all your own code… right? 😉
Closures & Error Handling
“Closures are self-contained blocks of functionality
that can be passed around and used in your code.
Closures in Swift are similar to blocks in C and
Objective-C and to lambdas in other programming
languages.”
The Swift Programming Language (Swift 2.1)
Closures & Error Handling
- Live Coding Demo
Closures & Error Handling
Really useful links:
• How Do I Declare a Closure in Swift? (NSFW URL, but
content is fine)
• Swift closures cheatsheet
• Swift Closures — Everyday Gems
• Part 1
• Part 2
Swift 2.2
• Raft of non-breaking changes
• A gentle preparation for 3.0
• Linter warnings to help you on your way
• 2.2 is the time to fix your code, not 3.0
• Still bugs to fix - JIRA (Look for the label
“StarterBug”)
Swift 2.2
Referencing the Objective-C selector of a method
• Accepted Proposal - SE-0022
class vc: UIViewController {
let button = UIButton(type: .System)
func addTarget() {
button.addTarget(self, action:
#selector(vc.buttonTapped(_:)),
forControlEvents: .TouchUpInside)

}}
Swift 2.2
Naming Functions with Argument Labels
• Accepted Proposal - SE-0021
extension MyModel {
func insertData(data: NSData, at index: Int) {}
func insertData(data: NSData, aboveData
siblingData: NSData) {}
func insertData(data: NSData, belowData
siblingData: NSData) {}
}
Swift 2.2
Modernizing Swift's Debugging Identifiers
• Accepted Proposal - SE-0028
__FILE__ => #file
__LINE__ => #line
__COLUMN__ => #column
__FUNCTION__ => #function (Added during review)
__DSO_HANDLE__ => #dsohandle
Swift 2.2
Allow (most) keywords as argument labels
• Accepted Proposal - SE-0001
Allow the use of all keywords except inout, var, and let as argument
labels.
for i in 1.stride(through: 9, by: 2) {
print(i)
}
func find(data: NSData, in array: [NSData]) {
}
Swift 2.2
Tuple comparison operators
• Accepted Proposal - SE-0015
let singer = ("Taylor", "Swift")
let alien = ("Justin", “Bieber”)
if singer == alien {
print("Matching tuples!")
} else {
print("Non-matching tuples!")
}
Swift 2.2
Arrays and other slice types now have removeFirst()
This complements the existing removeLast()
var array = Array(1...10)
array.removeFirst()
for number in array {
print("(number) green bottles")
}
Swift 2.2
• Remove the ++ and -- operators - SE-0004
• Removing var from Function Parameters -
SE-0003
• Remove C-style for-loops with conditions and
incrementers
Say goodbye to…

for(var a = 0; a <10 ; a++)
Swift 3.0 & Roadmap
What we know is coming:
• Stable ABI - “guarantee a level of binary
compatibility moving forward”
• Complete generics - an array of Equatable
elements is Equatable
• Focus and refine the language
Swift 3.0 & Roadmap
Better Translation of Objective-C APIs Into Swift
• Accepted Proposal - SE-0005
let content =
listItemView.text.stringByTrimming…
CharactersInSet(NSCharacterSet.whitespaceAnd
NewlineCharacterSet())
let content =
listItemView.text.trimming(.whitespace…
AndNewlines)
Swift 3.0 & Roadmap
Apply API Guidelines to the Standard Library
• Accepted Proposal - SE-0006
-public protocol SequenceType { ... } =>
+public protocol Sequence { ... }
sort() => sorted(), sortInPlace() => sort()
reverse() => reversed()
enumerate() => enumerated()
Swift 3.0 & Roadmap
What we know is out of scope:
• Full source compatibility - there will be
breaking changes
• Concurrency
• C++ Interoperability
• Major new library functionality
Did you know?
Possible full stack in Swift?
Swift Stack
Server Options
• Swift Server IO
• Perfect
• Kitura
Maybe…
Core Data
Storage
Swift HTTP
Server
UICollectionView
Web UI
Tips and Tricks for Swift & Dot Swift 2016
Could be worse…
Dot Swift 2016
Paris - 29th January 2016
Dot Swift 2016
TLDR:
• Annual European Swift conference
• Packed schedule of 12 talks
• Ranging from UI, Live Coding & “The Bigger Picture”
• Two sessions of 4 lightning speakers
• Each talk had a structured Q&A after
The Talks
• Creating an animation with CAReplicatorLayer
• Showing that animations can be short and
succinct
• Talk
• Alessandro Ludovici
The Talks
• The Empathetic Developer
• Probably most thought provoking talk
• Talk
• Michael May
The Talks
• Tiny Networking in Swift
• Easily the best Live
Coding Demo
• Talk
• Chris Eidhof
The Talks
• Other notable talks:
• Swift [and the] Evolution - TJ Usiyan
• CloudKit: The Forgotten Cloud - Paul Ardeleanu
• iOS UIs built as Lego bricks - Victor Wang
• Beyond JSON in Swift - Maxim Zaks
• Going Swift and Beyond - Ayaka Nonaka
Featured Talk
• Localization is hard
• Lots of takeaways popular &
obscure
• Talk
• Roy Marmelstein
And Finally
• Protocol Oriented Programming
• Best use of cartoon characters
• Talk
• Grégoire Lhotellier
Thank you for your time
Adam Gask
@_AJ9

More Related Content

PDF
Icinga Camp Berlin 2018 - What's evolving in icinga 2018
PPTX
Icinga Camp Berlin 2017 - Icinga Web 2 - How to Write Modules
PDF
Icinga Web 2 at Icinga Camp Antwerp
PPTX
Loadays 2015 - Enterprise Monitoring with Icinga
PDF
Icinga @OSMC 2013
PPTX
Icinga Camp Berlin 2017 - Integrations all the way
PPTX
Icinga Camp Amsterdam - How to monitor Windows
PDF
Icinga 2 API @ Icinga Camp Portland at Puppetlabs
Icinga Camp Berlin 2018 - What's evolving in icinga 2018
Icinga Camp Berlin 2017 - Icinga Web 2 - How to Write Modules
Icinga Web 2 at Icinga Camp Antwerp
Loadays 2015 - Enterprise Monitoring with Icinga
Icinga @OSMC 2013
Icinga Camp Berlin 2017 - Integrations all the way
Icinga Camp Amsterdam - How to monitor Windows
Icinga 2 API @ Icinga Camp Portland at Puppetlabs

What's hot (20)

PDF
Icinga Camp Berlin 2017 - Icinga Director
PPTX
Icinga2 - Apify them all
PDF
Icinga Camp Berlin 2018 - Dev and Ops Stories - Integrations++
PPTX
Presentation about Icinga at Kiratech DevOps Day in Verona
PPTX
Icinga Camp San Diego 2016 - Icinga Web 2
PDF
Icinga Camp San Francisco 2017 - Icinga Director - Managing your configuration
PDF
Icinga Camp Amsterdam - Icinga2 and Ansible
PDF
Icinga 2010 at OSMC
PDF
Icinga Camp San Diego 2016 - Icinga Director
PDF
Saluki - do it like a user
PDF
Icinga Camp San Diego: Apify them all
PPTX
Icinga Camp Antwerp - Icinga2 Configuration
PPTX
Introduction into Icinga Web 2
PPTX
Icinga Camp Belgrade - Icinga Web 2
PDF
Icinga 2 and Puppet - Automate Monitoring
PPTX
Icinga Camp San Francisco 2017 - Current State of Icinga
PDF
Icinga Camp Amsterdam - Icinga Director
PPTX
Introduction into Icinga Web 2
PDF
Icinga 2 and puppet: automate monitoring
PDF
Icinga Camp Bangalore - Icinga2 and Ansible
Icinga Camp Berlin 2017 - Icinga Director
Icinga2 - Apify them all
Icinga Camp Berlin 2018 - Dev and Ops Stories - Integrations++
Presentation about Icinga at Kiratech DevOps Day in Verona
Icinga Camp San Diego 2016 - Icinga Web 2
Icinga Camp San Francisco 2017 - Icinga Director - Managing your configuration
Icinga Camp Amsterdam - Icinga2 and Ansible
Icinga 2010 at OSMC
Icinga Camp San Diego 2016 - Icinga Director
Saluki - do it like a user
Icinga Camp San Diego: Apify them all
Icinga Camp Antwerp - Icinga2 Configuration
Introduction into Icinga Web 2
Icinga Camp Belgrade - Icinga Web 2
Icinga 2 and Puppet - Automate Monitoring
Icinga Camp San Francisco 2017 - Current State of Icinga
Icinga Camp Amsterdam - Icinga Director
Introduction into Icinga Web 2
Icinga 2 and puppet: automate monitoring
Icinga Camp Bangalore - Icinga2 and Ansible
Ad

Viewers also liked (12)

PDF
[SwiftStudy 2016] 3장. 함수
PPTX
Oneresearch research services
PDF
2016 December Tools for Change CGI Newsletter
PDF
2014 02-10 - percezione del rischio
PPTX
Метасообщество
PDF
Mapas conceptuales arte_renacentista
PPT
9.5 El modelado del Litoral
PPT
Blogging For Beginners
PDF
54077367 somajul-proiect
PPSX
X.1 chapter 2
PPTX
Practical SEO for Developers - An Introduction
PPT
80 років голодомору
[SwiftStudy 2016] 3장. 함수
Oneresearch research services
2016 December Tools for Change CGI Newsletter
2014 02-10 - percezione del rischio
Метасообщество
Mapas conceptuales arte_renacentista
9.5 El modelado del Litoral
Blogging For Beginners
54077367 somajul-proiect
X.1 chapter 2
Practical SEO for Developers - An Introduction
80 років голодомору
Ad

Similar to Tips and Tricks for Swift & Dot Swift 2016 (20)

PPTX
SPS calgary 2017 introduction to azure functions microsoft flow
PPTX
Vincent biret azure functions and flow (toronto)
PPTX
Vincent biret azure functions and flow (ottawa)
PPTX
React inter3
PDF
Suite Script 2.0 API Basics
PDF
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
PPTX
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
PPTX
Evolution of a cloud start up: From C# to Node.js
PDF
C++ Windows Forms L01 - Intro
PPTX
Office add ins community call-January 2019
PPTX
Angular2 inter3
PDF
Qt Automotive Suite - under the hood // Qt World Summit 2017
PDF
Code for Startup MVP (Ruby on Rails) Session 1
PDF
Building an Angular 2 App
PPTX
Code Refactoring
PPTX
Serverless without Code (Lambda)
PDF
Spring insight what just happened
PDF
Introduction to OpenFaas
PPTX
BePUG - PowerShell and REST - Expanding your Horizon
PDF
Good bye Massive View Controller!
SPS calgary 2017 introduction to azure functions microsoft flow
Vincent biret azure functions and flow (toronto)
Vincent biret azure functions and flow (ottawa)
React inter3
Suite Script 2.0 API Basics
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
Evolution of a cloud start up: From C# to Node.js
C++ Windows Forms L01 - Intro
Office add ins community call-January 2019
Angular2 inter3
Qt Automotive Suite - under the hood // Qt World Summit 2017
Code for Startup MVP (Ruby on Rails) Session 1
Building an Angular 2 App
Code Refactoring
Serverless without Code (Lambda)
Spring insight what just happened
Introduction to OpenFaas
BePUG - PowerShell and REST - Expanding your Horizon
Good bye Massive View Controller!

Recently uploaded (20)

PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
Cloud computing and distributed systems.
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Empathic Computing: Creating Shared Understanding
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
A Presentation on Artificial Intelligence
PDF
Machine learning based COVID-19 study performance prediction
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPT
Teaching material agriculture food technology
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Encapsulation_ Review paper, used for researhc scholars
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Encapsulation theory and applications.pdf
PDF
A comparative analysis of optical character recognition models for extracting...
MIND Revenue Release Quarter 2 2025 Press Release
Dropbox Q2 2025 Financial Results & Investor Presentation
Network Security Unit 5.pdf for BCA BBA.
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Cloud computing and distributed systems.
Per capita expenditure prediction using model stacking based on satellite ima...
Empathic Computing: Creating Shared Understanding
Review of recent advances in non-invasive hemoglobin estimation
A Presentation on Artificial Intelligence
Machine learning based COVID-19 study performance prediction
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Teaching material agriculture food technology
Building Integrated photovoltaic BIPV_UPV.pdf
Chapter 3 Spatial Domain Image Processing.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Encapsulation_ Review paper, used for researhc scholars
The AUB Centre for AI in Media Proposal.docx
Encapsulation theory and applications.pdf
A comparative analysis of optical character recognition models for extracting...

Tips and Tricks for Swift & Dot Swift 2016

  • 1. Tips and Tricks for Swift Dot Swift 2016 Adam Gask March 2016
  • 2. Overview • Dependancy Management - left-pad (Gate?) • Closures & Error Handling - Live Coding Demo • Swift 2.2 - All the deprecation warnings • Swift 3 & Roadmap - All the breaking changes • Swift Stack • Pizza! -🍕+ 🍻 • Dot Swift Recap
  • 5. Dependancy Management • TLDR: • Azer Koçulu • Naming issue with Azer's ‘Kik’ npm package • Legal issues were raised • ‘Kik’ module was transfered to Kik • left-pad was removed (along with 272 others) And that's how JavaScript app development works in 2016. ®
  • 9. Dependancy Management • Cocoapods • Carthage • Checking all dependancies into source control • Just write all your own code… right? 😉
  • 10. Closures & Error Handling “Closures are self-contained blocks of functionality that can be passed around and used in your code. Closures in Swift are similar to blocks in C and Objective-C and to lambdas in other programming languages.” The Swift Programming Language (Swift 2.1)
  • 11. Closures & Error Handling - Live Coding Demo
  • 12. Closures & Error Handling Really useful links: • How Do I Declare a Closure in Swift? (NSFW URL, but content is fine) • Swift closures cheatsheet • Swift Closures — Everyday Gems • Part 1 • Part 2
  • 13. Swift 2.2 • Raft of non-breaking changes • A gentle preparation for 3.0 • Linter warnings to help you on your way • 2.2 is the time to fix your code, not 3.0 • Still bugs to fix - JIRA (Look for the label “StarterBug”)
  • 14. Swift 2.2 Referencing the Objective-C selector of a method • Accepted Proposal - SE-0022 class vc: UIViewController { let button = UIButton(type: .System) func addTarget() { button.addTarget(self, action: #selector(vc.buttonTapped(_:)), forControlEvents: .TouchUpInside)
 }}
  • 15. Swift 2.2 Naming Functions with Argument Labels • Accepted Proposal - SE-0021 extension MyModel { func insertData(data: NSData, at index: Int) {} func insertData(data: NSData, aboveData siblingData: NSData) {} func insertData(data: NSData, belowData siblingData: NSData) {} }
  • 16. Swift 2.2 Modernizing Swift's Debugging Identifiers • Accepted Proposal - SE-0028 __FILE__ => #file __LINE__ => #line __COLUMN__ => #column __FUNCTION__ => #function (Added during review) __DSO_HANDLE__ => #dsohandle
  • 17. Swift 2.2 Allow (most) keywords as argument labels • Accepted Proposal - SE-0001 Allow the use of all keywords except inout, var, and let as argument labels. for i in 1.stride(through: 9, by: 2) { print(i) } func find(data: NSData, in array: [NSData]) { }
  • 18. Swift 2.2 Tuple comparison operators • Accepted Proposal - SE-0015 let singer = ("Taylor", "Swift") let alien = ("Justin", “Bieber”) if singer == alien { print("Matching tuples!") } else { print("Non-matching tuples!") }
  • 19. Swift 2.2 Arrays and other slice types now have removeFirst() This complements the existing removeLast() var array = Array(1...10) array.removeFirst() for number in array { print("(number) green bottles") }
  • 20. Swift 2.2 • Remove the ++ and -- operators - SE-0004 • Removing var from Function Parameters - SE-0003 • Remove C-style for-loops with conditions and incrementers Say goodbye to…
 for(var a = 0; a <10 ; a++)
  • 21. Swift 3.0 & Roadmap What we know is coming: • Stable ABI - “guarantee a level of binary compatibility moving forward” • Complete generics - an array of Equatable elements is Equatable • Focus and refine the language
  • 22. Swift 3.0 & Roadmap Better Translation of Objective-C APIs Into Swift • Accepted Proposal - SE-0005 let content = listItemView.text.stringByTrimming… CharactersInSet(NSCharacterSet.whitespaceAnd NewlineCharacterSet()) let content = listItemView.text.trimming(.whitespace… AndNewlines)
  • 23. Swift 3.0 & Roadmap Apply API Guidelines to the Standard Library • Accepted Proposal - SE-0006 -public protocol SequenceType { ... } => +public protocol Sequence { ... } sort() => sorted(), sortInPlace() => sort() reverse() => reversed() enumerate() => enumerated()
  • 24. Swift 3.0 & Roadmap What we know is out of scope: • Full source compatibility - there will be breaking changes • Concurrency • C++ Interoperability • Major new library functionality
  • 25. Did you know? Possible full stack in Swift?
  • 26. Swift Stack Server Options • Swift Server IO • Perfect • Kitura
  • 30. Dot Swift 2016 Paris - 29th January 2016
  • 31. Dot Swift 2016 TLDR: • Annual European Swift conference • Packed schedule of 12 talks • Ranging from UI, Live Coding & “The Bigger Picture” • Two sessions of 4 lightning speakers • Each talk had a structured Q&A after
  • 32. The Talks • Creating an animation with CAReplicatorLayer • Showing that animations can be short and succinct • Talk • Alessandro Ludovici
  • 33. The Talks • The Empathetic Developer • Probably most thought provoking talk • Talk • Michael May
  • 34. The Talks • Tiny Networking in Swift • Easily the best Live Coding Demo • Talk • Chris Eidhof
  • 35. The Talks • Other notable talks: • Swift [and the] Evolution - TJ Usiyan • CloudKit: The Forgotten Cloud - Paul Ardeleanu • iOS UIs built as Lego bricks - Victor Wang • Beyond JSON in Swift - Maxim Zaks • Going Swift and Beyond - Ayaka Nonaka
  • 36. Featured Talk • Localization is hard • Lots of takeaways popular & obscure • Talk • Roy Marmelstein
  • 37. And Finally • Protocol Oriented Programming • Best use of cartoon characters • Talk • Grégoire Lhotellier
  • 38. Thank you for your time Adam Gask @_AJ9