In SwiftUI TextField
is the goto View
for capturing freeform input from your users. It works great out-of-the-box for capturing strings, but as with any stock API there are limitations and behavior that may catch you off-guard, especially if you try to work with optionals and other data types. This article will provide some observations, tips, and tricks I have learned to help you work effectively with TextField
.
Overlapping Navigation Titles In SwiftUI
Navigation stacks are a fundamental user interface component in iOS. We use them everyday as we tap in and out of messages in Mail, search our contacts to make a phone call, and adjust the settings on our phones. Being so crucial to the user experience, I was a bit surprised to find a navigation related bug in SwiftUI. Navigation titles from dismissed views were piling up at the top of the navigation bar in an overlapping mess. What the heck?! Here, we will go over sample code that both recreates this behavior and demonstrates current fixes.
Read moreA Quick Fix For Misbehaving List Cells In SwiftUI
One of the most frustrating aspects of working with SwiftUI is trying to debug unexpected behavior. I recently ran into a noodle-scratcher while adding search and interactivity features to views inside of a List
. Here, I will briefly show you a few unexpected behaviors you might run into when working with navigable List
views and show you the quick and dirty fix!
Dismissing The Keyboard In SwiftUI 2.0
SwiftUI, Apple’s declarative framework for rapid user interface development, is an awesome alternative to UIKit, but still missing some key features. Here, I will discuss a few of the common issues surrounding keyboard dismissal and provide two solutions and workarounds that I have found after an embarrassing amount of googling and combing of StackOverflow.
Read more