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
The ownership in iOS
Search
Yuji Taniguchi
April 20, 2018
Programming
0
350
The ownership in iOS
Yuji Taniguchi
April 20, 2018
Tweet
Share
More Decks by Yuji Taniguchi
See All by Yuji Taniguchi
Zeroconf on iOS
natpenguin
2
1.3k
Zero Configuration
natpenguin
1
200
Other Decks in Programming
See All in Programming
なぜGoのジェネリクスはこの形なのか? Featherweight Goが明かす設計の核心
ryotaros
7
1.1k
技術的負債の正体を知って向き合う / Facing Technical Debt
irof
0
150
iOSアプリの信頼性を向上させる取り組み/ios-app-improve-reliability
shino8rayu9
0
170
uniqueパッケージの内部実装を支えるweak pointerの話
magavel
0
970
組込みだけじゃない!TinyGo で始める無料クラウド開発入門
otakakot
0
200
(Extension DC 2025) Actor境界を越える技術
teamhimeh
1
250
CSC509 Lecture 06
javiergs
PRO
0
260
CSC305 Lecture 05
javiergs
PRO
0
210
詳しくない分野でのVibe Codingで困ったことと学び/vibe-coding-in-unfamiliar-area
shibayu36
3
4.8k
Le côté obscur des IA génératives
pascallemerrer
0
140
Web フロントエンドエンジニアに開かれる AI Agent プロダクト開発 - Vercel AI SDK を観察して AI Agent と仲良くなろう! #FEC余熱NIGHT
izumin5210
3
490
CSC305 Lecture 06
javiergs
PRO
0
210
Featured
See All Featured
Building Applications with DynamoDB
mza
96
6.7k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
9
590
Become a Pro
speakerdeck
PRO
29
5.5k
Unsuck your backbone
ammeep
671
58k
YesSQL, Process and Tooling at Scale
rocio
173
14k
How GitHub (no longer) Works
holman
315
140k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
Building Flexible Design Systems
yeseniaperezcruz
329
39k
Keith and Marios Guide to Fast Websites
keithpitt
411
23k
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.7k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
Transcript
The ownership in iOS Mixleap #11 in Osaka
@_natpenguin merpay iOS Software Engineer
@_natpenguin merpay iOS Software Engineer .filter { $0 == }
.map { $0 + } + [ , ✨ ] =
What is ownership?
It’s a management system for resource
It’s abstract word…
Ownership system is already used
Rust/C++/Swift… Ownership system is already used
Why we need ownership system?
None
- Speed
- Safety - Speed
- Safety - Speed - Concurrency
Safety
- Access conflict to Data Rust prevents these in compiling
- Access conflict to Data Rust prevents these in compiling
- Using after releasing resource
fn main() { let x = vec![1, 2, 3]; let
y = x; println!(“x[0] is {}", x[0]); } This code will be compiling error
fn main() { let x = vec![1, 2, 3]; take(x);
println!(“x[0] is {}", x[0]); } fn take(v: Vec<i32>) { // do something } This code will be compiling error
fn main() { let mut x = &100; let mut
y = &mut x; *y += 1; println!(“y is {}", y); } This code will be compiling error
It’s a difficult
None
Manifesto https://github.com/apple/swift/blob/master/docs/OwnershipManifesto.md
Q. What does swift want by using it?
A. Improving performance Q. What does swift want by using
it?
- Making extra copies at runtime Problem Point
- Making extra copies at runtime - Referencing to unique
resource Problem Point
- Making extra copies at runtime - Referencing to unique
resource - Overhead of reference count Problem Point
Point - Prevents simultaneously accessing to Data
Point - Prevents simultaneously accessing to Data - Give programmers
more control
Point - Prevents simultaneously accessing to Data - Give programmers
more control - Add types that can’t be implicitly copied
A1. Supporting a type that can’t copy Q. How does
swift improve performance?
A1. Supporting a type that can’t copy Q. How does
swift improve performance? A2. Law of exclusivity
New keywords - shared
func ==(left: shared String, right: shared String) -> Bool {
... } shared String isn’t copied
What is different with inout?
- shared - inout
New keywords - shared - moveonly
moveonly struct Foo { // some parameters }
moveonly extension Foo { // Some extensions }
extension Foo { moveonly func bar<U>(_ u: U) }
moveonly struct File { let descriptor: Int32 init(filename: String) throws
{ descriptor = Darwin.open(filename, O_RDONLY) } deinit { _ = Darwin.close(descriptor) } }
When we use it? - Performance tuning
When we use it? - More memory management - Performance
tuning
When we use it? - More memory management - Performance
tuning - Already know that no needed to copy
Thank you so much!