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
Property Wrappers
Search
yhkaplan
January 21, 2020
Programming
630
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Property Wrappers
yhkaplan
January 21, 2020
More Decks by yhkaplan
See All by yhkaplan
Using the latest UICollectionView APIs
yhkaplan
0
3.6k
Swift and Concurrency: The Plan for World Domination
yhkaplan
0
220
Backend-Driven UI: Making Screens Dynamic
yhkaplan
1
1.9k
Migrating from UIKit to SwiftUI efficiently
yhkaplan
4
4k
Parser Combinators
yhkaplan
0
330
The Great Swift Migration
yhkaplan
1
4.3k
Speeding Up Your CI
yhkaplan
0
520
Automate All the Things
yhkaplan
4
2.7k
Other Decks in Programming
See All in Programming
Security issues being discussed on Web Platforms
petamoriken
0
1.4k
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
470
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
32
14k
仕様駆動開発による爆速プロダクト開発 / Bakusoku Spec Driven Development
kobakei
0
160
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
210
スマートフォンでモールス信号を送受信する 〜スマートフォンのLEDとカメラで作る光通信の設計と実装〜
atsuki_seo
0
220
[2026-09-26]空論ジェネリックプロセス~テスト資産とAIで紡ぐ、再現可能なパフォーマンスチューニングの話~
tosite
0
250
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
170
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
470
更なる可用性を求めて、5年間運用したKotlinのアプリケーションをGoでリプレイスする話
ken_tunc
0
430
Workers Cache を知る
syumai
0
320
Featured
See All Featured
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
340
Discover your Explorer Soul
emna__ayadi
2
1.3k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
410
A Tale of Four Properties
chriscoyier
163
24k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
700
ラッコキーワード サービス紹介資料
rakko
1
5.1M
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
510
Embracing the Ebb and Flow
colly
88
5.2k
It's Worth the Effort
3n
188
29k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
600
Facilitating Awesome Meetings
lara
57
7.2k
Transcript
Property Wrappers 1
What are they? 2
→ New in 5.1 → Java-like annotations → Can accept
(generic) parameters → Used in SwiftUI 3
Purpose 4
Examples 5
SwiftUI 6
struct ContentView: View { @State private var value = 0.0
var body: some View { VStack { Text("Value is \(value)") Slider(value: $value) } } } 7
UIKit/ Foundation 8
class ViewController: UIViewController { @Keychain(key: "secret_info") var secretInfo = ""
} 9
Let's make one! 10
@propertyWrapper struct TwelveOrLess { private var number = 0 var
wrappedValue: Int { get { return number } set { number = min(newValue, 12) } } } // Use struct S { @TwelveOrLess var num = 13 // 12 } 11
@propertyWrapper struct Clamped { private var number = 0 private
let maxNum: Int private let minNum: Int var wrappedValue: Int { get { return number } set { number = max(min(newValue, maxNum), minNum) } } } // Use struct S { @Clamped(maxNum: 10, minNum: 0) var num = 13 // 10 } 12
Projected values 13
@propertyWrapper struct State<T> { //... var projectedValue: Binding<T> } 14
struct ContentView: View { @State private var isDisabled = false
var body: some View { OtherView($isDisabled) // Binding<Bool> } } 15
Conclusion 16
More info 17
→ The Swift Programming Language → Burritos 18