Photo by Thiébaud Faix on Unsplash

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.

  • A sample app is also available on GitHub if you are interested in trying out the code yourself.
  • Code written using XCode 12.4 an iOS 14

Binding To Optional Strings

If you have ever tried to…


Hint: It’s a matter of style.

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 a List view that has NavigationLinks and provide you with a simple fix!

Adding a button to a cell that has a navigation link.

If you try and add a button to a cell that has a navigation link you will notice that the button is essentially ignored and anywhere you tap on the cell pushes the linked view onto…


Before you break your actual keyboard, let me show you the way.

Photo by Justus Menke on Unsplash

SwiftUI, Apple’s declarative framework for rapid user interface development, has continued to mature as a useful alternative to UIKit with a 2.0 release at WWDC this year. As a newbie to the framework, I enjoy the instant feedback that the canvas preview provides with each code modification and am thoroughly impressed by the elegance and simplicity of SwiftUI’s design. That being said, I have run into odd behaviors and challenging problems that make me want to tear my hair out at times. One such issue, which at first seems trivial, is how to dismiss the keyboard when a user taps…


Over the past few years my wife and I have really gotten into gardening. We enjoy planting flowers and vegetables, getting outside, and rearranging our plants to enhance the aesthetic appeal of our yard. But having a garden is a lot of work and maintenance, especially when it comes to pulling weeds. On many occasions I would find myself losing track of my weeders and trowels while working a flower bed. I finally decided enough was enough and designed a small bucket caddy out of plywood that fits around any standard 5 gallon bucket.

Prep Work


A complete walk-through with code snippets, tips, and tricks

Windows before and after applying rectangle detection

Apple’s Vision framework provides a useful set of tools for common computer vision tasks including face detection, object classification, barcode scanning, and rectangle detection. In this post we will discuss why you should consider rectangle detection over fancier methods, briefly go over setting up vision requests, and then take a semi-deep dive into rectangle detection using VNDetectRectanglesRequest. …

Jonathancbadger

Pharmacist, data scientist, Apple developer, and maker.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store