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 週報 5/3
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Johnlin
May 03, 2016
Programming
140
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Swift 週報 5/3
Swift 週報 5/3
Johnlin
May 03, 2016
More Decks by Johnlin
See All by Johnlin
用 MLIR 實作 一個 Ruby IR (intermediate representation)
johnlinvc
0
390
Unearth Ruby builtin Gems 發掘 Ruby 的內建 Gems
johnlinvc
0
490
Ruby 型別檢查工具簡介
johnlinvc
0
700
Swift Actor 實作探索
johnlinvc
0
230
用 mruby 來寫跨平台工具
johnlinvc
0
150
Actor model 簡介
johnlinvc
0
280
一起玩 Helm 3
johnlinvc
1
200
為什麼 App 卡卡的
johnlinvc
2
1.4k
如何使用 byebug 來除錯 Ruby 程式
johnlinvc
0
300
Other Decks in Programming
See All in Programming
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.7k
ChromeでローカルLLM
ryu1013
0
140
Atomic Design, Enforced: Scaling Mobile Design Systems (next.app devCon / droidCon Berlin 2026)
steliosf
PRO
0
170
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
0
450
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
180
外から家のPCの電源入れたい!をPHPで解決する
kawashimo0
1
130
すこし踏み込む CancellationToken
htkym
2
1.7k
contenteditable と日本語入力に向き合う
colorful12
0
200
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
790
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
270
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
180
npm との違いを手がかりにGo の依存管理を理解したい
optim
0
290
Featured
See All Featured
Thoughts on Productivity
jonyablonski
76
5.4k
Producing Creativity
orderedlist
PRO
348
41k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
300
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
430
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.4k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
410
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
620
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
58k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
940
Transcript
Swift पใ 5/3 John Lin @johnlinvc
From the core • ෦ deprecation ܯࠂঋڃࡨޡ
෦ deprecation ܯࠂঋڃࡨ ޡ print(__FILE__) @warn_unused_result(message="oh no") func F1() ->
Int{ return 42 } for var a = 0; a < 3; a+=1 { a } • Ṝࠣࡏ։ᚙ൛తswift ቮៃኺܯࠂঋڃࡨޡɻҎޙ။࿈compile ෆߦɻ
Evolution • SE-0036 Enum ҰఆཁՃ։಄తᴍ • SE-0048 Generic typealias •
SE-0049 ሡ @noescape ᢛ @autoclosure Ҡࢸ type એࠂ • SE-0057 import Obj-C generics
SE-0036 Enum ҰఆཁՃ։಄త ᴍ enum Coin : CustomStringConvertible { case
heads, tails var description: String { switch self { case .heads: return “heads" //༗Ճᴍ case tails: return “tails" //ᔒՃᴍ } } } print(Coin.heads) • ҎޙҰఆཁՃ։಄తᴍɼ֬อҰகੑ
SE-0048 Generic typealias typealias StringDic = Dictionary<String, String> let dic:StringDic
= ["key" : "value"] • typealias ሡ။෦ࢧԉ Generic typealias StringDictionary<T> = Dictionary<String, T> typealias DictionaryOfStrings<T : Hashable> = Dictionary<T, String>
SE-0049 ሡ @noescape ᢛ @autoclosure Ҡࢸ type એࠂ • ݱࡏ
func fn(@noescape f : () -> () ) {} func fa(@autoclosure f : () -> () ) {} • ະိ func fn(f : @noescape () -> () ) {} func fa(f : @autoclosure () -> () ) {} • ᬋ inout త䳾㑊
SE-0057 import Obj-C generics • @interface MySet<T : id<NSCopying>> :
NSObject -(MySet<T> *)unionWithSet:(MySet<T> *)otherSet; @end @interface MySomething : NSObject - (MySet<NSValue *> *)valueSet; @end • ။ҝ • class MySet<T : NSCopying> : NSObject { func unionWithSet(otherSet: MySet<T>) -> MySet<T> } class MySomething : NSObject { func valueSet() -> MySet<NSValue> }
Evolution • SE-0062 Obj-C key path syntax • SE-0063 Swift
PM ܥ౷ module search path • SE-0064 ༻ #selector ိࢦ getter & setter • SE-0065 Collections & Indices ৽ܕ • SE-0068 ༻ Self ိऔ dynamicType
SE-0062 Obj-C key path syntax class Person: NSObject { dynamic
var name:String = "" init(name: String){ self.name = name } } let john = Person(name: "John") john.valueForKey("name") //Optional(John) john.valueForKey(#keypath(Person.name)) //Optional(John) • ᩋฤᩄث㢨ᒾҰ༗ᔒ༗ଧࡨࣈ
SE-0063 Swift PM ܥ౷ module search path • લSwift ՄҎ
import C Libraryɼୠੋधཁፙ౸ include 䈕(*.h) Ґஔ • ະိሡՄҎࣗಈᩇऔ .pc 䈕ိፙ౸ include 䈕Ґஔ • ။ࢧԉܥ౷ package manager( Homebrew & Apt)
SE-0064 ༻ #selector ိࢦ getter & setter • #selector ՄҎ༻ိऔ
Obj-C త @selector ɻୠੋ ؐແ๏ࢧԉ getter & setter • ະိՄҎऔಘgetter & setter త selector • let firstNameGetter = #selector(getter: Person.firstName) let firstNameSetter = #selector(setter: Person.firstName)
SE-0065 Collections & Indices ৽ܕ • Collection ඃॏ৽ઃܭɼIndex( ForwardIndex, BidirectionalIndex,
RandomAccessIndex) ඃফ໓ ྃɻ • Index ૬᮫తޭೳ။ඃҠਐ Collection தɻ૾ੋ idx.successor() ။ඃ collection.index(after: idx) औ • ଖଞෆडӨڹ( index(of:), min(), sort() )
SE-0068 ༻ Self ိऔ dynamicType • ݱࡏ Self ᮫伴ࣈੋڅ Protocol
༻త • protocol Copyable { init(copy:Self) } • ະိՄҎࡏ class ཫᙛ self.dynamicType ༻ • struct MyStruct { static func staticMethod() { ... } func instanceMethod() { self.dynamicType.staticMethod() //ݱࡏ Self.staticMethod() //ະိ } }