var wrappedValue : DelegateType
The underlying delegate.
Availability 有効性
Technology
var projectedValue: ObservedObject
<DelegateType >.Wrapper
{ get }
DelegateType
inherits NSObject
, DelegateType
conforms to ObservableObject
, and DelegateType
conforms to WKExtensionDelegate
.Use the projected value to get a binding to a value that the delegate publishes. Access the projected value by prefixing the name of the delegate instance with a dollar sign ($
). For example, you might publish a Boolean value in your extension delegate:
class MyExtensionDelegate: NSObject, WKExtensionDelegate, ObservableObject {
var isEnabled = false
// ...
}
If you declare the delegate in your App
using the WKExtension
property wrapper, you can get the delegate that SwiftUI instantiates from the environment and access a binding to its published values from any view in your extension:
struct MyView: View {
private var extensionDelegate: MyExtensionDelegate
var body: some View {
Toggle("Enabled", isOn: $extensionDelegate.isEnabled)
}
}
var wrappedValue : DelegateType