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
Johnlin
April 12, 2016
Programming
140
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
Transcript
13 slides
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) }
More Decks by Johnlin
See All by Johnlin
用 MLIR 實作 一個 Ruby IR (intermediate representation)
johnlinvc
0
430
Unearth Ruby builtin Gems 發掘 Ruby 的內建 Gems
johnlinvc
0
520
Ruby 型別檢查工具簡介
johnlinvc
0
730
Swift Actor 實作探索
johnlinvc
0
260
用 mruby 來寫跨平台工具
johnlinvc
0
180
Actor model 簡介
johnlinvc
0
320
一起玩 Helm 3
johnlinvc
1
230
為什麼 App 卡卡的
johnlinvc
2
1.4k
如何使用 byebug 來除錯 Ruby 程式
johnlinvc
0
320
Other Decks in Programming
See All in Programming
Enforcing Your Architecture with Unit Tests in the AI Era (Swift Connection X)
steliosf
PRO
1
190
作れるエンジニアから、価値を届けるエンジニアへ
ryunakayama
1
310
高橋メソッドでCVE解説シリーズ 〜CVE-2026-112816〜
hakkadaikon
0
270
AIが生成したコードは読むべきか?抽象化設計とコードの品質保証 / abstraction-design-and-quality
minodriven
16
9.4k
エラーチャンネルのボールを拾い続けて鍛えるエンジニアの地力 / phpcon-niigata2026
meihei3
1
460
[DroidKnights 2026] Workflow AX: From Auto-Documented Policies to E2E Testing
raeminkang
0
600
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
380
AIコーディング時代のKotest ユニットテストから APIレベルの仕様固定化テストへ
ooga04
0
300
AI時代のシニアエンジニアとは
yosuke_furukawa
PRO
15
12k
[DroidKnights 2026] Workflow AX 적용기 — 자동 정책 정리부터 E2E까지
dayeon
0
110
Snowflake Openflow Connector利用の勘所 / 20261024developersio2026tokyo-snowflake-openflow
kasacchiful
PRO
0
360
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
360
Featured
See All Featured
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
640
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
960
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
121
130k
Tell your own story through comics
letsgokoyo
1
1.1k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
The Curse of the Amulet
leimatthew05
4
17k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3.1k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
550
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
620
We Have a Design System, Now What?
morganepeng
55
8.4k
Agile that works and the tools we love
rasmusluckow
331
22k