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
93
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
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
Compose Multiplatform × AI で作る、次世代アプリ開発支援ツールの設計と実装
thagikura
0
150
意外と簡単!?フロントエンドでパスキー認証を実現する WebAuthn
teamlab
PRO
2
750
Cache Me If You Can
ryunen344
2
730
テストカバレッジ100%を10年続けて得られた学びと品質
mottyzzz
2
590
MCPでVibe Working。そして、結局はContext Eng(略)/ Working with Vibe on MCP And Context Eng
rkaga
5
2.3k
Flutter with Dart MCP: All You Need - 박제창 2025 I/O Extended Busan
itsmedreamwalker
0
150
testingを眺める
matumoto
1
140
1から理解するWeb Push
dora1998
7
1.9k
今から始めるClaude Code入門〜AIコーディングエージェントの歴史と導入〜
nokomoro3
0
150
パッケージ設計の黒魔術/Kyoto.go#63
lufia
3
440
[FEConf 2025] 모노레포 절망편, 14개 레포로 부활하기까지 걸린 1년
mmmaxkim
0
1.6k
知っているようで知らない"rails new"の世界 / The World of "rails new" You Think You Know but Don't
luccafort
PRO
1
150
Featured
See All Featured
Making the Leap to Tech Lead
cromwellryan
135
9.5k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Build The Right Thing And Hit Your Dates
maggiecrowley
37
2.9k
How STYLIGHT went responsive
nonsquared
100
5.8k
Intergalactic Javascript Robots from Outer Space
tanoku
272
27k
Agile that works and the tools we love
rasmusluckow
330
21k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
18
1.1k
Designing Experiences People Love
moore
142
24k
Git: the NoSQL Database
bkeepers
PRO
431
66k
Practical Orchestrator
shlominoach
190
11k
How to train your dragon (web standard)
notwaldorf
96
6.2k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.1k
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()