NEW: Start my new Ultimate Portfolio App course with a free Hacking with Swift+ trial! >>

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.

   

Tried it on macOS 11.1 and works fine.

1      

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

   

Hacking with Swift is sponsored by RevenueCat

SPONSORED Building and maintaining in-app subscription infrastructure is hard. Luckily there's a better way. With RevenueCat, you can implement subscriptions for your app in hours, not months, so you can get back to building your app.

Try it for free

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

Reply to this topic…

You need to create an account or log in to reply.

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.