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 週報 5/3
Search
Johnlin
May 03, 2016
Programming
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Swift 週報 5/3
Swift 週報 5/3
Johnlin
May 03, 2016
More Decks by Johnlin
See All by Johnlin
用 MLIR 實作 一個 Ruby IR (intermediate representation)
johnlinvc
0
290
Unearth Ruby builtin Gems 發掘 Ruby 的內建 Gems
johnlinvc
0
370
Ruby 型別檢查工具簡介
johnlinvc
0
610
Swift Actor 實作探索
johnlinvc
0
200
用 mruby 來寫跨平台工具
johnlinvc
0
120
Actor model 簡介
johnlinvc
0
240
一起玩 Helm 3
johnlinvc
1
160
為什麼 App 卡卡的
johnlinvc
2
1.3k
如何使用 byebug 來除錯 Ruby 程式
johnlinvc
0
260
Other Decks in Programming
See All in Programming
作って学ぶ、 JSX (TSX) ランタイムの基本
syumai
7
1.6k
Signal Forms: Beyond the Basics @ngBaguette 2026 in Paris
manfredsteyer
PRO
0
240
Skillsは効率化、Agentsは"自分の拡張"——Builder時代のエージェント編成(CC Night 2026)
wemra
1
120
AI時代のUIはどこへ行く?その2!
yusukebe
21
7.1k
「なぜそう決めたのか」を残し続ける仕組み ― Notion AI カスタムエージェント × Slack連携による設計判断の自動記録 - NIKKEI Tech Talk #47
niftycorp
PRO
0
140
Claspは野良GASの夢をみるか
takter00
0
190
技術記事、AIに書かせるか、自分で書くか? 〜それでも私が自分の手で書く理由〜 / #QiitaConference
jnchito
2
1.4k
AIとASP.NET Coreで雑Webアプリを作った話
mayuki
0
510
AIで効率化できた業務・日常
ochtum
0
130
AI 時代のソフトウェア設計の学び方
masuda220
PRO
29
12k
Technical Debt: Understanding it Rightly, Engaging it Rightly #LaravelLiveJP
shogogg
0
220
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
540
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
3.4k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
540
KATA
mclloyd
PRO
35
15k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
570
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
580
Designing for humans not robots
tammielis
254
26k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4k
The Pragmatic Product Professional
lauravandoore
37
7.3k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
330
Transcript
Swift पใ 5/3 John Lin @johnlinvc
From the core • ෦ deprecation ܯࠂঋڃࡨޡ
෦ deprecation ܯࠂঋڃࡨ ޡ print(__FILE__) @warn_unused_result(message="oh no") func F1() ->
Int{ return 42 } for var a = 0; a < 3; a+=1 { a } • Ṝࠣࡏ։ᚙ൛తswift ቮៃኺܯࠂঋڃࡨޡɻҎޙ။࿈compile ෆߦɻ
Evolution • SE-0036 Enum ҰఆཁՃ։಄తᴍ • SE-0048 Generic typealias •
SE-0049 ሡ @noescape ᢛ @autoclosure Ҡࢸ type એࠂ • SE-0057 import Obj-C generics
SE-0036 Enum ҰఆཁՃ։಄త ᴍ enum Coin : CustomStringConvertible { case
heads, tails var description: String { switch self { case .heads: return “heads" //༗Ճᴍ case tails: return “tails" //ᔒՃᴍ } } } print(Coin.heads) • ҎޙҰఆཁՃ։಄తᴍɼ֬อҰகੑ
SE-0048 Generic typealias typealias StringDic = Dictionary<String, String> let dic:StringDic
= ["key" : "value"] • typealias ሡ။෦ࢧԉ Generic typealias StringDictionary<T> = Dictionary<String, T> typealias DictionaryOfStrings<T : Hashable> = Dictionary<T, String>
SE-0049 ሡ @noescape ᢛ @autoclosure Ҡࢸ type એࠂ • ݱࡏ
func fn(@noescape f : () -> () ) {} func fa(@autoclosure f : () -> () ) {} • ະိ func fn(f : @noescape () -> () ) {} func fa(f : @autoclosure () -> () ) {} • ᬋ inout త䳾㑊
SE-0057 import Obj-C generics • @interface MySet<T : id<NSCopying>> :
NSObject -(MySet<T> *)unionWithSet:(MySet<T> *)otherSet; @end @interface MySomething : NSObject - (MySet<NSValue *> *)valueSet; @end • ။ҝ • class MySet<T : NSCopying> : NSObject { func unionWithSet(otherSet: MySet<T>) -> MySet<T> } class MySomething : NSObject { func valueSet() -> MySet<NSValue> }
Evolution • SE-0062 Obj-C key path syntax • SE-0063 Swift
PM ܥ౷ module search path • SE-0064 ༻ #selector ိࢦ getter & setter • SE-0065 Collections & Indices ৽ܕ • SE-0068 ༻ Self ိऔ dynamicType
SE-0062 Obj-C key path syntax class Person: NSObject { dynamic
var name:String = "" init(name: String){ self.name = name } } let john = Person(name: "John") john.valueForKey("name") //Optional(John) john.valueForKey(#keypath(Person.name)) //Optional(John) • ᩋฤᩄث㢨ᒾҰ༗ᔒ༗ଧࡨࣈ
SE-0063 Swift PM ܥ౷ module search path • લSwift ՄҎ
import C Libraryɼୠੋधཁፙ౸ include 䈕(*.h) Ґஔ • ະိሡՄҎࣗಈᩇऔ .pc 䈕ိፙ౸ include 䈕Ґஔ • ။ࢧԉܥ౷ package manager( Homebrew & Apt)
SE-0064 ༻ #selector ိࢦ getter & setter • #selector ՄҎ༻ိऔ
Obj-C త @selector ɻୠੋ ؐແ๏ࢧԉ getter & setter • ະိՄҎऔಘgetter & setter త selector • let firstNameGetter = #selector(getter: Person.firstName) let firstNameSetter = #selector(setter: Person.firstName)
SE-0065 Collections & Indices ৽ܕ • Collection ඃॏ৽ઃܭɼIndex( ForwardIndex, BidirectionalIndex,
RandomAccessIndex) ඃফ໓ ྃɻ • Index ૬᮫తޭೳ။ඃҠਐ Collection தɻ૾ੋ idx.successor() ။ඃ collection.index(after: idx) औ • ଖଞෆडӨڹ( index(of:), min(), sort() )
SE-0068 ༻ Self ိऔ dynamicType • ݱࡏ Self ᮫伴ࣈੋڅ Protocol
༻త • protocol Copyable { init(copy:Self) } • ະိՄҎࡏ class ཫᙛ self.dynamicType ༻ • struct MyStruct { static func staticMethod() { ... } func instanceMethod() { self.dynamicType.staticMethod() //ݱࡏ Self.staticMethod() //ະိ } }