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
100
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
49
Unearth Ruby builtin Gems 發掘 Ruby 的內建 Gems
johnlinvc
0
200
Ruby 型別檢查工具簡介
johnlinvc
0
400
Swift Actor 實作探索
johnlinvc
0
130
用 mruby 來寫跨平台工具
johnlinvc
0
56
Actor model 簡介
johnlinvc
0
160
一起玩 Helm 3
johnlinvc
1
100
為什麼 App 卡卡的
johnlinvc
2
1.1k
如何使用 byebug 來除錯 Ruby 程式
johnlinvc
0
160
Other Decks in Programming
See All in Programming
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
230
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
520
as(型アサーション)を書く前にできること
marokanatani
10
2.6k
受け取る人から提供する人になるということ
little_rubyist
0
230
Contemporary Test Cases
maaretp
0
140
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
Jakarta EE meets AI
ivargrimstad
0
610
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
170
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
cmp.Or に感動した
otakakot
2
150
色々なIaCツールを実際に触って比較してみる
iriikeita
0
330
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
210
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Happy Clients
brianwarren
98
6.7k
KATA
mclloyd
29
14k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Side Projects
sachag
452
42k
Agile that works and the tools we love
rasmusluckow
327
21k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
Faster Mobile Websites
deanohume
305
30k
Unsuck your backbone
ammeep
668
57k
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 㢨ॿࣗಈɼ