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
Generalized accessors
Search
Takuma Shimizu
March 27, 2019
Programming
100
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Generalized accessors
Takuma Shimizu
March 27, 2019
Transcript
8 slides
subscrit get set
get let nums = Array(0..<10) let x10 = nums[3] *
10 // `get` print(num) subscript(index: Int) -> Element { get { let element = // `index` return element // } set { ... } }
set var nums = Array(0..<10) let num = nums[3] nums[3]
= num * 10 // `set` print(num) subscript(index: Int) -> Element { get { ... } set(newValue) { // `newValue` // buffer = newValue } }
Swift 4.2 mutableAddressWithPinnedNativeOwner Swift 5 read , modify yield co-routine
read // CoreAudio.swift subscript(index: Index) -> Element { _read {
yield ((_audioBuffersPointer + index).pointee) } } modify // Array.swift subscript(index: Int) -> Element { _modify { let address = _buffer.subscriptBaseAddress + index yield &address.pointee } }
yield subscript(index: Int) -> inout Element {} inout Rust Lifetime
Rust Swift
yield
!
More Decks by Takuma Shimizu
See All by Takuma Shimizu
RailsのValidatesをSwift Macrosで再現してみた
hokuron
0
210
Swift Attributes
hokuron
0
480
Peek in Calendar implementation of swift-foundation
hokuron
0
290
MVVM
hokuron
0
89
Summon Rust from Swift
hokuron
0
740
Opaque Result Type in Swift with Rust
hokuron
0
200
Ownership of Swift as seen from iteration and Rust
hokuron
1
760
Clean Architecture 3
hokuron
0
77
Clean Architecture 2
hokuron
0
100
Other Decks in Programming
See All in Programming
Performance Optimization With LLMs
xleitix
0
250
GraphQL の onError と Nullability のこれから
quramy
0
210
Distance field of Julia set
kinakomoti321
0
320
React Native経験者が Flutterを30⽇間触って驚いたこと
3saito
0
180
ローカルLLMの基本と近況 2611 / Local LLM basics and recent situation 2611
kishida
0
170
baseline으로 마이그레이션, 리팩토링 안전하게 맡기기
fornewid
1
980
Snowflake Openflow Connector利用の勘所 / 20261024developersio2026tokyo-snowflake-openflow
kasacchiful
PRO
0
330
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
1.7k
[DroidKnights 2026] Workflow AX: From Auto-Documented Policies to E2E Testing
raeminkang
0
570
조합이폭발하는디자인시스템이걸눈으로도테스트하라고요
giljongyu
0
750
protojson における文字化けの扱い
kazuki1023
0
400
느린 네트워크와 저사양 디바이스 사용자를 위한 웹뷰 로딩 시간 개선기
kmkim
1
230
Featured
See All Featured
SEO for Brand Visibility & Recognition
aleyda
0
4.9k
AI: The stuff that nobody shows you
jnunemaker
PRO
12
1.3k
Music & Morning Musume
bryan
48
7.5k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
350
Making the Leap to Tech Lead
cromwellryan
135
10k
Why Our Code Smells
bkeepers
PRO
340
58k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
RailsConf 2023
tenderlove
30
1.6k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
760
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
610