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
220
Unearth Ruby builtin Gems 發掘 Ruby 的內建 Gems
johnlinvc
0
320
Ruby 型別檢查工具簡介
johnlinvc
0
540
Swift Actor 實作探索
johnlinvc
0
180
用 mruby 來寫跨平台工具
johnlinvc
0
100
Actor model 簡介
johnlinvc
0
220
一起玩 Helm 3
johnlinvc
1
140
為什麼 App 卡卡的
johnlinvc
2
1.2k
如何使用 byebug 來除錯 Ruby 程式
johnlinvc
0
230
Other Decks in Programming
See All in Programming
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
270
AgentCoreとHuman in the Loop
har1101
5
240
Rust 製のコードエディタ “Zed” を使ってみた
nearme_tech
PRO
0
180
例外処理とどう使い分ける?Result型を使ったエラー設計 #burikaigi
kajitack
16
6.1k
Fragmented Architectures
denyspoltorak
0
160
QAフローを最適化し、品質水準を満たしながらリリースまでの期間を最短化する #RSGT2026
shibayu36
2
4.4k
humanlayerのブログから学ぶ、良いCLAUDE.mdの書き方
tsukamoto1783
0
200
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
1.2k
HTTPプロトコル正しく理解していますか? 〜かわいい猫と共に学ぼう。ฅ^•ω•^ฅ ニャ〜
hekuchan
2
690
Data-Centric Kaggle
isax1015
2
780
カスタマーサクセス業務を変革したヘルススコアの実現と学び
_hummer0724
0
710
KIKI_MBSD Cybersecurity Challenges 2025
ikema
0
1.3k
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
A Tale of Four Properties
chriscoyier
162
24k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
640
What's in a price? How to price your products and services
michaelherold
247
13k
How to Think Like a Performance Engineer
csswizardry
28
2.4k
How to make the Groovebox
asonas
2
1.9k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
120
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
420
How Software Deployment tools have changed in the past 20 years
geshan
0
32k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
93
Into the Great Unknown - MozCon
thekraken
40
2.3k
Odyssey Design
rkendrick25
PRO
1
500
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 㢨ॿࣗಈɼ