Building REUSABLE SwiftUI components
summary
Shows building a reusable SwiftUI text input that acts as a drop-in replacement for TextField with a floating label, clear button, focus handling and animation. Implements validation: mandatory flag plus custom validation closures registered via SwiftUI environment keys and exposes validity as a Binding so forms can enable submit buttons. Demonstrates refactorings (extract subview/local function), packaging into a Swift Package and Xcode LibraryContentProvider, and uses it in a Firebase-authenticated app where login and Firestore sync work.
AI-written summary · about
chapters (18)
- 0:00intro
- 2:56The best way to build an app is with…
- 3:50Hello world
- 6:01Useful SwiftUI Refactorings
- 7:52Peter’s Wishlist
- 12:26Building a Reusable Text Input Field
- 14:04Drop-in replacement for TextField
- 17:29Customising Views
- 20:41View Styling
- 22:09Focus handling
- 22:42Validation handling
- 24:56Exposing inner state
- 26:24Custom Validation
- 27:14How to register Closures / Callbacks
- 28:04Reusing the Component
- 31:15Peter’s Wishlist
- 32:31Live code Drop-in Replacement
- 36:38Building a Reusable Text Input Field
related talks
36mSwiftUI Everywhere
30mEvolving Existing Projects With SwiftUI
31mThe Swift Behind SwiftUI
29mCustom Styleable Containers in SwiftUI
14mBuilding a SwiftUI app with Firebase
30mCustom Styleable Containers in SwiftUI
38mRe-usable GUI Components with Re-frame and Atomic Design
35mSwiftUI Performance for Demanding Apps
