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-04-11
Search
Johnlin
April 11, 2017
Programming
0
110
Swift Weekly 2017-04-11
Johnlin
April 11, 2017
Tweet
Share
More Decks by Johnlin
See All by Johnlin
用 MLIR 實作 一個 Ruby IR (intermediate representation)
johnlinvc
0
150
Unearth Ruby builtin Gems 發掘 Ruby 的內建 Gems
johnlinvc
0
270
Ruby 型別檢查工具簡介
johnlinvc
0
490
Swift Actor 實作探索
johnlinvc
0
160
用 mruby 來寫跨平台工具
johnlinvc
0
82
Actor model 簡介
johnlinvc
0
190
一起玩 Helm 3
johnlinvc
1
120
為什麼 App 卡卡的
johnlinvc
2
1.2k
如何使用 byebug 來除錯 Ruby 程式
johnlinvc
0
210
Other Decks in Programming
See All in Programming
AIと私たちの学習の変化を考える - Claude Codeの学習モードを例に
azukiazusa1
10
3.9k
為你自己學 Python - 冷知識篇
eddie
1
350
Updates on MLS on Ruby (and maybe more)
sylph01
1
180
AIコーディングAgentとの向き合い方
eycjur
0
270
実用的なGOCACHEPROG実装をするために / golang.tokyo #40
mazrean
1
270
Kiroで始めるAI-DLC
kaonash
2
580
Oracle Database Technology Night 92 Database Connection control FAN-AC
oracle4engineer
PRO
1
440
Swift Updates - Learn Languages 2025
koher
2
470
旅行プランAIエージェント開発の裏側
ippo012
2
900
もうちょっといいRubyプロファイラを作りたい (2025)
osyoyu
1
430
Laravel Boost 超入門
fire_arlo
3
210
testingを眺める
matumoto
1
140
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
YesSQL, Process and Tooling at Scale
rocio
173
14k
Faster Mobile Websites
deanohume
309
31k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.5k
Typedesign – Prime Four
hannesfritz
42
2.8k
Raft: Consensus for Rubyists
vanstee
140
7.1k
Facilitating Awesome Meetings
lara
55
6.5k
Intergalactic Javascript Robots from Outer Space
tanoku
272
27k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
8
520
Transcript
Swift पใ 2017/04/11 John Lin @johnlinvc
From the core • Xcode 8.3 & Swift 3.1
Xcode 8.3 & Swift 3.1 • Swift 3.1 Լࢧԉ Swift
3.0 ఔࣜᛰ • ৽⃧ྃڐଟ৽ޭೳ • ཁঋڃܥ౷౸ Sierra ࠽ೳ Xcode 8.3
Xcode 8.3 & Swift 3.1 • Sequence ৽⃧ྃ drop(while:) &
prefix(while:) • @available(swift, obsoleted: 3.1) • Int(exactly: 3.14) • ݅ཧث။ࣗಈ㗞ੜ Package.pins ိه㑚መࡍ ༻త൛ຊ
Xcode 8.3 & Swift 3.1 • ެࠂ্ᔒሜత৽ޭೳ, ՄҎሣextension ࢦఆ associated
type • 1> extension Array where Element == Int { 2. var sum: Int { 3. return self.reduce(0){$0 + $1} 4. } 5. } 6> [1,2,3].sum $R0: Int = 6
Evolution • SE-0104 Ꮠ Protocol • SE-0156 Class existential •
SE-0157 ᬇ associated type • SE-0158 Swift ݅ཧثඳड़䈕֨ࣜमվ
SE-0104 Ꮠ Protocol • ᩋෆಉେখతIntɼൺํ㘸 Int8 Int32 ՄҎޓ૬ൺ େখ
• ୠੋؐෆೳᩋෆಉେখతIntɼൺํ㘸 Int8 Int32 Ұى၏Ճݮငআ
SE-0156 Class existential • ݱࡏՄҎࢦఆҰݸ݅ූ߹ଟݸProtocol • ະိ။ Obj-C ҰᒬؐՄҎࢦఆBase Class
• ෆաᷮݶԙ Class, ෆೳࢦఆBase Structɻ
SE-0156 Class existential • protocol ။ڣ{} protocol ။ಈ{} class ಈ
: ။ಈ {} class יࢠ : ಈ, ။ڣ {} class ӊᴰ : ಈ {} class ి෩ઔ : ။ಈ, ။ڣ {} • let : ಈ & ။ڣ & ။ಈ = יࢠ() //OK let : ಈ & ။ڣ & ။ಈ = ӊᴰ() //X ӊᴰෆ။ڣ let : ಈ & ။ڣ & ။ಈ = ి෩ઔ() //X ి෩ઔෆੋಈ
SE-0157 ᬇ associated type • ݱࡏత protocol తՄҎࢦఆ associated type
త protocol protocol Tree { associatedtype Subtree:Hashable } • ୠੋෆೳࢦఆࣗݾ
SE-0157 ᬇ associated type • ೭ޙprotocol ՄҎࢦఆ associated type ੋࣗݾɻ
• ။༻Ṝݸ৽ޠ๏ိվඪ४വࣜݿɼൺํ㘸 Collection త Subsequence ཁੋ Collectionɼؐඞਢཁ༗Ұ ᒬత Indexɻ
SE-0158 Swift ݅ཧثඳड़ 䈕֨ࣜमվ • վྃҰࠣେখሜɻ • Dependency తሜ๏Ꮣྃɻ༬ઃతঋڃൣᅴᏓኍྃɼ رେՈೳଟঋڃ
SE-0158 Swift ݅ཧثඳड़ 䈕֨ࣜमվ • //1.x.x ൛ՄҎ ݱࡏ: .Package(url: "/SwiftyJSON",
majorVersion: 1) ະိ: .package(url: "/SwiftyJSON", from: "1.0.0") ҃ੋ .package(url: "/SwiftyJSON", .upToNextMajor(from: "1.0.0"))
SE-0158 Swift ݅ཧثඳड़ 䈕֨ࣜमվ • //1.1.x ൛ՄҎ ݱࡏ: .Package(url: "/SwiftyJSON",
majorVersion: 1, minorVersion: 1) ະိ: .package(url: "/ SwiftyJSON", .upToNextMinor(from: "1.1.0"))
SE-0158 Swift ݅ཧثඳड़ 䈕֨ࣜमվ • .package(url: "/SwiftyJSON", .exact("1.1.6")) //ೳ ༻
1.1.6 ൛ • .package(url: "/SwiftyJSON", "1.2.3"..<"1.2.6"), // 1.2.3 ൛ ౸ 1.2.6 ೭ؒՄҎɼෆแؚ 1.2.6 • .package(url: "/SwiftyJSON", "1.2.3"..."1.2.6"), //1.2.3 ൛ ౸ 1.2.6 ೭ؒՄҎɼแؚ 1.2.6
SE-0158 Swift ݅ཧثඳड़ 䈕֨ࣜमվ • .package(url: "/SwiftyJSON", .branch("develop")) // ༻
develop branch • .package(url: "/ SwiftyJSON", .revision("e74b07278b926c9ec6f9643 455ea00d1ce04a021")) //༻ಛఆ commit
Evolution • SE-0160 䫐ݶᯅత @objc ඪḼ
SE-0160 䫐ݶᯅత @objc ඪḼ • ݱࡏཁ class ঝ NSObject ɼԼ໘త
method ब ။ࣗಈ㚎ݐ @objc • ະိཁࣗݾखଧ @objc
SE-0160 䫐ݶᯅత @objc ඪḼ • dynamic ཁखଧ @objc
SE-0160 䫐ݶᯅత @objc ඪḼ • 㑌ݸखଧྦྷతՄҎ༻ @objcMembers ိᩋ class ཫతMethod
༗ @objc
SE-0160 䫐ݶᯅత @objc ඪḼ • େ෦త @objc ཁࣗݾଧɼୠؐੋ༗Ұࠣ။㚎ݐ @objc తྫ֎
• override method • መ࡞ @objc త protocol ࣌ • @IBOutlet @IBAction @NSManaged
SE-0160 䫐ݶᯅత @objc ඪḼ • Ṝࠣ။ࡏ Swift 4.0 త࣌ީመɻ •
။Լ૬༰ • ฤᩄత࣌ީબ swift 3 ࣜबՄҎෆ༻ଧɼୠੋ။༗ warning ܯࠂ೭ޙෆೳ༻ɼؐ༗fixit 㢨ॿࣗಈɼ