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
92
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
130
Unearth Ruby builtin Gems 發掘 Ruby 的內建 Gems
johnlinvc
0
260
Ruby 型別檢查工具簡介
johnlinvc
0
460
Swift Actor 實作探索
johnlinvc
0
160
用 mruby 來寫跨平台工具
johnlinvc
0
75
Actor model 簡介
johnlinvc
0
190
一起玩 Helm 3
johnlinvc
1
120
為什麼 App 卡卡的
johnlinvc
2
1.2k
如何使用 byebug 來除錯 Ruby 程式
johnlinvc
0
200
Other Decks in Programming
See All in Programming
型付きアクターモデルがもたらす分散シミュレーションの未来
piyo7
0
810
地方に住むエンジニアの残酷な現実とキャリア論
ichimichi
5
1.4k
Bytecode Manipulation 으로 생산성 높이기
bigstark
2
390
AIプログラマーDevinは PHPerの夢を見るか?
shinyasaita
1
170
Deep Dive into ~/.claude/projects
hiragram
10
2k
明示と暗黙 ー PHPとGoの インターフェイスの違いを知る
shimabox
2
380
Kotlin エンジニアへ送る:Swift 案件に参加させられる日に備えて~似てるけど色々違う Swift の仕様 / from Kotlin to Swift
lovee
1
260
Team operations that are not burdened by SRE
kazatohiei
1
270
アンドパッドの Go 勉強会「 gopher 会」とその内容の紹介
andpad
0
280
DroidKnights 2025 - 다양한 스크롤 뷰에서의 영상 재생
gaeun5744
3
330
WebViewの現在地 - SwiftUI時代のWebKit - / The Current State Of WebView
marcy731
0
100
CursorはMCPを使った方が良いぞ
taigakono
1
200
Featured
See All Featured
KATA
mclloyd
30
14k
Why Our Code Smells
bkeepers
PRO
337
57k
Thoughts on Productivity
jonyablonski
69
4.7k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
A Modern Web Designer's Workflow
chriscoyier
694
190k
Music & Morning Musume
bryan
46
6.6k
Bash Introduction
62gerente
614
210k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Measuring & Analyzing Core Web Vitals
bluesmoon
7
490
Building Flexible Design Systems
yeseniaperezcruz
328
39k
[RailsConf 2023] Rails as a piece of cake
palkan
55
5.6k
Git: the NoSQL Database
bkeepers
PRO
430
65k
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()