diff --git a/Sources/Model/Data Flow/Binding.swift b/Sources/Model/Data Flow/Binding.swift index d0bd0d4..2431c85 100644 --- a/Sources/Model/Data Flow/Binding.swift +++ b/Sources/Model/Data Flow/Binding.swift @@ -112,6 +112,7 @@ public struct Binding { } +/// Extend bindings. extension Binding where Value: MutableCollection { /// Get a child at a certain index of the array as a binding. @@ -134,6 +135,7 @@ extension Binding where Value: MutableCollection { } +/// Extend bindings. extension Binding where Value: MutableCollection, Value.Element: Identifiable { /// Get a child of the array with a certain id as a binding. @@ -147,6 +149,7 @@ extension Binding where Value: MutableCollection, Value.Element: Identifiable { } +/// Extend bindings. extension Binding: CustomStringConvertible where Value: CustomStringConvertible { /// A textual description of the wrapped value. diff --git a/Sources/Model/Data Flow/Model.swift b/Sources/Model/Data Flow/Model.swift index 99c79d9..45e962e 100644 --- a/Sources/Model/Data Flow/Model.swift +++ b/Sources/Model/Data Flow/Model.swift @@ -67,6 +67,7 @@ public struct ModelData { } +/// Extend the model. extension Model { /// Get the value as a binding using the `$` prefix. diff --git a/Sources/Model/Extensions/Array.swift b/Sources/Model/Extensions/Array.swift index 3c85146..7f5f7c2 100644 --- a/Sources/Model/Extensions/Array.swift +++ b/Sources/Model/Extensions/Array.swift @@ -7,6 +7,7 @@ import Foundation +/// Extend arrays. extension Array: AnyView where Element == AnyView { /// The array's view body is the array itself. @@ -69,6 +70,7 @@ extension Array: AnyView where Element == AnyView { } +/// Extend arrays. extension Array { /// Accesses the element at the specified position safely. @@ -96,6 +98,7 @@ extension Array { } +/// Extend arrays. extension Array where Element: Identifiable { /// Accesses the element with a certain id safely. diff --git a/Sources/Model/Extensions/String.swift b/Sources/Model/Extensions/String.swift index 7b0b9f2..62347ce 100644 --- a/Sources/Model/Extensions/String.swift +++ b/Sources/Model/Extensions/String.swift @@ -5,6 +5,7 @@ // Created by david-swift on 09.06.24. // +/// Extend strings. extension String { /// An identifier for main content in a view storage. diff --git a/Sources/Model/User Interface/App/App.swift b/Sources/Model/User Interface/App/App.swift index 7c9b8d4..9ec9eaa 100644 --- a/Sources/Model/User Interface/App/App.swift +++ b/Sources/Model/User Interface/App/App.swift @@ -40,6 +40,7 @@ public protocol App { } +/// Extend the app. extension App { /// The application's entry point. @@ -91,6 +92,8 @@ extension App { return appInstance } + /// Get the state from the properties. + /// - Returns: The state. func getState() -> [String: StateProtocol] { var state: [String: StateProtocol] = [:] for property in Mirror(reflecting: self).children { diff --git a/Sources/Model/User Interface/App/AppStorage.swift b/Sources/Model/User Interface/App/AppStorage.swift index cb7d503..3b8a6ce 100644 --- a/Sources/Model/User Interface/App/AppStorage.swift +++ b/Sources/Model/User Interface/App/AppStorage.swift @@ -27,6 +27,7 @@ public protocol AppStorage: AnyObject { } +/// Extend the app storage. extension AppStorage { /// Focus the scene element with a certain id (if supported). Create the element if it doesn't already exist. diff --git a/Sources/Model/User Interface/View/AnyView.swift b/Sources/Model/User Interface/View/AnyView.swift index b22aa6a..91c75fa 100644 --- a/Sources/Model/User Interface/View/AnyView.swift +++ b/Sources/Model/User Interface/View/AnyView.swift @@ -13,8 +13,12 @@ public protocol AnyView { } +/// Extend any view. extension AnyView { + /// Get the view with modifications applied. + /// - Parameters: + /// - data: func getModified(data: WidgetData, type: Data.Type) -> AnyView where Data: ViewRenderData { var modified: AnyView = self for modifier in data.modifiers { diff --git a/Sources/Model/User Interface/View/SimpleView.swift b/Sources/Model/User Interface/View/SimpleView.swift index 9f742e3..f981dfe 100644 --- a/Sources/Model/User Interface/View/SimpleView.swift +++ b/Sources/Model/User Interface/View/SimpleView.swift @@ -27,6 +27,7 @@ public protocol SimpleView: AnyView { } +/// Extend the simple view type without state. extension SimpleView { /// The view's content. diff --git a/Sources/Model/User Interface/View/View.swift b/Sources/Model/User Interface/View/View.swift index 4d28a2c..4e7d0d2 100644 --- a/Sources/Model/User Interface/View/View.swift +++ b/Sources/Model/User Interface/View/View.swift @@ -27,6 +27,7 @@ public protocol View: AnyView { } +/// Extend the view type with state. extension View { /// The view's content. @@ -34,6 +35,8 @@ extension View { [StateWrapper(content: { view }, state: getState())] } + /// Get the state from the properties. + /// - Returns: The state. func getState() -> [String: StateProtocol] { var state: [String: StateProtocol] = [:] for property in Mirror(reflecting: self).children { diff --git a/Sources/Model/User Interface/View/Widget.swift b/Sources/Model/User Interface/View/Widget.swift index d854373..e4da191 100644 --- a/Sources/Model/User Interface/View/Widget.swift +++ b/Sources/Model/User Interface/View/Widget.swift @@ -36,6 +36,7 @@ public protocol Widget: AnyView { } +/// Extend the widget type. extension Widget { /// A widget's view is empty. diff --git a/Sources/View/AppearObserver.swift b/Sources/View/AppearObserver.swift index 2df1ad5..377a62f 100644 --- a/Sources/View/AppearObserver.swift +++ b/Sources/View/AppearObserver.swift @@ -44,6 +44,7 @@ struct AppearObserver: ConvenienceWidget { } +/// Extend any view. extension AnyView { /// Run a function on the widget when it appears for the first time. diff --git a/Sources/View/ContentModifier.swift b/Sources/View/ContentModifier.swift index e8db113..7e39440 100644 --- a/Sources/View/ContentModifier.swift +++ b/Sources/View/ContentModifier.swift @@ -58,6 +58,7 @@ struct ContentModifier: ConvenienceWidget where Content: AnyView { } +/// Extend any view. extension AnyView { /// Replace every occurrence of a certain view type in the content. diff --git a/Sources/View/DummyEitherView.swift b/Sources/View/DummyEitherView.swift index 067377a..84ac20e 100644 --- a/Sources/View/DummyEitherView.swift +++ b/Sources/View/DummyEitherView.swift @@ -6,7 +6,7 @@ // /// A dummy either view. This will be replaced by the platform-specific either view. -struct DummyEitherView: Widget { +struct DummyEitherView: ConvenienceWidget { /// Whether to present the first view. var condition: Bool diff --git a/Sources/View/Freeze.swift b/Sources/View/Freeze.swift index 1e5fc24..17a09c3 100644 --- a/Sources/View/Freeze.swift +++ b/Sources/View/Freeze.swift @@ -45,6 +45,7 @@ struct Freeze: ConvenienceWidget { } +/// Extend any view. extension AnyView { /// Prevent a view from being updated. diff --git a/Sources/View/InspectorWrapper.swift b/Sources/View/InspectorWrapper.swift index 4e61da6..e72caa1 100644 --- a/Sources/View/InspectorWrapper.swift +++ b/Sources/View/InspectorWrapper.swift @@ -45,6 +45,7 @@ struct InspectorWrapper: ConvenienceWidget { } +/// Extend any view. extension AnyView { /// Run a custom code accessing the view's storage when initializing and updating the view. diff --git a/Sources/View/ModifierStopper.swift b/Sources/View/ModifierStopper.swift index d4167df..85066af 100644 --- a/Sources/View/ModifierStopper.swift +++ b/Sources/View/ModifierStopper.swift @@ -40,6 +40,7 @@ struct ModifierStopper: ConvenienceWidget { } +/// Extend any view. extension AnyView { /// Remove all of the content data for the wrapped views.