Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
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
340
Unearth Ruby builtin Gems 發掘 Ruby 的內建 Gems
johnlinvc
0
420
Ruby 型別檢查工具簡介
johnlinvc
0
640
Swift Actor 實作探索
johnlinvc
0
210
用 mruby 來寫跨平台工具
johnlinvc
0
130
Actor model 簡介
johnlinvc
0
250
一起玩 Helm 3
johnlinvc
1
170
為什麼 App 卡卡的
johnlinvc
2
1.3k
如何使用 byebug 來除錯 Ruby 程式
johnlinvc
0
280
Other Decks in Programming
See All in Programming
WebMCP Challenge に星空観察アプリで参加した話
okajun35
0
180
setup-vp GitLab対応の裏側
naokihaba
0
100
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
9
4.6k
Webの地図
yosuke_furukawa
PRO
6
4.5k
A2UI for Android: Safely Rendering AI-Generated UI with Jetpack Compose - DroidKaigi 2026
itsmedreamwalker
0
140
XHTMLが残したもの
yosuke_furukawa
PRO
2
810
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
280
{ Android | Kotlin } Gradle Plugin in 2026
ryunen344
1
320
Are APIs Still Relevant in the AI Era?
soyuka
0
230
Vue Fes Japan 2026 タイムテーブル徹底解説
448jp
1
210
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
410
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
0
150
Featured
See All Featured
HDC tutorial
michielstock
2
870
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
57k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
540
Test your architecture with Archunit
thirion
2
2.4k
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
How to Talk to Developers About Accessibility
jct
2
550
YesSQL, Process and Tooling at Scale
rocio
174
15k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Six Lessons from altMBA
skipperchong
29
4.5k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
420
Joys of Absence: A Defence of Solitary Play
codingconduct
1
520
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() //ະိ } }