From d8cb34da3a263341ad8e044981cf25efa4677b2f Mon Sep 17 00:00:00 2001 From: Carson Katri Date: Tue, 22 Aug 2023 14:49:14 -0400 Subject: [PATCH 1/4] Add params for animation -> menus_and_commands --- .../RenameActionModifier.swift | 22 +++++-------------- .../MaskModifier.swift | 10 ++++----- .../OnDeleteCommandModifier.swift | 8 +++---- .../OnHoverModifier.swift | 8 +++---- .../OnMoveCommandModifier.swift | 16 +++++++------- ...fier.swift => MenuIndicatorModifier.swift} | 11 +++++----- .../animation/matched_geometry_effect.ex | 10 +++++++++ .../button_border_shape.ex | 3 +++ .../modifiers/documents/rename_action.ex | 14 ++++++++++-- .../modifiers/drag_and_drop/draggable.ex | 4 ++++ .../drag_and_drop/drop_destination.ex | 2 +- .../drawing_and_graphics/background_style.ex | 9 ++++++++ .../drawing_and_graphics/blend_mode.ex | 4 ++++ .../modifiers/drawing_and_graphics/border.ex | 10 +++++++++ .../drawing_and_graphics/brightness.ex | 3 +++ .../drawing_and_graphics/clip_shape.ex | 10 +++++++++ .../drawing_and_graphics/color_multiply.ex | 9 ++++++++ .../drawing_and_graphics/contrast.ex | 3 +++ .../drawing_and_graphics/corner_radius.ex | 4 ++++ .../drawing_and_graphics/grayscale.ex | 3 +++ .../drawing_and_graphics/hue_rotation.ex | 9 ++++++++ .../modifiers/drawing_and_graphics/mask.ex | 2 +- .../drawing_and_graphics/projection_effect.ex | 9 ++++++++ .../rotation_3d_effect.ex | 10 +++++++++ .../drawing_and_graphics/rotation_effect.ex | 10 +++++++++ .../drawing_and_graphics/saturation.ex | 3 +++ .../modifiers/drawing_and_graphics/tint.ex | 9 ++++++++ .../drawing_and_graphics/transform_effect.ex | 9 ++++++++ .../modifiers/focus/focus_scope.ex | 9 ++++++++ .../modifiers/focus/focusable.ex | 3 +++ .../modifiers/focus/prefers_default_focus.ex | 3 +++ .../gestures/defers_system_gestures.ex | 3 +++ .../modifiers/gestures/gesture.ex | 6 ++++- .../modifiers/images/antialiased.ex | 3 +++ .../modifiers/images/interpolation.ex | 3 +++ .../modifiers/images/rendering_mode.ex | 3 +++ .../modifiers/images/symbol_rendering_mode.ex | 3 +++ .../modifiers/images/symbol_variant.ex | 9 ++++++++ .../input_events/allows_hit_testing.ex | 3 +++ .../digital_crown_accessory_visibility.ex | 3 +++ .../modifiers/input_events/hover_effect.ex | 3 +++ .../input_events/on_delete_command.ex | 4 ++-- .../modifiers/input_events/on_hover.ex | 4 ++-- .../modifiers/input_events/on_move_command.ex | 2 +- .../modifiers/input_events/on_submit.ex | 12 +++++++++- .../modifiers/input_events/submit_scope.ex | 3 +++ .../layout_adjustments/coordinate_space.ex | 3 +++ .../layout_adjustments/ignores_safe_area.ex | 4 +++- .../modifiers/lists/badge.ex | 11 ++++++++++ .../modifiers/lists/delete_disabled.ex | 3 +++ .../modifiers/lists/disclosure_group_style.ex | 3 +++ .../modifiers/lists/header_prominence.ex | 5 ++++- .../modifiers/lists/list_item_tint.ex | 9 ++++++++ .../modifiers/lists/list_row_background.ex | 9 ++++++++ .../modifiers/lists/list_row_insets.ex | 9 ++++++++ .../modifiers/lists/list_row_separator.ex | 6 ++++- .../lists/list_row_separator_tint.ex | 10 +++++++++ .../modifiers/lists/list_section_separator.ex | 4 ++++ .../lists/list_section_separator_tint.ex | 10 +++++++++ .../modifiers/lists/list_style.ex | 3 +++ .../modifiers/lists/move_disabled.ex | 3 +++ .../modifiers/lists/refreshable.ex | 2 +- .../menu_action_dismiss_behavior.ex | 3 +++ .../menu_indicator_visibility.ex | 5 ++++- .../menus_and_commands/menu_order.ex | 3 +++ .../menus_and_commands/menu_style.ex | 3 +++ .../keyboard_shortcut.ex | 2 +- .../modifiers/view_fundamentals/on_appear.ex | 4 ++-- .../view_fundamentals/on_disappear.ex | 4 ++-- lib/live_view_native_swift_ui/types/event.ex | 20 ----------------- .../types/event_modifier.ex | 2 +- 71 files changed, 358 insertions(+), 85 deletions(-) rename Sources/LiveViewNative/Modifiers/Menus and Commands/{MenuIndicatorVisibilityModifier.swift => MenuIndicatorModifier.swift} (84%) delete mode 100644 lib/live_view_native_swift_ui/types/event.ex diff --git a/Sources/LiveViewNative/Modifiers/Documents Modifiers/RenameActionModifier.swift b/Sources/LiveViewNative/Modifiers/Documents Modifiers/RenameActionModifier.swift index 8b204235bb..362b85491b 100644 --- a/Sources/LiveViewNative/Modifiers/Documents Modifiers/RenameActionModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Documents Modifiers/RenameActionModifier.swift @@ -14,7 +14,7 @@ import SwiftUI /// ```html /// /// ``` @@ -30,33 +30,21 @@ struct RenameActionModifier: ViewModifier, Decodable { #if swift(>=5.8) @_documentation(visibility: public) #endif - private let event: String - /// The LiveView or LiveComponent to perform the event on. - /// - /// In a component, you may use the `@myself` assign to handle the event on the LiveComponent. - #if swift(>=5.8) - @_documentation(visibility: public) - #endif - private let target: Int? - @Environment(\.coordinatorEnvironment) private var coordinatorEnvironment + @Event private var action: Event.EventHandler init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - self.event = try container.decode(String.self, forKey: .event) - self.target = try container.decode(Int?.self, forKey: .target) + self._action = try container.decode(Event.self, forKey: .action) } private enum CodingKeys: String, CodingKey { - case event - case target + case action } func body(content: Content) -> some View { content .renameAction { - Task { - try await coordinatorEnvironment?.pushEvent("click", event, [String:Any](), target) - } + action(value: [String:String]()) } } } diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/MaskModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/MaskModifier.swift index f030aa2639..d46d877b36 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/MaskModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/MaskModifier.swift @@ -15,7 +15,7 @@ import SwiftUI /// @native /// |> foreground_color(color: :blue) /// |> font(font: {:system, :large_title}) -/// |> mask(alignment: :center, content: :mask) +/// |> mask(alignment: :center, mask: :mask) /// } /// > /// opacity(opacity: 0.1)} /> @@ -41,7 +41,7 @@ struct MaskModifier: ViewModifier, Decodable { #if swift(>=5.8) @_documentation(visibility: public) #endif - private let content: String + private let mask: String @ObservedElement private var element @LiveContext private var context @@ -50,17 +50,17 @@ struct MaskModifier: ViewModifier, Decodable { let container = try decoder.container(keyedBy: CodingKeys.self) self.alignment = try container.decode(Alignment.self, forKey: .alignment) - self.content = try container.decode(String.self, forKey: .content) + self.mask = try container.decode(String.self, forKey: .mask) } func body(content: Content) -> some View { content.mask(alignment: alignment) { - context.buildChildren(of: element, forTemplate: self.content) + context.buildChildren(of: element, forTemplate: self.mask) } } enum CodingKeys: String, CodingKey { case alignment - case content + case mask } } diff --git a/Sources/LiveViewNative/Modifiers/Input Events Modifiers/OnDeleteCommandModifier.swift b/Sources/LiveViewNative/Modifiers/Input Events Modifiers/OnDeleteCommandModifier.swift index d25c940fab..a2dfbd8bc2 100644 --- a/Sources/LiveViewNative/Modifiers/Input Events Modifiers/OnDeleteCommandModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Input Events Modifiers/OnDeleteCommandModifier.swift @@ -46,24 +46,24 @@ struct OnDeleteCommandModifier: ViewModifier, Decodable { #if swift(>=5.8) @_documentation(visibility: public) #endif - @Event private var action: Event.EventHandler + @Event private var perform: Event.EventHandler init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - self._action = try container.decode(Event.self, forKey: .action) + self._perform = try container.decode(Event.self, forKey: .perform) } func body(content: Content) -> some View { content #if os(macOS) .onDeleteCommand { - action() + perform() } #endif } enum CodingKeys: String, CodingKey { - case action + case perform } } diff --git a/Sources/LiveViewNative/Modifiers/Input Events Modifiers/OnHoverModifier.swift b/Sources/LiveViewNative/Modifiers/Input Events Modifiers/OnHoverModifier.swift index 48a0d0c6df..5405ea4e51 100644 --- a/Sources/LiveViewNative/Modifiers/Input Events Modifiers/OnHoverModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Input Events Modifiers/OnHoverModifier.swift @@ -44,24 +44,24 @@ struct OnHoverModifier: ViewModifier, Decodable { #if swift(>=5.8) @_documentation(visibility: public) #endif - @Event private var action: Event.EventHandler + @Event private var perform: Event.EventHandler init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - self._action = try container.decode(Event.self, forKey: .action) + self._perform = try container.decode(Event.self, forKey: .perform) } func body(content: Content) -> some View { content #if os(iOS) || os(macOS) .onHover { isHovering in - action(value: isHovering) + perform(value: isHovering) } #endif } enum CodingKeys: String, CodingKey { - case action + case perform } } diff --git a/Sources/LiveViewNative/Modifiers/Input Events Modifiers/OnMoveCommandModifier.swift b/Sources/LiveViewNative/Modifiers/Input Events Modifiers/OnMoveCommandModifier.swift index 857e97e61d..fc3bc56ef1 100644 --- a/Sources/LiveViewNative/Modifiers/Input Events Modifiers/OnMoveCommandModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Input Events Modifiers/OnMoveCommandModifier.swift @@ -52,12 +52,12 @@ struct OnMoveCommandModifier: ViewModifier, Decodable { #if swift(>=5.8) @_documentation(visibility: public) #endif - @Event private var action: Event.EventHandler + @Event private var perform: Event.EventHandler init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - self._action = try container.decode(Event.self, forKey: .action) + self._perform = try container.decode(Event.self, forKey: .perform) } func body(content: Content) -> some View { @@ -66,21 +66,21 @@ struct OnMoveCommandModifier: ViewModifier, Decodable { .onMoveCommand { direction in switch direction { case .up: - action(value: ["direction": "up"]) + perform(value: ["direction": "up"]) case .down: - action(value: ["direction": "down"]) + perform(value: ["direction": "down"]) case .left: - action(value: ["direction": "left"]) + perform(value: ["direction": "left"]) case .right: - action(value: ["direction": "right"]) + perform(value: ["direction": "right"]) @unknown default: - action(value: ["direction": String(describing: direction)]) + perform(value: ["direction": String(describing: direction)]) } } #endif } enum CodingKeys: String, CodingKey { - case action + case perform } } diff --git a/Sources/LiveViewNative/Modifiers/Menus and Commands/MenuIndicatorVisibilityModifier.swift b/Sources/LiveViewNative/Modifiers/Menus and Commands/MenuIndicatorModifier.swift similarity index 84% rename from Sources/LiveViewNative/Modifiers/Menus and Commands/MenuIndicatorVisibilityModifier.swift rename to Sources/LiveViewNative/Modifiers/Menus and Commands/MenuIndicatorModifier.swift index 44f91c8cdc..80e64039ea 100644 --- a/Sources/LiveViewNative/Modifiers/Menus and Commands/MenuIndicatorVisibilityModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Menus and Commands/MenuIndicatorModifier.swift @@ -10,7 +10,7 @@ import SwiftUI /// Specifies whether the indicator on a ``Menu`` should be visible. /// /// ```html -/// menu_indicator_visibility(visibility: :hidden)}> +/// menu_indicator(visibility: :hidden)}> /// /// Edit Actions /// @@ -28,7 +28,7 @@ import SwiftUI @_documentation(visibility: public) #endif @available(iOS 16.0, macOS 13.0, tvOS 16.0, *) -struct MenuIndicatorVisibilityModifier: ViewModifier, Decodable { +struct MenuIndicatorModifier: ViewModifier, Decodable { /// The indicator visibility. /// /// See ``LiveViewNative/SwiftUI/Visibility`` for possible values. @@ -38,8 +38,9 @@ struct MenuIndicatorVisibilityModifier: ViewModifier, Decodable { private let visibility: Visibility func body(content: Content) -> some View { -#if !os(watchOS) - content.menuIndicator(visibility) -#endif + content + #if !os(watchOS) + .menuIndicator(visibility) + #endif } } diff --git a/lib/live_view_native_swift_ui/modifiers/animation/matched_geometry_effect.ex b/lib/live_view_native_swift_ui/modifiers/animation/matched_geometry_effect.ex index d30079eb3f..a842bb51ff 100644 --- a/lib/live_view_native_swift_ui/modifiers/animation/matched_geometry_effect.ex +++ b/lib/live_view_native_swift_ui/modifiers/animation/matched_geometry_effect.ex @@ -10,4 +10,14 @@ defmodule LiveViewNativeSwiftUi.Modifiers.MatchedGeometryEffect do field :anchor, UnitPoint field :is_source, :boolean, default: true end + + def params([id: id, in: namespace, properties: properties, anchor: anchor, is_source: is_source]), + do: [ + id: id, + namespace: namespace, + properties: properties, + anchor: anchor, + is_source: is_source + ] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/button_border_shape.ex b/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/button_border_shape.ex index 3aecba949b..57acd013e8 100644 --- a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/button_border_shape.ex +++ b/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/button_border_shape.ex @@ -5,4 +5,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ButtonBorderShape do field(:shape, Ecto.Enum, values: ~w(automatic capsule rounded_rectangle)a) field(:radius, :float, default: nil) end + + def params(shape) when is_atom(shape) and not is_boolean(shape) and not is_nil(shape), do: [shape: shape] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/documents/rename_action.ex b/lib/live_view_native_swift_ui/modifiers/documents/rename_action.ex index 3522cbfaf1..f62b2563ef 100644 --- a/lib/live_view_native_swift_ui/modifiers/documents/rename_action.ex +++ b/lib/live_view_native_swift_ui/modifiers/documents/rename_action.ex @@ -1,8 +1,18 @@ defmodule LiveViewNativeSwiftUi.Modifiers.RenameAction do use LiveViewNativePlatform.Modifier + alias LiveViewNativePlatform.Types.Event + modifier_schema "rename_action" do - field :event, :string - field :target, :integer + field :action, Event + end + + def params(params) do + with {:ok, _} <- Event.cast(params) do + [action: params] + else + _ -> + params + end end end diff --git a/lib/live_view_native_swift_ui/modifiers/drag_and_drop/draggable.ex b/lib/live_view_native_swift_ui/modifiers/drag_and_drop/draggable.ex index ca0bb6dcd5..bd5db456a7 100644 --- a/lib/live_view_native_swift_ui/modifiers/drag_and_drop/draggable.ex +++ b/lib/live_view_native_swift_ui/modifiers/drag_and_drop/draggable.ex @@ -6,4 +6,8 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Draggable do field :payload, :string field :preview, KeyName end + + def params(payload, [preview: preview]), do: [payload: payload, preview: preview] + def params(payload) when is_binary(payload), do: [payload: payload, preview: nil] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/drag_and_drop/drop_destination.ex b/lib/live_view_native_swift_ui/modifiers/drag_and_drop/drop_destination.ex index 8db51eace3..6ad3a9b2ec 100644 --- a/lib/live_view_native_swift_ui/modifiers/drag_and_drop/drop_destination.ex +++ b/lib/live_view_native_swift_ui/modifiers/drag_and_drop/drop_destination.ex @@ -1,7 +1,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.DropDestination do use LiveViewNativePlatform.Modifier - alias LiveViewNativeSwiftUi.Types.Event + alias LiveViewNativePlatform.Types.Event modifier_schema "drop_destination" do field :action, Event diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/background_style.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/background_style.ex index f89b227da9..971fafd4e2 100644 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/background_style.ex +++ b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/background_style.ex @@ -6,4 +6,13 @@ defmodule LiveViewNativeSwiftUi.Modifiers.BackgroundStyle do modifier_schema "background_style" do field :style, ShapeStyle end + + def params(params) do + with {:ok, _} <- ShapeStyle.cast(params) do + [style: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/blend_mode.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/blend_mode.ex index 853506d30b..8a4ad9f32c 100644 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/blend_mode.ex +++ b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/blend_mode.ex @@ -26,4 +26,8 @@ defmodule LiveViewNativeSwiftUi.Modifiers.BlendMode do destination_out )a) end + + def params(blend_mode) when is_atom(blend_mode) and not is_boolean(blend_mode) and not is_nil(blend_mode), + do: [blend_mode: blend_mode] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/border.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/border.ex index b4f0c11772..ce78cec1ad 100644 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/border.ex +++ b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/border.ex @@ -7,4 +7,14 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Border do field :content, ShapeStyle field :width, :float, default: 1.0 end + + def params(content, [width: width]), do: [content: content, width: width] + def params(params) do + with {:ok, _} <- ShapeStyle.cast(params) do + [content: params, width: 1.0] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/brightness.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/brightness.ex index 4e924cebab..5858eeb57e 100644 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/brightness.ex +++ b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/brightness.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Brightness do modifier_schema "brightness" do field :amount, :float end + + def params(amount) when is_number(amount), do: [amount: amount] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/clip_shape.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/clip_shape.ex index 23375498cf..f75f017da2 100644 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/clip_shape.ex +++ b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/clip_shape.ex @@ -7,4 +7,14 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ClipShape do field :shape, Shape field :style, FillStyle end + + def params(shape, [style: style]), do: [shape: shape, style: style] + def params(params) do + with {:ok, _} <- Shape.cast(params) do + [shape: params, style: nil] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/color_multiply.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/color_multiply.ex index 69b61bbe47..ecc8eb29b0 100644 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/color_multiply.ex +++ b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/color_multiply.ex @@ -6,4 +6,13 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ColorMultiply do modifier_schema "color_multiply" do field :color, Color end + + def params(params) do + with {:ok, _} <- Color.cast(params) do + [color: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/contrast.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/contrast.ex index ed791bc066..5ef051555f 100644 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/contrast.ex +++ b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/contrast.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Contrast do modifier_schema "contrast" do field :amount, :float end + + def params(amount) when is_number(amount), do: [amount: amount] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/corner_radius.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/corner_radius.ex index ee68cabd76..5a00f061ca 100644 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/corner_radius.ex +++ b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/corner_radius.ex @@ -5,4 +5,8 @@ defmodule LiveViewNativeSwiftUi.Modifiers.CornerRadius do field(:radius, :float) field(:antialiased, :boolean, default: true) end + + def params(radius, [antialiased: antialiased]), do: [radius: radius, antialiased: antialiased] + def params(radius) when is_number(radius), do: [radius: radius] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/grayscale.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/grayscale.ex index a618a6cc72..437face9fa 100644 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/grayscale.ex +++ b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/grayscale.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Grayscale do modifier_schema "grayscale" do field :amount, :float end + + def params(amount) when is_number(amount), do: [amount: amount] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/hue_rotation.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/hue_rotation.ex index bf27f27fc6..3592dbc8fc 100644 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/hue_rotation.ex +++ b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/hue_rotation.ex @@ -6,4 +6,13 @@ defmodule LiveViewNativeSwiftUi.Modifiers.HueRotation do modifier_schema "hue_rotation" do field :angle, Angle end + + def params(params) do + with {:ok, _} <- Angle.cast(params) do + [angle: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/mask.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/mask.ex index 98c2dc5502..b58b878070 100644 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/mask.ex +++ b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/mask.ex @@ -17,6 +17,6 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Mask do trailing trailing_first_text_baseline )a, default: :center - field :content, KeyName + field :mask, KeyName end end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/projection_effect.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/projection_effect.ex index b5fdb79cbc..43efb6a584 100644 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/projection_effect.ex +++ b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/projection_effect.ex @@ -6,4 +6,13 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ProjectionEffect do modifier_schema "projection_effect" do field :transform, ProjectionTransform end + + def params(params) do + with {:ok, _} <- ProjectionTransform.cast(params) do + [transform: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/rotation_3d_effect.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/rotation_3d_effect.ex index 30fd6fcd0b..b2e039460b 100644 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/rotation_3d_effect.ex +++ b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/rotation_3d_effect.ex @@ -12,4 +12,14 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Rotation3DEffect do field :anchor_z, :float, default: 0.0 field :perspective, :float, default: 1.0 end + + def params(angle, [axis: axis, anchor: anchor, anchor_z: anchor_z, perspective: perspective]), + do: [ + angle: angle, + axis: axis, + anchor: anchor, + anchor_z: anchor_z, + perspective: perspective + ] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/rotation_effect.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/rotation_effect.ex index 744139f91b..15c14a8539 100644 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/rotation_effect.ex +++ b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/rotation_effect.ex @@ -8,4 +8,14 @@ defmodule LiveViewNativeSwiftUi.Modifiers.RotationEffect do field :angle, Angle field :anchor, UnitPoint end + + def params(angle, [anchor: anchor]), do: [angle: angle, anchor: anchor] + def params(params) do + with {:ok, _} <- Angle.cast(params) do + [angle: params, anchor: :center] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/saturation.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/saturation.ex index 8271288daf..e57e53a123 100644 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/saturation.ex +++ b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/saturation.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Saturation do modifier_schema "saturation" do field :amount, :float end + + def params(amount) when is_number(amount), do: [amount: amount] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/tint.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/tint.ex index cb2aa38958..d57003e7bd 100644 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/tint.ex +++ b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/tint.ex @@ -6,4 +6,13 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Tint do modifier_schema "tint" do field :color, Color end + + def params(params) do + with {:ok, _} <- Color.cast(params) do + [color: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/transform_effect.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/transform_effect.ex index 2982dba53a..6b1b464816 100644 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/transform_effect.ex +++ b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/transform_effect.ex @@ -6,4 +6,13 @@ defmodule LiveViewNativeSwiftUi.Modifiers.TransformEffect do modifier_schema "transform_effect" do field :transform, AffineTransform end + + def params(params) do + with {:ok, _} <- AffineTransform.cast(params) do + [transform: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/focus/focus_scope.ex b/lib/live_view_native_swift_ui/modifiers/focus/focus_scope.ex index 9d16dbd3ef..9e01c6fd59 100644 --- a/lib/live_view_native_swift_ui/modifiers/focus/focus_scope.ex +++ b/lib/live_view_native_swift_ui/modifiers/focus/focus_scope.ex @@ -6,4 +6,13 @@ defmodule LiveViewNativeSwiftUi.Modifiers.FocusScope do modifier_schema "focus_scope" do field :namespace, Namespace end + + def params(params) do + with {:ok, _} <- Namespace.cast(params) do + [namespace: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/focus/focusable.ex b/lib/live_view_native_swift_ui/modifiers/focus/focusable.ex index 10dac3b8a9..e49be41425 100644 --- a/lib/live_view_native_swift_ui/modifiers/focus/focusable.ex +++ b/lib/live_view_native_swift_ui/modifiers/focus/focusable.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Focusable do modifier_schema "focusable" do field :is_focusable, :boolean, default: true end + + def params(is_focusable) when is_boolean(is_focusable), do: [is_focusable: is_focusable] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/focus/prefers_default_focus.ex b/lib/live_view_native_swift_ui/modifiers/focus/prefers_default_focus.ex index be261260d2..e2c4f539fd 100644 --- a/lib/live_view_native_swift_ui/modifiers/focus/prefers_default_focus.ex +++ b/lib/live_view_native_swift_ui/modifiers/focus/prefers_default_focus.ex @@ -7,4 +7,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.PrefersDefaultFocus do field :prefers_default_focus, :boolean, default: true field :namespace, Namespace end + + # def params(prefers_default_focus \\ true, [in: namespace]), do: [prefers_default_focus: prefers_default_focus, namespace: namespace] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/gestures/defers_system_gestures.ex b/lib/live_view_native_swift_ui/modifiers/gestures/defers_system_gestures.ex index e1dcadaeea..dd1f697abd 100644 --- a/lib/live_view_native_swift_ui/modifiers/gestures/defers_system_gestures.ex +++ b/lib/live_view_native_swift_ui/modifiers/gestures/defers_system_gestures.ex @@ -6,4 +6,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.DefersSystemGestures do modifier_schema "defers_system_gestures" do field :edges, EdgeSet end + + def params([on: edges]), do: [edges: edges] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/gestures/gesture.ex b/lib/live_view_native_swift_ui/modifiers/gestures/gesture.ex index 255a97e7d1..e068f7d060 100644 --- a/lib/live_view_native_swift_ui/modifiers/gestures/gesture.ex +++ b/lib/live_view_native_swift_ui/modifiers/gestures/gesture.ex @@ -2,7 +2,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.OnTapGesture do use LiveViewNativePlatform.Modifier alias LiveViewNativeSwiftUi.Types.Gesture - alias LiveViewNativeSwiftUi.Types.Event + alias LiveViewNativePlatform.Types.Event modifier_schema "gesture" do field :gesture, Gesture @@ -10,4 +10,8 @@ defmodule LiveViewNativeSwiftUi.Modifiers.OnTapGesture do field :priority, Ecto.Enum, values: ~w(low high simultaneous)a, default: :low field :mask, Ecto.Enum, values: ~w(none gesture subviews all)a, default: :all end + + def params(gesture, [action: action, priority: priority, mask: mask]), + do: [gesture: gesture, action: action, priority: priority, mask: mask] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/images/antialiased.ex b/lib/live_view_native_swift_ui/modifiers/images/antialiased.ex index ed5ffa077d..a23556caf6 100644 --- a/lib/live_view_native_swift_ui/modifiers/images/antialiased.ex +++ b/lib/live_view_native_swift_ui/modifiers/images/antialiased.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Antialiased do modifier_schema "antialiased" do field :is_active, :boolean, default: true end + + def params(is_active) when is_boolean(is_active), do: [is_active: is_active] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/images/interpolation.ex b/lib/live_view_native_swift_ui/modifiers/images/interpolation.ex index a802f42b96..ee20a9bef0 100644 --- a/lib/live_view_native_swift_ui/modifiers/images/interpolation.ex +++ b/lib/live_view_native_swift_ui/modifiers/images/interpolation.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Interpolation do modifier_schema "interpolation" do field :interpolation, Ecto.Enum, values: ~w(low medium high none)a end + + def params(interpolation) when is_atom(interpolation) and not is_boolean(interpolation) and not is_nil(interpolation), do: [interpolation: interpolation] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/images/rendering_mode.ex b/lib/live_view_native_swift_ui/modifiers/images/rendering_mode.ex index 583db44e29..2b1011611c 100644 --- a/lib/live_view_native_swift_ui/modifiers/images/rendering_mode.ex +++ b/lib/live_view_native_swift_ui/modifiers/images/rendering_mode.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.RenderingMode do modifier_schema "rendering_mode" do field :mode, Ecto.Enum, values: ~w(original template)a end + + def params(mode) when is_atom(mode) and not is_boolean(mode) and not is_nil(mode), do: [mode: mode] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/images/symbol_rendering_mode.ex b/lib/live_view_native_swift_ui/modifiers/images/symbol_rendering_mode.ex index 7dc0b11b09..5b42fb2f39 100644 --- a/lib/live_view_native_swift_ui/modifiers/images/symbol_rendering_mode.ex +++ b/lib/live_view_native_swift_ui/modifiers/images/symbol_rendering_mode.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.SymbolRenderingMode do modifier_schema "symbol_rendering_mode" do field :mode, Ecto.Enum, values: ~w(hierarchical monochrome multicolor palette)a end + + def params(mode) when is_atom(mode) and not is_boolean(mode) and not is_nil(mode), do: [mode: mode] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/images/symbol_variant.ex b/lib/live_view_native_swift_ui/modifiers/images/symbol_variant.ex index 301068e544..de5659ab82 100644 --- a/lib/live_view_native_swift_ui/modifiers/images/symbol_variant.ex +++ b/lib/live_view_native_swift_ui/modifiers/images/symbol_variant.ex @@ -6,4 +6,13 @@ defmodule LiveViewNativeSwiftUi.Modifiers.SymbolVariant do modifier_schema "symbol_variant" do field :variant, SymbolVariants end + + def params(params) do + with {:ok, _} <- SymbolVariants.cast(params) do + [variant: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/input_events/allows_hit_testing.ex b/lib/live_view_native_swift_ui/modifiers/input_events/allows_hit_testing.ex index 4601e273d3..72fa94fad1 100644 --- a/lib/live_view_native_swift_ui/modifiers/input_events/allows_hit_testing.ex +++ b/lib/live_view_native_swift_ui/modifiers/input_events/allows_hit_testing.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.AllowsHitTesting do modifier_schema "allows_hit_testing" do field :enabled, :boolean end + + def params(enabled) when is_boolean(enabled), do: [enabled: enabled] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/input_events/digital_crown_accessory_visibility.ex b/lib/live_view_native_swift_ui/modifiers/input_events/digital_crown_accessory_visibility.ex index b14c5b41c7..b188a3503f 100644 --- a/lib/live_view_native_swift_ui/modifiers/input_events/digital_crown_accessory_visibility.ex +++ b/lib/live_view_native_swift_ui/modifiers/input_events/digital_crown_accessory_visibility.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.DigitalCrownAccessoryVisibility do modifier_schema "digital_crown_accessory_visibility" do field :visibility, Ecto.Enum, values: ~w(automatic visible hidden)a end + + def params(visibility) when is_atom(visibility) and not is_boolean(visibility) and not is_nil(visibility), do: [visibility: visibility] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/input_events/hover_effect.ex b/lib/live_view_native_swift_ui/modifiers/input_events/hover_effect.ex index 071e91b388..21027a7fe8 100644 --- a/lib/live_view_native_swift_ui/modifiers/input_events/hover_effect.ex +++ b/lib/live_view_native_swift_ui/modifiers/input_events/hover_effect.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.HoverEffect do modifier_schema "hover_effect" do field :effect, Ecto.Enum, values: ~w(automatic highlight lift)a, default: :automatic end + + def params(effect) when is_atom(effect) and not is_boolean(effect) and not is_nil(effect), do: [effect: effect] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/input_events/on_delete_command.ex b/lib/live_view_native_swift_ui/modifiers/input_events/on_delete_command.ex index eda8dfc541..326e98ceef 100644 --- a/lib/live_view_native_swift_ui/modifiers/input_events/on_delete_command.ex +++ b/lib/live_view_native_swift_ui/modifiers/input_events/on_delete_command.ex @@ -1,9 +1,9 @@ defmodule LiveViewNativeSwiftUi.Modifiers.OnDeleteCommand do use LiveViewNativePlatform.Modifier - alias LiveViewNativeSwiftUi.Types.Event + alias LiveViewNativePlatform.Types.Event modifier_schema "on_delete_command" do - field :action, Event + field :perform, Event end end diff --git a/lib/live_view_native_swift_ui/modifiers/input_events/on_hover.ex b/lib/live_view_native_swift_ui/modifiers/input_events/on_hover.ex index 137495421a..33fcf5bdf3 100644 --- a/lib/live_view_native_swift_ui/modifiers/input_events/on_hover.ex +++ b/lib/live_view_native_swift_ui/modifiers/input_events/on_hover.ex @@ -1,9 +1,9 @@ defmodule LiveViewNativeSwiftUi.Modifiers.OnHover do use LiveViewNativePlatform.Modifier - alias LiveViewNativeSwiftUi.Types.Event + alias LiveViewNativePlatform.Types.Event modifier_schema "on_hover" do - field :action, Event + field :perform, Event end end diff --git a/lib/live_view_native_swift_ui/modifiers/input_events/on_move_command.ex b/lib/live_view_native_swift_ui/modifiers/input_events/on_move_command.ex index 82427728d3..518e728ef3 100644 --- a/lib/live_view_native_swift_ui/modifiers/input_events/on_move_command.ex +++ b/lib/live_view_native_swift_ui/modifiers/input_events/on_move_command.ex @@ -1,7 +1,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.OnMoveCommand do use LiveViewNativePlatform.Modifier - alias LiveViewNativeSwiftUi.Types.Event + alias LiveViewNativePlatform.Types.Event modifier_schema "on_move_command" do field :action, Event diff --git a/lib/live_view_native_swift_ui/modifiers/input_events/on_submit.ex b/lib/live_view_native_swift_ui/modifiers/input_events/on_submit.ex index 34ec05c921..0505e7673a 100644 --- a/lib/live_view_native_swift_ui/modifiers/input_events/on_submit.ex +++ b/lib/live_view_native_swift_ui/modifiers/input_events/on_submit.ex @@ -2,10 +2,20 @@ defmodule LiveViewNativeSwiftUi.Modifiers.OnSubmit do use LiveViewNativePlatform.Modifier alias LiveViewNativeSwiftUi.Types.SubmitTriggers - alias LiveViewNativeSwiftUi.Types.Event + alias LiveViewNativePlatform.Types.Event modifier_schema "on_submit" do field :triggers, SubmitTriggers field :action, Event end + + def params([of: triggers], action), do: [triggers: triggers, action: action] + def params(params) do + with {:ok, _} <- Event.cast(params) do + [action: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/input_events/submit_scope.ex b/lib/live_view_native_swift_ui/modifiers/input_events/submit_scope.ex index 0168ccbd11..ec8454f53a 100644 --- a/lib/live_view_native_swift_ui/modifiers/input_events/submit_scope.ex +++ b/lib/live_view_native_swift_ui/modifiers/input_events/submit_scope.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.SubmitScope do modifier_schema "submit_scope" do field :is_blocking, :boolean, default: true end + + def params(is_blocking) when is_boolean(is_blocking), do: [is_blocking: is_blocking] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/coordinate_space.ex b/lib/live_view_native_swift_ui/modifiers/layout_adjustments/coordinate_space.ex index 1e7b33d75e..5baeaa88af 100644 --- a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/coordinate_space.ex +++ b/lib/live_view_native_swift_ui/modifiers/layout_adjustments/coordinate_space.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.CoordinateSpace do modifier_schema "coordinate_space" do field :name, :string end + + def params(name) when is_binary(name), do: [name: name] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/ignores_safe_area.ex b/lib/live_view_native_swift_ui/modifiers/layout_adjustments/ignores_safe_area.ex index 4247a0b22d..a0cf421532 100644 --- a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/ignores_safe_area.ex +++ b/lib/live_view_native_swift_ui/modifiers/layout_adjustments/ignores_safe_area.ex @@ -7,5 +7,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.IgnoresSafeArea do field :regions, Ecto.Enum, values: ~w(all container keyboard)a, default: :all field :edges, EdgeSet end -end + def params(regions, [edges: edges]), do: [regions: regions, edges: edges] + def params(params), do: params +end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/badge.ex b/lib/live_view_native_swift_ui/modifiers/lists/badge.ex index 94c2103092..87931367bf 100644 --- a/lib/live_view_native_swift_ui/modifiers/lists/badge.ex +++ b/lib/live_view_native_swift_ui/modifiers/lists/badge.ex @@ -8,4 +8,15 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Badge do field :label, :string field :count, :integer end + + def params(label) when is_binary(label), do: [label: label] + def params(count) when is_number(count), do: [count: count] + def params(params) do + with {:ok, _} <- KeyName.cast(params) do + [content: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/delete_disabled.ex b/lib/live_view_native_swift_ui/modifiers/lists/delete_disabled.ex index ec1c116a35..e0b476e9e5 100644 --- a/lib/live_view_native_swift_ui/modifiers/lists/delete_disabled.ex +++ b/lib/live_view_native_swift_ui/modifiers/lists/delete_disabled.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.DeleteDisabled do modifier_schema "delete_disabled" do field :is_disabled, :boolean end + + def params(is_disabled) when is_boolean(is_disabled), do: [is_disabled: is_disabled] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/disclosure_group_style.ex b/lib/live_view_native_swift_ui/modifiers/lists/disclosure_group_style.ex index 4e988c3d77..55b13e48bc 100644 --- a/lib/live_view_native_swift_ui/modifiers/lists/disclosure_group_style.ex +++ b/lib/live_view_native_swift_ui/modifiers/lists/disclosure_group_style.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.DisclosureGroupStyle do modifier_schema "disclosure_group_style" do field :style, Ecto.Enum, values: ~w(automatic)a end + + def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/header_prominence.ex b/lib/live_view_native_swift_ui/modifiers/lists/header_prominence.ex index f942297b71..21952870ff 100644 --- a/lib/live_view_native_swift_ui/modifiers/lists/header_prominence.ex +++ b/lib/live_view_native_swift_ui/modifiers/lists/header_prominence.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.HeaderProminence do modifier_schema "header_prominence" do field :prominence, Ecto.Enum, values: ~w(increased standard)a end -end \ No newline at end of file + + def params(prominence) when is_atom(prominence) and not is_boolean(prominence) and not is_nil(prominence), do: [prominence: prominence] + def params(params), do: params +end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/list_item_tint.ex b/lib/live_view_native_swift_ui/modifiers/lists/list_item_tint.ex index 5db32efeee..de1c7e053e 100644 --- a/lib/live_view_native_swift_ui/modifiers/lists/list_item_tint.ex +++ b/lib/live_view_native_swift_ui/modifiers/lists/list_item_tint.ex @@ -6,4 +6,13 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ListItemTint do modifier_schema "list_item_tint" do field :tint, ListItemTint end + + def params(params) do + with {:ok, _} <- ListItemTint.cast(params) do + [tint: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/list_row_background.ex b/lib/live_view_native_swift_ui/modifiers/lists/list_row_background.ex index 181585cb35..69a00e5895 100644 --- a/lib/live_view_native_swift_ui/modifiers/lists/list_row_background.ex +++ b/lib/live_view_native_swift_ui/modifiers/lists/list_row_background.ex @@ -6,4 +6,13 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ListRowBackground do modifier_schema "list_row_background" do field :content, KeyName end + + def params(params) do + with {:ok, _} <- KeyName.cast(params) do + [content: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/list_row_insets.ex b/lib/live_view_native_swift_ui/modifiers/lists/list_row_insets.ex index ccccdab02e..310f053e0e 100644 --- a/lib/live_view_native_swift_ui/modifiers/lists/list_row_insets.ex +++ b/lib/live_view_native_swift_ui/modifiers/lists/list_row_insets.ex @@ -6,4 +6,13 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ListRowInsets do modifier_schema "list_row_insets" do field :insets, EdgeInsets end + + def params(params) do + with {:ok, _} <- EdgeInsets.cast(params) do + [insets: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/list_row_separator.ex b/lib/live_view_native_swift_ui/modifiers/lists/list_row_separator.ex index 5a93a0135a..467ddb29b9 100644 --- a/lib/live_view_native_swift_ui/modifiers/lists/list_row_separator.ex +++ b/lib/live_view_native_swift_ui/modifiers/lists/list_row_separator.ex @@ -3,6 +3,10 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ListRowSeparator do modifier_schema "list_row_separator" do field :visibility, Ecto.Enum, values: ~w(automatic visible hidden)a - field :edges, Ecto.Enum, values: ~w(all bottom top)a + field :edges, Ecto.Enum, values: ~w(all bottom top)a, default: :all end + + def params(visibility, [edges: edges]), do: [visibility: visibility, edges: edges] + def params(visibility) when is_atom(visibility) and not is_boolean(visibility) and not is_nil(visibility), do: [visibility: visibility] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/list_row_separator_tint.ex b/lib/live_view_native_swift_ui/modifiers/lists/list_row_separator_tint.ex index 5d07eb1d17..75bace8335 100644 --- a/lib/live_view_native_swift_ui/modifiers/lists/list_row_separator_tint.ex +++ b/lib/live_view_native_swift_ui/modifiers/lists/list_row_separator_tint.ex @@ -7,4 +7,14 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ListRowSeparatorTint do field :color, Color field :edges, Ecto.Enum, values: ~w(all bottom top)a, default: :all end + + def params(color, [edges: edges]), do: [color: color, edges: edges] + def params(params) do + with {:ok, _} <- Color.cast(params) do + [color: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/list_section_separator.ex b/lib/live_view_native_swift_ui/modifiers/lists/list_section_separator.ex index 5edc212a07..39bb90e749 100644 --- a/lib/live_view_native_swift_ui/modifiers/lists/list_section_separator.ex +++ b/lib/live_view_native_swift_ui/modifiers/lists/list_section_separator.ex @@ -5,4 +5,8 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ListSectionSeparator do field :visibility, Ecto.Enum, values: ~w(automatic hidden visible)a field :edges, Ecto.Enum, values: ~w(all bottom top)a, default: :all end + + def params(visibility, [edges: edges]), do: [visibility: visibility, edges: edges] + def params(visibility) when is_atom(visibility) and not is_boolean(visibility) and not is_nil(visibility), do: [visibility: visibility] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/list_section_separator_tint.ex b/lib/live_view_native_swift_ui/modifiers/lists/list_section_separator_tint.ex index be4b47e780..b72902e8cc 100644 --- a/lib/live_view_native_swift_ui/modifiers/lists/list_section_separator_tint.ex +++ b/lib/live_view_native_swift_ui/modifiers/lists/list_section_separator_tint.ex @@ -7,4 +7,14 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ListSectionSeparatorTint do field :color, Color field :edges, Ecto.Enum, values: ~w(all bottom top)a, default: :all end + + def params(color, [edges: edges]), do: [color: color, edges: edges] + def params(params) do + with {:ok, _} <- Color.cast(params) do + [color: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/list_style.ex b/lib/live_view_native_swift_ui/modifiers/lists/list_style.ex index 12357c24b9..971e2471c8 100644 --- a/lib/live_view_native_swift_ui/modifiers/lists/list_style.ex +++ b/lib/live_view_native_swift_ui/modifiers/lists/list_style.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ListStyle do modifier_schema "list_style" do field :style, Ecto.Enum, values: ~w(automatic bordered bordered_alternating carousel elliptical grouped inset inset_grouped inset_alternating plain sidebar)a end + + def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/move_disabled.ex b/lib/live_view_native_swift_ui/modifiers/lists/move_disabled.ex index 301a5c497e..11e0ae37a5 100644 --- a/lib/live_view_native_swift_ui/modifiers/lists/move_disabled.ex +++ b/lib/live_view_native_swift_ui/modifiers/lists/move_disabled.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.MoveDisabled do modifier_schema "move_disabled" do field :is_disabled, :boolean end + + def params(is_disabled) when is_boolean(is_disabled), do: [is_disabled: is_disabled] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/refreshable.ex b/lib/live_view_native_swift_ui/modifiers/lists/refreshable.ex index 82fd033953..af78d39c4d 100644 --- a/lib/live_view_native_swift_ui/modifiers/lists/refreshable.ex +++ b/lib/live_view_native_swift_ui/modifiers/lists/refreshable.ex @@ -1,7 +1,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Refreshable do use LiveViewNativePlatform.Modifier - alias LiveViewNativeSwiftUi.Types.Event + alias LiveViewNativePlatform.Types.Event modifier_schema "refreshable" do field :action, Event diff --git a/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_action_dismiss_behavior.ex b/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_action_dismiss_behavior.ex index cb4cc90201..f786051d1b 100644 --- a/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_action_dismiss_behavior.ex +++ b/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_action_dismiss_behavior.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.MenuActionDismissBehavior do modifier_schema "menu_action_dismiss_behavior" do field(:behavior, Ecto.Enum, values: ~w(automatic enabled disabled)a) end + + def params(behavior) when is_atom(behavior) and not is_boolean(behavior) and not is_nil(behavior), do: [behavior: behavior] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_indicator_visibility.ex b/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_indicator_visibility.ex index ace2b15ec6..3a3b9b8be5 100644 --- a/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_indicator_visibility.ex +++ b/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_indicator_visibility.ex @@ -1,7 +1,10 @@ defmodule LiveViewNativeSwiftUi.Modifiers.MenuIndicatorVisibility do use LiveViewNativePlatform.Modifier - modifier_schema "menu_indicator_visibility" do + modifier_schema "menu_indicator" do field(:visibility, Ecto.Enum, values: ~w(automatic hidden visible)a) end + + def params(visibility) when is_atom(visibility) and not is_boolean(visibility) and not is_nil(visibility), do: [visibility: visibility] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_order.ex b/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_order.ex index 873df7363c..e60b3fd216 100644 --- a/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_order.ex +++ b/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_order.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.MenuOrder do modifier_schema "menu_order" do field(:order, Ecto.Enum, values: ~w(automatic fixed priority)a) end + + def params(order) when is_atom(order) and not is_boolean(order) and not is_nil(order), do: [order: order] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_style.ex b/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_style.ex index afa3a00c25..c149ba8416 100644 --- a/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_style.ex +++ b/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_style.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.MenuStyle do modifier_schema "menu_style" do field(:style, Ecto.Enum, values: ~w(automatic button)a) end + + def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/keyboard_shortcut.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/keyboard_shortcut.ex index f1d0e558f8..79ba38c9bc 100644 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/keyboard_shortcut.ex +++ b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/keyboard_shortcut.ex @@ -1,7 +1,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.KeyboardShortcut do use LiveViewNativePlatform.Modifier - alias LiveViewNativeSwiftUi.Types.EventModifier + alias LiveViewNativePlatform.Types.EventModifier alias LiveViewNativeSwiftUi.Types.KeyEquivalent modifier_schema "keyboard_shortcut" do diff --git a/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_appear.ex b/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_appear.ex index f41f0b439f..df9911ecae 100644 --- a/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_appear.ex +++ b/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_appear.ex @@ -1,7 +1,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.OnAppear do use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.Event + + alias LiveViewNativePlatform.Types.Event modifier_schema "on_appear" do field :action, Event diff --git a/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_disappear.ex b/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_disappear.ex index 7878782843..4bf434b9e2 100644 --- a/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_disappear.ex +++ b/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_disappear.ex @@ -1,7 +1,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.OnDisappear do use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.Event + + alias LiveViewNativePlatform.Types.Event modifier_schema "on_disappear" do field :action, Event diff --git a/lib/live_view_native_swift_ui/types/event.ex b/lib/live_view_native_swift_ui/types/event.ex deleted file mode 100644 index bada534220..0000000000 --- a/lib/live_view_native_swift_ui/types/event.ex +++ /dev/null @@ -1,20 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.Event do - @derive Jason.Encoder - defstruct [:event, :type, :params, :target, :debounce, :throttle] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - def cast(nil), do: {:ok, nil} - def cast(event) when is_bitstring(event), do: {:ok, %__MODULE__{event: event}} - - def cast(value) when is_map(value) do - value = - value - |> Map.update(:params, Jason.encode!(Map.new()), fn params -> Jason.encode!(params) end) - - {:ok, struct(__MODULE__, value)} - end - - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/event_modifier.ex b/lib/live_view_native_swift_ui/types/event_modifier.ex index c9908b06a5..b43925b393 100644 --- a/lib/live_view_native_swift_ui/types/event_modifier.ex +++ b/lib/live_view_native_swift_ui/types/event_modifier.ex @@ -1,4 +1,4 @@ -defmodule LiveViewNativeSwiftUi.Types.EventModifier do +defmodule LiveViewNativePlatform.Types.EventModifier do use LiveViewNativePlatform.Modifier.Type def type, do: {:array, :string} From 0ae9e6a58c53bd210da268081a398f1150bcc201 Mon Sep 17 00:00:00 2001 From: Carson Katri Date: Tue, 22 Aug 2023 16:15:33 -0400 Subject: [PATCH 2/4] Add more `params` impls --- .../HiddenModifier.swift | 21 +++--------------- .../OnAppearModifier.swift | 8 +++---- .../OnDisappearModifier.swift | 8 +++---- .../modifiers/documents/rename_action.ex | 2 +- .../drag_and_drop/drop_destination.ex | 2 +- .../modifiers/gestures/gesture.ex | 2 +- .../input_events/on_delete_command.ex | 2 +- .../modifiers/input_events/on_hover.ex | 2 +- .../modifiers/input_events/on_move_command.ex | 2 +- .../modifiers/input_events/on_submit.ex | 2 +- .../modifiers/lists/refreshable.ex | 2 +- .../modifiers/modal_presentations/alert.ex | 3 +++ .../confirmation_dialog.ex | 3 +++ .../modal_presentations/full_screen_cover.ex | 3 ++- .../interactive_dismiss_disabled.ex | 3 +++ .../presentation_background.ex | 3 +++ .../presentation_background_interaction.ex | 4 ++++ .../presentation_content_interaction.ex | 3 +++ .../presentation_corner_radius.ex | 3 +++ .../presentation_detents.ex | 11 ++++++++++ .../presentation_drag_indicator.ex | 3 +++ .../modifiers/modal_presentations/sheet.ex | 3 ++- .../navigation_bar_back_button_hidden.ex | 4 +++- .../navigation_bar_title_display_mode.ex | 3 +++ .../navigation/navigation_subtitle.ex | 3 +++ .../modifiers/navigation/navigation_title.ex | 3 +++ .../modifiers/navigation/tab_item.ex | 9 ++++++++ .../modifiers/navigation/tab_view_style.ex | 3 +++ .../scroll_views/scroll_bounce_behavior.ex | 4 ++++ .../scroll_views/scroll_content_background.ex | 2 ++ .../modifiers/scroll_views/scroll_disabled.ex | 3 +++ .../scroll_views/scroll_dismisses_keyboard.ex | 3 +++ .../scroll_views/scroll_indicators.ex | 4 ++++ .../modifiers/search/find_disabled.ex | 3 +++ .../modifiers/search/replace_disabled.ex | 2 ++ .../modifiers/search/search_completion.ex | 4 ++++ .../modifiers/search/search_scopes.ex | 3 +++ .../modifiers/search/search_suggestions.ex | 9 ++++++++ .../modifiers/shape/fill.ex | 10 +++++++++ .../modifiers/shape/inset.ex | 3 +++ .../modifiers/shape/rotation.ex | 10 +++++++++ .../modifiers/shape/stroke.ex | 10 +++++++++ .../modifiers/shape/stroke_border.ex | 10 +++++++++ .../modifiers/shape/trim.ex | 3 +++ .../modifiers/shapes/container_shape.ex | 9 ++++++++ .../modifiers/tables/table_style.ex | 3 +++ .../autocorrection_disabled.ex | 3 +++ .../text_input_and_output/baseline_offset.ex | 3 +++ ...lips_for_right_to_left_layout_direction.ex | 3 +++ .../modifiers/text_input_and_output/font.ex | 9 ++++++++ .../text_input_and_output/font_width.ex | 9 ++++++++ .../keyboard_shortcut.ex | 12 +++++++++- .../text_input_and_output/keyboard_type.ex | 3 +++ .../text_input_and_output/label_style.ex | 3 +++ .../text_input_and_output/line_limit.ex | 3 +++ .../minimum_scale_factor.ex | 4 +++- .../privacy_sensitive.ex | 3 +++ .../text_input_and_output/strikethrough.ex | 4 ++++ .../text_input_and_output/submit_label.ex | 2 ++ .../text_content_type.ex | 3 +++ .../text_input_and_output/text_field_style.ex | 3 +++ .../text_input_autocapitalization.ex | 3 +++ .../text_input_and_output/text_selection.ex | 3 +++ .../text_input_and_output/truncation_mode.ex | 3 +++ .../text_input_and_output/underline.ex | 4 ++++ .../modifiers/toolbar/toolbar_background.ex | 4 ++++ .../modifiers/toolbar/toolbar_color_scheme.ex | 3 +++ .../modifiers/toolbar/toolbar_role.ex | 3 +++ .../modifiers/toolbar/toolbar_visibility.ex | 3 +++ .../modifiers/view_configuration/help.ex | 3 +++ .../modifiers/view_configuration/hidden.ex | 7 +----- .../persistent_system_overlays.ex | 3 +++ .../view_configuration/status_bar_hidden.ex | 3 +++ .../modifiers/view_fundamentals/on_appear.ex | 4 ++-- .../view_fundamentals/on_disappear.ex | 4 ++-- .../view_groupings/control_group_style.ex | 3 +++ .../view_groupings/group_box_style.ex | 3 +++ .../modifiers/view_styles/content_shape.ex | 22 +++++++++++++++++++ .../modifiers/view_styles/index_view_style.ex | 3 +++ .../types/event_modifier.ex | 2 +- 80 files changed, 315 insertions(+), 50 deletions(-) diff --git a/Sources/LiveViewNative/Modifiers/View Configuration Modifiers/HiddenModifier.swift b/Sources/LiveViewNative/Modifiers/View Configuration Modifiers/HiddenModifier.swift index 1407939939..5f799b8318 100644 --- a/Sources/LiveViewNative/Modifiers/View Configuration Modifiers/HiddenModifier.swift +++ b/Sources/LiveViewNative/Modifiers/View Configuration Modifiers/HiddenModifier.swift @@ -10,28 +10,13 @@ import SwiftUI /// Hides any element. /// /// ```html -/// -/// This text is hidden -/// This text is visible -/// -/// -/// ## Arguments -/// * ``isActive`` +/// This text is hidden +/// ``` #if swift(>=5.8) @_documentation(visibility: public) #endif struct HiddenModifier: ViewModifier, Decodable { - /// A boolean indicating whether the view should be hidden. - #if swift(>=5.8) - @_documentation(visibility: public) - #endif - private var isActive: Bool - func body(content: Content) -> some View { - if isActive { - content.hidden() - } else { - content - } + content.hidden() } } diff --git a/Sources/LiveViewNative/Modifiers/View Fundamentals Modifiers/OnAppearModifier.swift b/Sources/LiveViewNative/Modifiers/View Fundamentals Modifiers/OnAppearModifier.swift index e98d96700b..8dfcb4305b 100644 --- a/Sources/LiveViewNative/Modifiers/View Fundamentals Modifiers/OnAppearModifier.swift +++ b/Sources/LiveViewNative/Modifiers/View Fundamentals Modifiers/OnAppearModifier.swift @@ -25,21 +25,21 @@ struct OnAppearModifier: ViewModifier, Decodable { #if swift(>=5.8) @_documentation(visibility: public) #endif - @Event private var action: Event.EventHandler + @Event private var perform: Event.EventHandler init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - self._action = try container.decode(Event.self, forKey: .action) + self._perform = try container.decode(Event.self, forKey: .perform) } func body(content: Content) -> some View { content.onAppear { - self.action() + self.perform() } } enum CodingKeys: String, CodingKey { - case action + case perform } } diff --git a/Sources/LiveViewNative/Modifiers/View Fundamentals Modifiers/OnDisappearModifier.swift b/Sources/LiveViewNative/Modifiers/View Fundamentals Modifiers/OnDisappearModifier.swift index 43a9a505b3..3462de9f80 100644 --- a/Sources/LiveViewNative/Modifiers/View Fundamentals Modifiers/OnDisappearModifier.swift +++ b/Sources/LiveViewNative/Modifiers/View Fundamentals Modifiers/OnDisappearModifier.swift @@ -25,21 +25,21 @@ struct OnDisappearModifier: ViewModifier, Decodable { #if swift(>=5.8) @_documentation(visibility: public) #endif - @Event private var action: Event.EventHandler + @Event private var perform: Event.EventHandler init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - self._action = try container.decode(Event.self, forKey: .action) + self._perform = try container.decode(Event.self, forKey: .perform) } func body(content: Content) -> some View { content.onDisappear { - self.action() + self.perform() } } enum CodingKeys: String, CodingKey { - case action + case perform } } diff --git a/lib/live_view_native_swift_ui/modifiers/documents/rename_action.ex b/lib/live_view_native_swift_ui/modifiers/documents/rename_action.ex index f62b2563ef..1a4d249d3c 100644 --- a/lib/live_view_native_swift_ui/modifiers/documents/rename_action.ex +++ b/lib/live_view_native_swift_ui/modifiers/documents/rename_action.ex @@ -1,7 +1,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.RenameAction do use LiveViewNativePlatform.Modifier - alias LiveViewNativePlatform.Types.Event + alias LiveViewNativePlatform.Modifier.Types.Event modifier_schema "rename_action" do field :action, Event diff --git a/lib/live_view_native_swift_ui/modifiers/drag_and_drop/drop_destination.ex b/lib/live_view_native_swift_ui/modifiers/drag_and_drop/drop_destination.ex index 6ad3a9b2ec..691b31b9b6 100644 --- a/lib/live_view_native_swift_ui/modifiers/drag_and_drop/drop_destination.ex +++ b/lib/live_view_native_swift_ui/modifiers/drag_and_drop/drop_destination.ex @@ -1,7 +1,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.DropDestination do use LiveViewNativePlatform.Modifier - alias LiveViewNativePlatform.Types.Event + alias LiveViewNativePlatform.Modifier.Types.Event modifier_schema "drop_destination" do field :action, Event diff --git a/lib/live_view_native_swift_ui/modifiers/gestures/gesture.ex b/lib/live_view_native_swift_ui/modifiers/gestures/gesture.ex index e068f7d060..7d2a8065de 100644 --- a/lib/live_view_native_swift_ui/modifiers/gestures/gesture.ex +++ b/lib/live_view_native_swift_ui/modifiers/gestures/gesture.ex @@ -2,7 +2,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.OnTapGesture do use LiveViewNativePlatform.Modifier alias LiveViewNativeSwiftUi.Types.Gesture - alias LiveViewNativePlatform.Types.Event + alias LiveViewNativePlatform.Modifier.Types.Event modifier_schema "gesture" do field :gesture, Gesture diff --git a/lib/live_view_native_swift_ui/modifiers/input_events/on_delete_command.ex b/lib/live_view_native_swift_ui/modifiers/input_events/on_delete_command.ex index 326e98ceef..e0ee7eb3f3 100644 --- a/lib/live_view_native_swift_ui/modifiers/input_events/on_delete_command.ex +++ b/lib/live_view_native_swift_ui/modifiers/input_events/on_delete_command.ex @@ -1,7 +1,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.OnDeleteCommand do use LiveViewNativePlatform.Modifier - alias LiveViewNativePlatform.Types.Event + alias LiveViewNativePlatform.Modifier.Types.Event modifier_schema "on_delete_command" do field :perform, Event diff --git a/lib/live_view_native_swift_ui/modifiers/input_events/on_hover.ex b/lib/live_view_native_swift_ui/modifiers/input_events/on_hover.ex index 33fcf5bdf3..ee322249b0 100644 --- a/lib/live_view_native_swift_ui/modifiers/input_events/on_hover.ex +++ b/lib/live_view_native_swift_ui/modifiers/input_events/on_hover.ex @@ -1,7 +1,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.OnHover do use LiveViewNativePlatform.Modifier - alias LiveViewNativePlatform.Types.Event + alias LiveViewNativePlatform.Modifier.Types.Event modifier_schema "on_hover" do field :perform, Event diff --git a/lib/live_view_native_swift_ui/modifiers/input_events/on_move_command.ex b/lib/live_view_native_swift_ui/modifiers/input_events/on_move_command.ex index 518e728ef3..b6efe4db1f 100644 --- a/lib/live_view_native_swift_ui/modifiers/input_events/on_move_command.ex +++ b/lib/live_view_native_swift_ui/modifiers/input_events/on_move_command.ex @@ -1,7 +1,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.OnMoveCommand do use LiveViewNativePlatform.Modifier - alias LiveViewNativePlatform.Types.Event + alias LiveViewNativePlatform.Modifier.Types.Event modifier_schema "on_move_command" do field :action, Event diff --git a/lib/live_view_native_swift_ui/modifiers/input_events/on_submit.ex b/lib/live_view_native_swift_ui/modifiers/input_events/on_submit.ex index 0505e7673a..dcbc4de16a 100644 --- a/lib/live_view_native_swift_ui/modifiers/input_events/on_submit.ex +++ b/lib/live_view_native_swift_ui/modifiers/input_events/on_submit.ex @@ -2,7 +2,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.OnSubmit do use LiveViewNativePlatform.Modifier alias LiveViewNativeSwiftUi.Types.SubmitTriggers - alias LiveViewNativePlatform.Types.Event + alias LiveViewNativePlatform.Modifier.Types.Event modifier_schema "on_submit" do field :triggers, SubmitTriggers diff --git a/lib/live_view_native_swift_ui/modifiers/lists/refreshable.ex b/lib/live_view_native_swift_ui/modifiers/lists/refreshable.ex index af78d39c4d..98590e9e8b 100644 --- a/lib/live_view_native_swift_ui/modifiers/lists/refreshable.ex +++ b/lib/live_view_native_swift_ui/modifiers/lists/refreshable.ex @@ -1,7 +1,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Refreshable do use LiveViewNativePlatform.Modifier - alias LiveViewNativePlatform.Types.Event + alias LiveViewNativePlatform.Modifier.Types.Event modifier_schema "refreshable" do field :action, Event diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/alert.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/alert.ex index e332dcd560..556e2104d0 100644 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/alert.ex +++ b/lib/live_view_native_swift_ui/modifiers/modal_presentations/alert.ex @@ -11,4 +11,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Alert do change_event() end + + def params(title, params) when is_binary(title) and is_list(params), do: [{:title, title} | params] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/confirmation_dialog.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/confirmation_dialog.ex index e1e40b32c2..e5c4894edc 100644 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/confirmation_dialog.ex +++ b/lib/live_view_native_swift_ui/modifiers/modal_presentations/confirmation_dialog.ex @@ -14,4 +14,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ConfirmationDialog do change_event() end + + def params(title, params) when is_binary(title) and is_list(params), do: [{:title, title} | params] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/full_screen_cover.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/full_screen_cover.ex index efb4ab40c6..0fa89f8e65 100644 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/full_screen_cover.ex +++ b/lib/live_view_native_swift_ui/modifiers/modal_presentations/full_screen_cover.ex @@ -1,7 +1,8 @@ defmodule LiveViewNativeSwiftUi.Modifiers.FullScreenCover do use LiveViewNativePlatform.Modifier - alias LiveViewNativeSwiftUi.Types.{Event, KeyName} + alias LiveViewNativeSwiftUi.Types.KeyName + alias LiveViewNativePlatform.Modifier.Types.Event modifier_schema "full_screen_cover" do field(:is_presented, :boolean) diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/interactive_dismiss_disabled.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/interactive_dismiss_disabled.ex index 1d974b7d03..62e7555edb 100644 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/interactive_dismiss_disabled.ex +++ b/lib/live_view_native_swift_ui/modifiers/modal_presentations/interactive_dismiss_disabled.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.InteractiveDismissDisabled do modifier_schema "interactive_dismiss_disabled" do field(:disabled, :boolean, default: true) end + + def params(disabled) when is_boolean(disabled), do: [disabled: disabled] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_background.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_background.ex index 53d3262fe0..ce416f0aa9 100644 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_background.ex +++ b/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_background.ex @@ -25,4 +25,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.PresentationBackground do field(:content, KeyName, default: nil) end + + def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_background_interaction.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_background_interaction.ex index 4b91e4e3d7..3b468ccb42 100644 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_background_interaction.ex +++ b/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_background_interaction.ex @@ -7,4 +7,8 @@ defmodule LiveViewNativeSwiftUi.Modifiers.PresentationBackgroundInteraction do field(:mode, Ecto.Enum, values: ~w(automatic disabled enabled)a) field(:maximum_detent, PresentationDetent, default: nil) end + + def params(mode) when is_atom(mode) and not is_boolean(mode) and not is_nil(mode), do: [mode: mode] + def params({:enabled = mode, [up_through: maximum_detent]}), do: [mode: mode, maximum_detent: maximum_detent] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_content_interaction.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_content_interaction.ex index 7c9926e2fd..012a30112e 100644 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_content_interaction.ex +++ b/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_content_interaction.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.PresentationContentInteraction do modifier_schema "presentation_content_interaction" do field(:interaction, Ecto.Enum, values: ~w(automatic resizes scrolls)a) end + + def params(interaction) when is_atom(interaction) and not is_boolean(interaction) and not is_nil(interaction), do: [interaction: interaction] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_corner_radius.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_corner_radius.ex index c76cf409d4..5ae8d50a3a 100644 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_corner_radius.ex +++ b/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_corner_radius.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.PresentationCornerRadius do modifier_schema "presentation_corner_radius" do field(:radius, :float) end + + def params(radius) when is_number(radius), do: [radius: radius] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_detents.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_detents.ex index 68a5ca209e..6c0fb6916a 100644 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_detents.ex +++ b/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_detents.ex @@ -9,4 +9,15 @@ defmodule LiveViewNativeSwiftUi.Modifiers.PresentationDetents do change_event() end + + def params(detents, [selection: selection]), do: [detents: detents, selection: selection] + def params([detent | _] = params) do + with {:ok, _} <- PresentationDetent.cast(detent) do + [detents: params] + else + _ -> + params + end + end + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_drag_indicator.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_drag_indicator.ex index 99307c7df8..7f964876db 100644 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_drag_indicator.ex +++ b/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_drag_indicator.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.PresentationDragIndicator do modifier_schema "presentation_drag_indicator" do field(:visibility, Ecto.Enum, values: ~w(automatic visible hidden)a) end + + def params(visibility) when is_atom(visibility) and not is_boolean(visibility) and not is_nil(visibility), do: [visibility: visibility] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/sheet.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/sheet.ex index bf2a1b206e..961a6f0887 100644 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/sheet.ex +++ b/lib/live_view_native_swift_ui/modifiers/modal_presentations/sheet.ex @@ -1,7 +1,8 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Sheet do use LiveViewNativePlatform.Modifier - alias LiveViewNativeSwiftUi.Types.{Event, KeyName} + alias LiveViewNativeSwiftUi.Types.KeyName + alias LiveViewNativePlatform.Modifier.Types.Event modifier_schema "sheet" do field(:is_presented, :boolean) diff --git a/lib/live_view_native_swift_ui/modifiers/navigation/navigation_bar_back_button_hidden.ex b/lib/live_view_native_swift_ui/modifiers/navigation/navigation_bar_back_button_hidden.ex index ca6c59241d..5ca1d51271 100644 --- a/lib/live_view_native_swift_ui/modifiers/navigation/navigation_bar_back_button_hidden.ex +++ b/lib/live_view_native_swift_ui/modifiers/navigation/navigation_bar_back_button_hidden.ex @@ -4,5 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.NavigationBarBackButtonHidden do modifier_schema "navigation_bar_back_button_hidden" do field :hides_back_button, :boolean, default: true end -end + def params(hides_back_button) when is_boolean(hides_back_button), do: [hides_back_button: hides_back_button] + def params(params), do: params +end diff --git a/lib/live_view_native_swift_ui/modifiers/navigation/navigation_bar_title_display_mode.ex b/lib/live_view_native_swift_ui/modifiers/navigation/navigation_bar_title_display_mode.ex index f718696edb..439040e3e2 100644 --- a/lib/live_view_native_swift_ui/modifiers/navigation/navigation_bar_title_display_mode.ex +++ b/lib/live_view_native_swift_ui/modifiers/navigation/navigation_bar_title_display_mode.ex @@ -8,4 +8,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.NavigationBarTitleDisplayMode do large )a) end + + def params(display_mode) when is_atom(display_mode) and not is_boolean(display_mode) and not is_nil(display_mode), do: [display_mode: display_mode] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/navigation/navigation_subtitle.ex b/lib/live_view_native_swift_ui/modifiers/navigation/navigation_subtitle.ex index b04c5c9455..52a16a1f74 100644 --- a/lib/live_view_native_swift_ui/modifiers/navigation/navigation_subtitle.ex +++ b/lib/live_view_native_swift_ui/modifiers/navigation/navigation_subtitle.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.NavigationSubtitle do modifier_schema "navigation_subtitle" do field :subtitle, :string end + + def params(subtitle) when is_binary(subtitle), do: [subtitle: subtitle] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/navigation/navigation_title.ex b/lib/live_view_native_swift_ui/modifiers/navigation/navigation_title.ex index 5c9e80ff01..fb4708f0be 100644 --- a/lib/live_view_native_swift_ui/modifiers/navigation/navigation_title.ex +++ b/lib/live_view_native_swift_ui/modifiers/navigation/navigation_title.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.NavigationTitle do modifier_schema "navigation_title" do field :title, :string end + + def params(title) when is_binary(title), do: [title: title] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/navigation/tab_item.ex b/lib/live_view_native_swift_ui/modifiers/navigation/tab_item.ex index e57d6d990e..b8f476188c 100644 --- a/lib/live_view_native_swift_ui/modifiers/navigation/tab_item.ex +++ b/lib/live_view_native_swift_ui/modifiers/navigation/tab_item.ex @@ -6,4 +6,13 @@ defmodule LiveViewNativeSwiftUi.Modifiers.TabItem do modifier_schema "tab_item" do field :label, KeyName end + + def params(params) do + with {:ok, _} <- KeyName.cast(params) do + [label: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/navigation/tab_view_style.ex b/lib/live_view_native_swift_ui/modifiers/navigation/tab_view_style.ex index 7cc2729f88..559688901c 100644 --- a/lib/live_view_native_swift_ui/modifiers/navigation/tab_view_style.ex +++ b/lib/live_view_native_swift_ui/modifiers/navigation/tab_view_style.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.TabViewStyle do modifier_schema "tab_view_style" do field :style, Ecto.Enum, values: ~w(automatic carousel page page_always page_never)a end + + def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_bounce_behavior.ex b/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_bounce_behavior.ex index 3d7faa7b07..d3f53517bf 100644 --- a/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_bounce_behavior.ex +++ b/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_bounce_behavior.ex @@ -5,4 +5,8 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ScrollBounceBehavior do field :behavior, Ecto.Enum, values: ~w(automatic always based_on_size)a field :axes, Ecto.Enum, values: [:horizontal, :vertical, :all], default: :vertical end + + def params(behavior, params) when is_list(params), do: [{:behavior, behavior} | params] + def params(behavior) when is_atom(behavior) and not is_boolean(behavior) and not is_nil(behavior), do: [behavior: behavior] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_content_background.ex b/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_content_background.ex index 65cec91754..1701fa6d5d 100644 --- a/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_content_background.ex +++ b/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_content_background.ex @@ -4,4 +4,6 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ScrollContentBackground do modifier_schema "scroll_content_background" do field :visibility, Ecto.Enum, values: ~w(automatic visible hidden)a end + + def params(visibility) when is_atom(visibility) and not is_boolean(visibility) and not is_nil(visibility), do: [visibility: visibility] end diff --git a/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_disabled.ex b/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_disabled.ex index fd5dfb0350..027cd35035 100644 --- a/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_disabled.ex +++ b/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_disabled.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ScrollDisabled do modifier_schema "scroll_disabled" do field :disabled, :boolean end + + def params(disabled) when is_boolean(disabled), do: [disabled: disabled] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_dismisses_keyboard.ex b/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_dismisses_keyboard.ex index 9c19e8eb65..2dcd78e43d 100644 --- a/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_dismisses_keyboard.ex +++ b/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_dismisses_keyboard.ex @@ -9,4 +9,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ScrollDismissesKeyboard do never )a end + + def params(mode) when is_atom(mode) and not is_boolean(mode) and not is_nil(mode), do: [mode: mode] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_indicators.ex b/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_indicators.ex index 7fcdcb1625..0f53193a91 100644 --- a/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_indicators.ex +++ b/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_indicators.ex @@ -5,4 +5,8 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ScrollIndicators do field :visibility, Ecto.Enum, values: ~w(automatic hidden never visible)a field :axes, Ecto.Enum, values: [:horizontal, :vertical, :all], default: :all end + + def params(visibility, params) when is_list(params), do: [{:visibility, visibility} | params] + def params(visibility) when is_atom(visibility) and not is_boolean(visibility) and not is_nil(visibility), do: [visibility: visibility] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/search/find_disabled.ex b/lib/live_view_native_swift_ui/modifiers/search/find_disabled.ex index eeaddb6a2d..428fa1b390 100644 --- a/lib/live_view_native_swift_ui/modifiers/search/find_disabled.ex +++ b/lib/live_view_native_swift_ui/modifiers/search/find_disabled.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.FindDisabled do modifier_schema "find_disabled" do field :disabled, :boolean, default: true end + + def params(disabled) when is_boolean(disabled), do: [disabled: disabled] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/search/replace_disabled.ex b/lib/live_view_native_swift_ui/modifiers/search/replace_disabled.ex index e13b76a0e7..c71943a27f 100644 --- a/lib/live_view_native_swift_ui/modifiers/search/replace_disabled.ex +++ b/lib/live_view_native_swift_ui/modifiers/search/replace_disabled.ex @@ -4,4 +4,6 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ReplaceDisabled do modifier_schema "replace_disabled" do field :disabled, :boolean, default: true end + + def params(disabled) when is_boolean(disabled), do: [disabled: disabled] end diff --git a/lib/live_view_native_swift_ui/modifiers/search/search_completion.ex b/lib/live_view_native_swift_ui/modifiers/search/search_completion.ex index d0658d251e..92c21f1b68 100644 --- a/lib/live_view_native_swift_ui/modifiers/search/search_completion.ex +++ b/lib/live_view_native_swift_ui/modifiers/search/search_completion.ex @@ -5,4 +5,8 @@ defmodule LiveViewNativeSwiftUi.Modifiers.SearchCompletion do field :completion, :string field :token, :string end + + def params(token) when is_atom(token) and not is_boolean(token) and not is_nil(token), do: [token: token] + def params(completion) when is_binary(completion), do: [completion: completion] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/search/search_scopes.ex b/lib/live_view_native_swift_ui/modifiers/search/search_scopes.ex index 5dae11fc5e..f75dbc07eb 100644 --- a/lib/live_view_native_swift_ui/modifiers/search/search_scopes.ex +++ b/lib/live_view_native_swift_ui/modifiers/search/search_scopes.ex @@ -10,4 +10,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.SearchScopes do change_event() end + + def params(active, params) when is_list(params), do: [{:active, active} | params] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/search/search_suggestions.ex b/lib/live_view_native_swift_ui/modifiers/search/search_suggestions.ex index b34668dd10..d40d69ebc2 100644 --- a/lib/live_view_native_swift_ui/modifiers/search/search_suggestions.ex +++ b/lib/live_view_native_swift_ui/modifiers/search/search_suggestions.ex @@ -6,4 +6,13 @@ defmodule LiveViewNativeSwiftUi.Modifiers.SearchSuggestions do modifier_schema "search_suggestions" do field :suggestions, KeyName end + + def params(params) do + with {:ok, _} <- KeyName.cast(params) do + [suggestions: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/shape/fill.ex b/lib/live_view_native_swift_ui/modifiers/shape/fill.ex index e3cca5677a..67779d754a 100644 --- a/lib/live_view_native_swift_ui/modifiers/shape/fill.ex +++ b/lib/live_view_native_swift_ui/modifiers/shape/fill.ex @@ -7,4 +7,14 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Fill do field :content, ShapeStyle field :style, FillStyle end + + def params(content, params) when is_list(params), do: [{:content, content} | params] + def params(params) do + with {:ok, _} <- ShapeStyle.cast(params) do + [content: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/shape/inset.ex b/lib/live_view_native_swift_ui/modifiers/shape/inset.ex index bff496eb60..5cea91db47 100644 --- a/lib/live_view_native_swift_ui/modifiers/shape/inset.ex +++ b/lib/live_view_native_swift_ui/modifiers/shape/inset.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Inset do modifier_schema "inset" do field :amount, :float end + + def params([by: amount]), do: [amount: amount] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/shape/rotation.ex b/lib/live_view_native_swift_ui/modifiers/shape/rotation.ex index 8d3b70e4c9..d542045755 100644 --- a/lib/live_view_native_swift_ui/modifiers/shape/rotation.ex +++ b/lib/live_view_native_swift_ui/modifiers/shape/rotation.ex @@ -7,4 +7,14 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Rotation do field :angle, Angle field :anchor, UnitPoint end + + def params(angle, params) when is_list(params), do: [{:angle, angle} | params] + def params(params) do + with {:ok, _} <- Angle.cast(params) do + [angle: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/shape/stroke.ex b/lib/live_view_native_swift_ui/modifiers/shape/stroke.ex index 44eb777e4a..3a836d962f 100644 --- a/lib/live_view_native_swift_ui/modifiers/shape/stroke.ex +++ b/lib/live_view_native_swift_ui/modifiers/shape/stroke.ex @@ -7,4 +7,14 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Stroke do field :content, ShapeStyle field :style, StrokeStyle end + + def params(content, params) when is_list(params), do: [{:content, content} | params] + def params(params) do + with {:ok, _} <- ShapeStyle.cast(params) do + [content: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/shape/stroke_border.ex b/lib/live_view_native_swift_ui/modifiers/shape/stroke_border.ex index 6fe661cc48..707b50ec25 100644 --- a/lib/live_view_native_swift_ui/modifiers/shape/stroke_border.ex +++ b/lib/live_view_native_swift_ui/modifiers/shape/stroke_border.ex @@ -8,4 +8,14 @@ defmodule LiveViewNativeSwiftUi.Modifiers.StrokeBorder do field :style, StrokeStyle field :antialiased, :boolean, default: true end + + def params(content, params) when is_list(params), do: [{:content, content} | params] + def params(params) do + with {:ok, _} <- ShapeStyle.cast(params) do + [content: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/shape/trim.ex b/lib/live_view_native_swift_ui/modifiers/shape/trim.ex index bdd3cad7bb..1ae006236c 100644 --- a/lib/live_view_native_swift_ui/modifiers/shape/trim.ex +++ b/lib/live_view_native_swift_ui/modifiers/shape/trim.ex @@ -5,4 +5,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Trim do field :start_fraction, :float, default: 0.0 field :end_fraction, :float, default: 1.0 end + + def params([from: start_fraction, to: end_fraction]), do: [start_fraction: start_fraction, end_fraction: end_fraction] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/shapes/container_shape.ex b/lib/live_view_native_swift_ui/modifiers/shapes/container_shape.ex index 547819f3d1..fb853cdf7f 100644 --- a/lib/live_view_native_swift_ui/modifiers/shapes/container_shape.ex +++ b/lib/live_view_native_swift_ui/modifiers/shapes/container_shape.ex @@ -6,4 +6,13 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ContainerShape do modifier_schema "container_shape" do field :shape, Shape end + + def params(params) do + with {:ok, _} <- Shape.cast(params) do + [shape: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/tables/table_style.ex b/lib/live_view_native_swift_ui/modifiers/tables/table_style.ex index 3ec428bd15..b632d9a714 100644 --- a/lib/live_view_native_swift_ui/modifiers/tables/table_style.ex +++ b/lib/live_view_native_swift_ui/modifiers/tables/table_style.ex @@ -10,4 +10,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.TableStyle do bordered_alternates_row_backgrounds )a end + + def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/autocorrection_disabled.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/autocorrection_disabled.ex index 303f4b7dc0..cf8253c204 100644 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/autocorrection_disabled.ex +++ b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/autocorrection_disabled.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.AutocorrectionDisabled do modifier_schema "autocorrection_disabled" do field :disable, :boolean, default: true end + + def params(disable) when is_boolean(disable), do: [disable: disable] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/baseline_offset.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/baseline_offset.ex index 763d13bb5c..efe9bc4a79 100644 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/baseline_offset.ex +++ b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/baseline_offset.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.BaselineOffset do modifier_schema "baseline_offset" do field :offset, :float end + + def params(offset) when is_number(offset), do: [offset: offset] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/flips_for_right_to_left_layout_direction.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/flips_for_right_to_left_layout_direction.ex index d460c25595..8a250fcd0c 100644 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/flips_for_right_to_left_layout_direction.ex +++ b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/flips_for_right_to_left_layout_direction.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.FlipsForRightToLeftLayoutDirection do modifier_schema "flips_for_right_to_left_layout_direction" do field :enabled, :boolean end + + def params(enabled) when is_boolean(enabled), do: [enabled: enabled] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/font.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/font.ex index 960dd4a51b..78e5b36a40 100644 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/font.ex +++ b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/font.ex @@ -6,4 +6,13 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Font do modifier_schema "font" do field :font, Font end + + def params(params) do + with {:ok, _} <- Font.cast(params) do + [font: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/font_width.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/font_width.ex index efac4c21b3..8ab005c630 100644 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/font_width.ex +++ b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/font_width.ex @@ -6,4 +6,13 @@ defmodule LiveViewNativeSwiftUi.Modifiers.FontWidth do modifier_schema "font_width" do field :width, FontWidth end + + def params(params) do + with {:ok, _} <- FontWidth.cast(params) do + [width: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/keyboard_shortcut.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/keyboard_shortcut.ex index 79ba38c9bc..eb0147d358 100644 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/keyboard_shortcut.ex +++ b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/keyboard_shortcut.ex @@ -1,11 +1,21 @@ defmodule LiveViewNativeSwiftUi.Modifiers.KeyboardShortcut do use LiveViewNativePlatform.Modifier - alias LiveViewNativePlatform.Types.EventModifier + alias LiveViewNativePlatform.Modifier.Types.EventModifier alias LiveViewNativeSwiftUi.Types.KeyEquivalent modifier_schema "keyboard_shortcut" do field :key, KeyEquivalent field :modifiers, EventModifier end + + def params(key, params) when is_list(params), do: [{:key, key} | params] + def params(params) do + with {:ok, _} <- KeyEquivalent.cast(params) do + [key: params] + else + _ -> + params + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/keyboard_type.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/keyboard_type.ex index da4a48d30a..a9742f5711 100644 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/keyboard_type.ex +++ b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/keyboard_type.ex @@ -16,4 +16,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.KeyboardType do ascii_capable_number_pad )a end + + def params(keyboard_type) when is_atom(keyboard_type) and not is_boolean(keyboard_type) and not is_nil(keyboard_type), do: [keyboard_type: keyboard_type] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/label_style.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/label_style.ex index b0ef830d0d..f8dbc2dbae 100644 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/label_style.ex +++ b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/label_style.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.LabelStyle do modifier_schema "label_style" do field :style, Ecto.Enum, values: ~w(automatic icon_only title_and_icon title_only)a end + + def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/line_limit.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/line_limit.ex index 7ff7831203..8139d3e8f2 100644 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/line_limit.ex +++ b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/line_limit.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.LineLimit do modifier_schema "line_limit" do field :number, :integer end + + def params(number) when is_integer(number), do: [number: number] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/minimum_scale_factor.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/minimum_scale_factor.ex index 2838c56750..1a04496d4d 100644 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/minimum_scale_factor.ex +++ b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/minimum_scale_factor.ex @@ -4,5 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.MinimumScaleFactor do modifier_schema "minimum_scale_factor" do field :factor, :float end -end + def params(factor) when is_number(factor), do: [factor: factor] + def params(params), do: params +end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/privacy_sensitive.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/privacy_sensitive.ex index 39ea00bbc3..ab57cb2b44 100644 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/privacy_sensitive.ex +++ b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/privacy_sensitive.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.PrivacySensitive do modifier_schema "privacy_sensitive" do field :sensitive, :boolean end + + def params(sensitive) when is_boolean(sensitive), do: [sensitive: sensitive] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/strikethrough.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/strikethrough.ex index 736baec583..681ff9e038 100644 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/strikethrough.ex +++ b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/strikethrough.ex @@ -8,4 +8,8 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Strikethrough do field :pattern, Ecto.Enum, values: ~w(dash dash_dot dash_dot_dot dot solid)a, default: :solid field :color, Color end + + def params(is_active, params) when is_list(params), do: [{:is_active, is_active} | params] + def params(is_active) when is_boolean(is_active), do: [is_active: is_active] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/submit_label.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/submit_label.ex index ad3ab2075e..56ad47fa0a 100644 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/submit_label.ex +++ b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/submit_label.ex @@ -14,4 +14,6 @@ defmodule LiveViewNativeSwiftUi.Modifiers.SubmitLabel do continue )a) end + + def params(submit_label) when is_atom(submit_label) and not is_boolean(submit_label) and not is_nil(submit_label), do: [submit_label: submit_label] end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_content_type.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_content_type.ex index 25d66b0edd..9788cd36e3 100644 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_content_type.ex +++ b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_content_type.ex @@ -35,4 +35,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.TextContentType do shipment_tracking_number )a) end + + def params(text_content_type) when is_atom(text_content_type) and not is_boolean(text_content_type) and not is_nil(text_content_type), do: [text_content_type: text_content_type] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_field_style.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_field_style.ex index 6e92cb5233..0b8ef0ed5b 100644 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_field_style.ex +++ b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_field_style.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.TextFieldStyle do modifier_schema "text_field_style" do field :style, Ecto.Enum, values: ~w(automatic plain rounded_border square_border)a end + + def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_input_autocapitalization.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_input_autocapitalization.ex index a8f48f90c8..1b89b89fd6 100644 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_input_autocapitalization.ex +++ b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_input_autocapitalization.ex @@ -9,4 +9,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.TextInputAutocapitalization do never )a end + + def params(autocapitalization) when is_atom(autocapitalization) and not is_boolean(autocapitalization) and not is_nil(autocapitalization), do: [autocapitalization: autocapitalization] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_selection.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_selection.ex index 19c6caf6fd..eed48b3773 100644 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_selection.ex +++ b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_selection.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.TextSelection do modifier_schema "text_selection" do field :selectable, :boolean end + + def params(selectable) when is_boolean(selectable), do: [selectable: selectable] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/truncation_mode.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/truncation_mode.ex index ff812c5b59..aa79db3c2e 100644 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/truncation_mode.ex +++ b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/truncation_mode.ex @@ -8,4 +8,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.TruncationMode do tail )a end + + def params(mode) when is_atom(mode) and not is_boolean(mode) and not is_nil(mode), do: [mode: mode] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/underline.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/underline.ex index 2e4a9782ad..93663e7d81 100644 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/underline.ex +++ b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/underline.ex @@ -7,4 +7,8 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Underline do field :pattern, Ecto.Enum, values: ~w(dash dash_dot dash_dot_dot dot solid)a, default: :solid field :color, Color end + + def params(is_active, params) when is_list(params), do: [{:is_active, is_active} | params] + def params(is_active) when is_boolean(is_active), do: [is_active: is_active] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_background.ex b/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_background.ex index 561394070e..44274e37f1 100644 --- a/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_background.ex +++ b/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_background.ex @@ -8,4 +8,8 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ToolbarBackground do field :visibility, Ecto.Enum, values: ~w(automatic hidden visible)a field :bars, Ecto.Enum, values: ~w(automatic bottom_bar navigation_bar tab_bar window_toolbar)a end + + def params(visibility, params) when is_atom(visibility) and not is_boolean(visibility) and not is_nil(visibility) and is_list(params), do: [{:visibility, visibility} | params] + def params(style, params) when is_list(params), do: [{:style, style} | params] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_color_scheme.ex b/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_color_scheme.ex index bd3c30596a..8f728fe06a 100644 --- a/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_color_scheme.ex +++ b/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_color_scheme.ex @@ -5,4 +5,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ToolbarColorScheme do field :color_scheme, Ecto.Enum, values: ~w(dark light)a field :bars, Ecto.Enum, values: ~w(automatic bottom_bar navigation_bar tab_bar window_toolbar)a end + + def params(color_scheme, params) when is_list(params), do: [{:color_scheme, color_scheme} | params] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_role.ex b/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_role.ex index 784a32da45..733f06d211 100644 --- a/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_role.ex +++ b/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_role.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ToolbarRole do modifier_schema "toolbar_role" do field :role, Ecto.Enum, values: ~w(automatic browser editor navigation_stack)a end + + def params(role) when is_atom(role) and not is_boolean(role) and not is_nil(role), do: [role: role] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_visibility.ex b/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_visibility.ex index a1f04973d1..1cfab716e1 100644 --- a/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_visibility.ex +++ b/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_visibility.ex @@ -5,4 +5,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ToolbarVisibility do field :visibility, Ecto.Enum, values: ~w(automatic hidden visible)a field :bars, Ecto.Enum, values: ~w(automatic bottom_bar navigation_bar tab_bar window_toolbar)a end + + def params(visibility, params) when is_list(params), do: [{:visibility, visibility} | params] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/view_configuration/help.ex b/lib/live_view_native_swift_ui/modifiers/view_configuration/help.ex index fca05ed072..f1bf36a543 100644 --- a/lib/live_view_native_swift_ui/modifiers/view_configuration/help.ex +++ b/lib/live_view_native_swift_ui/modifiers/view_configuration/help.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Help do modifier_schema "help" do field :text, :string end + + def params(text) when is_binary(text), do: [text: text] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/view_configuration/hidden.ex b/lib/live_view_native_swift_ui/modifiers/view_configuration/hidden.ex index 8cd16bc352..f3adad4ca7 100644 --- a/lib/live_view_native_swift_ui/modifiers/view_configuration/hidden.ex +++ b/lib/live_view_native_swift_ui/modifiers/view_configuration/hidden.ex @@ -1,10 +1,5 @@ defmodule LiveViewNativeSwiftUi.Modifiers.Hidden do use LiveViewNativePlatform.Modifier - modifier_schema "hidden" do - field :is_active, :boolean - end - - def params(is_active) when is_boolean(is_active), do: [is_active: is_active] - def params(params), do: params + modifier_schema "hidden" end diff --git a/lib/live_view_native_swift_ui/modifiers/view_configuration/persistent_system_overlays.ex b/lib/live_view_native_swift_ui/modifiers/view_configuration/persistent_system_overlays.ex index bc353a91ee..e61fdee7ed 100644 --- a/lib/live_view_native_swift_ui/modifiers/view_configuration/persistent_system_overlays.ex +++ b/lib/live_view_native_swift_ui/modifiers/view_configuration/persistent_system_overlays.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.PersistentSystemOverlays do modifier_schema "persistent_system_overlays" do field :visibility, Ecto.Enum, values: ~w(automatic hidden visible)a end + + def params(visibility) when is_atom(visibility) and not is_boolean(visibility) and not is_nil(visibility), do: [visibility: visibility] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/view_configuration/status_bar_hidden.ex b/lib/live_view_native_swift_ui/modifiers/view_configuration/status_bar_hidden.ex index ca623dd731..06976b73fa 100644 --- a/lib/live_view_native_swift_ui/modifiers/view_configuration/status_bar_hidden.ex +++ b/lib/live_view_native_swift_ui/modifiers/view_configuration/status_bar_hidden.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.StatusBarHidden do modifier_schema "status_bar_hidden" do field :hidden, :boolean end + + def params(hidden) when is_boolean(hidden), do: [hidden: hidden] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_appear.ex b/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_appear.ex index df9911ecae..12319a59e5 100644 --- a/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_appear.ex +++ b/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_appear.ex @@ -1,9 +1,9 @@ defmodule LiveViewNativeSwiftUi.Modifiers.OnAppear do use LiveViewNativePlatform.Modifier - alias LiveViewNativePlatform.Types.Event + alias LiveViewNativePlatform.Modifier.Types.Event modifier_schema "on_appear" do - field :action, Event + field :perform, Event end end diff --git a/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_disappear.ex b/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_disappear.ex index 4bf434b9e2..483d9fd3ea 100644 --- a/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_disappear.ex +++ b/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_disappear.ex @@ -1,9 +1,9 @@ defmodule LiveViewNativeSwiftUi.Modifiers.OnDisappear do use LiveViewNativePlatform.Modifier - alias LiveViewNativePlatform.Types.Event + alias LiveViewNativePlatform.Modifier.Types.Event modifier_schema "on_disappear" do - field :action, Event + field :perform, Event end end diff --git a/lib/live_view_native_swift_ui/modifiers/view_groupings/control_group_style.ex b/lib/live_view_native_swift_ui/modifiers/view_groupings/control_group_style.ex index 433e512778..7d1a3a154a 100644 --- a/lib/live_view_native_swift_ui/modifiers/view_groupings/control_group_style.ex +++ b/lib/live_view_native_swift_ui/modifiers/view_groupings/control_group_style.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ControlGroupStyle do modifier_schema "control_group_style" do field :style, Ecto.Enum, values: ~w(automatic compact_menu menu navigation)a end + + def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/view_groupings/group_box_style.ex b/lib/live_view_native_swift_ui/modifiers/view_groupings/group_box_style.ex index e05edc77e9..66ff57388e 100644 --- a/lib/live_view_native_swift_ui/modifiers/view_groupings/group_box_style.ex +++ b/lib/live_view_native_swift_ui/modifiers/view_groupings/group_box_style.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.GroupBoxStyle do modifier_schema "group_box_style" do field :style, Ecto.Enum, values: ~w(automatic)a end + + def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/modifiers/view_styles/content_shape.ex b/lib/live_view_native_swift_ui/modifiers/view_styles/content_shape.ex index bcfc45611e..97c33ff1f3 100644 --- a/lib/live_view_native_swift_ui/modifiers/view_styles/content_shape.ex +++ b/lib/live_view_native_swift_ui/modifiers/view_styles/content_shape.ex @@ -8,4 +8,26 @@ defmodule LiveViewNativeSwiftUi.Modifiers.ContentShape do field :shape, Shape field :eo_fill, :boolean end + + def params(shape, params) when is_list(params) do + with {:ok, _} <- ContentShapeKind.cast(shape) do + [{:kind, shape} | params] + else + _ -> + [{:shape, shape} | params] + end + end + def params(params) do + with {:ok, _} <- ContentShapeKind.cast(params) do + [kind: params] + else + _ -> + with {:ok, _} <- Shape.cast(params) do + [shape: params] + else + _ -> + params + end + end + end end diff --git a/lib/live_view_native_swift_ui/modifiers/view_styles/index_view_style.ex b/lib/live_view_native_swift_ui/modifiers/view_styles/index_view_style.ex index 4603b120fc..c84d04aca4 100644 --- a/lib/live_view_native_swift_ui/modifiers/view_styles/index_view_style.ex +++ b/lib/live_view_native_swift_ui/modifiers/view_styles/index_view_style.ex @@ -4,4 +4,7 @@ defmodule LiveViewNativeSwiftUi.Modifiers.IndexViewStyle do modifier_schema "index_view_style" do field :style, Ecto.Enum, values: ~w(page page_always page_automatic page_interactive page_never)a end + + def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] + def params(params), do: params end diff --git a/lib/live_view_native_swift_ui/types/event_modifier.ex b/lib/live_view_native_swift_ui/types/event_modifier.ex index b43925b393..d27c31defa 100644 --- a/lib/live_view_native_swift_ui/types/event_modifier.ex +++ b/lib/live_view_native_swift_ui/types/event_modifier.ex @@ -1,4 +1,4 @@ -defmodule LiveViewNativePlatform.Types.EventModifier do +defmodule LiveViewNativePlatform.Modifier.Types.EventModifier do use LiveViewNativePlatform.Modifier.Type def type, do: {:array, :string} From a795702f757883ffd15e3bbac50efa59e46d8c21 Mon Sep 17 00:00:00 2001 From: Carson Katri Date: Tue, 22 Aug 2023 17:03:24 -0400 Subject: [PATCH 3/4] Update all docs --- .../Image Modifiers/AntialiasedModifier.swift | 2 +- .../InterpolationModifier.swift | 4 ++-- .../RenderingModeModifier.swift | 6 +++--- .../Image Modifiers/ResizableModifier.swift | 4 ++-- .../AnimationModifier.swift | 8 ++++---- .../ContentTransitionModifier.swift | 11 +++++------ .../KeyframeAnimatorModifier.swift | 4 ++-- .../MatchedGeometryEffectModifier.swift | 10 +++++----- .../TransitionModifier.swift | 2 +- .../ButtonBorderShapeModifier.swift | 4 ++-- .../ControlSizeModifier.swift | 4 ++-- .../HorizontalRadioGroupLayoutModifier.swift | 2 +- .../DraggableModifier.swift | 4 ++-- .../DropDestinationModifier.swift | 4 ++-- .../BlendModeModifier.swift | 11 +++++------ .../BlurModifier.swift | 2 +- .../BorderModifier.swift | 2 +- .../BrightnessModifier.swift | 2 +- .../ClipShapeModifier.swift | 6 +++--- .../ClippedModifier.swift | 3 +-- .../ColorInvertModifier.swift | 2 +- .../ColorMultiplyModifier.swift | 2 +- .../CompositingGroupModifier.swift | 7 +++---- .../ContrastModifier.swift | 2 +- .../CornerRadiusModifier.swift | 2 +- .../DrawingGroupModifier.swift | 19 +++++++++---------- .../ForegroundColorModifier.swift | 2 +- .../GrayscaleModifier.swift | 2 +- .../HueRotationModifier.swift | 5 ++--- .../LuminanceToAlphaModifier.swift | 7 +++---- .../MaskModifier.swift | 7 +++---- .../ProjectionEffectModifier.swift | 2 +- .../Rotation3DEffectModifier.swift | 2 +- .../RotationEffectModifier.swift | 2 +- .../SaturationModifier.swift | 2 +- .../ScaleEffectModifier.swift | 2 +- .../ScaledToFillModifier.swift | 2 +- .../ScaledToFitModifier.swift | 2 +- .../ShadowModifier.swift | 2 +- .../SymbolVariantModifier.swift | 4 ++-- .../TransformEffectModifier.swift | 2 +- .../Focus Modifiers/FocusScopeModifier.swift | 4 ++-- .../FocusSectionModifier.swift | 2 +- .../Focus Modifiers/FocusableModifier.swift | 4 ++-- .../PrefersDefaultFocusModifier.swift | 4 ++-- .../DefersSystemGesturesModifier.swift | 5 ++--- .../Gestures Modifiers/GestureModifier.swift | 8 ++++---- .../Images Modifiers/ImageScaleModifier.swift | 2 +- .../SymbolRenderingModeModifier.swift | 2 +- .../AllowsHitTestingModifier.swift | 5 ++--- .../DigitalCrownAccessoryModifier.swift | 5 ++--- ...italCrownAccessoryVisibilityModifier.swift | 9 +++------ .../HoverEffectModifier.swift | 2 +- .../OnDeleteCommandModifier.swift | 4 ++-- .../OnHoverModifier.swift | 4 ++-- .../OnMoveCommandModifier.swift | 4 ++-- .../OnSubmitModifier.swift | 7 +++---- .../SubmitScopeModifier.swift | 4 ++-- .../CoordinateSpaceModifier.swift | 2 +- .../FixedSizeModifier.swift | 4 ++-- .../FrameModifier.swift | 6 +++--- .../IgnoresSafeAreaModifier.swift | 2 +- .../LayoutPriorityModifier.swift | 2 +- .../OffsetModifier.swift | 2 +- .../PaddingModifier.swift | 8 ++++---- .../PositionModifier.swift | 2 +- .../SafeAreaInsetModifier.swift | 2 +- .../ScenePaddingModifier.swift | 2 +- .../BackgroundModifier.swift | 6 +++--- .../GridCellAnchorModifier.swift | 2 +- .../GridCellColumnsModifier.swift | 2 +- .../GridCellUnsizedAxesModifier.swift | 2 +- .../GridColumnAlignmentModifier.swift | 2 +- .../OverlayModifier.swift | 8 ++++---- .../ZIndexModifier.swift | 4 ++-- .../Lists Modifiers/BadgeModifier.swift | 6 +++--- .../DeleteDisabledModifier.swift | 2 +- .../HeaderProminenceModifier.swift | 2 +- .../ListItemTintModifier.swift | 6 +++--- .../ListRowBackgroundModifier.swift | 2 +- .../ListRowInsetsModifier.swift | 2 +- .../ListRowSeparatorTintModifier.swift | 4 ++-- .../ListSectionSeparatorModifier.swift | 2 +- .../ListSectionSeparatorTintModifier.swift | 4 ++-- .../Lists Modifiers/ListStyleModifier.swift | 2 +- .../MoveDisabledModifier.swift | 2 +- .../Lists Modifiers/RefreshableModifier.swift | 4 ++-- .../SwipeActionsModifier.swift | 5 ++--- .../ContextMenuModifier.swift | 4 ++-- .../MenuActionDismissBehaviorModifier.swift | 2 +- .../MenuIndicatorModifier.swift | 2 +- .../MenuOrderModifier.swift | 2 +- .../MenuStyleModifier.swift | 2 +- .../Modal Presentations/AlertModifier.swift | 3 +-- .../ConfirmationDialogModifier.swift | 3 +-- .../FullScreenCoverModifier.swift | 2 +- .../InteractiveDismissDisabledModifier.swift | 4 ++-- .../Modal Presentations/PopoverModifier.swift | 4 ++-- ...ntationBackgroundInteractionModifier.swift | 4 ++-- .../PresentationBackgroundModifier.swift | 4 ++-- ...resentationCompactAdaptationModifier.swift | 4 ++-- ...esentationContentInteractionModifier.swift | 4 ++-- .../PresentationCornerRadiusModifier.swift | 4 ++-- .../PresentationDetentsModifier.swift | 6 +++--- .../PresentationDragIndicatorModifier.swift | 4 ++-- ...avigationBarBackButtonHiddenModifier.swift | 2 +- ...avigationBarTitleDisplayModeModifier.swift | 9 ++++----- .../NavigationSubtitleModifier.swift | 2 +- .../NavigationTitleModifier.swift | 2 +- .../TabItemModifier.swift | 2 +- .../TabViewStyleModifier.swift | 2 +- .../ScrollBounceBehaviorModifier.swift | 2 +- .../ScrollContentBackgroundModifier.swift | 2 +- .../ScrollDisabledModifier.swift | 2 +- .../ScrollDismissesKeyboardModifier.swift | 2 +- .../ScrollIndicatorsModifier.swift | 2 +- .../FindDisabledModifier.swift | 2 +- .../FindNavigatorModifier.swift | 2 +- .../ReplaceDisabledModifier.swift | 2 +- .../SearchCompletionModifier.swift | 4 ++-- .../SearchScopesModifier.swift | 5 ++--- .../SearchSuggestionsModifier.swift | 9 ++++----- .../Search Modifiers/SearchableModifier.swift | 4 ++-- .../ContainerShapeModifier.swift | 4 ++-- .../Tables Modifiers/TableStyleModifier.swift | 2 +- .../AutocorrectionDisabledModifier.swift | 4 ++-- .../BaselineOffsetModifier.swift | 2 +- .../BoldModifier.swift | 4 ++-- .../DynamicTypeSizeModifier.swift | 4 ++-- ...orRightToLeftLayoutDirectionModifier.swift | 2 +- .../FontDesignModifier.swift | 8 ++++---- .../FontModifier.swift | 2 +- .../FontWeightModifier.swift | 2 +- .../FontWidthModifier.swift | 2 +- .../ItalicModifier.swift | 4 ++-- .../KerningModifier.swift | 2 +- .../KeyboardShortcutModifier.swift | 8 ++++---- .../KeyboardTypeModifier.swift | 2 +- .../LineLimitModifier.swift | 2 +- .../LineSpacingModifier.swift | 2 +- .../MinimumScaleFactorModifier.swift | 2 +- .../MonospacedDigitModifier.swift | 2 +- .../MonospacedModifier.swift | 2 +- .../MultilineTextAlignmentModifier.swift | 2 +- .../PrivacySensitiveModifier.swift | 2 +- .../StrikethroughModifier.swift | 2 +- .../SubmitLabelModifier.swift | 2 +- .../TextCaseModifier.swift | 2 +- .../TextContentTypeModifier.swift | 6 +++--- .../TextFieldStyleModifier.swift | 2 +- .../TextInputAutocapitalizationModifier.swift | 2 +- .../TextSelectionModifier.swift | 2 +- .../TrackingModifier.swift | 2 +- .../TruncationModeModifier.swift | 2 +- .../UnderlineModifier.swift | 2 +- .../ToolbarBackgroundModifier.swift | 4 ++-- .../ToolbarColorSchemeModifier.swift | 2 +- .../Toolbars Modifiers/ToolbarModifier.swift | 4 ++-- .../ToolbarRoleModifier.swift | 2 +- .../ToolbarTitleMenuModifier.swift | 2 +- .../DisabledModifier.swift | 2 +- .../HelpModifier.swift | 2 +- .../LabelsHiddenModifier.swift | 2 +- .../OpacityModifier.swift | 2 +- .../PersistentSystemOverlaysModifier.swift | 2 +- .../PreferredColorSchemeModifier.swift | 2 +- .../RedactedModifier.swift | 2 +- .../StatusBarHiddenModifier.swift | 2 +- .../UnredactedModifier.swift | 2 +- .../OnAppearModifier.swift | 2 +- .../OnDisappearModifier.swift | 2 +- .../ContentShapeModifier.swift | 6 +++--- .../IndexViewStyleModifier.swift | 9 ++++----- .../Shape Modifiers/FillModifier.swift | 2 +- .../Shape Modifiers/InsetModifier.swift | 2 +- .../Shape Modifiers/OffsetShapeModifier.swift | 2 +- .../Shape Modifiers/RotationModifier.swift | 2 +- .../Shape Modifiers/SizeModifier.swift | 2 +- .../StrokeBorderModifier.swift | 2 +- .../Shape Modifiers/StrokeModifier.swift | 2 +- .../Shape Modifiers/TrimModifier.swift | 2 +- .../LiveViewNative/Utils/AnyTransition.swift | 2 +- .../LiveViewNative/Utils/ShapeReference.swift | 2 +- .../Views/Accessibility/ScaledMetric.swift | 2 +- .../LiveViewNative/Views/Images/Image.swift | 2 +- .../Layout Containers/Groups/Group.swift | 2 +- .../Presentation Containers/TabView.swift | 2 +- .../Scroll Views/ScrollView.swift | 2 +- .../Views/Text Input and Output/Text.swift | 4 ++-- .../Text Input and Output/TextField.swift | 11 +++++------ .../Views/Toolbars/ToolbarItem.swift | 2 +- .../rotation_3d_effect.ex | 9 +-------- .../modifiers/focus/prefers_default_focus.ex | 3 ++- .../modifiers/gestures/gesture.ex | 3 +-- .../modifiers/view_styles/content_shape.ex | 9 +-------- 195 files changed, 320 insertions(+), 357 deletions(-) diff --git a/Sources/LiveViewNative/Image Modifiers/AntialiasedModifier.swift b/Sources/LiveViewNative/Image Modifiers/AntialiasedModifier.swift index e0153df239..fd5849d69d 100644 --- a/Sources/LiveViewNative/Image Modifiers/AntialiasedModifier.swift +++ b/Sources/LiveViewNative/Image Modifiers/AntialiasedModifier.swift @@ -10,7 +10,7 @@ import SwiftUI /// Enables/disables antialiasing. /// /// ```html -/// +/// /// ``` /// /// ## Arguments diff --git a/Sources/LiveViewNative/Image Modifiers/InterpolationModifier.swift b/Sources/LiveViewNative/Image Modifiers/InterpolationModifier.swift index 6d1e232460..8142886880 100644 --- a/Sources/LiveViewNative/Image Modifiers/InterpolationModifier.swift +++ b/Sources/LiveViewNative/Image Modifiers/InterpolationModifier.swift @@ -15,11 +15,11 @@ import SwiftUI /// ```html /// resizable() |> interpolation(interpolation: :none)} +/// modifiers={resizable([]) |> interpolation(:none)} /// /> /// resizable() |> interpolation(interpolation: :medium)} +/// modifiers={resizable([]) |> interpolation(:medium)} /// /> /// ``` /// diff --git a/Sources/LiveViewNative/Image Modifiers/RenderingModeModifier.swift b/Sources/LiveViewNative/Image Modifiers/RenderingModeModifier.swift index 7f7eb11617..4819b1029f 100644 --- a/Sources/LiveViewNative/Image Modifiers/RenderingModeModifier.swift +++ b/Sources/LiveViewNative/Image Modifiers/RenderingModeModifier.swift @@ -13,8 +13,8 @@ import SwiftUI /// The `template` mode renders nontransparent pixels as the foreground color. /// /// ```html -/// -/// +/// +/// /// ``` /// /// This modifier can also be used to render multicolor SF Symbols. @@ -23,7 +23,7 @@ import SwiftUI /// ```html /// /// ``` /// diff --git a/Sources/LiveViewNative/Image Modifiers/ResizableModifier.swift b/Sources/LiveViewNative/Image Modifiers/ResizableModifier.swift index 4bba51617a..4fafd88970 100644 --- a/Sources/LiveViewNative/Image Modifiers/ResizableModifier.swift +++ b/Sources/LiveViewNative/Image Modifiers/ResizableModifier.swift @@ -10,8 +10,8 @@ import SwiftUI /// Enables an image to fill the available space. /// /// ```html -/// -/// +/// +/// /// ``` /// /// ## Arguments diff --git a/Sources/LiveViewNative/Modifiers/Animations Modifiers/AnimationModifier.swift b/Sources/LiveViewNative/Modifiers/Animations Modifiers/AnimationModifier.swift index 8b89d864f7..dda175c05a 100644 --- a/Sources/LiveViewNative/Modifiers/Animations Modifiers/AnimationModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Animations Modifiers/AnimationModifier.swift @@ -16,8 +16,8 @@ import SwiftUI /// /// ```html /// /// ``` /// @@ -27,8 +27,8 @@ import SwiftUI /// /// ```html /// /// ``` /// diff --git a/Sources/LiveViewNative/Modifiers/Animations Modifiers/ContentTransitionModifier.swift b/Sources/LiveViewNative/Modifiers/Animations Modifiers/ContentTransitionModifier.swift index b7f8e7a713..7007847320 100644 --- a/Sources/LiveViewNative/Modifiers/Animations Modifiers/ContentTransitionModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Animations Modifiers/ContentTransitionModifier.swift @@ -13,13 +13,12 @@ import SwiftUI /// /// ```html /// content_transition(transition: :numeric_text) -/// |> animation(value: @count) -/// } +/// modifiers={ +/// content_transition(:numeric_text) +/// |> animation(value: @count) +/// } /// > -/// <%= @count %> +/// <%= @count %> /// /// ``` /// diff --git a/Sources/LiveViewNative/Modifiers/Animations Modifiers/KeyframeAnimatorModifier.swift b/Sources/LiveViewNative/Modifiers/Animations Modifiers/KeyframeAnimatorModifier.swift index ad0f51b688..f26b5b0268 100644 --- a/Sources/LiveViewNative/Modifiers/Animations Modifiers/KeyframeAnimatorModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Animations Modifiers/KeyframeAnimatorModifier.swift @@ -19,7 +19,7 @@ import SwiftUI /// keyframe_animator( +/// keyframe_animator( /// initial_value: 1.0, /// trigger: "#{@liked}", /// keyframes: [ @@ -27,7 +27,7 @@ import SwiftUI /// {:spring, 1.5, [duration: 0.8, spring: :bouncy]}, /// {:spring, 1.0, [spring: :bouncy]} /// ], -/// modifiers: @native |> scale_effect(x: 1.0, y: 1.0), +/// modifiers: scale_effect(x: 1.0, y: 1.0), /// properties: [scale_effect: [:x, :y]] /// ) /// } diff --git a/Sources/LiveViewNative/Modifiers/Animations Modifiers/MatchedGeometryEffectModifier.swift b/Sources/LiveViewNative/Modifiers/Animations Modifiers/MatchedGeometryEffectModifier.swift index c500df921d..466baee4ac 100644 --- a/Sources/LiveViewNative/Modifiers/Animations Modifiers/MatchedGeometryEffectModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Animations Modifiers/MatchedGeometryEffectModifier.swift @@ -21,13 +21,13 @@ import SwiftUI /// Use the same `id` argument for elements that should be paired. /// /// ```html -/// animation(value: Atom.to_string(@is_flipped))}> +/// /// <%= if @is_flipped do %> -/// matched_geometry_effect(id: "a", namespace: :animation)}>A -/// matched_geometry_effect(id: "b", namespace: :animation)}>B +/// A +/// B /// <% else %> -/// matched_geometry_effect(id: "b", namespace: :animation)}>B -/// matched_geometry_effect(id: "a", namespace: :animation)}>A +/// B +/// A /// <% end %> /// /// diff --git a/Sources/LiveViewNative/Modifiers/Animations Modifiers/TransitionModifier.swift b/Sources/LiveViewNative/Modifiers/Animations Modifiers/TransitionModifier.swift index 60259a660d..087ae196c1 100644 --- a/Sources/LiveViewNative/Modifiers/Animations Modifiers/TransitionModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Animations Modifiers/TransitionModifier.swift @@ -13,7 +13,7 @@ import SwiftUI /// /// ```html /// <%= if @show do %> -/// Scaled +/// Scaled /// <% end %> /// ``` /// diff --git a/Sources/LiveViewNative/Modifiers/Controls and Indicators Modifiers/ButtonBorderShapeModifier.swift b/Sources/LiveViewNative/Modifiers/Controls and Indicators Modifiers/ButtonBorderShapeModifier.swift index 2906f90331..8ffc755308 100644 --- a/Sources/LiveViewNative/Modifiers/Controls and Indicators Modifiers/ButtonBorderShapeModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Controls and Indicators Modifiers/ButtonBorderShapeModifier.swift @@ -10,10 +10,10 @@ import SwiftUI /// Alters the shape of any bordered buttons' borders. /// /// ```html -/// -/// /// ``` diff --git a/Sources/LiveViewNative/Modifiers/Controls and Indicators Modifiers/ControlSizeModifier.swift b/Sources/LiveViewNative/Modifiers/Controls and Indicators Modifiers/ControlSizeModifier.swift index 9468e9a237..45a449b77e 100644 --- a/Sources/LiveViewNative/Modifiers/Controls and Indicators Modifiers/ControlSizeModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Controls and Indicators Modifiers/ControlSizeModifier.swift @@ -10,8 +10,8 @@ import SwiftUI /// Sets the size of controls within this view. /// /// ```html -/// -/// +/// +/// /// ``` /// /// ## Arguments diff --git a/Sources/LiveViewNative/Modifiers/Controls and Indicators Modifiers/HorizontalRadioGroupLayoutModifier.swift b/Sources/LiveViewNative/Modifiers/Controls and Indicators Modifiers/HorizontalRadioGroupLayoutModifier.swift index f215b46d23..b519714737 100644 --- a/Sources/LiveViewNative/Modifiers/Controls and Indicators Modifiers/HorizontalRadioGroupLayoutModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Controls and Indicators Modifiers/HorizontalRadioGroupLayoutModifier.swift @@ -10,7 +10,7 @@ import SwiftUI /// Changes radio-group style ``Picker``s to lay out horizontally. /// /// ```html -/// horizontal_radio_group_layout()}> +/// horizontal_radio_group_layout()}> /// ... /// /// ``` diff --git a/Sources/LiveViewNative/Modifiers/Drag and Drop Modifiers/DraggableModifier.swift b/Sources/LiveViewNative/Modifiers/Drag and Drop Modifiers/DraggableModifier.swift index 2269ad01e3..d598ccee83 100644 --- a/Sources/LiveViewNative/Modifiers/Drag and Drop Modifiers/DraggableModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drag and Drop Modifiers/DraggableModifier.swift @@ -10,8 +10,8 @@ import SwiftUI /// Activates this view as the source of a drag and drop operation. /// /// ```html -/// ABC -/// +/// ABC +/// /// ABC /// /// diff --git a/Sources/LiveViewNative/Modifiers/Drag and Drop Modifiers/DropDestinationModifier.swift b/Sources/LiveViewNative/Modifiers/Drag and Drop Modifiers/DropDestinationModifier.swift index c04de90f77..5953f20e13 100644 --- a/Sources/LiveViewNative/Modifiers/Drag and Drop Modifiers/DropDestinationModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drag and Drop Modifiers/DropDestinationModifier.swift @@ -10,8 +10,8 @@ import SwiftUI /// Defines the destination of a drag and drop operation that handles the dropped content with an event that you specify. /// /// ```html -/// ABC -/// +/// ABC +/// /// Drop Here /// /// ``` diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/BlendModeModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/BlendModeModifier.swift index ebb8fd2f2c..8ceb935e2b 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/BlendModeModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/BlendModeModifier.swift @@ -11,14 +11,13 @@ import SwiftUI /// /// ```html /// -/// frame(width: 50, height: 50, alignment: :center)} /> +/// /// frame(width: 50, height: 50, alignment: :center) -/// |> rotation_effect(angle: {:degrees, 45}) -/// |> padding(all: -20) -/// |> blend_mode(blend_mode: :color_burn) +/// frame(width: 50, height: 50, alignment: :center) +/// |> rotation_effect({:degrees, 45}) +/// |> padding(-20) +/// |> blend_mode(:color_burn) /// } /// /> /// diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/BlurModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/BlurModifier.swift index 1afca8e1f3..ce71c1368c 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/BlurModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/BlurModifier.swift @@ -12,7 +12,7 @@ import SwiftUI /// Set the ``radius`` to control the strength of the blur. /// /// ```html -/// Hello, world! +/// Hello, world! /// ``` /// /// ## Arguments diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/BorderModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/BorderModifier.swift index 098d5808a8..3e12b364a6 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/BorderModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/BorderModifier.swift @@ -10,7 +10,7 @@ import SwiftUI /// Applies a border to any element. /// /// ```html -/// +/// /// Purple border inside the view bounds. /// /// ``` diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/BrightnessModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/BrightnessModifier.swift index cff87e6aed..52faf6354c 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/BrightnessModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/BrightnessModifier.swift @@ -10,7 +10,7 @@ import SwiftUI /// Brighten the intensity of the colors in a view. /// /// ```html -/// brightness(amount: 0.5)} /> +/// /// ``` /// /// ## Arguments diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ClipShapeModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ClipShapeModifier.swift index c27dc836d4..a609cc0dc5 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ClipShapeModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ClipShapeModifier.swift @@ -12,7 +12,7 @@ import SwiftUI /// Provide a ``ShapeReference`` to clip the element with. /// /// ```html -/// +/// /// Hello, /// world! /// @@ -22,10 +22,10 @@ import SwiftUI /// This lets you apply modifiers to the clip shape. /// /// ```html -/// +/// /// Hello, /// world! -/// rotation(angle: {:degrees, 45})} /> +/// /// /// ``` /// diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ClippedModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ClippedModifier.swift index fc59fabc85..698eda2f5c 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ClippedModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ClippedModifier.swift @@ -12,8 +12,7 @@ import SwiftUI /// ```html /// foreground_color(color: :mint) +/// foreground_color(:mint) /// |> frame(width: 20, height: 20) /// |> clipped(antialiased: true) /// } diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ColorInvertModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ColorInvertModifier.swift index bf83e523f7..f41c973091 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ColorInvertModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ColorInvertModifier.swift @@ -10,7 +10,7 @@ import SwiftUI /// Inverts the colors in this view. /// /// ```html -/// foreground_style(primary: {:color, :red}) |> color_invert()} /> +/// color_invert()} /> /// ``` #if swift(>=5.8) @_documentation(visibility: public) diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ColorMultiplyModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ColorMultiplyModifier.swift index 43133fadcd..63a38a923c 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ColorMultiplyModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ColorMultiplyModifier.swift @@ -10,7 +10,7 @@ import SwiftUI /// Adds a color multiplication effect to this view. /// /// ```html -/// +/// /// ``` /// /// ## Arguments diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/CompositingGroupModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/CompositingGroupModifier.swift index 49c88d6c08..84d0716ec8 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/CompositingGroupModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/CompositingGroupModifier.swift @@ -15,13 +15,12 @@ import SwiftUI /// /// compositing_group() -/// |> opacity(opacity: 0.5) +/// compositing_group([]) +/// |> opacity(0.5) /// } /// > /// Hello, world! -/// Hello, world! +/// Hello, world! /// /// /// ``` diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ContrastModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ContrastModifier.swift index bda669ca75..bf8fd3f457 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ContrastModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ContrastModifier.swift @@ -10,7 +10,7 @@ import SwiftUI /// Sets the contrast and separation between similar colors in this view. /// /// ```html -/// foreground_style(primary: {:color, :red}) |> contrast(amount: 0.5)} /> +/// contrast(0.5)} /> /// ``` /// /// ## Arguments diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/CornerRadiusModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/CornerRadiusModifier.swift index 3ad2118f98..05c38eab2d 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/CornerRadiusModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/CornerRadiusModifier.swift @@ -10,7 +10,7 @@ import SwiftUI /// Clips this view to its bounding frame, with the specified corner ``radius``. /// /// ```html -/// corner_radius(radius: 8)} /> +/// /// ``` /// /// ## Arguments diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/DrawingGroupModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/DrawingGroupModifier.swift index 980de8b3ed..80714c9764 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/DrawingGroupModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/DrawingGroupModifier.swift @@ -11,16 +11,15 @@ import SwiftUI /// /// ```html /// -/// drawing_group(opaque: false, color_mode: :non_linear) -/// |> opacity(opacity: 0.5) -/// } -/// > -/// Hello, world! -/// Hello, world! -/// +/// opacity(opacity: 0.5) +/// } +/// > +/// Hello, world! +/// Hello, world! +/// /// /// ``` /// diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ForegroundColorModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ForegroundColorModifier.swift index 3dcb404c5d..6e18233092 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ForegroundColorModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ForegroundColorModifier.swift @@ -9,7 +9,7 @@ import SwiftUI /// Applies a foreground color to a view. /// ```html -/// +/// /// Minty fresh text. /// /// ``` diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/GrayscaleModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/GrayscaleModifier.swift index 7097157599..2fb45f8c41 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/GrayscaleModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/GrayscaleModifier.swift @@ -12,7 +12,7 @@ import SwiftUI /// A grayscale effect reduces the intensity of colors in this view. /// /// ```html -/// +/// /// ``` /// /// ## Arguments diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/HueRotationModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/HueRotationModifier.swift index 032b481ed5..f0c62d12a3 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/HueRotationModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/HueRotationModifier.swift @@ -17,9 +17,8 @@ import SwiftUI /// foreground_style(primary: {:linear_gradient, %{ :gradient => {:colors, [:blue, :red, :green]}, :start_point => {0.5, 0}, :end_point => {0.5, 1} }}) -/// |> hue_rotation(angle: {:degrees, item * 36}) +/// foreground_style({:linear_gradient, %{ :gradient => {:colors, [:blue, :red, :green]}, :start_point => {0.5, 0}, :end_point => {0.5, 1} }}) +/// |> hue_rotation({:degrees, item * 36}) /// |> frame(width: 60, height: 60, alignment: :center) /// } /// /> diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/LuminanceToAlphaModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/LuminanceToAlphaModifier.swift index 45163f57c7..86ff9b2f3c 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/LuminanceToAlphaModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/LuminanceToAlphaModifier.swift @@ -15,14 +15,13 @@ import SwiftUI /// background(alignment: :center, content: :heart_bg) -/// |> foreground_color(color: :red) +/// background(alignment: :center, content: :heart_bg) +/// |> foreground_color(:red) /// |> luminance_to_alpha() /// } /// > /// -/// frame(width: 32, height: 32) |> foreground_color(color: :red)} /> +/// foreground_color(:red)} /> /// /// /// ``` diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/MaskModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/MaskModifier.swift index d46d877b36..968138035a 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/MaskModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/MaskModifier.swift @@ -12,13 +12,12 @@ import SwiftUI /// ```html /// foreground_color(color: :blue) -/// |> font(font: {:system, :large_title}) +/// foreground_color(:blue) +/// |> font({:system, :large_title}) /// |> mask(alignment: :center, mask: :mask) /// } /// > -/// opacity(opacity: 0.1)} /> +/// /// /// ``` /// diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ProjectionEffectModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ProjectionEffectModifier.swift index a0438e4ced..973bb90042 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ProjectionEffectModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ProjectionEffectModifier.swift @@ -14,7 +14,7 @@ import SwiftUI /// - Note: The frame of the element is not affected. /// /// ```html -/// +/// /// Rotation by passing an angle in degrees /// /// ``` diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/RotationEffectModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/RotationEffectModifier.swift index 5341491eaf..284ec8f5f6 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/RotationEffectModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/RotationEffectModifier.swift @@ -12,7 +12,7 @@ import SwiftUI /// Pass an ``angle`` in degrees or radians to rotate the element. /// /// ```html -/// +/// /// Rotation by passing an angle in degrees /// /// ``` diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/SaturationModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/SaturationModifier.swift index d0ea77c890..a3b02a41a6 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/SaturationModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/SaturationModifier.swift @@ -12,7 +12,7 @@ import SwiftUI /// Use color saturation to increase or decrease the intensity of colors in a view. /// /// ```html -/// +/// /// ``` /// /// ## Arguments diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ScaleEffectModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ScaleEffectModifier.swift index 69b06bb614..1405a34804 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ScaleEffectModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ScaleEffectModifier.swift @@ -10,7 +10,7 @@ import SwiftUI /// Scales this view’s rendered output by the given vertical and horizontal size amounts, relative to an anchor point. /// /// ```html -/// +/// /// Scale by a width and height factor /// /// ``` diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ScaledToFillModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ScaledToFillModifier.swift index 0c7b0c9336..05a3bde99b 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ScaledToFillModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ScaledToFillModifier.swift @@ -10,7 +10,7 @@ import SwiftUI /// Scales this view to fill its parent, maintaining this view’s aspect ratio. /// /// ```html -/// +/// /// This view will fill its parent. /// /// ``` diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ScaledToFitModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ScaledToFitModifier.swift index 07c67a600f..52c350873c 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ScaledToFitModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ScaledToFitModifier.swift @@ -10,7 +10,7 @@ import SwiftUI /// Scales this view to fit its parent, maintaining this view’s aspect ratio. /// /// ```html -/// +/// /// This view will fit its parent. /// /// ``` diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ShadowModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ShadowModifier.swift index 699162bf1a..05c9a73fdf 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ShadowModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/ShadowModifier.swift @@ -10,7 +10,7 @@ import SwiftUI /// Adds a shadow to this view. /// /// ```html -/// Shadowed Text +/// Shadowed Text /// ``` /// /// ## Arguments diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/SymbolVariantModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/SymbolVariantModifier.swift index 933511d6e6..e417ee3aa6 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/SymbolVariantModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/SymbolVariantModifier.swift @@ -12,8 +12,8 @@ import SwiftUI /// See ``LiveViewNative/SwiftUI/SymbolVariants`` for a list of possible values. /// /// ```html -/// -/// +/// +/// /// ``` /// /// ## Arguments diff --git a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/TransformEffectModifier.swift b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/TransformEffectModifier.swift index 6a359549cc..8fde576d57 100644 --- a/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/TransformEffectModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Drawing and Graphics Modifiers/TransformEffectModifier.swift @@ -14,7 +14,7 @@ import SwiftUI /// - Note: The frame of the element is not affected. /// /// ```html -/// -/// +/// /// Username -/// Password +/// Password /// /// /// ``` diff --git a/Sources/LiveViewNative/Modifiers/Focus Modifiers/FocusSectionModifier.swift b/Sources/LiveViewNative/Modifiers/Focus Modifiers/FocusSectionModifier.swift index af56e948e8..01eac6474a 100644 --- a/Sources/LiveViewNative/Modifiers/Focus Modifiers/FocusSectionModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Focus Modifiers/FocusSectionModifier.swift @@ -19,7 +19,7 @@ import SwiftUI /// /// ```html /// -/// +/// /// /// /// diff --git a/Sources/LiveViewNative/Modifiers/Focus Modifiers/FocusableModifier.swift b/Sources/LiveViewNative/Modifiers/Focus Modifiers/FocusableModifier.swift index cf7be84c5a..dbc33a2679 100644 --- a/Sources/LiveViewNative/Modifiers/Focus Modifiers/FocusableModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Focus Modifiers/FocusableModifier.swift @@ -12,12 +12,12 @@ import SwiftUI /// You can apply this modifier to elements that do not receive focus by default. /// /// ```html -/// +/// /// ``` /// /// Or disable focusability for an element. /// ```html -/// /// ``` diff --git a/Sources/LiveViewNative/Modifiers/Focus Modifiers/PrefersDefaultFocusModifier.swift b/Sources/LiveViewNative/Modifiers/Focus Modifiers/PrefersDefaultFocusModifier.swift index fbba730bc2..0467692bce 100644 --- a/Sources/LiveViewNative/Modifiers/Focus Modifiers/PrefersDefaultFocusModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Focus Modifiers/PrefersDefaultFocusModifier.swift @@ -13,9 +13,9 @@ import SwiftUI /// /// ```html /// -/// +/// /// Username -/// Password +/// Password /// /// /// diff --git a/Sources/LiveViewNative/Modifiers/Gestures Modifiers/DefersSystemGesturesModifier.swift b/Sources/LiveViewNative/Modifiers/Gestures Modifiers/DefersSystemGesturesModifier.swift index 8964dbe1ec..277b79cdd4 100644 --- a/Sources/LiveViewNative/Modifiers/Gestures Modifiers/DefersSystemGesturesModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Gestures Modifiers/DefersSystemGesturesModifier.swift @@ -13,9 +13,8 @@ import SwiftUI /// /// ```html /// gesture(...) -/// |> defers_system_gestures(edges: :vertical) +/// gesture(...) +/// |> defers_system_gestures(on: :vertical) /// } /> /// ``` /// diff --git a/Sources/LiveViewNative/Modifiers/Gestures Modifiers/GestureModifier.swift b/Sources/LiveViewNative/Modifiers/Gestures Modifiers/GestureModifier.swift index c67bf77c91..fd1ded9b8f 100644 --- a/Sources/LiveViewNative/Modifiers/Gestures Modifiers/GestureModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Gestures Modifiers/GestureModifier.swift @@ -14,7 +14,7 @@ import SwiftUI /// Pass in a ``gesture`` and an event name. /// /// ```html -/// +/// /// ``` /// /// ```elixir @@ -122,7 +122,7 @@ enum GesturePriority: String, Decodable { /// ```html /// @@ -136,7 +136,7 @@ enum GesturePriority: String, Decodable { /// ```html /// @@ -150,7 +150,7 @@ enum GesturePriority: String, Decodable { /// ```html /// diff --git a/Sources/LiveViewNative/Modifiers/Images Modifiers/ImageScaleModifier.swift b/Sources/LiveViewNative/Modifiers/Images Modifiers/ImageScaleModifier.swift index 17bfef8bc4..9d87ccd9d3 100644 --- a/Sources/LiveViewNative/Modifiers/Images Modifiers/ImageScaleModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Images Modifiers/ImageScaleModifier.swift @@ -10,7 +10,7 @@ import SwiftUI /// Adjusts the scaling of images within an element. /// /// ```html -/// +/// /// /// /// ``` diff --git a/Sources/LiveViewNative/Modifiers/Images Modifiers/SymbolRenderingModeModifier.swift b/Sources/LiveViewNative/Modifiers/Images Modifiers/SymbolRenderingModeModifier.swift index 7f551028db..c0d6eece26 100644 --- a/Sources/LiveViewNative/Modifiers/Images Modifiers/SymbolRenderingModeModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Images Modifiers/SymbolRenderingModeModifier.swift @@ -10,7 +10,7 @@ import SwiftUI /// Sets the rendering mode for symbol images within this view. /// /// ```html -/// +/// /// /// /// ``` diff --git a/Sources/LiveViewNative/Modifiers/Input Events Modifiers/AllowsHitTestingModifier.swift b/Sources/LiveViewNative/Modifiers/Input Events Modifiers/AllowsHitTestingModifier.swift index 62597de690..2c2850e4ea 100644 --- a/Sources/LiveViewNative/Modifiers/Input Events Modifiers/AllowsHitTestingModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Input Events Modifiers/AllowsHitTestingModifier.swift @@ -12,9 +12,8 @@ import SwiftUI /// ```html /// frame(width: 32, height: 32) -/// |> allows_hit_testing(enabled: true) +/// frame(width: 32, height: 32) +/// |> allows_hit_testing(true) /// } /// /> /// ``` diff --git a/Sources/LiveViewNative/Modifiers/Input Events Modifiers/DigitalCrownAccessoryModifier.swift b/Sources/LiveViewNative/Modifiers/Input Events Modifiers/DigitalCrownAccessoryModifier.swift index 9b991dc47a..6079b26c73 100644 --- a/Sources/LiveViewNative/Modifiers/Input Events Modifiers/DigitalCrownAccessoryModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Input Events Modifiers/DigitalCrownAccessoryModifier.swift @@ -13,9 +13,8 @@ import SwiftUI /// /// ```html /// digital_crown_accessory(content: :dca_view) -/// |> digital_crown_accessory_visibility(visibility: :visible) +/// digital_crown_accessory(content: :dca_view) +/// |> digital_crown_accessory_visibility(:visible) /// }> /// /// diff --git a/Sources/LiveViewNative/Modifiers/Input Events Modifiers/DigitalCrownAccessoryVisibilityModifier.swift b/Sources/LiveViewNative/Modifiers/Input Events Modifiers/DigitalCrownAccessoryVisibilityModifier.swift index 91fd23b40f..ccc532ef16 100644 --- a/Sources/LiveViewNative/Modifiers/Input Events Modifiers/DigitalCrownAccessoryVisibilityModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Input Events Modifiers/DigitalCrownAccessoryVisibilityModifier.swift @@ -13,13 +13,10 @@ import SwiftUI /// /// ```html /// digital_crown_accessory(content: :dca_view) -/// |> digital_crown_accessory_visibility(visibility: :visible) +/// digital_crown_accessory(content: :dca_view) +/// |> digital_crown_accessory_visibility(:visible) /// }> -/// -/// -/// +/// /// /// ``` /// diff --git a/Sources/LiveViewNative/Modifiers/Input Events Modifiers/HoverEffectModifier.swift b/Sources/LiveViewNative/Modifiers/Input Events Modifiers/HoverEffectModifier.swift index 9eb69816b6..cb9f7c1439 100644 --- a/Sources/LiveViewNative/Modifiers/Input Events Modifiers/HoverEffectModifier.swift +++ b/Sources/LiveViewNative/Modifiers/Input Events Modifiers/HoverEffectModifier.swift @@ -12,7 +12,7 @@ import SwiftUI /// Note: The system may fall back to a more appropriate effect. /// /// ```html -///