How to disable NSTextView in SwiftUI

Issue #702

The trick is to use an overlay

1
2
3
4
5
6
7
8
9
10
MessageTextView(text: $input.message)
.overlay(obscure)

var obscure: AnyView {
if store.pricingPlan.isPro {
return EmptyView().erase()
} else {
return Color.black.opacity(0.01).erase()
}
}

Comments