AppProperty // Implement `DynamicProperty` protocol.

This commit is contained in:
ShikiSuen 2023-09-24 12:51:14 +08:00
parent b4a669650a
commit 02a059a629
1 changed files with 3 additions and 3 deletions

View File

@ -159,12 +159,12 @@ public struct TextEditorEX: NSViewRepresentable {
// MARK: - Property Wrapper (Bindable Extension) // MARK: - Property Wrapper (Bindable Extension)
public extension AppProperty { extension AppProperty: DynamicProperty {
@available(macOS 10.15, *) @available(macOS 10.15, *)
var projectedValue: Binding<Value> { public var projectedValue: Binding<Value> {
.init( .init(
get: { get: {
container.object(forKey: key) as? Value ?? defaultValue wrappedValue
}, },
set: { set: {
container.set($0, forKey: key) container.set($0, forKey: key)