SwiftUI PreferenceKeys
In this tutorial, I am going to introduce you to SwiftUI PreferenceKeys. If you've been creating SwiftUI applications for a while, you might have been using them without even realizing it. Firstly, I will explain what a preferenceKey is and demonstrate how you have been utilizing them in your own projects since the early stages of SwiftUI development. It's fascinating to discover the hidden power behind these essential tools. Next, I will delve into the structure and requirements for creating custom PreferenceKeys. I'll guide you through the process and show you how to utilize the Reduce function to send information up your view hierarchy instead of the traditional approach of passing down variables through the environment. To make things more practical and engaging, I will provide four examples throughout the video. Some of these examples may seem contrived, but they serve the purpose of showcasing the true potential of preference keys. You'll gain a solid understanding of their capabilities and how they can be effectively integrated into your own applications. By the end of this tutorial, you'll have a clear grasp of SwiftUI PreferenceKeys and the immense value they bring to your development workflow. If you want to support my work, you can buy me a coffee :) https://ko-fi.com/stewartlynch Table of Contents: 0:00 Introduction 1:06 The NavigationTitle PreferenceKey 4:21 Example 1 11:04 Example 2 15:18 Example 3 - Practical Reduce Function 17:11 Example 4 - With GeometryReader Starter Project Files: (If you are having problems downloading zip files, use Safari. Chrome restricts zip files by default) https://www.createchsol.com/StarterPr... Completed Project: https://github.com/StewartLynch/Swift... References mentioned in video: Custom Environment Values in SwiftUI • Custom Environment Values in SwiftUI Other References: Stewart Lynch's YouTube Channel: / @stewartlynch Stewart Lynch on Mastodon: https://iosdev.space/@StewartLynch Stewart Lynch on Twitter: / stewartlynch Stewart Lynch on LinkedIn / stewartlynch

SwiftUI GeometryReader

Use PreferenceKey to extract values from child views in SwiftUI | Advanced Learning #10

SwiftUI: Presenting Modals and Bindings with Callbacks

SwiftUI AlignmentGuides

Codex 5.3 vs Claude Opus 4.6: iOS/SwiftUI App Comparison

WWDC24: SwiftUI essentials | Apple

Listen and Feel the Peace | Tibetan Healing Sounds for Deep Meditation, Inner Peace & Soul Healing

Man in The Middle Attack and SSLPinning | Ethical Hacking | Charles | iOS | Swift | Xcode

🔴 Sheets in SwiftUI | Everything you need to know

Understanding SwiftUI ViewBuilders

Creating pickers in a form – WeSplit SwiftUI Tutorial 8/11

Custom View Modifiers in SwiftUI

Getting Started with Combine Framework in Swift - Introduction to Functional Reactive Programming

Publishers and Subscribers in Combine with a SwiftUI project | Continued Learning #25

Understanding Swift Result Builders-The Power Behind ViewBuilder

Introductions to Closures in Swift

SwiftUI Data Flow with the new Observation - simpler SwiftUI code and improved performance in iOS 17

Mastering Liquid Glass in SwiftUI – Buttons, Containers & Transitions

Paul Hudson: Custom Layouts in iOS 16 | SuperMinds 2022

