Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Swift 2.0
Search
Iain Smith
August 21, 2015
Programming
46
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Swift 2.0
Iain Smith
August 21, 2015
Other Decks in Programming
See All in Programming
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
1.1k
Web Framework Benchmark Battle 2026, Any%
a_matsuda
2
2k
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
220
HTML-in-Canvasで作る未来のWeb UI表現
clockmaker
5
5.1k
Vue Fes Japan の “作る側”に関わってみて
naokihaba
0
160
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.7k
[Dev Group Paris Octobre 26] Agentforce, SIforce, Claudeforce, Slackbot… on s'y retrouve ?
nabondance
0
110
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
300
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
0
460
Optunaを作ったときにやりたかったこと、その後 (2026/10/16, Optuna Meetup #3)
iwiwi
1
430
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.9k
TechTown - Creating Composable Callables in Contemporary C++
rollbear
0
130
Featured
See All Featured
Accessibility Awareness
sabderemane
1
250
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
410
SEO for Brand Visibility & Recognition
aleyda
0
4.8k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
520
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
280
Code Review Best Practice
trishagee
74
20k
Fireside Chat
paigeccino
43
4.1k
Skip the Path - Find Your Career Trail
mkilby
1
260
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
490
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Chasing Engaging Ingredients in Design
codingconduct
0
360
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
750
Transcript
Swi$%2.0
h"p:/ /bit.ly/asos_swi1 Iain%Smith%(@_iains)
Today's(Outline • Swi%&==&Simple • New%features%in%Swi/%2.0 • Should(you(use(Swi.(in(Produc3on?
Adventures*in*Swi. Why$should$we$bother$with$Swi1?
[EveryoneLoves+bracketsRight:YES];
Stockholm)Syndrome?)1 1"Where"hostages"express"posi/ve"feelings"toward"their"captors
Apple's'Marke,ng Designed(for(Safety Fast%and%Powerful Modern,(markdown,(REPL,(Generics Objec&ve(C*Interoperability
Swi$%is%simple
Objec&ve(C*Example #import <Foundation/Foundation.h> #import <CoreGraphics/CoreGraphics.h> @class Animal; @interface Park :
NSObject @property (nonatomic, readonly) NSArray *animals - (Animal *)animalNearestPoint:(CGPoint)point; @end
Swi$%Example @import CoreGraphics class Park { private(set) var animals: [Animal]
= [] func animalNearestPoint(point: CGPoint) -> Animal? { // Method body omitted } }
Annotated(Objec-ve/C(Example #import <Foundation/Foundation.h> #import <CoreGraphics/CoreGraphics.h> @class Animal; @interface Park :
NSObject @property (nonatomic, strong, nonnull) NSArray *animals; - (nullable Animal *)animalNearestPoint:(CGPoint)point; @end
RX#Example#(Reac-ve#Cocoa) Objec&ve(C @interface NUKImageProcessor : NSObject - (RACSignal *)imageForBook:(Book *)obj;
// Internal - (RACSignal *)requestForBook:(Book *)obj; - (RACSignal *)processForBook:(Book *)obj; @end
RX#Example#(Reac-ve#Cocoa) Swi$ class ImageProcessor { func imageForBook(book: Book) -> Signal<UIImage,
NSError> {} //Internal func requestForBook(book: Book) -> Signal<ImageData, NSError> {} func processForBook(book: Book) -> Signal<UIImage, NoError> {} }
Swi$%let's%you%build%safe,%expressive% abstrac8ons.
Truth&is&ever&to&be& found&in&simplicity,&and& not&in&the&mul7plicity& and&confusion&of& things. —"Sir"Isaac"Newton
What’s'new'in'Swi-'2.0 New$Error$Handling$Model Powerful)control)flow)with)do,)guard,)defer,)and)repeat Protocol'extensions'and'default'implementa3ons
Think&Different! Pa#erns(in(Swi,
Error$Handling do { let str = try NSString(contentsOfFile: "Foo.bar", encoding:
NSUTF8StringEncoding) } catch let error as NSError { print(error.localizedDescription) }
Protocol'Extensions protocol APIEndpoint { var endpoint: String { get }
var base: String { get } } extension APIEndpoint { var url : NSURL { return NSURL(string: base+endpoint)! } }
enum SlackUsersEndpoint : APIEndpoint { case List case Info(SlackUser) var
endpoint: String { switch(self) { case .Info(let user): return "info?user=\(user.id)" case .List: return "list" } } var base: String { return "https://slack.com/api/users." } }
Extensions)on)Standard)Types protocol Sumable { init() func + (lhs: Self, rhs:
Self) -> Self } extension Int : Sumable {} extension Double: Sumable {} extension SequenceType where Generator.Element: Sumable { var sum: Generator.Element { return reduce(Generator.Element()) { $0 + $1 } } } [5, 3, 5, 1].sum [3.4, 4.5, 2.0].sum
Defer func processing() { self.delegate?.didStartProcessing() if (active) { if (encoding)
{ self.delegate?.didFinishProcessing } } else { self.delegate?.didFinishProcessing } }
func processing() { self.delegate?.didStartProcessing() defer { self.delegate?.didFinishProcessing } // code
emitted. }
Guard&&&Extensions
Availability if #available(iOS 8.0, OSX 10.10, *) { // Use
Handoff APIs when available. let activity = NSUserActivity(activityType:"com.example.ShoppingList.view") activity.becomeCurrent() } else { // Fall back when Handoff APIs not available. } @available(iOS 8.0, OSX 10.10, *) func startUserActivity() -> NSUserActivity { }
Ready&for&produc-on? • The%Tooling%problem • The%Compila1on%problem • The%Team%problem • The%Client/deadline%problem •
The%How%do%I%do%that%in%Swi9%problem?
Thank&You