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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
CSC307 Lecture 07
javiergs
PRO
0
550
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
AI時代の認知負荷との向き合い方
optfit
0
160
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
180
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
740
Architectural Extensions
denyspoltorak
0
290
Oxlint JS plugins
kazupon
1
960
ノイジーネイバー問題を解決する 公平なキューイング
occhi
0
100
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
4
2k
MUSUBIXとは
nahisaho
0
130
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
450
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
650
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
How Software Deployment tools have changed in the past 20 years
geshan
0
32k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
93
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.2k
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Believing is Seeing
oripsolob
1
55
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
1
1.4k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.3k
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 㢨ॿࣗಈɼ