Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Swift Weekly 2017-05-02
Search
Johnlin
May 02, 2017
Programming
0
46
Swift Weekly 2017-05-02
Johnlin
May 02, 2017
Tweet
Share
More Decks by Johnlin
See All by Johnlin
Unearth Ruby builtin Gems 發掘 Ruby 的內建 Gems
johnlinvc
0
110
Ruby 型別檢查工具簡介
johnlinvc
0
310
Swift Actor 實作探索
johnlinvc
0
130
用 mruby 來寫跨平台工具
johnlinvc
0
49
Actor model 簡介
johnlinvc
0
120
一起玩 Helm 3
johnlinvc
1
82
為什麼 App 卡卡的
johnlinvc
2
1k
如何使用 byebug 來除錯 Ruby 程式
johnlinvc
0
140
Life of a Cell
johnlinvc
0
1.3k
Other Decks in Programming
See All in Programming
#phpcon_odawara オープン・クローズドなテストフィクスチャを求めて / open closed test fixtures
77web
3
230
Behind VS Code Extensions for JavaScript / TypeScript Linnting and Formatting
unvalley
5
900
Elm 0.19.0 Changes
bkuhlmann
0
490
Rethinking UI building strategies @ SFI 2024
letelete
0
270
Anthropic Cookbook のおすすめレシピ
schroneko
7
870
Designing for tomorrow's programming workflows
honnibal
PRO
2
120
GitHub Copilotのススメ
marcy731
1
200
Ruby GitHub Packages
bkuhlmann
0
630
MetricKitで予期せぬ終了を検知する話 / Detect unexpected termination with MetricKit
nekowen
1
180
Site Reliability Engineering for GMO
pyama86
7
1k
新宿ダンジョンを可視化してみた
satoshi7190
2
240
雑に思考を整理する技術と効能
konifar
58
29k
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
92
4.8k
Atom: Resistance is Futile
akmur
259
25k
Debugging Ruby Performance
tmm1
70
11k
Being A Developer After 40
akosma
57
580k
It's Worth the Effort
3n
180
27k
Designing for Performance
lara
601
67k
Code Reviewing Like a Champion
maltzj
514
39k
Six Lessons from altMBA
skipperchong
21
3k
Rebuilding a faster, lazier Slack
samanthasiow
73
8.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
9
8.3k
Teambox: Starting and Learning
jrom
128
8.4k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
19
1.7k
Transcript
Swift पใ 2017/05/02 John Lin @johnlinvc
From the core • ABI ᜦఆੑّද൘ • ఔࣜᛰ૬༰ੑଌࢼܥ౷
ABI ᜦఆੑّද൘ • ABI ᜦఆදෆಉ൛ຊSwift ฤᩄग़ိతവࣜݿ (.dylib/.framework) ՄҎޓ૬૬༰ɻલؐෆߦɻ • ّද൛ྻग़ୡ
ABI ᜦఆؐधཁ၏తमվɼؐ༗ଞ ၇ݱࡏత㐫گɻ
ఔࣜᛰ૬༰ੑଌࢼܥ౷ • Swift 4 తඪ೭Ұੋཁࡏ Swift 3 ࣜԼԼ૬༰ɼ बੋ㘸Swift 3
తఔࣜᛰෆ༻मվबೳ᠃༻ɻ • ҝྃ֬อԼ૬༰తᜦఆੑɼCI ܥ౷။ࣗಈଌࢼ֤ വࣜݿత૬༰ੑɼแؚ Realm, Alamofire, Perfect, vapor ɻ
Evolution • SE-0155 Enum case දࣔ๏ਖ਼نԽ • SE-0161 ߋతKey Value
Coding • SE-0162 ݅ཧث٬੍Խࢿྉᇄ݁ߏ • SE-0163 վྑࣈ۲ɿࢧԉCollection, C ૬༰ੑ • SE-0164 Protocol extension ෆೳ༻ final
SE-0155 Enum case දࣔ๏ਖ਼ن Խ • ݱࡏ Enum એࠂత case
ଖመੋ༻ᔒ༗ඪតతTuple መ࡞తɼ೭ޙ။վҰൠత class Ұᒬɻ • ॴҎ೭ޙ Enum ՄҎ༗༬ઃᆴɼؐ༗ಉҰݸ ໊ ୠෆಉඪតత൛ຊɻ • ୠੋჩᏐత Void ཁଧग़ိɻ
SE-0155 Enum case දࣔ๏ਖ਼ن Խ
SE-0155 Enum case දࣔ๏ਖ਼ن Խ • ݱࡏ
ະိ
SE-0161 ߋతKey Value Coding • ݱࡏత key value coding ੋ༻
#keypath() ိදࣔɼ جຊबੋᱛᨽաతࣈ۲ɻ༗NSObject ࠽ೳ༻ • ৽⃧Ұݸ \.<path> తදࣔ๏ɼ [keyPath: ] ༻ɻ
SE-0161 ߋతKey Value Coding
SE-0161 ߋతKey Value Coding
SE-0161 ߋతKey Value Coding
SE-0162 ݅ཧث٬੍Խࢿྉ ᇄ݁ߏ • ݱࡏ݅ཧث༻༬ઃత࿏ኸိཧ䈕Ҋɼ Sources ब์ఔࣜᛰɼTests ब์ଌࢼɻ • ሢҊҰେब༻ɻ
• ະိॴ༗ඪతࢿྉᇄඞध໌֬ྻग़ိ
SE-0162 ݅ཧث٬੍Խࢿྉ ᇄ݁ߏ
SE-0163 վྑࣈ۲ɿࢧԉ Collection, C ૬༰ੑ • Swift 2 ࣈ۲ᙛ collection
༻ޭೳ፤ᎃྃɼSwift 4 ။Ճ ճိʂ • ။৽⃧Ұݸ Substring Type ိଘաతࣈ۲ɼෆաෆݐ ٞ༻ိظṶଘɼ༰қ٣ଠଟهԱᱪɻ • ৽⃧Ұݸ Unicode protocol ိᙛ၏ String Substring తجఈɼํศ၏ᔟܕ • ৽⃧زݸኺC ࣈ۲ Swift ࣈ۲తവᏐ
SE-0164 Protocol extension ෆೳ༻ final • Protocol extension ຊိबෆೳඃվሜɼ༗ᔒ༗Ճ final
Ұᒬɻ • ೭ޙՃྃ final ब။༗ࡨޡɼෆա։ swift 3 ࣜత ။༗ܯࠂɻ
Evolution • SE-0165 Ճڧ Dictionary Set • SE-0166 ෧ଘᢛংྻԽ
• SE-0167 ฤᛰث • SE-0168 ଟߦᏐతࣈ۲
SE-0165 Ճڧ Dictionary Set • Dictionary Set ༻ىိෆⴺ༻ɼڧԽྃԼ໘زᴍ
• ኺ Array 㗞ੜ Dictionaryɼ߹ซ Dictionary • औᆴ࣌ՌKey ෆଘࡏՄҎڅ༬ઃᆴ • Dictionary Set త map & filter • ՄҎ౸ Dictionary Set త༰ྔ • ՄҎሣ Array ၏ group by
SE-0165 Ճڧ Dictionary Set • ኺ Array 㗞ੜ Dictionary
• ݱࡏೳखಈ Array Dictionary ɼ೭ޙՄҎࣗ ಈ tuple array Dictionary
SE-0165 Ճڧ Dictionary Set • ߹ซDictionary • ݱࡏೳखಈҰݸҰݸᆴ߹ซɼ೭ޙཁఏڙҰݸ ղܾ
key ॏෳత closure बՄҎࣗಈ߹ซ
SE-0165 Ճڧ Dictionary Set • ᩇሜᆴℭೂݔKey ෆଘࡏՄҎڅ༬ઃᆴ • ݱࡏೳखಈऔҰ࣍ੋෆੋnil,
ੋత࠶څ༬ઃ ᆴɻ೭ޙՄҎࡏsubscript ఏڙ༬ઃᆴɻ
SE-0165 Ճڧ Dictionary Set • Dictionary త mapValues •
ݱࡏೳmap೭ޙ࠶खಈݐཱҰ࣍ Dictionaryɻ೭ ޙՄҎሣValue ၏ mapɻ
SE-0165 Ճڧ Dictionary Set • Dictionary Set త
filter • ݱࡏೳfilter ೭ޙ࠶खಈݐཱҰ࣍ Dictionaryɻ೭ ޙՄҎ၏ filter ɼ။ճၚҰݸ Dictionaryɻ
SE-0165 Ճڧ Dictionary Set • ՄҎ౸ Dictionary Set
త༰ྔ • ՄҎखಈ⃧Ճ༰ྔ
SE-0165 Ճڧ Dictionary Set • ՄҎሣ Array ၏ group
by
SE-0166 ෧ଘᢛংྻԽ • ݱࡏೳᯪ NSCoder ိ၏ংྻԽɼॴҎ Struct Enum ෆೳඃংྻԽɻ
• ။৽⃧ Encoder, Decoder, Encodable Decodable protocolိ႔ཧংྻԽɼࢧԉ Class, Struct Enum • ؐ༗ Codable protocol දՄҎग़ڈ࠶ճိ
SE-0166 ෧ଘᢛংྻԽ
SE-0167 ฤᛰث • ఏڙၷछংྻԽతฤᛰثɼ json plist • 㚎ݐతdata type
collection type ՄҎඃࣗಈ • ؐ༗Ұථ Foundation త class แؚ Date, URL • Codable ။ NSKeyed[Un]Archiver ૬༰
SE-0168 ଟߦᏐతࣈ۲ • ࢧԉލߦతࣈ۲ɼ Python Ұᒬ༻ࡾݸძҾᥒိᙛ ։಄݁ඌ • ။Ҏ݁ඌతॖഉҝج४ɼࣗಈᎃ㑌Ұߦ։಄తۭനɻ
SE-0168 ଟߦᏐతࣈ۲
Evolution • SE-0169 ༏Խ private extension ೭ؒత᮫ • SE-0170
NSNumber ڮվળ • SE-0171 ༻ inout ိ reduce • SE-0172 ༗Ұᬑత Range • SE-0173 ৽⃧ MutableCollection.swapAt(_:_:)
SE-0169 ༏Խ private extension ೭ؒత᮫ • ݱࡏprivate member ༗ࡏఆٛతׅᥒൣᅴ㚎࠽ೳ
ଘऔɼಉҰݸ䈕Ҋ㚎ෆߦɼཁվ༻fileprivate • େՈتᓣ༻extension ိఆٛfunctionɼଟ ෆඞཁత fileprivate • ೭ޙಉҰݸ䈕Ҋ㚎త extension ՄҎଘऔ private member
SE-0170 NSNumber ڮվળ • ݱࡏNSNumber Swift త༗ᴍոոత
SE-0170 NSNumber ڮվળ • ্໘తᆴੋ -1 (0x11111111) • ೭ޙ༻ as?
࣌။ߟྔඪతେখɼݱ༗తኺ NSNumber աိతํ๏။ၷݸ
SE-0171 ༻ inout ိ reduce • ။৽⃧Ұݸ Sequence#reduce(into:_) ိ၏ in-place
త reduceɼ䋯ಘൺֱշ • ෆoverload ݱ༗తreduce, Ҽҝ type checker ။่ ௵
SE-0172 ༗Ұᬑత Range • ݱࡏ • ະိ
SE-0173 ৽⃧ MutableCollection.swapAt(_:_:) • ݱ༗త swap ༗ၷݸ inout ჩᏐɼᔒ༗ූ߹ Ownership
తنଇ • ৽⃧Ұݸ༻index ိަత swapAt(indexA, indexB)