UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

TextField, .disabled(), and macOS

Forums > SwiftUI

I'm writing an application for macOS using SwiftUI and I want to allow the user to set some values for the app to use when it does work, but not to change those values if the app is currently working.

I've found that the .disabled() modifier works fine for buttons (disabling the Start button when it's already going, and disabling the Stop button when it's already stopped) but that it doesn't work for TextField. The TextField doesn't get disabled and, furthermore, there are a bunch of messages spewed to the log like:

AttributeGraph: cycle detected through attribute <##>

This is targeting 10.15, so maybe it gets fixed in Big Sur. But, you know, FYI.

2      

Tried it on macOS 11.1 and works fine.

3      

Cool! Okay, so that's one more in the column for upgrading.

2      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.