In this video I am going to show you how I handle textfields for iOS and iPADOS in SwiftUI when I want to restrict entry to either integer or decimal values only.
There are some real issues with using TextFields in SwiftUI when you want to limit the entry to either an integer or a decimal value. As we work through this project I will show you what those issues are and how I overcome them with a Toolbar button, a view Modifier and UIKit trick.
If you want to support my work, you can buy me a coffee :)
https://ko-fi.com/stewartlynch
Table of Contents:
0:00 Introduction
0:42 Dismiss Keyboard with FocusState
4:53 NumbersOnly ViewModifier
12:45 ClearTextField
Starter Project Files:
https://www.createchsol.com/StarterPr...
Completed Project:
https://github.com/StewartLynch/Numer...
References mentioned in video:
Custom View Modifiers
• Custom View Modifiers in SwiftUI
Other References:
Stewart Lynch's YouTube Channel:
/ @stewartlynch
Stewart Lynch on Twitter:
/ stewartlynch
Stewart Lynch on LinkedIn
/ stewartlynch