Numeric TextFields in SwiftUI

Published: 25 December 2022
on channel: Stewart Lynch
9,594
363

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  


Watch video Numeric TextFields in SwiftUI online without registration, duration hours minute second in high quality. This video was added by user Stewart Lynch 25 December 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 9,594 once and liked it 363 people.