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 11/1
Search
Johnlin
November 01, 2016
Programming
1
89
Swift Weekly 11/1
Johnlin
November 01, 2016
Tweet
Share
More Decks by Johnlin
See All by Johnlin
用 MLIR 實作 一個 Ruby IR (intermediate representation)
johnlinvc
0
120
Unearth Ruby builtin Gems 發掘 Ruby 的內建 Gems
johnlinvc
0
250
Ruby 型別檢查工具簡介
johnlinvc
0
460
Swift Actor 實作探索
johnlinvc
0
160
用 mruby 來寫跨平台工具
johnlinvc
0
71
Actor model 簡介
johnlinvc
0
190
一起玩 Helm 3
johnlinvc
1
110
為什麼 App 卡卡的
johnlinvc
2
1.2k
如何使用 byebug 來除錯 Ruby 程式
johnlinvc
0
200
Other Decks in Programming
See All in Programming
F#で自在につくる静的ブログサイト - 関数型まつり2025
pizzacat83
0
300
XSLTで作るBrainfuck処理系
makki_d
0
200
生成AIで日々のエラー調査を進めたい
yuyaabo
0
570
Cursor AI Agentと伴走する アプリケーションの高速リプレイス
daisuketakeda
1
110
カクヨムAndroidアプリのリブート
numeroanddev
0
420
Practical Tips and Tricks for Working with Compose Multiplatform Previews (mDevCamp 2025)
stewemetal
0
120
セキュリティマネジャー廃止とクラウドネイティブ型サンドボックス活用
kazumura
1
170
Blueskyのプラグインを作ってみた
hakkadaikon
1
550
無関心の谷
kanayannet
0
160
人には人それぞれのサービス層がある
shimabox
3
670
Development of an App for Intuitive AI Learning - Blockly Summit 2025
teba_eleven
0
110
C++20 射影変換
faithandbrave
0
460
Featured
See All Featured
Making the Leap to Tech Lead
cromwellryan
134
9.3k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
43
2.4k
Adopting Sorbet at Scale
ufuk
77
9.4k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
107
19k
Art, The Web, and Tiny UX
lynnandtonic
299
21k
Designing Experiences People Love
moore
142
24k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.3k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
2.8k
Speed Design
sergeychernyshev
31
990
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
48
5.4k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
How to Think Like a Performance Engineer
csswizardry
24
1.7k
Transcript
Swift पใ 11/1 John Lin @johnlinvc
From the core • Swift 3.0.1 GM • ࢧԉߋଟత Ubuntu
൛ຊ • Server API Project
Swift 3.0.1 GM • แؚࡏ Xcode 8.1 㚎 • https://developer.apple.com/library/content/
releasenotes/DeveloperTools/RN-Xcode/ Introduction.html
ࢧԉߋଟత Ubuntu ൛ຊ • աڈࢧԉ • 14.04 • 15.10 •
৽⃧ • 16.04 • 16.10
Server API Project • ਪಈލฏత Server Side ጯ༻ɻ • ሡ࿏҆શ૬᮫త
API Ҡ২౸ Swift ɼ ࠶ෆ༻ґ ↳֎෦త C ఔࣜݿɻ • ෆ။แؚߴ֊త Server ᐽՍɻ • ݱࡏతඪੋݐཱҰݸᘐཱత݅ɼᏈԿ࠶ ܾఆཁෆཁ㚎ݐɻ
Server API workgroup • ֩৺һแؚ Chris Bailey (@seabaylea, IBM Kitura),
Logan Wright (@LoganWright, Vapor), Paulo Faria (@paulofaria, Zewo), Steve Algernon (@salgernon, Apple) • ૬᮫ऀ(stakeholder): ଟਓɼཁᚙPR बՄҎᙛ૬᮫ऀ • ྲྀఔ: API ఏҊ -> ֩৺/૬᮫ऀධ-> Evolution ධ -> ։ᚙ -> ᚙ -> ༻ -> ճᰶ
Evolution • SE-0141 ༻ @available ိඪࣔ Swift ൛ຊ • SE-0142
༻where ိݶ੍ associated types • (佀ճ) SE-0144 Ҹڐ༻ $ ᙛ࡞ identifier
SE-0141 ༻ @available ိඪࣔ Swift ൛ຊ • ݱࡏཁᒾҰ Swift ൛ຊೳ༻
#if swift(>=3.0) Ṝछڊ ूɻ • ະိՄҎ༻ @available(swift 3) ိએࠂՄ༻త swift ൛ ຊɻ • ՄҎ༻ @available(swift, obsoleted: 3.1) ိએࠂະိ ။ኑআɻ • ڊूతࠩҟᴍࡏෆधཁॏ৽ฤᩄɻ
SE-0142 ༻where ိݶ੍ associated types • ՄҎݶ੍ associated type ೭ؒత᮫࿆ੑ
protocol Sequence { associatedtype Iterator : IteratorProtocol associatedtype SubSequence : Sequence where SubSequence.Iterator.Element == Iterator.Element }
(佀ճ) SE-0144 Ҹڐ༻ $ ᙛ࡞ identifier • աڈ༗Ұݸ Bug ੋՄҎ༻ᄸҰݸ
$ ᥒᙛ၏ identifier • ॴҎग़ݱྃҰݸ Lib ڣ၏ dollar ՄҎ၏Ұࠣ Functional తࣄɼ૾ੋ map/reduce • ޙိଞ၇Ṝݸ bug मྃɼୠ༗ਓबෆ։৺ྃ • ࠷ޙେՈܾఆෆೳҝྃҰݸ Lib swift Ꮣಘෳᯑ
Community • ᔟܕ Range ԋࢉ๏ https://oleb.net/blog/2016/10/ generic-range-algorithms/ • TouchBar API
https://developer.apple.com/macos/ touch-bar/
ᔟܕ Range ԋࢉ๏ • Swift 3 ༗ၷछ range • Range
a..<b ෆแؚ b • CloseRange a…b แؚ b • ࡏଞ၇೭ؒෆೳޓ૬
Range 㚎ᬋػᏐࣈ func random(from range: Range<Int>) -> Int { let
distance = range.upperBound - range.lowerBound let rnd = arc4random_uniform(UInt32(distance)) return range.lowerBound + Int(rnd) } let random1 = random(from: 1..<10) let random2 = random(from: 1...10) //error
Range 㚎ᬋػᏐࣈ func random(from range: Range<Int>) -> Int { let
distance = range.upperBound - range.lowerBound let rnd = arc4random_uniform(UInt32(distance)) return range.lowerBound + Int(rnd) } func random(from range: ClosedRange<Int>) -> Int { let distance = range.upperBound - range.lowerBound let rnd = arc4random_uniform(UInt32(distance)) return range.lowerBound + Int(rnd) } let random1 = random(from: 1..<10) let random2 = random(from: 1...10)
Ұݸ๏ extension RandomAccessCollection { func random() -> Iterator.Element? { guard
count > 0 else { return nil } let offset = arc4random_uniform(numericCast(count)) let i = index(startIndex, offsetBy: numericCast(offset)) return self[i] } } (1..<10).random() (1...20).random() ["a","b","c","d"].random()