Type Safely

Type Safely

Share this post

Type Safely
Type Safely
Use a Segmented Picker To Switch @FocusState Between Text Fields

Use a Segmented Picker To Switch @FocusState Between Text Fields

Daily Coding Tip 125

Millie Sturgeon's avatar
Millie Sturgeon
Jul 06, 2022
∙ Paid

Share this post

Type Safely
Type Safely
Use a Segmented Picker To Switch @FocusState Between Text Fields
Share
Image by Eszter Miller from Pixabay

Tested on Xcode Version 14.0 beta 2 (14A5229c).

I was previously using a Boolean value as a FocusState in a recent Daily Coding Tip, but this time I want to use a custom type. This is a simple enum called FocusedField with two possible values, text1 and text2.

Although I can use this as my FocusState, I can’t use it lik…

Keep reading with a 7-day free trial

Subscribe to Type Safely to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Type Safely
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share