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
130
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
300
Unearth Ruby builtin Gems 發掘 Ruby 的內建 Gems
johnlinvc
0
390
Ruby 型別檢查工具簡介
johnlinvc
0
620
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
AI がコードを書く時代における新卒エンジニアの仕事風景 (2026) / New Graduate Engineers in the Era of AI Coding (2026)
sushichan044
0
220
なぜ関数型プログラミングで「型」と「証明」が語られるのか #fp_matsuri
kajitack
3
990
LaravelLive Japan の裏方のすべて — 第188回 PHP勉強会@東京 (2026-06-24)
suguruooki
2
150
Honoでのサプライチェーン侵害対策 〜 3つのライブラリに学ぶ
yusukebe
7
1.9k
AI駆動開発を妨げる技術的負債の解消アプローチ / ai-refactoring-approach
minodriven
17
9.2k
AI時代、エンジニアはどう育つのか -未経験エンジニアの成長を間近で見て考えたこと-
thasu0123
0
140
才能?センス?知らん、 続けたもん勝ちだ。-- 結婚・出産・癌を越えてなお、私がプロダクトを創り続ける理由
16bitidol
2
880
エンジニアにデザインハーネスを 〜デザインプロセスを規定するためのハーネス〜 / Design harness from an engineer's perspective
rkaga
2
1.6k
SREの積み重ねがAI駆動開発のガードレールになった ― 7つの実践/SRE Guardrails The 7
tomoyakitaura
8
4.8k
act1-costs.pdf
sumedhbala
0
240
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
1
200
PHP Application における Kubernetes 内 gRPC 通信
ganchiku
0
510
Featured
See All Featured
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
970
Balancing Empowerment & Direction
lara
6
1.2k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.4k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
550
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.2k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
420
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
330
AI: The stuff that nobody shows you
jnunemaker
PRO
9
840
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.8k
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() //ະိ } }