Enabling text selection statically works fine as in this answer
simply;
Text("Selectable text")
.textSelection(.enabled)
Text("Non selectable text")
.textSelection(.disabled)
I want text are selectible according to user's preferences, some annoys with selection. So; I've expected that the below runs perfectly;
Text("Sample Text)
.textSelection( enableSelection ? .enabled : .disabled)
Xcode 14.2 provides two errors;
Member 'disabled' in 'EnabledTextSelectability' produces result of type 'DisabledTextSelectability', but context expects 'EnabledTextSelectability'
and
Static property 'disabled' requires the types 'EnabledTextSelectability' and 'DisabledTextSelectability' be equivalent
How can we solve this issue so that we can toggle the selection in real time?