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 周報 4/12
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Johnlin
April 12, 2016
Programming
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Swift 周報 4/12
Swift 周報 4/12
Johnlin
April 12, 2016
More Decks by Johnlin
See All by Johnlin
用 MLIR 實作 一個 Ruby IR (intermediate representation)
johnlinvc
0
390
Unearth Ruby builtin Gems 發掘 Ruby 的內建 Gems
johnlinvc
0
490
Ruby 型別檢查工具簡介
johnlinvc
0
700
Swift Actor 實作探索
johnlinvc
0
230
用 mruby 來寫跨平台工具
johnlinvc
0
150
Actor model 簡介
johnlinvc
0
280
一起玩 Helm 3
johnlinvc
1
200
為什麼 App 卡卡的
johnlinvc
2
1.4k
如何使用 byebug 來除錯 Ruby 程式
johnlinvc
0
300
Other Decks in Programming
See All in Programming
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
120
re:Inventに行く前に知っておきたい現地参加のノウハウ
nokomoro3
0
420
TechTown - Creating Composable Callables in Contemporary C++
rollbear
0
130
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
1k
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
0
880
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
270
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
140
[ハンズオン]AIへの指示だけで「五目並べ」を作ってみよう
satoshi256kbyte
1
380
パスワード再設定メールのURLについて知っておこう
uyuki234
0
160
golang-bob.pdf
iwatsukayura
0
130
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
Verilogで学ぶCPU自作入門
uyuki234
8
4.1k
Featured
See All Featured
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
590
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
310
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
58k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
540
StorybookのUI Testing Handbookを読んだ
zakiyama
31
7k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.5k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
How to Talk to Developers About Accessibility
jct
2
580
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
2
2k
Technical Leadership for Architectural Decision Making
baasie
3
600
Transcript
Swift पใ 4/12 John Lin @johnlinvc
From the core • inliner ࠷ՂԽᩋࣥߦ䈕େখݮগ
inliner ࠷ՂԽᩋࣥߦ䈕େখݮগ • ࠷ՂԽ inliner ԋࢉ๏ᩋࣥߦ䈕େখݮগ • stdlib: 3% •
Benchmarks_O: 9% • ၷݸେఔࣜ: 15%, 20%
Evolution • SE-0042 ἷฏԽ instance method references తܕผ • SE-0043
ࡏ༗ଟݸpatterns త case label தએࠂᏓ Ꮠ • SE-0044 Import C function ᗣ swift function • SE-0047 ༬ઃܯࠂᔒ༗༻౸తճၚᆴ
ἷฏԽ instance method references తܕผ • ݱࡏ class Foo {
func foo(bar:Int) { print(bar) } } Foo.foo(Foo())(3) // 3 • ະိ Foo.foo(Foo(),3) // 3
ࡏ༗ଟݸpatterns త case label தએࠂᏓᏐ • Լ໘Ҏޙ။ಈ let point =
(2,2) switch point { case let (1,x), let (2,x): //error print(x) default: break }
Import C function ᗣ swift function • ݱࡏimport C function
ޙ။Ꮣglobal function • ະိՄҎࢦఆimport ਐိޙతҐஔɼबੋՄҎࢦఆC function ᗣ init, method, computed property, static property, static computed property ҃ੋ subscript • ༻ __attribute__((swift_name(“SWIFT_NAME")));
Import C function ᗣ swift function // Import as init
struct Point3D createPoint3D(float x, float y, float z) __attribute__((swift_name("Point3D.init(x:y:z:)"))); // Import as method struct Point3D rotatePoint3D(Point3D point, float radians) __attribute__((swift_name("Point3D.rotate(self:radians:)")));
༬ઃܯࠂᔒ༗༻౸తճၚᆴ • ᙛfunc ༗ճၚᆴɼୠੋᔒ༗ඃ༻౸త࣌ީሡ။༬ઃग़ݱܯࠂ func getScore()->Int { return 56 }
var score = 0 getScore() //will raise warning print(score) • ݱࡏ༬ઃෆ။ܯࠂɼ༻@warn_unused_result ՄҎ㗞ੜܯ ࠂɻ • ະိ༬ઃܯࠂɼՄҎ༻@discardableResult ိऔফܯࠂɻ
Evolution • SE-0016 Unsafe[Mutable]Pointer ՄҎ Int • SE-0053 function ჩᏐதෆ࠶ՄҎ༗
let • SE-0054 Abolish ImplicitlyUnwrappedOptional type • SE-0055 ᩋUnsafe Pointer༻Optional ိදࣔ nullability
Unsafe[Mutable]Pointer ՄҎ [U]Int • ՄҎPointer Int ೭ޙ၏֤छӡࢉɻ • ᩋSwift
ՄҎ၏ߋଟతܥ౷ఔࣜ
function ჩᏐதෆ࠶ՄҎ༗ let • function ჩᏐલpass by value ޙੋෆೳվᏓతɼະ ိ။શෆೳࡏჩᏐલ໘ଧ
let/var fun fLet(let a:Int) { print(a) } • ႔ɿະိ argument label ՄҎੋԿ keyword func fc(let l:Int) { print(l) } fc(let: 10)
ᩋUnsafe Pointer༻Optional ိ දࣔ nullability • ݱࡏᔒ༗㭎๏ኺType ग़Pointer ༗ᔒ༗Մೳੋ NULL
• ະိ Pointer ။Ճೖ Optional తޭೳ • if let ptr = nil_ptr { foo(ptr) }