Fix style
This commit is contained in:
parent
d244fce038
commit
133a4b02da
@ -55,7 +55,12 @@ extension Array: AnyView where Element == AnyView {
|
|||||||
/// - modifiers: Modify views before being updated.
|
/// - modifiers: Modify views before being updated.
|
||||||
/// - updateProperties: Whether to update properties.
|
/// - updateProperties: Whether to update properties.
|
||||||
/// - type: The type of the widgets.
|
/// - type: The type of the widgets.
|
||||||
public func update<WidgetType>(_ storage: [ViewStorage], modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: WidgetType.Type) {
|
public func update<WidgetType>(
|
||||||
|
_ storage: [ViewStorage],
|
||||||
|
modifiers: [(AnyView) -> AnyView],
|
||||||
|
updateProperties: Bool,
|
||||||
|
type: WidgetType.Type
|
||||||
|
) {
|
||||||
for (index, element) in enumerated() where element.renderable(type: type) {
|
for (index, element) in enumerated() where element.renderable(type: type) {
|
||||||
if let storage = storage[safe: index] {
|
if let storage = storage[safe: index] {
|
||||||
element
|
element
|
||||||
|
|||||||
@ -43,7 +43,12 @@ extension AnyView {
|
|||||||
/// - modifiers: Modify views before being updated.
|
/// - modifiers: Modify views before being updated.
|
||||||
/// - updateProperties: Whether to update properties.
|
/// - updateProperties: Whether to update properties.
|
||||||
/// - type: The type of the widgets.
|
/// - type: The type of the widgets.
|
||||||
public func updateStorage<WidgetType>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: WidgetType.Type) {
|
public func updateStorage<WidgetType>(
|
||||||
|
_ storage: ViewStorage,
|
||||||
|
modifiers: [(AnyView) -> AnyView],
|
||||||
|
updateProperties: Bool,
|
||||||
|
type: WidgetType.Type
|
||||||
|
) {
|
||||||
let modified = getModified(modifiers: modifiers)
|
let modified = getModified(modifiers: modifiers)
|
||||||
if let widget = modified as? Widget {
|
if let widget = modified as? Widget {
|
||||||
widget.update(storage, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
widget.update(storage, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||||
@ -75,7 +80,10 @@ extension AnyView {
|
|||||||
|
|
||||||
/// Whether the view can be rendered in a certain environment.
|
/// Whether the view can be rendered in a certain environment.
|
||||||
func renderable<WidgetType>(type: WidgetType.Type) -> Bool {
|
func renderable<WidgetType>(type: WidgetType.Type) -> Bool {
|
||||||
self as? WidgetType != nil || self as? SimpleView != nil || self as? View != nil || self as? ConvenienceWidget != nil
|
self as? WidgetType != nil
|
||||||
|
|| self as? SimpleView != nil
|
||||||
|
|| self as? View != nil
|
||||||
|
|| self as? ConvenienceWidget != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,12 @@ public protocol Widget: AnyView {
|
|||||||
/// - modifiers: Modify views before being updated
|
/// - modifiers: Modify views before being updated
|
||||||
/// - updateProperties: Whether to update the view's properties.
|
/// - updateProperties: Whether to update the view's properties.
|
||||||
/// - type: The type of the widgets.
|
/// - type: The type of the widgets.
|
||||||
func update<WidgetType>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: WidgetType.Type)
|
func update<WidgetType>(
|
||||||
|
_ storage: ViewStorage,
|
||||||
|
modifiers: [(AnyView) -> AnyView],
|
||||||
|
updateProperties: Bool,
|
||||||
|
type: WidgetType.Type
|
||||||
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -51,7 +51,12 @@ public struct StateWrapper: ConvenienceWidget {
|
|||||||
/// - modifiers: Modify views before being updated.
|
/// - modifiers: Modify views before being updated.
|
||||||
/// - updateProperties: Whether to update properties.
|
/// - updateProperties: Whether to update properties.
|
||||||
/// - type: The type of the widgets.
|
/// - type: The type of the widgets.
|
||||||
public func update<WidgetType>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: WidgetType.Type) {
|
public func update<WidgetType>(
|
||||||
|
_ storage: ViewStorage,
|
||||||
|
modifiers: [(AnyView) -> AnyView],
|
||||||
|
updateProperties: Bool,
|
||||||
|
type: WidgetType.Type
|
||||||
|
) {
|
||||||
var updateProperties = storage.fields[updateID] as? Bool ?? false
|
var updateProperties = storage.fields[updateID] as? Bool ?? false
|
||||||
storage.fields[updateID] = false
|
storage.fields[updateID] = false
|
||||||
for property in state {
|
for property in state {
|
||||||
|
|||||||
@ -33,7 +33,12 @@ public struct Wrapper: ConvenienceWidget {
|
|||||||
/// - modifiers: Modify views before being updated.
|
/// - modifiers: Modify views before being updated.
|
||||||
/// - updateProperties: Whether to update properties.
|
/// - updateProperties: Whether to update properties.
|
||||||
/// - type: The widget types.
|
/// - type: The widget types.
|
||||||
public func update<WidgetType>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: WidgetType.Type) {
|
public func update<WidgetType>(
|
||||||
|
_ storage: ViewStorage,
|
||||||
|
modifiers: [(AnyView) -> AnyView],
|
||||||
|
updateProperties: Bool,
|
||||||
|
type: WidgetType.Type
|
||||||
|
) {
|
||||||
guard let storages = storage.content[.mainContent] else {
|
guard let storages = storage.content[.mainContent] else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user