diff --git a/Sources/Model/User Interface/View/AnyView.swift b/Sources/Model/User Interface/View/AnyView.swift index 5a1ff3d..6659e06 100644 --- a/Sources/Model/User Interface/View/AnyView.swift +++ b/Sources/Model/User Interface/View/AnyView.swift @@ -75,7 +75,7 @@ extension AnyView { /// Whether the view can be rendered in a certain environment. func renderable(type: WidgetType.Type) -> Bool { - self as? WidgetType != nil || self as? SimpleView != nil || self as? View != nil + self as? WidgetType != nil || self as? SimpleView != nil || self as? View != nil || self as? ConvenienceWidget != nil } } diff --git a/Sources/Model/User Interface/View/ConvenienceWidget.swift b/Sources/Model/User Interface/View/ConvenienceWidget.swift new file mode 100644 index 0000000..0edcf3d --- /dev/null +++ b/Sources/Model/User Interface/View/ConvenienceWidget.swift @@ -0,0 +1,9 @@ +// +// ConvenienceWidget.swift +// Meta +// +// Created by david-swift on 17.06.24. +// + +/// A widget that does not interact with a platform-specific framework. +public protocol ConvenienceWidget: Widget { } diff --git a/Sources/View/StateWrapper.swift b/Sources/View/StateWrapper.swift index a059415..cc05b46 100644 --- a/Sources/View/StateWrapper.swift +++ b/Sources/View/StateWrapper.swift @@ -8,7 +8,7 @@ import Observation /// A storage for `@State` properties. -public struct StateWrapper: Widget { +public struct StateWrapper: ConvenienceWidget { /// The content. var content: () -> Body diff --git a/Sources/View/Wrapper.swift b/Sources/View/Wrapper.swift index fd73cc1..e9748a0 100644 --- a/Sources/View/Wrapper.swift +++ b/Sources/View/Wrapper.swift @@ -6,7 +6,7 @@ // /// Wrap a view into a single widget. -public struct Wrapper: Widget { +public struct Wrapper: ConvenienceWidget { /// The content. var content: Body