Add convenience widgets
This commit is contained in:
parent
c15839de3b
commit
d244fce038
@ -75,7 +75,7 @@ extension AnyView {
|
||||
|
||||
/// Whether the view can be rendered in a certain environment.
|
||||
func renderable<WidgetType>(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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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 { }
|
||||
@ -8,7 +8,7 @@
|
||||
import Observation
|
||||
|
||||
/// A storage for `@State` properties.
|
||||
public struct StateWrapper: Widget {
|
||||
public struct StateWrapper: ConvenienceWidget {
|
||||
|
||||
/// The content.
|
||||
var content: () -> Body
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
//
|
||||
|
||||
/// Wrap a view into a single widget.
|
||||
public struct Wrapper: Widget {
|
||||
public struct Wrapper: ConvenienceWidget {
|
||||
|
||||
/// The content.
|
||||
var content: Body
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user