diff --git a/Sources/Adwaita/View/Generated/ActionRow.swift b/Sources/Adwaita/View/Generated/ActionRow.swift index 59ea5bc..7932ee4 100644 --- a/Sources/Adwaita/View/Generated/ActionRow.swift +++ b/Sources/Adwaita/View/Generated/ActionRow.swift @@ -2,7 +2,7 @@ // ActionRow.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -38,7 +38,7 @@ public struct ActionRow: AdwaitaWidget { /// /// The target widget will be activated by emitting the /// `Gtk.Widget::mnemonic-activate` signal on it. - var activatableWidget: (() -> Body)? + var activatableWidget: Body? /// The subtitle for this row. /// /// The subtitle is interpreted as Pango markup unless @@ -96,7 +96,7 @@ public struct ActionRow: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let activatableWidgetStorage = activatableWidget?().storage(data: data, type: type) { + if let activatableWidgetStorage = activatableWidget?.storage(data: data, type: type) { storage.content["activatableWidget"] = [activatableWidgetStorage] adw_action_row_set_activatable_widget(storage.opaquePointer?.cast(), activatableWidgetStorage.opaquePointer?.cast()) } @@ -131,7 +131,7 @@ public struct ActionRow: AdwaitaWidget { storage.modify { widget in if let widget = storage.content["activatableWidget"]?.first { - activatableWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + activatableWidget?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let subtitleLines, updateProperties, (storage.previousState as? Self)?.subtitleLines != subtitleLines { adw_action_row_set_subtitle_lines(widget?.cast(), subtitleLines.cInt) @@ -202,10 +202,8 @@ public struct ActionRow: AdwaitaWidget { /// /// The target widget will be activated by emitting the /// `Gtk.Widget::mnemonic-activate` signal on it. - public func activatableWidget(@ViewBuilder _ activatableWidget: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.activatableWidget = activatableWidget - return newSelf + public func activatableWidget(@ViewBuilder _ activatableWidget: () -> Body) -> Self { + modify { $0.activatableWidget = activatableWidget() } } /// The subtitle for this row. @@ -213,9 +211,7 @@ public struct ActionRow: AdwaitaWidget { /// The subtitle is interpreted as Pango markup unless /// ``useMarkup(_:)`` is set to `false`. public func subtitle(_ subtitle: String?) -> Self { - var newSelf = self - newSelf.subtitle = subtitle - return newSelf + modify { $0.subtitle = subtitle } } /// The number of lines at the end of which the subtitle label will be @@ -223,18 +219,14 @@ public struct ActionRow: AdwaitaWidget { /// /// If the value is 0, the number of lines won't be limited. public func subtitleLines(_ subtitleLines: Int?) -> Self { - var newSelf = self - newSelf.subtitleLines = subtitleLines - return newSelf + modify { $0.subtitleLines = subtitleLines } } /// Whether the user can copy the subtitle from the label. /// /// See also ``selectable(_:)``. public func subtitleSelectable(_ subtitleSelectable: Bool? = true) -> Self { - var newSelf = self - newSelf.subtitleSelectable = subtitleSelectable - return newSelf + modify { $0.subtitleSelectable = subtitleSelectable } } /// The title of the preference represented by this row. @@ -242,27 +234,21 @@ public struct ActionRow: AdwaitaWidget { /// The title is interpreted as Pango markup unless /// ``useMarkup(_:)`` is set to `false`. public func title(_ title: String?) -> Self { - var newSelf = self - newSelf.title = title - return newSelf + modify { $0.title = title } } /// The number of lines at the end of which the title label will be ellipsized. /// /// If the value is 0, the number of lines won't be limited. public func titleLines(_ titleLines: Int?) -> Self { - var newSelf = self - newSelf.titleLines = titleLines - return newSelf + modify { $0.titleLines = titleLines } } /// Whether the user can copy the title from the label. /// /// See also ``selectable(_:)``. public func titleSelectable(_ titleSelectable: Bool? = true) -> Self { - var newSelf = self - newSelf.titleSelectable = titleSelectable - return newSelf + modify { $0.titleSelectable = titleSelectable } } /// Whether to use Pango markup for the title label. @@ -271,16 +257,12 @@ public struct ActionRow: AdwaitaWidget { /// /// See also `Pango.parse_markup`. public func useMarkup(_ useMarkup: Bool? = true) -> Self { - var newSelf = self - newSelf.useMarkup = useMarkup - return newSelf + modify { $0.useMarkup = useMarkup } } /// Whether an embedded underline in the title indicates a mnemonic. public func useUnderline(_ useUnderline: Bool? = true) -> Self { - var newSelf = self - newSelf.useUnderline = useUnderline - return newSelf + modify { $0.useUnderline = useUnderline } } /// This signal is emitted after the row has been activated. diff --git a/Sources/Adwaita/View/Generated/AspectFrame.swift b/Sources/Adwaita/View/Generated/AspectFrame.swift index 7f6d0f8..5e0062a 100644 --- a/Sources/Adwaita/View/Generated/AspectFrame.swift +++ b/Sources/Adwaita/View/Generated/AspectFrame.swift @@ -2,7 +2,7 @@ // AspectFrame.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -26,7 +26,7 @@ public struct AspectFrame: AdwaitaWidget { /// The accessible role cannot be changed once set. var accessibleRole: String? /// The child widget. - var child: (() -> Body)? + var child: Body? /// Whether the `GtkAspectFrame` should use the aspect ratio of its child. var obeyChild: Bool? /// The aspect ratio to be used by the `GtkAspectFrame`. @@ -55,7 +55,7 @@ public struct AspectFrame: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let childStorage = child?().storage(data: data, type: type) { + if let childStorage = child?.storage(data: data, type: type) { storage.content["child"] = [childStorage] gtk_aspect_frame_set_child(storage.opaquePointer, childStorage.opaquePointer?.cast()) } @@ -73,7 +73,7 @@ public struct AspectFrame: AdwaitaWidget { storage.modify { widget in if let widget = storage.content["child"]?.first { - child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + child?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let obeyChild, updateProperties, (storage.previousState as? Self)?.obeyChild != obeyChild { gtk_aspect_frame_set_obey_child(widget, obeyChild.cBool) @@ -103,23 +103,17 @@ public struct AspectFrame: AdwaitaWidget { /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// The child widget. - public func child(@ViewBuilder _ child: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.child = child - return newSelf + public func child(@ViewBuilder _ child: () -> Body) -> Self { + modify { $0.child = child() } } /// Whether the `GtkAspectFrame` should use the aspect ratio of its child. public func obeyChild(_ obeyChild: Bool? = true) -> Self { - var newSelf = self - newSelf.obeyChild = obeyChild - return newSelf + modify { $0.obeyChild = obeyChild } } /// The aspect ratio to be used by the `GtkAspectFrame`. @@ -127,23 +121,17 @@ public struct AspectFrame: AdwaitaWidget { /// This property is only used if /// ``obeyChild(_:)`` is set to `false`. public func ratio(_ ratio: Float) -> Self { - var newSelf = self - newSelf.ratio = ratio - return newSelf + modify { $0.ratio = ratio } } /// The horizontal alignment of the child. public func xalign(_ xalign: Float?) -> Self { - var newSelf = self - newSelf.xalign = xalign - return newSelf + modify { $0.xalign = xalign } } /// The vertical alignment of the child. public func yalign(_ yalign: Float?) -> Self { - var newSelf = self - newSelf.yalign = yalign - return newSelf + modify { $0.yalign = yalign } } } diff --git a/Sources/Adwaita/View/Generated/Avatar.swift b/Sources/Adwaita/View/Generated/Avatar.swift index 474d689..1cc78aa 100644 --- a/Sources/Adwaita/View/Generated/Avatar.swift +++ b/Sources/Adwaita/View/Generated/Avatar.swift @@ -2,7 +2,7 @@ // Avatar.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -107,25 +107,19 @@ public struct Avatar: AdwaitaWidget { /// /// If no name is set, `avatar-default-symbolic` will be used. public func iconName(_ iconName: String?) -> Self { - var newSelf = self - newSelf.iconName = iconName - return newSelf + modify { $0.iconName = iconName } } /// Whether initials are used instead of an icon on the fallback avatar. /// /// See ``iconName(_:)`` for how to change the fallback icon. public func showInitials(_ showInitials: Bool) -> Self { - var newSelf = self - newSelf.showInitials = showInitials - return newSelf + modify { $0.showInitials = showInitials } } /// The size of the avatar. public func size(_ size: Int) -> Self { - var newSelf = self - newSelf.size = size - return newSelf + modify { $0.size = size } } /// Sets the text used to generate the fallback initials and color. @@ -133,9 +127,7 @@ public struct Avatar: AdwaitaWidget { /// It's only used to generate the color if ``showInitials(_:)`` is /// `false`. public func text(_ text: String?) -> Self { - var newSelf = self - newSelf.text = text - return newSelf + modify { $0.text = text } } } diff --git a/Sources/Adwaita/View/Generated/Banner.swift b/Sources/Adwaita/View/Generated/Banner.swift index 845382a..e4592b1 100644 --- a/Sources/Adwaita/View/Generated/Banner.swift +++ b/Sources/Adwaita/View/Generated/Banner.swift @@ -2,7 +2,7 @@ // Banner.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -122,34 +122,26 @@ public struct Banner: AdwaitaWidget { /// The button can be used with a `GAction`, or with the /// `Banner::button-clicked` signal. public func buttonLabel(_ buttonLabel: String?) -> Self { - var newSelf = self - newSelf.buttonLabel = buttonLabel - return newSelf + modify { $0.buttonLabel = buttonLabel } } /// Whether the banner is currently revealed. public func revealed(_ revealed: Bool? = true) -> Self { - var newSelf = self - newSelf.revealed = revealed - return newSelf + modify { $0.revealed = revealed } } /// The title for this banner. /// /// See also: ``useMarkup(_:)``. public func title(_ title: String) -> Self { - var newSelf = self - newSelf.title = title - return newSelf + modify { $0.title = title } } /// Whether to use Pango markup for the banner title. /// /// See also `Pango.parse_markup`. public func useMarkup(_ useMarkup: Bool? = true) -> Self { - var newSelf = self - newSelf.useMarkup = useMarkup - return newSelf + modify { $0.useMarkup = useMarkup } } /// This signal is emitted after the action button has been clicked. diff --git a/Sources/Adwaita/View/Generated/Bin.swift b/Sources/Adwaita/View/Generated/Bin.swift index e5a3c53..eb217e8 100644 --- a/Sources/Adwaita/View/Generated/Bin.swift +++ b/Sources/Adwaita/View/Generated/Bin.swift @@ -2,7 +2,7 @@ // Bin.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -25,7 +25,7 @@ public struct Bin: AdwaitaWidget { var appearFunctions: [(ViewStorage, WidgetData) -> Void] = [] /// The child widget of the `AdwBin`. - var child: (() -> Body)? + var child: Body? /// Initialize `Bin`. public init() { @@ -42,7 +42,7 @@ public struct Bin: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let childStorage = child?().storage(data: data, type: type) { + if let childStorage = child?.storage(data: data, type: type) { storage.content["child"] = [childStorage] adw_bin_set_child(storage.opaquePointer?.cast(), childStorage.opaquePointer?.cast()) } @@ -60,7 +60,7 @@ public struct Bin: AdwaitaWidget { storage.modify { widget in if let widget = storage.content["child"]?.first { - child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + child?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } @@ -75,10 +75,8 @@ public struct Bin: AdwaitaWidget { } /// The child widget of the `AdwBin`. - public func child(@ViewBuilder _ child: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.child = child - return newSelf + public func child(@ViewBuilder _ child: () -> Body) -> Self { + modify { $0.child = child() } } } diff --git a/Sources/Adwaita/View/Generated/Box.swift b/Sources/Adwaita/View/Generated/Box.swift index 28d986f..093a3aa 100644 --- a/Sources/Adwaita/View/Generated/Box.swift +++ b/Sources/Adwaita/View/Generated/Box.swift @@ -2,7 +2,7 @@ // Box.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -148,32 +148,24 @@ public struct Box: AdwaitaWidget { /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// The position of the child that determines the baseline. /// /// This is only relevant if the box is in vertical orientation. public func baselineChild(_ baselineChild: Int?) -> Self { - var newSelf = self - newSelf.baselineChild = baselineChild - return newSelf + modify { $0.baselineChild = baselineChild } } /// Whether the children should all be the same size. public func homogeneous(_ homogeneous: Bool? = true) -> Self { - var newSelf = self - newSelf.homogeneous = homogeneous - return newSelf + modify { $0.homogeneous = homogeneous } } /// The amount of space between children. public func spacing(_ spacing: Int) -> Self { - var newSelf = self - newSelf.spacing = spacing - return newSelf + modify { $0.spacing = spacing } } /// Set the body for "append". diff --git a/Sources/Adwaita/View/Generated/Button.swift b/Sources/Adwaita/View/Generated/Button.swift index 286c6a6..2492182 100644 --- a/Sources/Adwaita/View/Generated/Button.swift +++ b/Sources/Adwaita/View/Generated/Button.swift @@ -2,7 +2,7 @@ // Button.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -39,7 +39,7 @@ public struct Button: AdwaitaWidget { /// property has no effect. var canShrink: Bool? /// The child widget. - var child: (() -> Body)? + var child: Body? /// Whether the button has a frame. var hasFrame: Bool? /// The name of the icon used to automatically populate the button. @@ -75,7 +75,7 @@ public struct Button: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let childStorage = child?().storage(data: data, type: type) { + if let childStorage = child?.storage(data: data, type: type) { storage.content["child"] = [childStorage] gtk_button_set_child(storage.opaquePointer?.cast(), childStorage.opaquePointer?.cast()) } @@ -109,7 +109,7 @@ public struct Button: AdwaitaWidget { gtk_button_set_can_shrink(widget?.cast(), canShrink.cBool) } if let widget = storage.content["child"]?.first { - child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + child?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let hasFrame, updateProperties, (storage.previousState as? Self)?.hasFrame != hasFrame { gtk_button_set_has_frame(widget?.cast(), hasFrame.cBool) @@ -139,16 +139,12 @@ public struct Button: AdwaitaWidget { /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// The name of the action with which this widget should be associated. public func actionName(_ actionName: String?) -> Self { - var newSelf = self - newSelf.actionName = actionName - return newSelf + modify { $0.actionName = actionName } } /// Whether the size of the button can be made smaller than the natural @@ -159,45 +155,33 @@ public struct Button: AdwaitaWidget { /// If the contents of a button are an icon or a custom widget, setting this /// property has no effect. public func canShrink(_ canShrink: Bool? = true) -> Self { - var newSelf = self - newSelf.canShrink = canShrink - return newSelf + modify { $0.canShrink = canShrink } } /// The child widget. - public func child(@ViewBuilder _ child: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.child = child - return newSelf + public func child(@ViewBuilder _ child: () -> Body) -> Self { + modify { $0.child = child() } } /// Whether the button has a frame. public func hasFrame(_ hasFrame: Bool? = true) -> Self { - var newSelf = self - newSelf.hasFrame = hasFrame - return newSelf + modify { $0.hasFrame = hasFrame } } /// The name of the icon used to automatically populate the button. public func iconName(_ iconName: String?) -> Self { - var newSelf = self - newSelf.iconName = iconName - return newSelf + modify { $0.iconName = iconName } } /// Text of the label inside the button, if the button contains a label widget. public func label(_ label: String?) -> Self { - var newSelf = self - newSelf.label = label - return newSelf + modify { $0.label = label } } /// If set, an underline in the text indicates that the following character is /// to be used as mnemonic. public func useUnderline(_ useUnderline: Bool? = true) -> Self { - var newSelf = self - newSelf.useUnderline = useUnderline - return newSelf + modify { $0.useUnderline = useUnderline } } /// Emitted to animate press then release. diff --git a/Sources/Adwaita/View/Generated/ButtonContent.swift b/Sources/Adwaita/View/Generated/ButtonContent.swift index db9150b..efb219c 100644 --- a/Sources/Adwaita/View/Generated/ButtonContent.swift +++ b/Sources/Adwaita/View/Generated/ButtonContent.swift @@ -2,7 +2,7 @@ // ButtonContent.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -110,25 +110,19 @@ public struct ButtonContent: AdwaitaWidget { /// /// See ``canShrink(_:)``. public func canShrink(_ canShrink: Bool? = true) -> Self { - var newSelf = self - newSelf.canShrink = canShrink - return newSelf + modify { $0.canShrink = canShrink } } /// The name of the displayed icon. /// /// If empty, the icon is not shown. public func iconName(_ iconName: String?) -> Self { - var newSelf = self - newSelf.iconName = iconName - return newSelf + modify { $0.iconName = iconName } } /// The displayed label. public func label(_ label: String?) -> Self { - var newSelf = self - newSelf.label = label - return newSelf + modify { $0.label = label } } /// Whether an underline in the text indicates a mnemonic. @@ -137,9 +131,7 @@ public struct ButtonContent: AdwaitaWidget { /// /// See ``label(_:)``. public func useUnderline(_ useUnderline: Bool? = true) -> Self { - var newSelf = self - newSelf.useUnderline = useUnderline - return newSelf + modify { $0.useUnderline = useUnderline } } } diff --git a/Sources/Adwaita/View/Generated/Carousel.swift b/Sources/Adwaita/View/Generated/Carousel.swift index b24ee5e..78a9137 100644 --- a/Sources/Adwaita/View/Generated/Carousel.swift +++ b/Sources/Adwaita/View/Generated/Carousel.swift @@ -2,7 +2,7 @@ // Carousel.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -150,27 +150,21 @@ public struct Carousel: AdwaitaWidget where Element: Identifiable { /// /// If the value is `false`, each swipe can only move to the adjacent pages. public func allowLongSwipes(_ allowLongSwipes: Bool? = true) -> Self { - var newSelf = self - newSelf.allowLongSwipes = allowLongSwipes - return newSelf + modify { $0.allowLongSwipes = allowLongSwipes } } /// Sets whether the `AdwCarousel` can be dragged with mouse pointer. /// /// If the value is `false`, dragging is only available on touch. public func allowMouseDrag(_ allowMouseDrag: Bool? = true) -> Self { - var newSelf = self - newSelf.allowMouseDrag = allowMouseDrag - return newSelf + modify { $0.allowMouseDrag = allowMouseDrag } } /// Whether the widget will respond to scroll wheel events. /// /// If the value is `false`, wheel events will be ignored. public func allowScrollWheel(_ allowScrollWheel: Bool? = true) -> Self { - var newSelf = self - newSelf.allowScrollWheel = allowScrollWheel - return newSelf + modify { $0.allowScrollWheel = allowScrollWheel } } /// Whether the carousel can be navigated. @@ -178,32 +172,24 @@ public struct Carousel: AdwaitaWidget where Element: Identifiable { /// This can be used to temporarily disable the carousel to only allow /// navigating it in a certain state. public func interactive(_ interactive: Bool? = true) -> Self { - var newSelf = self - newSelf.interactive = interactive - return newSelf + modify { $0.interactive = interactive } } /// The number of pages in a `AdwCarousel`. public func nPages(_ nPages: UInt?) -> Self { - var newSelf = self - newSelf.nPages = nPages - return newSelf + modify { $0.nPages = nPages } } /// Page reveal duration, in milliseconds. /// /// Reveal duration is used when animating adding or removing pages. public func revealDuration(_ revealDuration: UInt?) -> Self { - var newSelf = self - newSelf.revealDuration = revealDuration - return newSelf + modify { $0.revealDuration = revealDuration } } /// Spacing between pages in pixels. public func spacing(_ spacing: UInt?) -> Self { - var newSelf = self - newSelf.spacing = spacing - return newSelf + modify { $0.spacing = spacing } } /// This signal is emitted after a page has been changed. diff --git a/Sources/Adwaita/View/Generated/CenterBox.swift b/Sources/Adwaita/View/Generated/CenterBox.swift index 1811b1c..7c9e229 100644 --- a/Sources/Adwaita/View/Generated/CenterBox.swift +++ b/Sources/Adwaita/View/Generated/CenterBox.swift @@ -2,7 +2,7 @@ // CenterBox.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -33,13 +33,13 @@ public struct CenterBox: AdwaitaWidget { /// The accessible role cannot be changed once set. var accessibleRole: String? /// The widget that is placed at the center position. - var centerWidget: (() -> Body)? + var centerWidget: Body? /// The widget that is placed at the end position. /// /// In vertical orientation, the end position is at the bottom. /// In horizontal orientation, the end position is at the trailing /// edge with respect to the text direction. - var endWidget: (() -> Body)? + var endWidget: Body? /// Whether to shrink the center widget after other children. /// /// By default, when there's no space to give all three children their @@ -54,7 +54,7 @@ public struct CenterBox: AdwaitaWidget { /// In vertical orientation, the start position is at the top. /// In horizontal orientation, the start position is at the leading /// edge with respect to the text direction. - var startWidget: (() -> Body)? + var startWidget: Body? /// Initialize `CenterBox`. public init() { @@ -71,15 +71,15 @@ public struct CenterBox: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let centerWidgetStorage = centerWidget?().storage(data: data, type: type) { + if let centerWidgetStorage = centerWidget?.storage(data: data, type: type) { storage.content["centerWidget"] = [centerWidgetStorage] gtk_center_box_set_center_widget(storage.opaquePointer, centerWidgetStorage.opaquePointer?.cast()) } - if let endWidgetStorage = endWidget?().storage(data: data, type: type) { + if let endWidgetStorage = endWidget?.storage(data: data, type: type) { storage.content["endWidget"] = [endWidgetStorage] gtk_center_box_set_end_widget(storage.opaquePointer, endWidgetStorage.opaquePointer?.cast()) } - if let startWidgetStorage = startWidget?().storage(data: data, type: type) { + if let startWidgetStorage = startWidget?.storage(data: data, type: type) { storage.content["startWidget"] = [startWidgetStorage] gtk_center_box_set_start_widget(storage.opaquePointer, startWidgetStorage.opaquePointer?.cast()) } @@ -97,16 +97,16 @@ public struct CenterBox: AdwaitaWidget { storage.modify { widget in if let widget = storage.content["centerWidget"]?.first { - centerWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + centerWidget?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let widget = storage.content["endWidget"]?.first { - endWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + endWidget?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let shrinkCenterLast, updateProperties, (storage.previousState as? Self)?.shrinkCenterLast != shrinkCenterLast { gtk_center_box_set_shrink_center_last(widget, shrinkCenterLast.cBool) } if let widget = storage.content["startWidget"]?.first { - startWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + startWidget?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } @@ -124,16 +124,12 @@ public struct CenterBox: AdwaitaWidget { /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// The widget that is placed at the center position. - public func centerWidget(@ViewBuilder _ centerWidget: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.centerWidget = centerWidget - return newSelf + public func centerWidget(@ViewBuilder _ centerWidget: () -> Body) -> Self { + modify { $0.centerWidget = centerWidget() } } /// The widget that is placed at the end position. @@ -141,10 +137,8 @@ public struct CenterBox: AdwaitaWidget { /// In vertical orientation, the end position is at the bottom. /// In horizontal orientation, the end position is at the trailing /// edge with respect to the text direction. - public func endWidget(@ViewBuilder _ endWidget: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.endWidget = endWidget - return newSelf + public func endWidget(@ViewBuilder _ endWidget: () -> Body) -> Self { + modify { $0.endWidget = endWidget() } } /// Whether to shrink the center widget after other children. @@ -156,9 +150,7 @@ public struct CenterBox: AdwaitaWidget { /// If false, start and end widgets keep natural width and the /// center widget starts shrinking instead. public func shrinkCenterLast(_ shrinkCenterLast: Bool? = true) -> Self { - var newSelf = self - newSelf.shrinkCenterLast = shrinkCenterLast - return newSelf + modify { $0.shrinkCenterLast = shrinkCenterLast } } /// The widget that is placed at the start position. @@ -166,10 +158,8 @@ public struct CenterBox: AdwaitaWidget { /// In vertical orientation, the start position is at the top. /// In horizontal orientation, the start position is at the leading /// edge with respect to the text direction. - public func startWidget(@ViewBuilder _ startWidget: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.startWidget = startWidget - return newSelf + public func startWidget(@ViewBuilder _ startWidget: () -> Body) -> Self { + modify { $0.startWidget = startWidget() } } } diff --git a/Sources/Adwaita/View/Generated/CheckButton.swift b/Sources/Adwaita/View/Generated/CheckButton.swift index 9e046f5..f62af33 100644 --- a/Sources/Adwaita/View/Generated/CheckButton.swift +++ b/Sources/Adwaita/View/Generated/CheckButton.swift @@ -2,7 +2,7 @@ // CheckButton.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -39,7 +39,7 @@ public struct CheckButton: AdwaitaWidget { /// the check button and the indicator CSS node. var active: Binding? /// The child widget. - var child: (() -> Body)? + var child: Body? /// If the check button is in an “in between” state. /// /// The inconsistent state only affects visual appearance, @@ -80,7 +80,7 @@ public struct CheckButton: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let childStorage = child?().storage(data: data, type: type) { + if let childStorage = child?.storage(data: data, type: type) { storage.content["child"] = [childStorage] gtk_check_button_set_child(storage.opaquePointer?.cast(), childStorage.opaquePointer?.cast()) } @@ -120,7 +120,7 @@ if let active, newValue != active.wrappedValue { gtk_check_button_set_active(storage.opaquePointer?.cast(), active.wrappedValue.cBool) } if let widget = storage.content["child"]?.first { - child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + child?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let inconsistent, updateProperties, (storage.previousState as? Self)?.inconsistent != inconsistent { gtk_check_button_set_inconsistent(widget?.cast(), inconsistent.cBool) @@ -147,16 +147,12 @@ if let active, newValue != active.wrappedValue { /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// The name of the action with which this widget should be associated. public func actionName(_ actionName: String?) -> Self { - var newSelf = self - newSelf.actionName = actionName - return newSelf + modify { $0.actionName = actionName } } /// If the check button is active. @@ -164,16 +160,12 @@ if let active, newValue != active.wrappedValue { /// Setting `active` to `true` will add the `:checked:` state to both /// the check button and the indicator CSS node. public func active(_ active: Binding?) -> Self { - var newSelf = self - newSelf.active = active - return newSelf + modify { $0.active = active } } /// The child widget. - public func child(@ViewBuilder _ child: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.child = child - return newSelf + public func child(@ViewBuilder _ child: () -> Body) -> Self { + modify { $0.child = child() } } /// If the check button is in an “in between” state. @@ -181,24 +173,18 @@ if let active, newValue != active.wrappedValue { /// The inconsistent state only affects visual appearance, /// not the semantics of the button. public func inconsistent(_ inconsistent: Bool? = true) -> Self { - var newSelf = self - newSelf.inconsistent = inconsistent - return newSelf + modify { $0.inconsistent = inconsistent } } /// Text of the label inside the check button, if it contains a label widget. public func label(_ label: String?) -> Self { - var newSelf = self - newSelf.label = label - return newSelf + modify { $0.label = label } } /// If set, an underline in the text indicates that the following /// character is to be used as mnemonic. public func useUnderline(_ useUnderline: Bool? = true) -> Self { - var newSelf = self - newSelf.useUnderline = useUnderline - return newSelf + modify { $0.useUnderline = useUnderline } } /// Emitted to when the check button is activated. diff --git a/Sources/Adwaita/View/Generated/Clamp.swift b/Sources/Adwaita/View/Generated/Clamp.swift index dc1c56a..0d02391 100644 --- a/Sources/Adwaita/View/Generated/Clamp.swift +++ b/Sources/Adwaita/View/Generated/Clamp.swift @@ -2,7 +2,7 @@ // Clamp.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -34,7 +34,7 @@ public struct Clamp: AdwaitaWidget { var appearFunctions: [(ViewStorage, WidgetData) -> Void] = [] /// The child widget of the `AdwClamp`. - var child: (() -> Body)? + var child: Body? /// The maximum size allocated to the child. /// /// It is the width if the clamp is horizontal, or the height if it is vertical. @@ -70,7 +70,7 @@ public struct Clamp: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let childStorage = child?().storage(data: data, type: type) { + if let childStorage = child?.storage(data: data, type: type) { storage.content["child"] = [childStorage] adw_clamp_set_child(storage.opaquePointer, childStorage.opaquePointer?.cast()) } @@ -88,7 +88,7 @@ public struct Clamp: AdwaitaWidget { storage.modify { widget in if let widget = storage.content["child"]?.first { - child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + child?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let maximumSize, updateProperties, (storage.previousState as? Self)?.maximumSize != maximumSize { adw_clamp_set_maximum_size(widget, maximumSize.cInt) @@ -109,19 +109,15 @@ public struct Clamp: AdwaitaWidget { } /// The child widget of the `AdwClamp`. - public func child(@ViewBuilder _ child: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.child = child - return newSelf + public func child(@ViewBuilder _ child: () -> Body) -> Self { + modify { $0.child = child() } } /// The maximum size allocated to the child. /// /// It is the width if the clamp is horizontal, or the height if it is vertical. public func maximumSize(_ maximumSize: Int?) -> Self { - var newSelf = self - newSelf.maximumSize = maximumSize - return newSelf + modify { $0.maximumSize = maximumSize } } /// The size above which the child is clamped. @@ -139,9 +135,7 @@ public struct Clamp: AdwaitaWidget { /// Effectively, tightening the grip on the child before it reaches its maximum /// size makes transitions to and from the maximum size smoother when resizing. public func tighteningThreshold(_ tighteningThreshold: Int?) -> Self { - var newSelf = self - newSelf.tighteningThreshold = tighteningThreshold - return newSelf + modify { $0.tighteningThreshold = tighteningThreshold } } } diff --git a/Sources/Adwaita/View/Generated/ComboRow.swift b/Sources/Adwaita/View/Generated/ComboRow.swift index 3fdba9c..ec56bd9 100644 --- a/Sources/Adwaita/View/Generated/ComboRow.swift +++ b/Sources/Adwaita/View/Generated/ComboRow.swift @@ -2,7 +2,7 @@ // ComboRow.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -46,7 +46,7 @@ public struct ComboRow: AdwaitaWidget { /// /// The target widget will be activated by emitting the /// `Gtk.Widget::mnemonic-activate` signal on it. - var activatableWidget: (() -> Body)? + var activatableWidget: Body? /// Whether to show a search entry in the popup. /// /// If set to `true`, a search entry will be shown in the popup that @@ -126,7 +126,7 @@ public struct ComboRow: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let activatableWidgetStorage = activatableWidget?().storage(data: data, type: type) { + if let activatableWidgetStorage = activatableWidget?.storage(data: data, type: type) { storage.content["activatableWidget"] = [activatableWidgetStorage] adw_action_row_set_activatable_widget(storage.opaquePointer?.cast(), activatableWidgetStorage.opaquePointer?.cast()) } @@ -167,7 +167,7 @@ if let selected, newValue != selected.wrappedValue { } } if let widget = storage.content["activatableWidget"]?.first { - activatableWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + activatableWidget?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let enableSearch, updateProperties, (storage.previousState as? Self)?.enableSearch != enableSearch { adw_combo_row_set_enable_search(widget?.cast(), enableSearch.cBool) @@ -223,10 +223,8 @@ if let selected, newValue != selected.wrappedValue { /// /// The target widget will be activated by emitting the /// `Gtk.Widget::mnemonic-activate` signal on it. - public func activatableWidget(@ViewBuilder _ activatableWidget: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.activatableWidget = activatableWidget - return newSelf + public func activatableWidget(@ViewBuilder _ activatableWidget: () -> Body) -> Self { + modify { $0.activatableWidget = activatableWidget() } } /// Whether to show a search entry in the popup. @@ -236,9 +234,7 @@ if let selected, newValue != selected.wrappedValue { /// /// Search requires ``expression(_:)`` to be set. public func enableSearch(_ enableSearch: Bool? = true) -> Self { - var newSelf = self - newSelf.enableSearch = enableSearch - return newSelf + modify { $0.enableSearch = enableSearch } } /// The position of the selected item. @@ -246,9 +242,7 @@ if let selected, newValue != selected.wrappedValue { /// If no item is selected, the property has the value /// `Gtk.INVALID_LIST_POSITION` public func selected(_ selected: Binding?) -> Self { - var newSelf = self - newSelf.selected = selected - return newSelf + modify { $0.selected = selected } } /// The subtitle for this row. @@ -256,9 +250,7 @@ if let selected, newValue != selected.wrappedValue { /// The subtitle is interpreted as Pango markup unless /// ``useMarkup(_:)`` is set to `false`. public func subtitle(_ subtitle: String?) -> Self { - var newSelf = self - newSelf.subtitle = subtitle - return newSelf + modify { $0.subtitle = subtitle } } /// The number of lines at the end of which the subtitle label will be @@ -266,18 +258,14 @@ if let selected, newValue != selected.wrappedValue { /// /// If the value is 0, the number of lines won't be limited. public func subtitleLines(_ subtitleLines: Int?) -> Self { - var newSelf = self - newSelf.subtitleLines = subtitleLines - return newSelf + modify { $0.subtitleLines = subtitleLines } } /// Whether the user can copy the subtitle from the label. /// /// See also ``selectable(_:)``. public func subtitleSelectable(_ subtitleSelectable: Bool? = true) -> Self { - var newSelf = self - newSelf.subtitleSelectable = subtitleSelectable - return newSelf + modify { $0.subtitleSelectable = subtitleSelectable } } /// The title of the preference represented by this row. @@ -285,27 +273,21 @@ if let selected, newValue != selected.wrappedValue { /// The title is interpreted as Pango markup unless /// ``useMarkup(_:)`` is set to `false`. public func title(_ title: String?) -> Self { - var newSelf = self - newSelf.title = title - return newSelf + modify { $0.title = title } } /// The number of lines at the end of which the title label will be ellipsized. /// /// If the value is 0, the number of lines won't be limited. public func titleLines(_ titleLines: Int?) -> Self { - var newSelf = self - newSelf.titleLines = titleLines - return newSelf + modify { $0.titleLines = titleLines } } /// Whether the user can copy the title from the label. /// /// See also ``selectable(_:)``. public func titleSelectable(_ titleSelectable: Bool? = true) -> Self { - var newSelf = self - newSelf.titleSelectable = titleSelectable - return newSelf + modify { $0.titleSelectable = titleSelectable } } /// Whether to use Pango markup for the title label. @@ -314,9 +296,7 @@ if let selected, newValue != selected.wrappedValue { /// /// See also `Pango.parse_markup`. public func useMarkup(_ useMarkup: Bool? = true) -> Self { - var newSelf = self - newSelf.useMarkup = useMarkup - return newSelf + modify { $0.useMarkup = useMarkup } } /// Whether to use the current value as the subtitle. @@ -329,16 +309,12 @@ if let selected, newValue != selected.wrappedValue { /// The subtitle is interpreted as Pango markup if /// ``useMarkup(_:)`` is set to `true`. public func useSubtitle(_ useSubtitle: Bool? = true) -> Self { - var newSelf = self - newSelf.useSubtitle = useSubtitle - return newSelf + modify { $0.useSubtitle = useSubtitle } } /// Whether an embedded underline in the title indicates a mnemonic. public func useUnderline(_ useUnderline: Bool? = true) -> Self { - var newSelf = self - newSelf.useUnderline = useUnderline - return newSelf + modify { $0.useUnderline = useUnderline } } /// This signal is emitted after the row has been activated. diff --git a/Sources/Adwaita/View/Generated/DropDown.swift b/Sources/Adwaita/View/Generated/DropDown.swift index 44050b2..c1936cc 100644 --- a/Sources/Adwaita/View/Generated/DropDown.swift +++ b/Sources/Adwaita/View/Generated/DropDown.swift @@ -2,7 +2,7 @@ // DropDown.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -139,9 +139,7 @@ if let selected, newValue != selected.wrappedValue { /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// Whether to show a search entry in the popup. @@ -149,9 +147,7 @@ if let selected, newValue != selected.wrappedValue { /// Note that search requires ``expression(_:)`` /// to be set. public func enableSearch(_ enableSearch: Bool? = true) -> Self { - var newSelf = self - newSelf.enableSearch = enableSearch - return newSelf + modify { $0.enableSearch = enableSearch } } /// The position of the selected item. @@ -159,16 +155,12 @@ if let selected, newValue != selected.wrappedValue { /// If no item is selected, the property has the value /// %GTK_INVALID_LIST_POSITION. public func selected(_ selected: Binding?) -> Self { - var newSelf = self - newSelf.selected = selected - return newSelf + modify { $0.selected = selected } } /// Whether to show an arrow within the GtkDropDown widget. public func showArrow(_ showArrow: Bool? = true) -> Self { - var newSelf = self - newSelf.showArrow = showArrow - return newSelf + modify { $0.showArrow = showArrow } } /// Emitted to when the drop down is activated. diff --git a/Sources/Adwaita/View/Generated/Entry.swift b/Sources/Adwaita/View/Generated/Entry.swift index 0a383fd..a0f6f95 100644 --- a/Sources/Adwaita/View/Generated/Entry.swift +++ b/Sources/Adwaita/View/Generated/Entry.swift @@ -2,7 +2,7 @@ // Entry.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -69,7 +69,7 @@ public struct Entry: AdwaitaWidget { /// If undo/redo should be enabled for the editable. var enableUndo: Bool? /// A menu model whose contents will be appended to the context menu. - var extraMenu: (() -> Body)? + var extraMenu: Body? /// Whether the entry should draw a frame. var hasFrame: Bool? /// Which IM (input method) module should be used for this entry. @@ -280,8 +280,8 @@ public struct Entry: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let menu = extraMenu?() { - let childStorage = MenuCollection { menu }.getMenu(data: data) + if let extraMenu { + let childStorage = MenuCollection { extraMenu }.getMenu(data: data) storage.content["extraMenu"] = [childStorage] gtk_entry_set_extra_menu(storage.opaquePointer?.cast(), childStorage.opaquePointer?.cast()) } @@ -354,7 +354,7 @@ if let text, newValue != text.wrappedValue { gtk_editable_set_enable_undo(widget, enableUndo.cBool) } if let menu = storage.content["extraMenu"]?.first { - MenuCollection { extraMenu?() ?? [] } + MenuCollection { extraMenu ?? [] } .updateStorage(menu, data: data.noModifiers, updateProperties: updateProperties, type: MenuContext.self) } if let hasFrame, updateProperties, (storage.previousState as? Self)?.hasFrame != hasFrame { @@ -409,59 +409,43 @@ if let text, newValue != text.wrappedValue { /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// The current position of the insertion cursor in chars. public func cursorPosition(_ cursorPosition: Int?) -> Self { - var newSelf = self - newSelf.cursorPosition = cursorPosition - return newSelf + modify { $0.cursorPosition = cursorPosition } } /// Whether the entry contents can be edited. public func editable(_ editable: Bool? = true) -> Self { - var newSelf = self - newSelf.editable = editable - return newSelf + modify { $0.editable = editable } } /// Indicates whether editing on the cell has been canceled. public func editingCanceled(_ editingCanceled: Bool? = true) -> Self { - var newSelf = self - newSelf.editingCanceled = editingCanceled - return newSelf + modify { $0.editingCanceled = editingCanceled } } /// Whether to suggest Emoji replacements for :-delimited names /// like `:heart:`. public func enableEmojiCompletion(_ enableEmojiCompletion: Bool? = true) -> Self { - var newSelf = self - newSelf.enableEmojiCompletion = enableEmojiCompletion - return newSelf + modify { $0.enableEmojiCompletion = enableEmojiCompletion } } /// If undo/redo should be enabled for the editable. public func enableUndo(_ enableUndo: Bool? = true) -> Self { - var newSelf = self - newSelf.enableUndo = enableUndo - return newSelf + modify { $0.enableUndo = enableUndo } } /// A menu model whose contents will be appended to the context menu. - public func extraMenu(@ViewBuilder _ extraMenu: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.extraMenu = extraMenu - return newSelf + public func extraMenu(@ViewBuilder _ extraMenu: () -> Body) -> Self { + modify { $0.extraMenu = extraMenu() } } /// Whether the entry should draw a frame. public func hasFrame(_ hasFrame: Bool? = true) -> Self { - var newSelf = self - newSelf.hasFrame = hasFrame - return newSelf + modify { $0.hasFrame = hasFrame } } /// Which IM (input method) module should be used for this entry. @@ -472,37 +456,27 @@ if let text, newValue != text.wrappedValue { /// module setting. See the GtkSettings ``gtkImModule(_:)`` /// property. public func imModule(_ imModule: String?) -> Self { - var newSelf = self - newSelf.imModule = imModule - return newSelf + modify { $0.imModule = imModule } } /// The character to use when masking entry contents (“password mode”). public func invisibleCharacter(_ invisibleCharacter: UInt?) -> Self { - var newSelf = self - newSelf.invisibleCharacter = invisibleCharacter - return newSelf + modify { $0.invisibleCharacter = invisibleCharacter } } /// Whether the invisible char has been set for the `GtkEntry`. public func invisibleCharacterSet(_ invisibleCharacterSet: Bool? = true) -> Self { - var newSelf = self - newSelf.invisibleCharacterSet = invisibleCharacterSet - return newSelf + modify { $0.invisibleCharacterSet = invisibleCharacterSet } } /// Maximum number of characters for this entry. public func maxLength(_ maxLength: Int?) -> Self { - var newSelf = self - newSelf.maxLength = maxLength - return newSelf + modify { $0.maxLength = maxLength } } /// The desired maximum width of the entry, in characters. public func maxWidthChars(_ maxWidthChars: Int?) -> Self { - var newSelf = self - newSelf.maxWidthChars = maxWidthChars - return newSelf + modify { $0.maxWidthChars = maxWidthChars } } /// Text for an item in the context menu to activate the primary icon action. @@ -518,9 +492,7 @@ if let text, newValue != text.wrappedValue { /// menu. This set of methods greatly simplifies this, by adding a menu item that, when /// enabled, calls the same callback than clicking on the icon. public func menuEntryIconPrimaryText(_ menuEntryIconPrimaryText: String?) -> Self { - var newSelf = self - newSelf.menuEntryIconPrimaryText = menuEntryIconPrimaryText - return newSelf + modify { $0.menuEntryIconPrimaryText = menuEntryIconPrimaryText } } /// Text for an item in the context menu to activate the secondary icon action. @@ -536,24 +508,18 @@ if let text, newValue != text.wrappedValue { /// menu. This set of methods greatly simplifies this, by adding a menu item that, when /// enabled, calls the same callback than clicking on the icon. public func menuEntryIconSecondaryText(_ menuEntryIconSecondaryText: String?) -> Self { - var newSelf = self - newSelf.menuEntryIconSecondaryText = menuEntryIconSecondaryText - return newSelf + modify { $0.menuEntryIconSecondaryText = menuEntryIconSecondaryText } } /// If text is overwritten when typing in the `GtkEntry`. public func overwriteMode(_ overwriteMode: Bool? = true) -> Self { - var newSelf = self - newSelf.overwriteMode = overwriteMode - return newSelf + modify { $0.overwriteMode = overwriteMode } } /// The text that will be displayed in the `GtkEntry` when it is empty /// and unfocused. public func placeholderText(_ placeholderText: String?) -> Self { - var newSelf = self - newSelf.placeholderText = placeholderText - return newSelf + modify { $0.placeholderText = placeholderText } } /// Whether the primary icon is activatable. @@ -565,16 +531,12 @@ if let text, newValue != text.wrappedValue { /// Sensitive, but non-activatable icons can be used for purely /// informational purposes. public func primaryIconActivatable(_ primaryIconActivatable: Bool? = true) -> Self { - var newSelf = self - newSelf.primaryIconActivatable = primaryIconActivatable - return newSelf + modify { $0.primaryIconActivatable = primaryIconActivatable } } /// The icon name to use for the primary icon for the entry. public func primaryIconName(_ primaryIconName: String?) -> Self { - var newSelf = self - newSelf.primaryIconName = primaryIconName - return newSelf + modify { $0.primaryIconName = primaryIconName } } /// Whether the primary icon is sensitive. @@ -586,34 +548,26 @@ if let text, newValue != text.wrappedValue { /// An icon should be set insensitive if the action that would trigger /// when clicked is currently not available. public func primaryIconSensitive(_ primaryIconSensitive: Bool? = true) -> Self { - var newSelf = self - newSelf.primaryIconSensitive = primaryIconSensitive - return newSelf + modify { $0.primaryIconSensitive = primaryIconSensitive } } /// The contents of the tooltip on the primary icon, with markup. /// /// Also see `Gtk.Entry.set_icon_tooltip_markup`. public func primaryIconTooltipMarkup(_ primaryIconTooltipMarkup: String?) -> Self { - var newSelf = self - newSelf.primaryIconTooltipMarkup = primaryIconTooltipMarkup - return newSelf + modify { $0.primaryIconTooltipMarkup = primaryIconTooltipMarkup } } /// The contents of the tooltip on the primary icon. /// /// Also see `Gtk.Entry.set_icon_tooltip_text`. public func primaryIconTooltipText(_ primaryIconTooltipText: String?) -> Self { - var newSelf = self - newSelf.primaryIconTooltipText = primaryIconTooltipText - return newSelf + modify { $0.primaryIconTooltipText = primaryIconTooltipText } } /// The current fraction of the task that's been completed. public func progressFraction(_ progressFraction: Double?) -> Self { - var newSelf = self - newSelf.progressFraction = progressFraction - return newSelf + modify { $0.progressFraction = progressFraction } } /// The fraction of total entry width to move the progress @@ -621,16 +575,12 @@ if let text, newValue != text.wrappedValue { /// /// See `Gtk.Entry.progress_pulse`. public func progressPulseStep(_ progressPulseStep: Double?) -> Self { - var newSelf = self - newSelf.progressPulseStep = progressPulseStep - return newSelf + modify { $0.progressPulseStep = progressPulseStep } } /// Number of pixels of the entry scrolled off the screen to the left. public func scrollOffset(_ scrollOffset: Int?) -> Self { - var newSelf = self - newSelf.scrollOffset = scrollOffset - return newSelf + modify { $0.scrollOffset = scrollOffset } } /// Whether the secondary icon is activatable. @@ -642,16 +592,12 @@ if let text, newValue != text.wrappedValue { /// Sensitive, but non-activatable icons can be used for purely /// informational purposes. public func secondaryIconActivatable(_ secondaryIconActivatable: Bool? = true) -> Self { - var newSelf = self - newSelf.secondaryIconActivatable = secondaryIconActivatable - return newSelf + modify { $0.secondaryIconActivatable = secondaryIconActivatable } } /// The icon name to use for the secondary icon for the entry. public func secondaryIconName(_ secondaryIconName: String?) -> Self { - var newSelf = self - newSelf.secondaryIconName = secondaryIconName - return newSelf + modify { $0.secondaryIconName = secondaryIconName } } /// Whether the secondary icon is sensitive. @@ -663,87 +609,65 @@ if let text, newValue != text.wrappedValue { /// An icon should be set insensitive if the action that would trigger /// when clicked is currently not available. public func secondaryIconSensitive(_ secondaryIconSensitive: Bool? = true) -> Self { - var newSelf = self - newSelf.secondaryIconSensitive = secondaryIconSensitive - return newSelf + modify { $0.secondaryIconSensitive = secondaryIconSensitive } } /// The contents of the tooltip on the secondary icon, with markup. /// /// Also see `Gtk.Entry.set_icon_tooltip_markup`. public func secondaryIconTooltipMarkup(_ secondaryIconTooltipMarkup: String?) -> Self { - var newSelf = self - newSelf.secondaryIconTooltipMarkup = secondaryIconTooltipMarkup - return newSelf + modify { $0.secondaryIconTooltipMarkup = secondaryIconTooltipMarkup } } /// The contents of the tooltip on the secondary icon. /// /// Also see `Gtk.Entry.set_icon_tooltip_text`. public func secondaryIconTooltipText(_ secondaryIconTooltipText: String?) -> Self { - var newSelf = self - newSelf.secondaryIconTooltipText = secondaryIconTooltipText - return newSelf + modify { $0.secondaryIconTooltipText = secondaryIconTooltipText } } /// The position of the opposite end of the selection from the cursor in chars. public func selectionBound(_ selectionBound: Int?) -> Self { - var newSelf = self - newSelf.selectionBound = selectionBound - return newSelf + modify { $0.selectionBound = selectionBound } } /// Whether the entry will show an Emoji icon in the secondary icon position /// to open the Emoji chooser. public func showEmojiIcon(_ showEmojiIcon: Bool? = true) -> Self { - var newSelf = self - newSelf.showEmojiIcon = showEmojiIcon - return newSelf + modify { $0.showEmojiIcon = showEmojiIcon } } /// The contents of the entry. public func text(_ text: Binding?) -> Self { - var newSelf = self - newSelf.text = text - return newSelf + modify { $0.text = text } } /// The length of the text in the `GtkEntry`. public func textLength(_ textLength: UInt?) -> Self { - var newSelf = self - newSelf.textLength = textLength - return newSelf + modify { $0.textLength = textLength } } /// When `true`, pasted multi-line text is truncated to the first line. public func truncateMultiline(_ truncateMultiline: Bool? = true) -> Self { - var newSelf = self - newSelf.truncateMultiline = truncateMultiline - return newSelf + modify { $0.truncateMultiline = truncateMultiline } } /// Whether the entry should show the “invisible char” instead of the /// actual text (“password mode”). public func visibility(_ visibility: Bool? = true) -> Self { - var newSelf = self - newSelf.visibility = visibility - return newSelf + modify { $0.visibility = visibility } } /// Number of characters to leave space for in the entry. public func widthChars(_ widthChars: Int?) -> Self { - var newSelf = self - newSelf.widthChars = widthChars - return newSelf + modify { $0.widthChars = widthChars } } /// The horizontal alignment, from 0 (left) to 1 (right). /// /// Reversed for RTL layouts. public func xalign(_ xalign: Float?) -> Self { - var newSelf = self - newSelf.xalign = xalign - return newSelf + modify { $0.xalign = xalign } } /// Emitted when the entry is activated. diff --git a/Sources/Adwaita/View/Generated/EntryRow.swift b/Sources/Adwaita/View/Generated/EntryRow.swift index 24c5e93..b4abf7f 100644 --- a/Sources/Adwaita/View/Generated/EntryRow.swift +++ b/Sources/Adwaita/View/Generated/EntryRow.swift @@ -2,7 +2,7 @@ // EntryRow.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -194,25 +194,19 @@ public struct EntryRow: AdwaitaWidget { /// Whether activating the embedded entry can activate the default widget. public func activatesDefault(_ activatesDefault: Bool? = true) -> Self { - var newSelf = self - newSelf.activatesDefault = activatesDefault - return newSelf + modify { $0.activatesDefault = activatesDefault } } /// Whether to suggest emoji replacements on the entry row. /// /// Emoji replacement is done with :-delimited names, like `:heart:`. public func enableEmojiCompletion(_ enableEmojiCompletion: Bool? = true) -> Self { - var newSelf = self - newSelf.enableEmojiCompletion = enableEmojiCompletion - return newSelf + modify { $0.enableEmojiCompletion = enableEmojiCompletion } } /// Maximum number of characters for the entry. public func maxLength(_ maxLength: Int?) -> Self { - var newSelf = self - newSelf.maxLength = maxLength - return newSelf + modify { $0.maxLength = maxLength } } /// Whether to show the apply button. @@ -225,16 +219,12 @@ public struct EntryRow: AdwaitaWidget { /// operation, e.g. network activity, to avoid triggering it after typing every /// character. public func showApplyButton(_ showApplyButton: Bool? = true) -> Self { - var newSelf = self - newSelf.showApplyButton = showApplyButton - return newSelf + modify { $0.showApplyButton = showApplyButton } } /// The length of the text in the entry row. public func textLength(_ textLength: UInt?) -> Self { - var newSelf = self - newSelf.textLength = textLength - return newSelf + modify { $0.textLength = textLength } } /// The title of the preference represented by this row. @@ -242,18 +232,14 @@ public struct EntryRow: AdwaitaWidget { /// The title is interpreted as Pango markup unless /// ``useMarkup(_:)`` is set to `false`. public func title(_ title: String?) -> Self { - var newSelf = self - newSelf.title = title - return newSelf + modify { $0.title = title } } /// Whether the user can copy the title from the label. /// /// See also ``selectable(_:)``. public func titleSelectable(_ titleSelectable: Bool? = true) -> Self { - var newSelf = self - newSelf.titleSelectable = titleSelectable - return newSelf + modify { $0.titleSelectable = titleSelectable } } /// Whether to use Pango markup for the title label. @@ -262,16 +248,12 @@ public struct EntryRow: AdwaitaWidget { /// /// See also `Pango.parse_markup`. public func useMarkup(_ useMarkup: Bool? = true) -> Self { - var newSelf = self - newSelf.useMarkup = useMarkup - return newSelf + modify { $0.useMarkup = useMarkup } } /// Whether an embedded underline in the title indicates a mnemonic. public func useUnderline(_ useUnderline: Bool? = true) -> Self { - var newSelf = self - newSelf.useUnderline = useUnderline - return newSelf + modify { $0.useUnderline = useUnderline } } /// Emitted when the apply button is pressed. diff --git a/Sources/Adwaita/View/Generated/ExpanderRow.swift b/Sources/Adwaita/View/Generated/ExpanderRow.swift index cde6b1c..0b100e9 100644 --- a/Sources/Adwaita/View/Generated/ExpanderRow.swift +++ b/Sources/Adwaita/View/Generated/ExpanderRow.swift @@ -2,7 +2,7 @@ // ExpanderRow.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -206,23 +206,17 @@ if let expanded, newValue != expanded.wrappedValue { /// Whether expansion is enabled. public func enableExpansion(_ enableExpansion: Binding?) -> Self { - var newSelf = self - newSelf.enableExpansion = enableExpansion - return newSelf + modify { $0.enableExpansion = enableExpansion } } /// Whether the row is expanded. public func expanded(_ expanded: Binding?) -> Self { - var newSelf = self - newSelf.expanded = expanded - return newSelf + modify { $0.expanded = expanded } } /// Whether the switch enabling the expansion is visible. public func showEnableSwitch(_ showEnableSwitch: Bool? = true) -> Self { - var newSelf = self - newSelf.showEnableSwitch = showEnableSwitch - return newSelf + modify { $0.showEnableSwitch = showEnableSwitch } } /// The subtitle for this row. @@ -230,9 +224,7 @@ if let expanded, newValue != expanded.wrappedValue { /// The subtitle is interpreted as Pango markup unless /// ``useMarkup(_:)`` is set to `false`. public func subtitle(_ subtitle: String?) -> Self { - var newSelf = self - newSelf.subtitle = subtitle - return newSelf + modify { $0.subtitle = subtitle } } /// The number of lines at the end of which the subtitle label will be @@ -240,9 +232,7 @@ if let expanded, newValue != expanded.wrappedValue { /// /// If the value is 0, the number of lines won't be limited. public func subtitleLines(_ subtitleLines: Int?) -> Self { - var newSelf = self - newSelf.subtitleLines = subtitleLines - return newSelf + modify { $0.subtitleLines = subtitleLines } } /// The title of the preference represented by this row. @@ -250,27 +240,21 @@ if let expanded, newValue != expanded.wrappedValue { /// The title is interpreted as Pango markup unless /// ``useMarkup(_:)`` is set to `false`. public func title(_ title: String?) -> Self { - var newSelf = self - newSelf.title = title - return newSelf + modify { $0.title = title } } /// The number of lines at the end of which the title label will be ellipsized. /// /// If the value is 0, the number of lines won't be limited. public func titleLines(_ titleLines: Int?) -> Self { - var newSelf = self - newSelf.titleLines = titleLines - return newSelf + modify { $0.titleLines = titleLines } } /// Whether the user can copy the title from the label. /// /// See also ``selectable(_:)``. public func titleSelectable(_ titleSelectable: Bool? = true) -> Self { - var newSelf = self - newSelf.titleSelectable = titleSelectable - return newSelf + modify { $0.titleSelectable = titleSelectable } } /// Whether to use Pango markup for the title label. @@ -279,16 +263,12 @@ if let expanded, newValue != expanded.wrappedValue { /// /// See also `Pango.parse_markup`. public func useMarkup(_ useMarkup: Bool? = true) -> Self { - var newSelf = self - newSelf.useMarkup = useMarkup - return newSelf + modify { $0.useMarkup = useMarkup } } /// Whether an embedded underline in the title indicates a mnemonic. public func useUnderline(_ useUnderline: Bool? = true) -> Self { - var newSelf = self - newSelf.useUnderline = useUnderline - return newSelf + modify { $0.useUnderline = useUnderline } } /// Set the body for "rows". diff --git a/Sources/Adwaita/View/Generated/Fixed.swift b/Sources/Adwaita/View/Generated/Fixed.swift index cd15a5b..9719fb0 100644 --- a/Sources/Adwaita/View/Generated/Fixed.swift +++ b/Sources/Adwaita/View/Generated/Fixed.swift @@ -2,7 +2,7 @@ // Fixed.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -101,9 +101,7 @@ public struct Fixed: AdwaitaWidget { /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } } diff --git a/Sources/Adwaita/View/Generated/FlowBox.swift b/Sources/Adwaita/View/Generated/FlowBox.swift index e96535e..1a78e81 100644 --- a/Sources/Adwaita/View/Generated/FlowBox.swift +++ b/Sources/Adwaita/View/Generated/FlowBox.swift @@ -2,7 +2,7 @@ // FlowBox.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -238,49 +238,37 @@ public struct FlowBox: AdwaitaWidget where Element: Identifiable { /// Whether to accept unpaired release events. public func acceptUnpairedRelease(_ acceptUnpairedRelease: Bool? = true) -> Self { - var newSelf = self - newSelf.acceptUnpairedRelease = acceptUnpairedRelease - return newSelf + modify { $0.acceptUnpairedRelease = acceptUnpairedRelease } } /// The accessible role of the given `GtkAccessible` implementation. /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// Determines whether children can be activated with a single /// click, or require a double-click. public func activateOnSingleClick(_ activateOnSingleClick: Bool? = true) -> Self { - var newSelf = self - newSelf.activateOnSingleClick = activateOnSingleClick - return newSelf + modify { $0.activateOnSingleClick = activateOnSingleClick } } /// The amount of horizontal space between two children. public func columnSpacing(_ columnSpacing: UInt?) -> Self { - var newSelf = self - newSelf.columnSpacing = columnSpacing - return newSelf + modify { $0.columnSpacing = columnSpacing } } /// Determines whether all children should be allocated the /// same size. public func homogeneous(_ homogeneous: Bool? = true) -> Self { - var newSelf = self - newSelf.homogeneous = homogeneous - return newSelf + modify { $0.homogeneous = homogeneous } } /// The maximum amount of children to request space for consecutively /// in the given orientation. public func maxChildrenPerLine(_ maxChildrenPerLine: UInt?) -> Self { - var newSelf = self - newSelf.maxChildrenPerLine = maxChildrenPerLine - return newSelf + modify { $0.maxChildrenPerLine = maxChildrenPerLine } } /// The minimum number of children to allocate consecutively @@ -290,16 +278,12 @@ public struct FlowBox: AdwaitaWidget where Element: Identifiable { /// that a reasonably small height will be requested /// for the overall minimum width of the box. public func minChildrenPerLine(_ minChildrenPerLine: UInt?) -> Self { - var newSelf = self - newSelf.minChildrenPerLine = minChildrenPerLine - return newSelf + modify { $0.minChildrenPerLine = minChildrenPerLine } } /// The amount of vertical space between two children. public func rowSpacing(_ rowSpacing: UInt?) -> Self { - var newSelf = self - newSelf.rowSpacing = rowSpacing - return newSelf + modify { $0.rowSpacing = rowSpacing } } /// Emitted when the user activates the @box. diff --git a/Sources/Adwaita/View/Generated/HeaderBar.swift b/Sources/Adwaita/View/Generated/HeaderBar.swift index e733ee1..73dd20d 100644 --- a/Sources/Adwaita/View/Generated/HeaderBar.swift +++ b/Sources/Adwaita/View/Generated/HeaderBar.swift @@ -2,7 +2,7 @@ // HeaderBar.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -72,7 +72,7 @@ public struct HeaderBar: AdwaitaWidget { /// ```xml /// Title /// ``` - var titleWidget: (() -> Body)? + var titleWidget: Body? /// The body for the widget "start". var start: () -> Body = { [] } /// The body for the widget "end". @@ -93,7 +93,7 @@ public struct HeaderBar: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let titleWidgetStorage = titleWidget?().storage(data: data, type: type) { + if let titleWidgetStorage = titleWidget?.storage(data: data, type: type) { storage.content["titleWidget"] = [titleWidgetStorage] adw_header_bar_set_title_widget(storage.opaquePointer, titleWidgetStorage.opaquePointer?.cast()) } @@ -138,7 +138,7 @@ public struct HeaderBar: AdwaitaWidget { adw_header_bar_set_show_title(widget, showTitle.cBool) } if let widget = storage.content["titleWidget"]?.first { - titleWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + titleWidget?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let startStorage = storage.content["start"] { @@ -189,9 +189,7 @@ public struct HeaderBar: AdwaitaWidget { /// For example, “icon:minimize,maximize,close” specifies an icon at the start, /// and minimize, maximize and close buttons at the end. public func decorationLayout(_ decorationLayout: String?) -> Self { - var newSelf = self - newSelf.decorationLayout = decorationLayout - return newSelf + modify { $0.decorationLayout = decorationLayout } } /// Whether the header bar can show the back button. @@ -199,9 +197,7 @@ public struct HeaderBar: AdwaitaWidget { /// The back button will never be shown unless the header bar is placed inside an /// `NavigationView`. Usually, there is no reason to set this to `false`. public func showBackButton(_ showBackButton: Bool? = true) -> Self { - var newSelf = self - newSelf.showBackButton = showBackButton - return newSelf + modify { $0.showBackButton = showBackButton } } /// Whether to show title buttons at the end of the header bar. @@ -213,9 +209,7 @@ public struct HeaderBar: AdwaitaWidget { /// window (e.g. a close button will not be shown if the window can't be /// closed). public func showEndTitleButtons(_ showEndTitleButtons: Bool? = true) -> Self { - var newSelf = self - newSelf.showEndTitleButtons = showEndTitleButtons - return newSelf + modify { $0.showEndTitleButtons = showEndTitleButtons } } /// Whether to show title buttons at the start of the header bar. @@ -227,16 +221,12 @@ public struct HeaderBar: AdwaitaWidget { /// window (e.g. a close button will not be shown if the window can't be /// closed). public func showStartTitleButtons(_ showStartTitleButtons: Bool? = true) -> Self { - var newSelf = self - newSelf.showStartTitleButtons = showStartTitleButtons - return newSelf + modify { $0.showStartTitleButtons = showStartTitleButtons } } /// Whether the title widget should be shown. public func showTitle(_ showTitle: Bool? = true) -> Self { - var newSelf = self - newSelf.showTitle = showTitle - return newSelf + modify { $0.showTitle = showTitle } } /// The title widget to display. @@ -249,10 +239,8 @@ public struct HeaderBar: AdwaitaWidget { /// ```xml /// Title /// ``` - public func titleWidget(@ViewBuilder _ titleWidget: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.titleWidget = titleWidget - return newSelf + public func titleWidget(@ViewBuilder _ titleWidget: () -> Body) -> Self { + modify { $0.titleWidget = titleWidget() } } /// Set the body for "start". diff --git a/Sources/Adwaita/View/Generated/Image.swift b/Sources/Adwaita/View/Generated/Image.swift index fe5a6b5..c59d15d 100644 --- a/Sources/Adwaita/View/Generated/Image.swift +++ b/Sources/Adwaita/View/Generated/Image.swift @@ -2,7 +2,7 @@ // Image.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -121,18 +121,14 @@ public struct Image: AdwaitaWidget { /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// The name of the icon in the icon theme. /// /// If the icon theme is changed, the image will be updated automatically. public func iconName(_ iconName: String?) -> Self { - var newSelf = self - newSelf.iconName = iconName - return newSelf + modify { $0.iconName = iconName } } /// The size in pixels to display icons at. @@ -141,23 +137,17 @@ public struct Image: AdwaitaWidget { /// ``iconSize(_:)`` property for images of type /// `GTK_IMAGE_ICON_NAME`. public func pixelSize(_ pixelSize: Int?) -> Self { - var newSelf = self - newSelf.pixelSize = pixelSize - return newSelf + modify { $0.pixelSize = pixelSize } } /// A path to a resource file to display. public func resource(_ resource: String?) -> Self { - var newSelf = self - newSelf.resource = resource - return newSelf + modify { $0.resource = resource } } /// The representation being used for image data. public func storageType(_ storageType: String?) -> Self { - var newSelf = self - newSelf.storageType = storageType - return newSelf + modify { $0.storageType = storageType } } /// Whether the icon displayed in the `GtkImage` will use @@ -166,9 +156,7 @@ public struct Image: AdwaitaWidget { /// The value of this property is only relevant for images of type /// %GTK_IMAGE_ICON_NAME and %GTK_IMAGE_GICON. public func useFallback(_ useFallback: Bool? = true) -> Self { - var newSelf = self - newSelf.useFallback = useFallback - return newSelf + modify { $0.useFallback = useFallback } } } diff --git a/Sources/Adwaita/View/Generated/Label.swift b/Sources/Adwaita/View/Generated/Label.swift index 463a99e..7ed34e7 100644 --- a/Sources/Adwaita/View/Generated/Label.swift +++ b/Sources/Adwaita/View/Generated/Label.swift @@ -2,7 +2,7 @@ // Label.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -64,7 +64,7 @@ public struct Label: AdwaitaWidget { /// The mnemonic accelerator key for the label. var mnemonicKeyval: UInt? /// The widget to be activated when the labels mnemonic key is pressed. - var mnemonicWidget: (() -> Body)? + var mnemonicWidget: Body? /// Whether the label text can be selected with the mouse. var selectable: Bool? /// Whether the label is in single line mode. @@ -122,7 +122,7 @@ public struct Label: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let mnemonicWidgetStorage = mnemonicWidget?().storage(data: data, type: type) { + if let mnemonicWidgetStorage = mnemonicWidget?.storage(data: data, type: type) { storage.content["mnemonicWidget"] = [mnemonicWidgetStorage] gtk_label_set_mnemonic_widget(storage.opaquePointer, mnemonicWidgetStorage.opaquePointer?.cast()) } @@ -154,7 +154,7 @@ public struct Label: AdwaitaWidget { gtk_label_set_max_width_chars(widget, maxWidthChars.cInt) } if let widget = storage.content["mnemonicWidget"]?.first { - mnemonicWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + mnemonicWidget?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let selectable, updateProperties, (storage.previousState as? Self)?.selectable != selectable { gtk_label_set_selectable(widget, selectable.cBool) @@ -196,9 +196,7 @@ public struct Label: AdwaitaWidget { /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// The contents of the label. @@ -214,9 +212,7 @@ public struct Label: AdwaitaWidget { /// set the ``useUnderline(_:)`` property to true in order /// for the label to display them. public func label(_ label: String) -> Self { - var newSelf = self - newSelf.label = label - return newSelf + modify { $0.label = label } } /// The number of lines to which an ellipsized, wrapping label @@ -235,9 +231,7 @@ public struct Label: AdwaitaWidget { /// /// Set this property to -1 if you don't want to limit the number of lines. public func lines(_ lines: Int?) -> Self { - var newSelf = self - newSelf.lines = lines - return newSelf + modify { $0.lines = lines } } /// The desired maximum width of the label, in characters. @@ -246,30 +240,22 @@ public struct Label: AdwaitaWidget { /// /// See the section on [text layout](class.Label.html public func maxWidthChars(_ maxWidthChars: Int?) -> Self { - var newSelf = self - newSelf.maxWidthChars = maxWidthChars - return newSelf + modify { $0.maxWidthChars = maxWidthChars } } /// The mnemonic accelerator key for the label. public func mnemonicKeyval(_ mnemonicKeyval: UInt?) -> Self { - var newSelf = self - newSelf.mnemonicKeyval = mnemonicKeyval - return newSelf + modify { $0.mnemonicKeyval = mnemonicKeyval } } /// The widget to be activated when the labels mnemonic key is pressed. - public func mnemonicWidget(@ViewBuilder _ mnemonicWidget: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.mnemonicWidget = mnemonicWidget - return newSelf + public func mnemonicWidget(@ViewBuilder _ mnemonicWidget: () -> Body) -> Self { + modify { $0.mnemonicWidget = mnemonicWidget() } } /// Whether the label text can be selected with the mouse. public func selectable(_ selectable: Bool? = true) -> Self { - var newSelf = self - newSelf.selectable = selectable - return newSelf + modify { $0.selectable = selectable } } /// Whether the label is in single line mode. @@ -279,26 +265,20 @@ public struct Label: AdwaitaWidget { /// can be an advantage in situations where resizing the label because /// of text changes would be distracting, e.g. in a statusbar. public func singleLineMode(_ singleLineMode: Bool? = true) -> Self { - var newSelf = self - newSelf.singleLineMode = singleLineMode - return newSelf + modify { $0.singleLineMode = singleLineMode } } /// True if the text of the label includes Pango markup. /// /// See `Pango.parse_markup`. public func useMarkup(_ useMarkup: Bool? = true) -> Self { - var newSelf = self - newSelf.useMarkup = useMarkup - return newSelf + modify { $0.useMarkup = useMarkup } } /// True if the text of the label indicates a mnemonic with an `_` /// before the mnemonic character. public func useUnderline(_ useUnderline: Bool? = true) -> Self { - var newSelf = self - newSelf.useUnderline = useUnderline - return newSelf + modify { $0.useUnderline = useUnderline } } /// The desired width of the label, in characters. @@ -307,16 +287,12 @@ public struct Label: AdwaitaWidget { /// /// See the section on [text layout](class.Label.html public func widthChars(_ widthChars: Int?) -> Self { - var newSelf = self - newSelf.widthChars = widthChars - return newSelf + modify { $0.widthChars = widthChars } } /// True if the label text will wrap if it gets too wide. public func wrap(_ wrap: Bool? = true) -> Self { - var newSelf = self - newSelf.wrap = wrap - return newSelf + modify { $0.wrap = wrap } } /// The horizontal alignment of the label text inside its size allocation. @@ -324,9 +300,7 @@ public struct Label: AdwaitaWidget { /// Compare this to ``halign(_:)``, which determines how the /// labels size allocation is positioned in the space available for the label. public func xalign(_ xalign: Float?) -> Self { - var newSelf = self - newSelf.xalign = xalign - return newSelf + modify { $0.xalign = xalign } } /// The vertical alignment of the label text inside its size allocation. @@ -334,9 +308,7 @@ public struct Label: AdwaitaWidget { /// Compare this to ``valign(_:)``, which determines how the /// labels size allocation is positioned in the space available for the label. public func yalign(_ yalign: Float?) -> Self { - var newSelf = self - newSelf.yalign = yalign - return newSelf + modify { $0.yalign = yalign } } /// Gets emitted to copy the selection to the clipboard. diff --git a/Sources/Adwaita/View/Generated/LevelBar.swift b/Sources/Adwaita/View/Generated/LevelBar.swift index 6b8f0b1..f1cbe6e 100644 --- a/Sources/Adwaita/View/Generated/LevelBar.swift +++ b/Sources/Adwaita/View/Generated/LevelBar.swift @@ -2,7 +2,7 @@ // LevelBar.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -120,9 +120,7 @@ public struct LevelBar: AdwaitaWidget { /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// Whether the `GtkLeveBar` is inverted. @@ -130,30 +128,22 @@ public struct LevelBar: AdwaitaWidget { /// Level bars normally grow from top to bottom or left to right. /// Inverted level bars grow in the opposite direction. public func inverted(_ inverted: Bool? = true) -> Self { - var newSelf = self - newSelf.inverted = inverted - return newSelf + modify { $0.inverted = inverted } } /// Determines the maximum value of the interval that can be displayed by the bar. public func maxValue(_ maxValue: Double?) -> Self { - var newSelf = self - newSelf.maxValue = maxValue - return newSelf + modify { $0.maxValue = maxValue } } /// Determines the minimum value of the interval that can be displayed by the bar. public func minValue(_ minValue: Double?) -> Self { - var newSelf = self - newSelf.minValue = minValue - return newSelf + modify { $0.minValue = minValue } } /// Determines the currently filled value of the level bar. public func value(_ value: Double?) -> Self { - var newSelf = self - newSelf.value = value - return newSelf + modify { $0.value = value } } /// Emitted when an offset specified on the bar changes value. diff --git a/Sources/Adwaita/View/Generated/LinkButton.swift b/Sources/Adwaita/View/Generated/LinkButton.swift index abf51ca..a177b83 100644 --- a/Sources/Adwaita/View/Generated/LinkButton.swift +++ b/Sources/Adwaita/View/Generated/LinkButton.swift @@ -2,7 +2,7 @@ // LinkButton.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -49,7 +49,7 @@ public struct LinkButton: AdwaitaWidget { /// property has no effect. var canShrink: Bool? /// The child widget. - var child: (() -> Body)? + var child: Body? /// Whether the button has a frame. var hasFrame: Bool? /// The name of the icon used to automatically populate the button. @@ -92,7 +92,7 @@ public struct LinkButton: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let childStorage = child?().storage(data: data, type: type) { + if let childStorage = child?.storage(data: data, type: type) { storage.content["child"] = [childStorage] gtk_button_set_child(storage.opaquePointer?.cast(), childStorage.opaquePointer?.cast()) } @@ -126,7 +126,7 @@ public struct LinkButton: AdwaitaWidget { gtk_button_set_can_shrink(widget?.cast(), canShrink.cBool) } if let widget = storage.content["child"]?.first { - child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + child?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let hasFrame, updateProperties, (storage.previousState as? Self)?.hasFrame != hasFrame { gtk_button_set_has_frame(widget?.cast(), hasFrame.cBool) @@ -162,16 +162,12 @@ public struct LinkButton: AdwaitaWidget { /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// The name of the action with which this widget should be associated. public func actionName(_ actionName: String?) -> Self { - var newSelf = self - newSelf.actionName = actionName - return newSelf + modify { $0.actionName = actionName } } /// Whether the size of the button can be made smaller than the natural @@ -182,61 +178,45 @@ public struct LinkButton: AdwaitaWidget { /// If the contents of a button are an icon or a custom widget, setting this /// property has no effect. public func canShrink(_ canShrink: Bool? = true) -> Self { - var newSelf = self - newSelf.canShrink = canShrink - return newSelf + modify { $0.canShrink = canShrink } } /// The child widget. - public func child(@ViewBuilder _ child: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.child = child - return newSelf + public func child(@ViewBuilder _ child: () -> Body) -> Self { + modify { $0.child = child() } } /// Whether the button has a frame. public func hasFrame(_ hasFrame: Bool? = true) -> Self { - var newSelf = self - newSelf.hasFrame = hasFrame - return newSelf + modify { $0.hasFrame = hasFrame } } /// The name of the icon used to automatically populate the button. public func iconName(_ iconName: String?) -> Self { - var newSelf = self - newSelf.iconName = iconName - return newSelf + modify { $0.iconName = iconName } } /// Text of the label inside the button, if the button contains a label widget. public func label(_ label: String?) -> Self { - var newSelf = self - newSelf.label = label - return newSelf + modify { $0.label = label } } /// The URI bound to this button. public func uri(_ uri: String) -> Self { - var newSelf = self - newSelf.uri = uri - return newSelf + modify { $0.uri = uri } } /// If set, an underline in the text indicates that the following character is /// to be used as mnemonic. public func useUnderline(_ useUnderline: Bool? = true) -> Self { - var newSelf = self - newSelf.useUnderline = useUnderline - return newSelf + modify { $0.useUnderline = useUnderline } } /// The 'visited' state of this button. /// /// A visited link is drawn in a different color. public func visited(_ visited: Bool? = true) -> Self { - var newSelf = self - newSelf.visited = visited - return newSelf + modify { $0.visited = visited } } /// Emitted to animate press then release. diff --git a/Sources/Adwaita/View/Generated/ListBox.swift b/Sources/Adwaita/View/Generated/ListBox.swift index 746a0ed..3e1988a 100644 --- a/Sources/Adwaita/View/Generated/ListBox.swift +++ b/Sources/Adwaita/View/Generated/ListBox.swift @@ -2,7 +2,7 @@ // ListBox.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -208,33 +208,25 @@ public struct ListBox: AdwaitaWidget where Element: Identifiable { /// Whether to accept unpaired release events. public func acceptUnpairedRelease(_ acceptUnpairedRelease: Bool? = true) -> Self { - var newSelf = self - newSelf.acceptUnpairedRelease = acceptUnpairedRelease - return newSelf + modify { $0.acceptUnpairedRelease = acceptUnpairedRelease } } /// The accessible role of the given `GtkAccessible` implementation. /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// Determines whether children can be activated with a single /// click, or require a double-click. public func activateOnSingleClick(_ activateOnSingleClick: Bool? = true) -> Self { - var newSelf = self - newSelf.activateOnSingleClick = activateOnSingleClick - return newSelf + modify { $0.activateOnSingleClick = activateOnSingleClick } } /// Whether to show separators between rows. public func showSeparators(_ showSeparators: Bool? = true) -> Self { - var newSelf = self - newSelf.showSeparators = showSeparators - return newSelf + modify { $0.showSeparators = showSeparators } } /// Emitted when the cursor row is activated. diff --git a/Sources/Adwaita/View/Generated/Menu.swift b/Sources/Adwaita/View/Generated/Menu.swift index de95e4b..05ffa70 100644 --- a/Sources/Adwaita/View/Generated/Menu.swift +++ b/Sources/Adwaita/View/Generated/Menu.swift @@ -2,7 +2,7 @@ // Menu.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -61,7 +61,7 @@ public struct Menu: AdwaitaWidget { /// size of its contents. var canShrink: Bool? /// The child widget. - var child: (() -> Body)? + var child: Body? /// Whether the button has a frame. var hasFrame: Bool? /// The name of the icon used to automatically populate the button. @@ -72,7 +72,7 @@ public struct Menu: AdwaitaWidget { /// /// See `Gtk.MenuButton.set_menu_model` for the interaction /// with the ``popover(_:)`` property. - var menuModel: (() -> Body)? + var menuModel: Body? /// Whether the menu button acts as a primary menu. /// /// Primary menus can be opened using the F10 key @@ -100,12 +100,12 @@ public struct Menu: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let childStorage = child?().storage(data: data, type: type) { + if let childStorage = child?.storage(data: data, type: type) { storage.content["child"] = [childStorage] gtk_menu_button_set_child(storage.opaquePointer, childStorage.opaquePointer?.cast()) } - if let menu = menuModel?() { - let childStorage = MenuCollection { menu }.getMenu(data: data) + if let menuModel { + let childStorage = MenuCollection { menuModel }.getMenu(data: data) storage.content["menuModel"] = [childStorage] gtk_menu_button_set_menu_model(storage.opaquePointer, childStorage.opaquePointer?.cast()) } @@ -143,7 +143,7 @@ if let active, newValue != active.wrappedValue { gtk_menu_button_set_can_shrink(widget, canShrink.cBool) } if let widget = storage.content["child"]?.first { - child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + child?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let hasFrame, updateProperties, (storage.previousState as? Self)?.hasFrame != hasFrame { gtk_menu_button_set_has_frame(widget, hasFrame.cBool) @@ -155,7 +155,7 @@ if let active, newValue != active.wrappedValue { gtk_menu_button_set_label(widget, label) } if let menu = storage.content["menuModel"]?.first { - MenuCollection { menuModel?() ?? [] } + MenuCollection { menuModel ?? [] } .updateStorage(menu, data: data.noModifiers, updateProperties: updateProperties, type: MenuContext.self) } if let primary, updateProperties, (storage.previousState as? Self)?.primary != primary { @@ -180,85 +180,63 @@ if let active, newValue != active.wrappedValue { /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// Whether the menu button is active. public func active(_ active: Binding?) -> Self { - var newSelf = self - newSelf.active = active - return newSelf + modify { $0.active = active } } /// Whether to show a dropdown arrow even when using an icon or a custom child. public func alwaysShowArrow(_ alwaysShowArrow: Bool? = true) -> Self { - var newSelf = self - newSelf.alwaysShowArrow = alwaysShowArrow - return newSelf + modify { $0.alwaysShowArrow = alwaysShowArrow } } /// Whether the size of the button can be made smaller than the natural /// size of its contents. public func canShrink(_ canShrink: Bool? = true) -> Self { - var newSelf = self - newSelf.canShrink = canShrink - return newSelf + modify { $0.canShrink = canShrink } } /// The child widget. - public func child(@ViewBuilder _ child: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.child = child - return newSelf + public func child(@ViewBuilder _ child: () -> Body) -> Self { + modify { $0.child = child() } } /// Whether the button has a frame. public func hasFrame(_ hasFrame: Bool? = true) -> Self { - var newSelf = self - newSelf.hasFrame = hasFrame - return newSelf + modify { $0.hasFrame = hasFrame } } /// The name of the icon used to automatically populate the button. public func iconName(_ iconName: String?) -> Self { - var newSelf = self - newSelf.iconName = iconName - return newSelf + modify { $0.iconName = iconName } } /// The label for the button. public func label(_ label: String?) -> Self { - var newSelf = self - newSelf.label = label - return newSelf + modify { $0.label = label } } /// The `GMenuModel` from which the popup will be created. /// /// See `Gtk.MenuButton.set_menu_model` for the interaction /// with the ``popover(_:)`` property. - public func menuModel(@ViewBuilder _ menuModel: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.menuModel = menuModel - return newSelf + public func menuModel(@ViewBuilder _ menuModel: () -> Body) -> Self { + modify { $0.menuModel = menuModel() } } /// Whether the menu button acts as a primary menu. /// /// Primary menus can be opened using the F10 key public func primary(_ primary: Bool? = true) -> Self { - var newSelf = self - newSelf.primary = primary - return newSelf + modify { $0.primary = primary } } /// If set an underscore in the text indicates a mnemonic. public func useUnderline(_ useUnderline: Bool? = true) -> Self { - var newSelf = self - newSelf.useUnderline = useUnderline - return newSelf + modify { $0.useUnderline = useUnderline } } /// Emitted to when the menu button is activated. diff --git a/Sources/Adwaita/View/Generated/NavigationView.swift b/Sources/Adwaita/View/Generated/NavigationView.swift index 812e4e0..c6ff408 100644 --- a/Sources/Adwaita/View/Generated/NavigationView.swift +++ b/Sources/Adwaita/View/Generated/NavigationView.swift @@ -2,7 +2,7 @@ // NavigationView.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -176,9 +176,7 @@ public struct NavigationView: AdwaitaWidget { /// /// Gesture-based transitions are always animated. public func animateTransitions(_ animateTransitions: Bool? = true) -> Self { - var newSelf = self - newSelf.animateTransitions = animateTransitions - return newSelf + modify { $0.animateTransitions = animateTransitions } } /// Whether the view is horizontally homogeneous. @@ -189,9 +187,7 @@ public struct NavigationView: AdwaitaWidget { /// If it's not, the page may change width when a different page becomes /// visible. public func hhomogeneous(_ hhomogeneous: Bool? = true) -> Self { - var newSelf = self - newSelf.hhomogeneous = hhomogeneous - return newSelf + modify { $0.hhomogeneous = hhomogeneous } } /// Whether pressing Escape pops the current page. @@ -199,9 +195,7 @@ public struct NavigationView: AdwaitaWidget { /// Applications using `AdwNavigationView` to implement a browser may want to /// disable it. public func popOnEscape(_ popOnEscape: Bool? = true) -> Self { - var newSelf = self - newSelf.popOnEscape = popOnEscape - return newSelf + modify { $0.popOnEscape = popOnEscape } } /// Whether the view is vertically homogeneous. @@ -212,16 +206,12 @@ public struct NavigationView: AdwaitaWidget { /// If it's not, the view may change height when a different page becomes /// visible. public func vhomogeneous(_ vhomogeneous: Bool? = true) -> Self { - var newSelf = self - newSelf.vhomogeneous = vhomogeneous - return newSelf + modify { $0.vhomogeneous = vhomogeneous } } /// The tag of the currently visible page. public func visiblePageTag(_ visiblePageTag: String?) -> Self { - var newSelf = self - newSelf.visiblePageTag = visiblePageTag - return newSelf + modify { $0.visiblePageTag = visiblePageTag } } /// Emitted when a push shortcut or a gesture is triggered. diff --git a/Sources/Adwaita/View/Generated/Overlay.swift b/Sources/Adwaita/View/Generated/Overlay.swift index 6d026d5..e4ad198 100644 --- a/Sources/Adwaita/View/Generated/Overlay.swift +++ b/Sources/Adwaita/View/Generated/Overlay.swift @@ -2,7 +2,7 @@ // Overlay.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -41,7 +41,7 @@ public struct Overlay: AdwaitaWidget { /// The accessible role cannot be changed once set. var accessibleRole: String? /// The main child widget. - var child: (() -> Body)? + var child: Body? /// Emitted to determine the position and size of any overlay /// child widgets. /// @@ -75,7 +75,7 @@ public struct Overlay: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let childStorage = child?().storage(data: data, type: type) { + if let childStorage = child?.storage(data: data, type: type) { storage.content["child"] = [childStorage] gtk_overlay_set_child(storage.opaquePointer, childStorage.opaquePointer?.cast()) } @@ -104,7 +104,7 @@ public struct Overlay: AdwaitaWidget { storage.modify { widget in if let widget = storage.content["child"]?.first { - child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + child?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let overlayStorage = storage.content["overlay"] { @@ -134,16 +134,12 @@ public struct Overlay: AdwaitaWidget { /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// The main child widget. - public func child(@ViewBuilder _ child: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.child = child - return newSelf + public func child(@ViewBuilder _ child: () -> Body) -> Self { + modify { $0.child = child() } } /// Emitted to determine the position and size of any overlay diff --git a/Sources/Adwaita/View/Generated/OverlaySplitView.swift b/Sources/Adwaita/View/Generated/OverlaySplitView.swift index b9e1a4a..8228f68 100644 --- a/Sources/Adwaita/View/Generated/OverlaySplitView.swift +++ b/Sources/Adwaita/View/Generated/OverlaySplitView.swift @@ -2,7 +2,7 @@ // OverlaySplitView.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -61,7 +61,7 @@ public struct OverlaySplitView: AdwaitaWidget { /// content widget, otherwise they are displayed side by side. var collapsed: Bool? /// The content widget. - var content: (() -> Body)? + var content: Body? /// Whether the sidebar can be closed with a swipe gesture. /// /// Only touchscreen swipes are supported. @@ -95,7 +95,7 @@ public struct OverlaySplitView: AdwaitaWidget { /// Whether the sidebar widget is shown. var showSidebar: Binding? /// The sidebar widget. - var sidebar: (() -> Body)? + var sidebar: Body? /// The preferred sidebar width as a fraction of the total width. /// /// The preferred width is additionally limited by @@ -121,11 +121,11 @@ public struct OverlaySplitView: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let contentStorage = content?().storage(data: data, type: type) { + if let contentStorage = content?.storage(data: data, type: type) { storage.content["content"] = [contentStorage] adw_overlay_split_view_set_content(storage.opaquePointer, contentStorage.opaquePointer?.cast()) } - if let sidebarStorage = sidebar?().storage(data: data, type: type) { + if let sidebarStorage = sidebar?.storage(data: data, type: type) { storage.content["sidebar"] = [sidebarStorage] adw_overlay_split_view_set_sidebar(storage.opaquePointer, sidebarStorage.opaquePointer?.cast()) } @@ -152,7 +152,7 @@ if let showSidebar, newValue != showSidebar.wrappedValue { adw_overlay_split_view_set_collapsed(widget, collapsed.cBool) } if let widget = storage.content["content"]?.first { - content?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + content?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let enableHideGesture, updateProperties, (storage.previousState as? Self)?.enableHideGesture != enableHideGesture { adw_overlay_split_view_set_enable_hide_gesture(widget, enableHideGesture.cBool) @@ -173,7 +173,7 @@ if let showSidebar, newValue != showSidebar.wrappedValue { adw_overlay_split_view_set_show_sidebar(storage.opaquePointer, showSidebar.wrappedValue.cBool) } if let widget = storage.content["sidebar"]?.first { - sidebar?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + sidebar?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let sidebarWidthFraction, updateProperties, (storage.previousState as? Self)?.sidebarWidthFraction != sidebarWidthFraction { adw_overlay_split_view_set_sidebar_width_fraction(widget, sidebarWidthFraction) @@ -195,34 +195,26 @@ if let showSidebar, newValue != showSidebar.wrappedValue { /// When collapsed, the sidebar widget is presented as an overlay above the /// content widget, otherwise they are displayed side by side. public func collapsed(_ collapsed: Bool? = true) -> Self { - var newSelf = self - newSelf.collapsed = collapsed - return newSelf + modify { $0.collapsed = collapsed } } /// The content widget. - public func content(@ViewBuilder _ content: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.content = content - return newSelf + public func content(@ViewBuilder _ content: () -> Body) -> Self { + modify { $0.content = content() } } /// Whether the sidebar can be closed with a swipe gesture. /// /// Only touchscreen swipes are supported. public func enableHideGesture(_ enableHideGesture: Bool? = true) -> Self { - var newSelf = self - newSelf.enableHideGesture = enableHideGesture - return newSelf + modify { $0.enableHideGesture = enableHideGesture } } /// Whether the sidebar can be opened with an edge swipe gesture. /// /// Only touchscreen swipes are supported. public func enableShowGesture(_ enableShowGesture: Bool? = true) -> Self { - var newSelf = self - newSelf.enableShowGesture = enableShowGesture - return newSelf + modify { $0.enableShowGesture = enableShowGesture } } /// The maximum sidebar width. @@ -233,9 +225,7 @@ if let showSidebar, newValue != showSidebar.wrappedValue { /// The sidebar widget can still be allocated with larger width if its own /// minimum width exceeds it. public func maxSidebarWidth(_ maxSidebarWidth: Double?) -> Self { - var newSelf = self - newSelf.maxSidebarWidth = maxSidebarWidth - return newSelf + modify { $0.maxSidebarWidth = maxSidebarWidth } } /// The minimum sidebar width. @@ -246,9 +236,7 @@ if let showSidebar, newValue != showSidebar.wrappedValue { /// The sidebar widget can still be allocated with larger width if its own /// minimum width exceeds it. public func minSidebarWidth(_ minSidebarWidth: Double?) -> Self { - var newSelf = self - newSelf.minSidebarWidth = minSidebarWidth - return newSelf + modify { $0.minSidebarWidth = minSidebarWidth } } /// Whether the sidebar widget is pinned. @@ -257,23 +245,17 @@ if let showSidebar, newValue != showSidebar.wrappedValue { /// uncollapsing it shows the sidebar. If set to `true`, sidebar visibility /// never changes on its own. public func pinSidebar(_ pinSidebar: Bool? = true) -> Self { - var newSelf = self - newSelf.pinSidebar = pinSidebar - return newSelf + modify { $0.pinSidebar = pinSidebar } } /// Whether the sidebar widget is shown. public func showSidebar(_ showSidebar: Binding?) -> Self { - var newSelf = self - newSelf.showSidebar = showSidebar - return newSelf + modify { $0.showSidebar = showSidebar } } /// The sidebar widget. - public func sidebar(@ViewBuilder _ sidebar: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.sidebar = sidebar - return newSelf + public func sidebar(@ViewBuilder _ sidebar: () -> Body) -> Self { + modify { $0.sidebar = sidebar() } } /// The preferred sidebar width as a fraction of the total width. @@ -285,9 +267,7 @@ if let showSidebar, newValue != showSidebar.wrappedValue { /// The sidebar widget can be allocated with larger width if its own minimum /// width exceeds the preferred width. public func sidebarWidthFraction(_ sidebarWidthFraction: Double?) -> Self { - var newSelf = self - newSelf.sidebarWidthFraction = sidebarWidthFraction - return newSelf + modify { $0.sidebarWidthFraction = sidebarWidthFraction } } } diff --git a/Sources/Adwaita/View/Generated/PasswordEntryRow.swift b/Sources/Adwaita/View/Generated/PasswordEntryRow.swift index 36f5da8..264db63 100644 --- a/Sources/Adwaita/View/Generated/PasswordEntryRow.swift +++ b/Sources/Adwaita/View/Generated/PasswordEntryRow.swift @@ -2,7 +2,7 @@ // PasswordEntryRow.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -164,25 +164,19 @@ public struct PasswordEntryRow: AdwaitaWidget { /// Whether activating the embedded entry can activate the default widget. public func activatesDefault(_ activatesDefault: Bool? = true) -> Self { - var newSelf = self - newSelf.activatesDefault = activatesDefault - return newSelf + modify { $0.activatesDefault = activatesDefault } } /// Whether to suggest emoji replacements on the entry row. /// /// Emoji replacement is done with :-delimited names, like `:heart:`. public func enableEmojiCompletion(_ enableEmojiCompletion: Bool? = true) -> Self { - var newSelf = self - newSelf.enableEmojiCompletion = enableEmojiCompletion - return newSelf + modify { $0.enableEmojiCompletion = enableEmojiCompletion } } /// Maximum number of characters for the entry. public func maxLength(_ maxLength: Int?) -> Self { - var newSelf = self - newSelf.maxLength = maxLength - return newSelf + modify { $0.maxLength = maxLength } } /// Whether to show the apply button. @@ -195,16 +189,12 @@ public struct PasswordEntryRow: AdwaitaWidget { /// operation, e.g. network activity, to avoid triggering it after typing every /// character. public func showApplyButton(_ showApplyButton: Bool? = true) -> Self { - var newSelf = self - newSelf.showApplyButton = showApplyButton - return newSelf + modify { $0.showApplyButton = showApplyButton } } /// The length of the text in the entry row. public func textLength(_ textLength: UInt?) -> Self { - var newSelf = self - newSelf.textLength = textLength - return newSelf + modify { $0.textLength = textLength } } /// The title of the preference represented by this row. @@ -212,18 +202,14 @@ public struct PasswordEntryRow: AdwaitaWidget { /// The title is interpreted as Pango markup unless /// ``useMarkup(_:)`` is set to `false`. public func title(_ title: String?) -> Self { - var newSelf = self - newSelf.title = title - return newSelf + modify { $0.title = title } } /// Whether the user can copy the title from the label. /// /// See also ``selectable(_:)``. public func titleSelectable(_ titleSelectable: Bool? = true) -> Self { - var newSelf = self - newSelf.titleSelectable = titleSelectable - return newSelf + modify { $0.titleSelectable = titleSelectable } } /// Whether to use Pango markup for the title label. @@ -232,16 +218,12 @@ public struct PasswordEntryRow: AdwaitaWidget { /// /// See also `Pango.parse_markup`. public func useMarkup(_ useMarkup: Bool? = true) -> Self { - var newSelf = self - newSelf.useMarkup = useMarkup - return newSelf + modify { $0.useMarkup = useMarkup } } /// Whether an embedded underline in the title indicates a mnemonic. public func useUnderline(_ useUnderline: Bool? = true) -> Self { - var newSelf = self - newSelf.useUnderline = useUnderline - return newSelf + modify { $0.useUnderline = useUnderline } } /// Emitted when the apply button is pressed. diff --git a/Sources/Adwaita/View/Generated/Picture.swift b/Sources/Adwaita/View/Generated/Picture.swift index 2cf9267..addd104 100644 --- a/Sources/Adwaita/View/Generated/Picture.swift +++ b/Sources/Adwaita/View/Generated/Picture.swift @@ -2,7 +2,7 @@ // Picture.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -107,30 +107,22 @@ public struct Picture: AdwaitaWidget { /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// The alternative textual description for the picture. public func alternativeText(_ alternativeText: String?) -> Self { - var newSelf = self - newSelf.alternativeText = alternativeText - return newSelf + modify { $0.alternativeText = alternativeText } } /// If the `GtkPicture` can be made smaller than the natural size of its contents. public func canShrink(_ canShrink: Bool? = true) -> Self { - var newSelf = self - newSelf.canShrink = canShrink - return newSelf + modify { $0.canShrink = canShrink } } /// How the content should be resized to fit inside the `GtkPicture`. public func contentFit(_ contentFit: ContentFit?) -> Self { - var newSelf = self - newSelf.contentFit = contentFit - return newSelf + modify { $0.contentFit = contentFit } } } diff --git a/Sources/Adwaita/View/Generated/Popover.swift b/Sources/Adwaita/View/Generated/Popover.swift index 7c1e4b4..3a9966a 100644 --- a/Sources/Adwaita/View/Generated/Popover.swift +++ b/Sources/Adwaita/View/Generated/Popover.swift @@ -2,7 +2,7 @@ // Popover.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -51,9 +51,9 @@ public struct Popover: AdwaitaWidget { /// This is used to implement the expected behavior of submenus. var cascadePopdown: Bool? /// The child widget. - var child: (() -> Body)? + var child: Body? /// The default widget inside the popover. - var defaultWidget: (() -> Body)? + var defaultWidget: Body? /// Whether to draw an arrow. var hasArrow: Bool? /// Whether mnemonics are currently visible in this popover. @@ -82,11 +82,11 @@ public struct Popover: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let childStorage = child?().storage(data: data, type: type) { + if let childStorage = child?.storage(data: data, type: type) { storage.content["child"] = [childStorage] gtk_popover_set_child(storage.opaquePointer?.cast(), childStorage.opaquePointer?.cast()) } - if let defaultWidgetStorage = defaultWidget?().storage(data: data, type: type) { + if let defaultWidgetStorage = defaultWidget?.storage(data: data, type: type) { storage.content["defaultWidget"] = [defaultWidgetStorage] gtk_popover_set_default_widget(storage.opaquePointer?.cast(), defaultWidgetStorage.opaquePointer?.cast()) } @@ -120,10 +120,10 @@ public struct Popover: AdwaitaWidget { gtk_popover_set_cascade_popdown(widget?.cast(), cascadePopdown.cBool) } if let widget = storage.content["child"]?.first { - child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + child?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let widget = storage.content["defaultWidget"]?.first { - defaultWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + defaultWidget?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let hasArrow, updateProperties, (storage.previousState as? Self)?.hasArrow != hasArrow { gtk_popover_set_has_arrow(widget?.cast(), hasArrow.cBool) @@ -147,53 +147,39 @@ public struct Popover: AdwaitaWidget { /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// Whether to dismiss the popover on outside clicks. public func autohide(_ autohide: Bool? = true) -> Self { - var newSelf = self - newSelf.autohide = autohide - return newSelf + modify { $0.autohide = autohide } } /// Whether the popover pops down after a child popover. /// /// This is used to implement the expected behavior of submenus. public func cascadePopdown(_ cascadePopdown: Bool? = true) -> Self { - var newSelf = self - newSelf.cascadePopdown = cascadePopdown - return newSelf + modify { $0.cascadePopdown = cascadePopdown } } /// The child widget. - public func child(@ViewBuilder _ child: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.child = child - return newSelf + public func child(@ViewBuilder _ child: () -> Body) -> Self { + modify { $0.child = child() } } /// The default widget inside the popover. - public func defaultWidget(@ViewBuilder _ defaultWidget: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.defaultWidget = defaultWidget - return newSelf + public func defaultWidget(@ViewBuilder _ defaultWidget: () -> Body) -> Self { + modify { $0.defaultWidget = defaultWidget() } } /// Whether to draw an arrow. public func hasArrow(_ hasArrow: Bool? = true) -> Self { - var newSelf = self - newSelf.hasArrow = hasArrow - return newSelf + modify { $0.hasArrow = hasArrow } } /// Whether mnemonics are currently visible in this popover. public func mnemonicsVisible(_ mnemonicsVisible: Bool? = true) -> Self { - var newSelf = self - newSelf.mnemonicsVisible = mnemonicsVisible - return newSelf + modify { $0.mnemonicsVisible = mnemonicsVisible } } /// Emitted whend the user activates the default widget. diff --git a/Sources/Adwaita/View/Generated/PreferencesGroup.swift b/Sources/Adwaita/View/Generated/PreferencesGroup.swift index 91b2e74..2b5718c 100644 --- a/Sources/Adwaita/View/Generated/PreferencesGroup.swift +++ b/Sources/Adwaita/View/Generated/PreferencesGroup.swift @@ -2,7 +2,7 @@ // PreferencesGroup.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -37,7 +37,7 @@ public struct PreferencesGroup: AdwaitaWidget { /// /// Suffixes are commonly used to show a button or a spinner for the whole /// group. - var headerSuffix: (() -> Body)? + var headerSuffix: Body? /// Whether to separate rows. /// /// Equivalent to using the @@ -63,7 +63,7 @@ public struct PreferencesGroup: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let headerSuffixStorage = headerSuffix?().storage(data: data, type: type) { + if let headerSuffixStorage = headerSuffix?.storage(data: data, type: type) { storage.content["headerSuffix"] = [headerSuffixStorage] adw_preferences_group_set_header_suffix(storage.opaquePointer?.cast(), headerSuffixStorage.opaquePointer?.cast()) } @@ -90,7 +90,7 @@ public struct PreferencesGroup: AdwaitaWidget { adw_preferences_group_set_description(widget?.cast(), description) } if let widget = storage.content["headerSuffix"]?.first { - headerSuffix?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + headerSuffix?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let separateRows, updateProperties, (storage.previousState as? Self)?.separateRows != separateRows { adw_preferences_group_set_separate_rows(widget?.cast(), separateRows.cBool) @@ -124,9 +124,7 @@ public struct PreferencesGroup: AdwaitaWidget { /// The description for this group of preferences. public func description(_ description: String?) -> Self { - var newSelf = self - newSelf.description = description - return newSelf + modify { $0.description = description } } /// The header suffix widget. @@ -135,10 +133,8 @@ public struct PreferencesGroup: AdwaitaWidget { /// /// Suffixes are commonly used to show a button or a spinner for the whole /// group. - public func headerSuffix(@ViewBuilder _ headerSuffix: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.headerSuffix = headerSuffix - return newSelf + public func headerSuffix(@ViewBuilder _ headerSuffix: () -> Body) -> Self { + modify { $0.headerSuffix = headerSuffix() } } /// Whether to separate rows. @@ -146,16 +142,12 @@ public struct PreferencesGroup: AdwaitaWidget { /// Equivalent to using the /// [`.boxed-list-separate`](style-classes.html public func separateRows(_ separateRows: Bool? = true) -> Self { - var newSelf = self - newSelf.separateRows = separateRows - return newSelf + modify { $0.separateRows = separateRows } } /// The title for this group of preferences. public func title(_ title: String?) -> Self { - var newSelf = self - newSelf.title = title - return newSelf + modify { $0.title = title } } /// Set the body for "child". diff --git a/Sources/Adwaita/View/Generated/PreferencesPage.swift b/Sources/Adwaita/View/Generated/PreferencesPage.swift index 80dec58..e5ab570 100644 --- a/Sources/Adwaita/View/Generated/PreferencesPage.swift +++ b/Sources/Adwaita/View/Generated/PreferencesPage.swift @@ -2,7 +2,7 @@ // PreferencesPage.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -116,44 +116,32 @@ public struct PreferencesPage: AdwaitaWidget { /// The description to be displayed at the top of the page. public func description(_ description: String?) -> Self { - var newSelf = self - newSelf.description = description - return newSelf + modify { $0.description = description } } /// Whether the description should be centered. public func descriptionCentered(_ descriptionCentered: Bool? = true) -> Self { - var newSelf = self - newSelf.descriptionCentered = descriptionCentered - return newSelf + modify { $0.descriptionCentered = descriptionCentered } } /// The icon name for this page. public func iconName(_ iconName: String?) -> Self { - var newSelf = self - newSelf.iconName = iconName - return newSelf + modify { $0.iconName = iconName } } /// The name of this page. public func name(_ name: String?) -> Self { - var newSelf = self - newSelf.name = name - return newSelf + modify { $0.name = name } } /// The title for this page. public func title(_ title: String?) -> Self { - var newSelf = self - newSelf.title = title - return newSelf + modify { $0.title = title } } /// Whether an embedded underline in the title indicates a mnemonic. public func useUnderline(_ useUnderline: Bool? = true) -> Self { - var newSelf = self - newSelf.useUnderline = useUnderline - return newSelf + modify { $0.useUnderline = useUnderline } } /// Set the body for "child". diff --git a/Sources/Adwaita/View/Generated/PreferencesRow.swift b/Sources/Adwaita/View/Generated/PreferencesRow.swift index abec3e7..02be8af 100644 --- a/Sources/Adwaita/View/Generated/PreferencesRow.swift +++ b/Sources/Adwaita/View/Generated/PreferencesRow.swift @@ -2,7 +2,7 @@ // PreferencesRow.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -99,18 +99,14 @@ public struct PreferencesRow: AdwaitaWidget { /// The title is interpreted as Pango markup unless /// ``useMarkup(_:)`` is set to `false`. public func title(_ title: String?) -> Self { - var newSelf = self - newSelf.title = title - return newSelf + modify { $0.title = title } } /// Whether the user can copy the title from the label. /// /// See also ``selectable(_:)``. public func titleSelectable(_ titleSelectable: Bool? = true) -> Self { - var newSelf = self - newSelf.titleSelectable = titleSelectable - return newSelf + modify { $0.titleSelectable = titleSelectable } } /// Whether to use Pango markup for the title label. @@ -119,16 +115,12 @@ public struct PreferencesRow: AdwaitaWidget { /// /// See also `Pango.parse_markup`. public func useMarkup(_ useMarkup: Bool? = true) -> Self { - var newSelf = self - newSelf.useMarkup = useMarkup - return newSelf + modify { $0.useMarkup = useMarkup } } /// Whether an embedded underline in the title indicates a mnemonic. public func useUnderline(_ useUnderline: Bool? = true) -> Self { - var newSelf = self - newSelf.useUnderline = useUnderline - return newSelf + modify { $0.useUnderline = useUnderline } } } diff --git a/Sources/Adwaita/View/Generated/ProgressBar.swift b/Sources/Adwaita/View/Generated/ProgressBar.swift index 40b413f..e46332c 100644 --- a/Sources/Adwaita/View/Generated/ProgressBar.swift +++ b/Sources/Adwaita/View/Generated/ProgressBar.swift @@ -2,7 +2,7 @@ // ProgressBar.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -124,30 +124,22 @@ public struct ProgressBar: AdwaitaWidget { /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// The fraction of total work that has been completed. public func fraction(_ fraction: Double?) -> Self { - var newSelf = self - newSelf.fraction = fraction - return newSelf + modify { $0.fraction = fraction } } /// Invert the direction in which the progress bar grows. public func inverted(_ inverted: Bool? = true) -> Self { - var newSelf = self - newSelf.inverted = inverted - return newSelf + modify { $0.inverted = inverted } } /// The fraction of total progress to move the bounding block when pulsed. public func pulseStep(_ pulseStep: Double?) -> Self { - var newSelf = self - newSelf.pulseStep = pulseStep - return newSelf + modify { $0.pulseStep = pulseStep } } /// Sets whether the progress bar will show a text in addition @@ -161,16 +153,12 @@ public struct ProgressBar: AdwaitaWidget { /// (even if the actual text is blank), set ``showText(_:)`` /// to `true` and ``text(_:)`` to the empty string (not %NULL). public func showText(_ showText: Bool? = true) -> Self { - var newSelf = self - newSelf.showText = showText - return newSelf + modify { $0.showText = showText } } /// Text to be displayed in the progress bar. public func text(_ text: String?) -> Self { - var newSelf = self - newSelf.text = text - return newSelf + modify { $0.text = text } } } diff --git a/Sources/Adwaita/View/Generated/ScrolledWindow.swift b/Sources/Adwaita/View/Generated/ScrolledWindow.swift index c0d834b..923a1e2 100644 --- a/Sources/Adwaita/View/Generated/ScrolledWindow.swift +++ b/Sources/Adwaita/View/Generated/ScrolledWindow.swift @@ -2,7 +2,7 @@ // ScrolledWindow.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -56,7 +56,7 @@ public struct ScrolledWindow: AdwaitaWidget { /// When setting this property, if the child widget does not implement /// `Gtk.Scrollable`, the scrolled window will add the child to /// a `Gtk.Viewport` and then set the viewport as the child. - var child: (() -> Body)? + var child: Body? /// Whether to draw a frame around the contents. var hasFrame: Bool? /// When the horizontal scrollbar is displayed. @@ -154,7 +154,7 @@ public struct ScrolledWindow: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let childStorage = child?().storage(data: data, type: type) { + if let childStorage = child?.storage(data: data, type: type) { storage.content["child"] = [childStorage] gtk_scrolled_window_set_child(storage.opaquePointer, childStorage.opaquePointer?.cast()) } @@ -192,7 +192,7 @@ public struct ScrolledWindow: AdwaitaWidget { storage.modify { widget in if let widget = storage.content["child"]?.first { - child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + child?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let hasFrame, updateProperties, (storage.previousState as? Self)?.hasFrame != hasFrame { gtk_scrolled_window_set_has_frame(widget, hasFrame.cBool) @@ -246,9 +246,7 @@ if hscrollbarPolicy != (storage.previousState as? Self)?.hscrollbarPolicy /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// The child widget. @@ -256,17 +254,13 @@ if hscrollbarPolicy != (storage.previousState as? Self)?.hscrollbarPolicy /// When setting this property, if the child widget does not implement /// `Gtk.Scrollable`, the scrolled window will add the child to /// a `Gtk.Viewport` and then set the viewport as the child. - public func child(@ViewBuilder _ child: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.child = child - return newSelf + public func child(@ViewBuilder _ child: () -> Body) -> Self { + modify { $0.child = child() } } /// Whether to draw a frame around the contents. public func hasFrame(_ hasFrame: Bool? = true) -> Self { - var newSelf = self - newSelf.hasFrame = hasFrame - return newSelf + modify { $0.hasFrame = hasFrame } } /// When the horizontal scrollbar is displayed. @@ -274,46 +268,34 @@ if hscrollbarPolicy != (storage.previousState as? Self)?.hscrollbarPolicy /// Use `Gtk.ScrolledWindow.set_policy` to set /// this property. public func hscrollbarPolicy(_ hscrollbarPolicy: ScrollbarVisibility?) -> Self { - var newSelf = self - newSelf.hscrollbarPolicy = hscrollbarPolicy - return newSelf + modify { $0.hscrollbarPolicy = hscrollbarPolicy } } /// Whether kinetic scrolling is enabled or not. /// /// Kinetic scrolling only applies to devices with source %GDK_SOURCE_TOUCHSCREEN. public func kineticScrolling(_ kineticScrolling: Bool? = true) -> Self { - var newSelf = self - newSelf.kineticScrolling = kineticScrolling - return newSelf + modify { $0.kineticScrolling = kineticScrolling } } /// The maximum content height of @scrolled_window. public func maxContentHeight(_ maxContentHeight: Int?) -> Self { - var newSelf = self - newSelf.maxContentHeight = maxContentHeight - return newSelf + modify { $0.maxContentHeight = maxContentHeight } } /// The maximum content width of @scrolled_window. public func maxContentWidth(_ maxContentWidth: Int?) -> Self { - var newSelf = self - newSelf.maxContentWidth = maxContentWidth - return newSelf + modify { $0.maxContentWidth = maxContentWidth } } /// The minimum content height of @scrolled_window. public func minContentHeight(_ minContentHeight: Int?) -> Self { - var newSelf = self - newSelf.minContentHeight = minContentHeight - return newSelf + modify { $0.minContentHeight = minContentHeight } } /// The minimum content width of @scrolled_window. public func minContentWidth(_ minContentWidth: Int?) -> Self { - var newSelf = self - newSelf.minContentWidth = minContentWidth - return newSelf + modify { $0.minContentWidth = minContentWidth } } /// Whether overlay scrolling is enabled or not. @@ -325,9 +307,7 @@ if hscrollbarPolicy != (storage.previousState as? Self)?.hscrollbarPolicy /// Note that overlay scrolling can also be globally disabled, with /// the ``gtkOverlayScrolling(_:)`` setting. public func overlayScrolling(_ overlayScrolling: Bool? = true) -> Self { - var newSelf = self - newSelf.overlayScrolling = overlayScrolling - return newSelf + modify { $0.overlayScrolling = overlayScrolling } } /// Whether the natural height of the child should be calculated and propagated @@ -336,9 +316,7 @@ if hscrollbarPolicy != (storage.previousState as? Self)?.hscrollbarPolicy /// This is useful in cases where an attempt should be made to allocate exactly /// enough space for the natural size of the child. public func propagateNaturalHeight(_ propagateNaturalHeight: Bool? = true) -> Self { - var newSelf = self - newSelf.propagateNaturalHeight = propagateNaturalHeight - return newSelf + modify { $0.propagateNaturalHeight = propagateNaturalHeight } } /// Whether the natural width of the child should be calculated and propagated @@ -347,9 +325,7 @@ if hscrollbarPolicy != (storage.previousState as? Self)?.hscrollbarPolicy /// This is useful in cases where an attempt should be made to allocate exactly /// enough space for the natural size of the child. public func propagateNaturalWidth(_ propagateNaturalWidth: Bool? = true) -> Self { - var newSelf = self - newSelf.propagateNaturalWidth = propagateNaturalWidth - return newSelf + modify { $0.propagateNaturalWidth = propagateNaturalWidth } } /// When the vertical scrollbar is displayed. @@ -357,9 +333,7 @@ if hscrollbarPolicy != (storage.previousState as? Self)?.hscrollbarPolicy /// Use `Gtk.ScrolledWindow.set_policy` to set /// this property. public func vscrollbarPolicy(_ vscrollbarPolicy: ScrollbarVisibility?) -> Self { - var newSelf = self - newSelf.vscrollbarPolicy = vscrollbarPolicy - return newSelf + modify { $0.vscrollbarPolicy = vscrollbarPolicy } } /// Emitted whenever user initiated scrolling makes the scrolled diff --git a/Sources/Adwaita/View/Generated/SearchBar.swift b/Sources/Adwaita/View/Generated/SearchBar.swift index a513b45..585010e 100644 --- a/Sources/Adwaita/View/Generated/SearchBar.swift +++ b/Sources/Adwaita/View/Generated/SearchBar.swift @@ -2,7 +2,7 @@ // SearchBar.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -40,9 +40,9 @@ public struct SearchBar: AdwaitaWidget { /// The accessible role cannot be changed once set. var accessibleRole: String? /// The child widget. - var child: (() -> Body)? + var child: Body? /// The key capture widget. - var keyCaptureWidget: (() -> Body)? + var keyCaptureWidget: Body? /// Whether the search mode is on and the search bar shown. var searchModeEnabled: Bool? /// Whether to show the close button in the search bar. @@ -63,11 +63,11 @@ public struct SearchBar: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let childStorage = child?().storage(data: data, type: type) { + if let childStorage = child?.storage(data: data, type: type) { storage.content["child"] = [childStorage] gtk_search_bar_set_child(storage.opaquePointer, childStorage.opaquePointer?.cast()) } - if let keyCaptureWidgetStorage = keyCaptureWidget?().storage(data: data, type: type) { + if let keyCaptureWidgetStorage = keyCaptureWidget?.storage(data: data, type: type) { storage.content["keyCaptureWidget"] = [keyCaptureWidgetStorage] gtk_search_bar_set_key_capture_widget(storage.opaquePointer, keyCaptureWidgetStorage.opaquePointer?.cast()) } @@ -85,10 +85,10 @@ public struct SearchBar: AdwaitaWidget { storage.modify { widget in if let widget = storage.content["child"]?.first { - child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + child?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let widget = storage.content["keyCaptureWidget"]?.first { - keyCaptureWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + keyCaptureWidget?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let searchModeEnabled, updateProperties, (storage.previousState as? Self)?.searchModeEnabled != searchModeEnabled { gtk_search_bar_set_search_mode(widget, searchModeEnabled.cBool) @@ -112,37 +112,27 @@ public struct SearchBar: AdwaitaWidget { /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// The child widget. - public func child(@ViewBuilder _ child: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.child = child - return newSelf + public func child(@ViewBuilder _ child: () -> Body) -> Self { + modify { $0.child = child() } } /// The key capture widget. - public func keyCaptureWidget(@ViewBuilder _ keyCaptureWidget: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.keyCaptureWidget = keyCaptureWidget - return newSelf + public func keyCaptureWidget(@ViewBuilder _ keyCaptureWidget: () -> Body) -> Self { + modify { $0.keyCaptureWidget = keyCaptureWidget() } } /// Whether the search mode is on and the search bar shown. public func searchModeEnabled(_ searchModeEnabled: Bool? = true) -> Self { - var newSelf = self - newSelf.searchModeEnabled = searchModeEnabled - return newSelf + modify { $0.searchModeEnabled = searchModeEnabled } } /// Whether to show the close button in the search bar. public func showCloseButton(_ showCloseButton: Bool? = true) -> Self { - var newSelf = self - newSelf.showCloseButton = showCloseButton - return newSelf + modify { $0.showCloseButton = showCloseButton } } } diff --git a/Sources/Adwaita/View/Generated/SearchEntry.swift b/Sources/Adwaita/View/Generated/SearchEntry.swift index eaf313e..3d702b1 100644 --- a/Sources/Adwaita/View/Generated/SearchEntry.swift +++ b/Sources/Adwaita/View/Generated/SearchEntry.swift @@ -2,7 +2,7 @@ // SearchEntry.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -265,90 +265,66 @@ if let text, newValue != text.wrappedValue { /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// Whether to activate the default widget when Enter is pressed. public func activatesDefault(_ activatesDefault: Bool? = true) -> Self { - var newSelf = self - newSelf.activatesDefault = activatesDefault - return newSelf + modify { $0.activatesDefault = activatesDefault } } /// The current position of the insertion cursor in chars. public func cursorPosition(_ cursorPosition: Int?) -> Self { - var newSelf = self - newSelf.cursorPosition = cursorPosition - return newSelf + modify { $0.cursorPosition = cursorPosition } } /// Whether the entry contents can be edited. public func editable(_ editable: Bool? = true) -> Self { - var newSelf = self - newSelf.editable = editable - return newSelf + modify { $0.editable = editable } } /// If undo/redo should be enabled for the editable. public func enableUndo(_ enableUndo: Bool? = true) -> Self { - var newSelf = self - newSelf.enableUndo = enableUndo - return newSelf + modify { $0.enableUndo = enableUndo } } /// The desired maximum width of the entry, in characters. public func maxWidthChars(_ maxWidthChars: Int?) -> Self { - var newSelf = self - newSelf.maxWidthChars = maxWidthChars - return newSelf + modify { $0.maxWidthChars = maxWidthChars } } /// The text that will be displayed in the `GtkSearchEntry` /// when it is empty and unfocused. public func placeholderText(_ placeholderText: String?) -> Self { - var newSelf = self - newSelf.placeholderText = placeholderText - return newSelf + modify { $0.placeholderText = placeholderText } } /// The delay in milliseconds from last keypress to the search /// changed signal. public func searchDelay(_ searchDelay: UInt?) -> Self { - var newSelf = self - newSelf.searchDelay = searchDelay - return newSelf + modify { $0.searchDelay = searchDelay } } /// The position of the opposite end of the selection from the cursor in chars. public func selectionBound(_ selectionBound: Int?) -> Self { - var newSelf = self - newSelf.selectionBound = selectionBound - return newSelf + modify { $0.selectionBound = selectionBound } } /// The contents of the entry. public func text(_ text: Binding?) -> Self { - var newSelf = self - newSelf.text = text - return newSelf + modify { $0.text = text } } /// Number of characters to leave space for in the entry. public func widthChars(_ widthChars: Int?) -> Self { - var newSelf = self - newSelf.widthChars = widthChars - return newSelf + modify { $0.widthChars = widthChars } } /// The horizontal alignment, from 0 (left) to 1 (right). /// /// Reversed for RTL layouts. public func xalign(_ xalign: Float?) -> Self { - var newSelf = self - newSelf.xalign = xalign - return newSelf + modify { $0.xalign = xalign } } /// Emitted when the entry is activated. diff --git a/Sources/Adwaita/View/Generated/Separator.swift b/Sources/Adwaita/View/Generated/Separator.swift index fcb0468..bb4a309 100644 --- a/Sources/Adwaita/View/Generated/Separator.swift +++ b/Sources/Adwaita/View/Generated/Separator.swift @@ -2,7 +2,7 @@ // Separator.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -73,9 +73,7 @@ public struct Separator: AdwaitaWidget { /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } } diff --git a/Sources/Adwaita/View/Generated/SpinRow.swift b/Sources/Adwaita/View/Generated/SpinRow.swift index 3f6df04..088137f 100644 --- a/Sources/Adwaita/View/Generated/SpinRow.swift +++ b/Sources/Adwaita/View/Generated/SpinRow.swift @@ -2,7 +2,7 @@ // SpinRow.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -37,7 +37,7 @@ public struct SpinRow: AdwaitaWidget { /// /// The target widget will be activated by emitting the /// `Gtk.Widget::mnemonic-activate` signal on it. - var activatableWidget: (() -> Body)? + var activatableWidget: Body? /// The acceleration rate when you hold down a button or key. var climbRate: Double /// The number of decimal places to display. @@ -126,7 +126,7 @@ public struct SpinRow: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let activatableWidgetStorage = activatableWidget?().storage(data: data, type: type) { + if let activatableWidgetStorage = activatableWidget?.storage(data: data, type: type) { storage.content["activatableWidget"] = [activatableWidgetStorage] adw_action_row_set_activatable_widget(storage.opaquePointer?.cast(), activatableWidgetStorage.opaquePointer?.cast()) } @@ -182,7 +182,7 @@ if let value, newValue != value.wrappedValue { } } if let widget = storage.content["activatableWidget"]?.first { - activatableWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + activatableWidget?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if updateProperties, (storage.previousState as? Self)?.climbRate != climbRate { adw_spin_row_set_climb_rate(widget, climbRate) @@ -247,38 +247,28 @@ if let value, newValue != value.wrappedValue { /// /// The target widget will be activated by emitting the /// `Gtk.Widget::mnemonic-activate` signal on it. - public func activatableWidget(@ViewBuilder _ activatableWidget: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.activatableWidget = activatableWidget - return newSelf + public func activatableWidget(@ViewBuilder _ activatableWidget: () -> Body) -> Self { + modify { $0.activatableWidget = activatableWidget() } } /// The acceleration rate when you hold down a button or key. public func climbRate(_ climbRate: Double) -> Self { - var newSelf = self - newSelf.climbRate = climbRate - return newSelf + modify { $0.climbRate = climbRate } } /// The number of decimal places to display. public func digits(_ digits: UInt) -> Self { - var newSelf = self - newSelf.digits = digits - return newSelf + modify { $0.digits = digits } } /// Whether non-numeric characters should be ignored. public func numeric(_ numeric: Bool? = true) -> Self { - var newSelf = self - newSelf.numeric = numeric - return newSelf + modify { $0.numeric = numeric } } /// Whether invalid values are snapped to the nearest step increment. public func snapToTicks(_ snapToTicks: Bool? = true) -> Self { - var newSelf = self - newSelf.snapToTicks = snapToTicks - return newSelf + modify { $0.snapToTicks = snapToTicks } } /// The subtitle for this row. @@ -286,9 +276,7 @@ if let value, newValue != value.wrappedValue { /// The subtitle is interpreted as Pango markup unless /// ``useMarkup(_:)`` is set to `false`. public func subtitle(_ subtitle: String?) -> Self { - var newSelf = self - newSelf.subtitle = subtitle - return newSelf + modify { $0.subtitle = subtitle } } /// The number of lines at the end of which the subtitle label will be @@ -296,18 +284,14 @@ if let value, newValue != value.wrappedValue { /// /// If the value is 0, the number of lines won't be limited. public func subtitleLines(_ subtitleLines: Int?) -> Self { - var newSelf = self - newSelf.subtitleLines = subtitleLines - return newSelf + modify { $0.subtitleLines = subtitleLines } } /// Whether the user can copy the subtitle from the label. /// /// See also ``selectable(_:)``. public func subtitleSelectable(_ subtitleSelectable: Bool? = true) -> Self { - var newSelf = self - newSelf.subtitleSelectable = subtitleSelectable - return newSelf + modify { $0.subtitleSelectable = subtitleSelectable } } /// The title of the preference represented by this row. @@ -315,27 +299,21 @@ if let value, newValue != value.wrappedValue { /// The title is interpreted as Pango markup unless /// ``useMarkup(_:)`` is set to `false`. public func title(_ title: String?) -> Self { - var newSelf = self - newSelf.title = title - return newSelf + modify { $0.title = title } } /// The number of lines at the end of which the title label will be ellipsized. /// /// If the value is 0, the number of lines won't be limited. public func titleLines(_ titleLines: Int?) -> Self { - var newSelf = self - newSelf.titleLines = titleLines - return newSelf + modify { $0.titleLines = titleLines } } /// Whether the user can copy the title from the label. /// /// See also ``selectable(_:)``. public func titleSelectable(_ titleSelectable: Bool? = true) -> Self { - var newSelf = self - newSelf.titleSelectable = titleSelectable - return newSelf + modify { $0.titleSelectable = titleSelectable } } /// Whether to use Pango markup for the title label. @@ -344,30 +322,22 @@ if let value, newValue != value.wrappedValue { /// /// See also `Pango.parse_markup`. public func useMarkup(_ useMarkup: Bool? = true) -> Self { - var newSelf = self - newSelf.useMarkup = useMarkup - return newSelf + modify { $0.useMarkup = useMarkup } } /// Whether an embedded underline in the title indicates a mnemonic. public func useUnderline(_ useUnderline: Bool? = true) -> Self { - var newSelf = self - newSelf.useUnderline = useUnderline - return newSelf + modify { $0.useUnderline = useUnderline } } /// The current value. public func value(_ value: Binding?) -> Self { - var newSelf = self - newSelf.value = value - return newSelf + modify { $0.value = value } } /// Whether the spin row should wrap upon reaching its limits. public func wrap(_ wrap: Bool? = true) -> Self { - var newSelf = self - newSelf.wrap = wrap - return newSelf + modify { $0.wrap = wrap } } /// This signal is emitted after the row has been activated. diff --git a/Sources/Adwaita/View/Generated/Spinner.swift b/Sources/Adwaita/View/Generated/Spinner.swift index ab6935f..5831839 100644 --- a/Sources/Adwaita/View/Generated/Spinner.swift +++ b/Sources/Adwaita/View/Generated/Spinner.swift @@ -2,7 +2,7 @@ // Spinner.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw diff --git a/Sources/Adwaita/View/Generated/SplitButton.swift b/Sources/Adwaita/View/Generated/SplitButton.swift index 50b1e5b..d1295a4 100644 --- a/Sources/Adwaita/View/Generated/SplitButton.swift +++ b/Sources/Adwaita/View/Generated/SplitButton.swift @@ -2,7 +2,7 @@ // SplitButton.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -37,7 +37,7 @@ public struct SplitButton: AdwaitaWidget { /// /// Setting the child widget will set ``label(_:)`` and /// ``iconName(_:)`` to `NULL`. - var child: (() -> Body)? + var child: Body? /// The tooltip of the dropdown button. /// /// The tooltip can be marked up with the Pango text markup language. @@ -62,7 +62,7 @@ public struct SplitButton: AdwaitaWidget { /// /// If ``popover(_:)`` is already set, it will be dissociated /// from the button, and the property is set to `NULL`. - var menuModel: (() -> Body)? + var menuModel: Body? /// Whether an underline in the text indicates a mnemonic. /// /// See ``label(_:)``. @@ -90,12 +90,12 @@ public struct SplitButton: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let childStorage = child?().storage(data: data, type: type) { + if let childStorage = child?.storage(data: data, type: type) { storage.content["child"] = [childStorage] adw_split_button_set_child(storage.opaquePointer, childStorage.opaquePointer?.cast()) } - if let menu = menuModel?() { - let childStorage = MenuCollection { menu }.getMenu(data: data) + if let menuModel { + let childStorage = MenuCollection { menuModel }.getMenu(data: data) storage.content["menuModel"] = [childStorage] adw_split_button_set_menu_model(storage.opaquePointer, childStorage.opaquePointer?.cast()) } @@ -126,7 +126,7 @@ public struct SplitButton: AdwaitaWidget { adw_split_button_set_can_shrink(widget, canShrink.cBool) } if let widget = storage.content["child"]?.first { - child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + child?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let dropdownTooltip, updateProperties, (storage.previousState as? Self)?.dropdownTooltip != dropdownTooltip { adw_split_button_set_dropdown_tooltip(widget, dropdownTooltip) @@ -138,7 +138,7 @@ public struct SplitButton: AdwaitaWidget { adw_split_button_set_label(widget, label) } if let menu = storage.content["menuModel"]?.first { - MenuCollection { menuModel?() ?? [] } + MenuCollection { menuModel ?? [] } .updateStorage(menu, data: data.noModifiers, updateProperties: updateProperties, type: MenuContext.self) } if let useUnderline, updateProperties, (storage.previousState as? Self)?.useUnderline != useUnderline { @@ -163,28 +163,22 @@ public struct SplitButton: AdwaitaWidget { /// See ``canShrink(_:)`` and /// ``canShrink(_:)``. public func canShrink(_ canShrink: Bool? = true) -> Self { - var newSelf = self - newSelf.canShrink = canShrink - return newSelf + modify { $0.canShrink = canShrink } } /// The child widget. /// /// Setting the child widget will set ``label(_:)`` and /// ``iconName(_:)`` to `NULL`. - public func child(@ViewBuilder _ child: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.child = child - return newSelf + public func child(@ViewBuilder _ child: () -> Body) -> Self { + modify { $0.child = child() } } /// The tooltip of the dropdown button. /// /// The tooltip can be marked up with the Pango text markup language. public func dropdownTooltip(_ dropdownTooltip: String?) -> Self { - var newSelf = self - newSelf.dropdownTooltip = dropdownTooltip - return newSelf + modify { $0.dropdownTooltip = dropdownTooltip } } /// The name of the icon used to automatically populate the button. @@ -192,9 +186,7 @@ public struct SplitButton: AdwaitaWidget { /// Setting the icon name will set ``label(_:)`` and /// ``child(_:)`` to `NULL`. public func iconName(_ iconName: String?) -> Self { - var newSelf = self - newSelf.iconName = iconName - return newSelf + modify { $0.iconName = iconName } } /// The label for the button. @@ -202,9 +194,7 @@ public struct SplitButton: AdwaitaWidget { /// Setting the label will set ``iconName(_:)`` and /// ``child(_:)`` to `NULL`. public func label(_ label: String?) -> Self { - var newSelf = self - newSelf.label = label - return newSelf + modify { $0.label = label } } /// The `GMenuModel` from which the popup will be created. @@ -217,19 +207,15 @@ public struct SplitButton: AdwaitaWidget { /// /// If ``popover(_:)`` is already set, it will be dissociated /// from the button, and the property is set to `NULL`. - public func menuModel(@ViewBuilder _ menuModel: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.menuModel = menuModel - return newSelf + public func menuModel(@ViewBuilder _ menuModel: () -> Body) -> Self { + modify { $0.menuModel = menuModel() } } /// Whether an underline in the text indicates a mnemonic. /// /// See ``label(_:)``. public func useUnderline(_ useUnderline: Bool? = true) -> Self { - var newSelf = self - newSelf.useUnderline = useUnderline - return newSelf + modify { $0.useUnderline = useUnderline } } /// Emitted to animate press then release. diff --git a/Sources/Adwaita/View/Generated/StatusPage.swift b/Sources/Adwaita/View/Generated/StatusPage.swift index e43991e..3caa606 100644 --- a/Sources/Adwaita/View/Generated/StatusPage.swift +++ b/Sources/Adwaita/View/Generated/StatusPage.swift @@ -2,7 +2,7 @@ // StatusPage.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -24,7 +24,7 @@ public struct StatusPage: AdwaitaWidget { var appearFunctions: [(ViewStorage, WidgetData) -> Void] = [] /// The child widget. - var child: (() -> Body)? + var child: Body? /// The description markup to be displayed below the title. var description: String? /// The name of the icon to be used. @@ -51,7 +51,7 @@ public struct StatusPage: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let childStorage = child?().storage(data: data, type: type) { + if let childStorage = child?.storage(data: data, type: type) { storage.content["child"] = [childStorage] adw_status_page_set_child(storage.opaquePointer, childStorage.opaquePointer?.cast()) } @@ -69,7 +69,7 @@ public struct StatusPage: AdwaitaWidget { storage.modify { widget in if let widget = storage.content["child"]?.first { - child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + child?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let description, updateProperties, (storage.previousState as? Self)?.description != description { adw_status_page_set_description(widget, description) @@ -93,35 +93,27 @@ public struct StatusPage: AdwaitaWidget { } /// The child widget. - public func child(@ViewBuilder _ child: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.child = child - return newSelf + public func child(@ViewBuilder _ child: () -> Body) -> Self { + modify { $0.child = child() } } /// The description markup to be displayed below the title. public func description(_ description: String?) -> Self { - var newSelf = self - newSelf.description = description - return newSelf + modify { $0.description = description } } /// The name of the icon to be used. /// /// Changing this will set ``paintable(_:)`` to `NULL`. public func iconName(_ iconName: String?) -> Self { - var newSelf = self - newSelf.iconName = iconName - return newSelf + modify { $0.iconName = iconName } } /// The title to be displayed below the icon. /// /// It is not parsed as Pango markup. public func title(_ title: String?) -> Self { - var newSelf = self - newSelf.title = title - return newSelf + modify { $0.title = title } } } diff --git a/Sources/Adwaita/View/Generated/SwitchRow.swift b/Sources/Adwaita/View/Generated/SwitchRow.swift index 4427249..8083442 100644 --- a/Sources/Adwaita/View/Generated/SwitchRow.swift +++ b/Sources/Adwaita/View/Generated/SwitchRow.swift @@ -2,7 +2,7 @@ // SwitchRow.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -46,7 +46,7 @@ public struct SwitchRow: AdwaitaWidget { /// /// The target widget will be activated by emitting the /// `Gtk.Widget::mnemonic-activate` signal on it. - var activatableWidget: (() -> Body)? + var activatableWidget: Body? /// Whether the switch row is in the "on" or "off" position. var active: Binding? /// The subtitle for this row. @@ -106,7 +106,7 @@ public struct SwitchRow: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let activatableWidgetStorage = activatableWidget?().storage(data: data, type: type) { + if let activatableWidgetStorage = activatableWidget?.storage(data: data, type: type) { storage.content["activatableWidget"] = [activatableWidgetStorage] adw_action_row_set_activatable_widget(storage.opaquePointer?.cast(), activatableWidgetStorage.opaquePointer?.cast()) } @@ -147,7 +147,7 @@ if let active, newValue != active.wrappedValue { } } if let widget = storage.content["activatableWidget"]?.first { - activatableWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + activatableWidget?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let active, updateProperties, (adw_switch_row_get_active(storage.opaquePointer) != 0) != active.wrappedValue { adw_switch_row_set_active(storage.opaquePointer, active.wrappedValue.cBool) @@ -197,17 +197,13 @@ if let active, newValue != active.wrappedValue { /// /// The target widget will be activated by emitting the /// `Gtk.Widget::mnemonic-activate` signal on it. - public func activatableWidget(@ViewBuilder _ activatableWidget: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.activatableWidget = activatableWidget - return newSelf + public func activatableWidget(@ViewBuilder _ activatableWidget: () -> Body) -> Self { + modify { $0.activatableWidget = activatableWidget() } } /// Whether the switch row is in the "on" or "off" position. public func active(_ active: Binding?) -> Self { - var newSelf = self - newSelf.active = active - return newSelf + modify { $0.active = active } } /// The subtitle for this row. @@ -215,9 +211,7 @@ if let active, newValue != active.wrappedValue { /// The subtitle is interpreted as Pango markup unless /// ``useMarkup(_:)`` is set to `false`. public func subtitle(_ subtitle: String?) -> Self { - var newSelf = self - newSelf.subtitle = subtitle - return newSelf + modify { $0.subtitle = subtitle } } /// The number of lines at the end of which the subtitle label will be @@ -225,18 +219,14 @@ if let active, newValue != active.wrappedValue { /// /// If the value is 0, the number of lines won't be limited. public func subtitleLines(_ subtitleLines: Int?) -> Self { - var newSelf = self - newSelf.subtitleLines = subtitleLines - return newSelf + modify { $0.subtitleLines = subtitleLines } } /// Whether the user can copy the subtitle from the label. /// /// See also ``selectable(_:)``. public func subtitleSelectable(_ subtitleSelectable: Bool? = true) -> Self { - var newSelf = self - newSelf.subtitleSelectable = subtitleSelectable - return newSelf + modify { $0.subtitleSelectable = subtitleSelectable } } /// The title of the preference represented by this row. @@ -244,27 +234,21 @@ if let active, newValue != active.wrappedValue { /// The title is interpreted as Pango markup unless /// ``useMarkup(_:)`` is set to `false`. public func title(_ title: String?) -> Self { - var newSelf = self - newSelf.title = title - return newSelf + modify { $0.title = title } } /// The number of lines at the end of which the title label will be ellipsized. /// /// If the value is 0, the number of lines won't be limited. public func titleLines(_ titleLines: Int?) -> Self { - var newSelf = self - newSelf.titleLines = titleLines - return newSelf + modify { $0.titleLines = titleLines } } /// Whether the user can copy the title from the label. /// /// See also ``selectable(_:)``. public func titleSelectable(_ titleSelectable: Bool? = true) -> Self { - var newSelf = self - newSelf.titleSelectable = titleSelectable - return newSelf + modify { $0.titleSelectable = titleSelectable } } /// Whether to use Pango markup for the title label. @@ -273,16 +257,12 @@ if let active, newValue != active.wrappedValue { /// /// See also `Pango.parse_markup`. public func useMarkup(_ useMarkup: Bool? = true) -> Self { - var newSelf = self - newSelf.useMarkup = useMarkup - return newSelf + modify { $0.useMarkup = useMarkup } } /// Whether an embedded underline in the title indicates a mnemonic. public func useUnderline(_ useUnderline: Bool? = true) -> Self { - var newSelf = self - newSelf.useUnderline = useUnderline - return newSelf + modify { $0.useUnderline = useUnderline } } /// This signal is emitted after the row has been activated. diff --git a/Sources/Adwaita/View/Generated/ToastOverlay.swift b/Sources/Adwaita/View/Generated/ToastOverlay.swift index bd19ddd..b661712 100644 --- a/Sources/Adwaita/View/Generated/ToastOverlay.swift +++ b/Sources/Adwaita/View/Generated/ToastOverlay.swift @@ -2,7 +2,7 @@ // ToastOverlay.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -30,7 +30,7 @@ public struct ToastOverlay: AdwaitaWidget { var appearFunctions: [(ViewStorage, WidgetData) -> Void] = [] /// The child widget. - var child: (() -> Body)? + var child: Body? /// Initialize `ToastOverlay`. public init() { @@ -47,7 +47,7 @@ public struct ToastOverlay: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let childStorage = child?().storage(data: data, type: type) { + if let childStorage = child?.storage(data: data, type: type) { storage.content["child"] = [childStorage] adw_toast_overlay_set_child(storage.opaquePointer, childStorage.opaquePointer?.cast()) } @@ -65,7 +65,7 @@ public struct ToastOverlay: AdwaitaWidget { storage.modify { widget in if let widget = storage.content["child"]?.first { - child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + child?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } @@ -80,10 +80,8 @@ public struct ToastOverlay: AdwaitaWidget { } /// The child widget. - public func child(@ViewBuilder _ child: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.child = child - return newSelf + public func child(@ViewBuilder _ child: () -> Body) -> Self { + modify { $0.child = child() } } } diff --git a/Sources/Adwaita/View/Generated/ToggleButton.swift b/Sources/Adwaita/View/Generated/ToggleButton.swift index 0cb4fa5..45f802a 100644 --- a/Sources/Adwaita/View/Generated/ToggleButton.swift +++ b/Sources/Adwaita/View/Generated/ToggleButton.swift @@ -2,7 +2,7 @@ // ToggleButton.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -48,7 +48,7 @@ public struct ToggleButton: AdwaitaWidget { /// property has no effect. var canShrink: Bool? /// The child widget. - var child: (() -> Body)? + var child: Body? /// Whether the button has a frame. var hasFrame: Bool? /// The name of the icon used to automatically populate the button. @@ -86,7 +86,7 @@ public struct ToggleButton: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let childStorage = child?().storage(data: data, type: type) { + if let childStorage = child?.storage(data: data, type: type) { storage.content["child"] = [childStorage] gtk_button_set_child(storage.opaquePointer?.cast(), childStorage.opaquePointer?.cast()) } @@ -134,7 +134,7 @@ if let active, newValue != active.wrappedValue { gtk_button_set_can_shrink(widget?.cast(), canShrink.cBool) } if let widget = storage.content["child"]?.first { - child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + child?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let hasFrame, updateProperties, (storage.previousState as? Self)?.hasFrame != hasFrame { gtk_button_set_has_frame(widget?.cast(), hasFrame.cBool) @@ -164,23 +164,17 @@ if let active, newValue != active.wrappedValue { /// /// The accessible role cannot be changed once set. public func accessibleRole(_ accessibleRole: String?) -> Self { - var newSelf = self - newSelf.accessibleRole = accessibleRole - return newSelf + modify { $0.accessibleRole = accessibleRole } } /// The name of the action with which this widget should be associated. public func actionName(_ actionName: String?) -> Self { - var newSelf = self - newSelf.actionName = actionName - return newSelf + modify { $0.actionName = actionName } } /// If the toggle button should be pressed in. public func active(_ active: Binding?) -> Self { - var newSelf = self - newSelf.active = active - return newSelf + modify { $0.active = active } } /// Whether the size of the button can be made smaller than the natural @@ -191,45 +185,33 @@ if let active, newValue != active.wrappedValue { /// If the contents of a button are an icon or a custom widget, setting this /// property has no effect. public func canShrink(_ canShrink: Bool? = true) -> Self { - var newSelf = self - newSelf.canShrink = canShrink - return newSelf + modify { $0.canShrink = canShrink } } /// The child widget. - public func child(@ViewBuilder _ child: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.child = child - return newSelf + public func child(@ViewBuilder _ child: () -> Body) -> Self { + modify { $0.child = child() } } /// Whether the button has a frame. public func hasFrame(_ hasFrame: Bool? = true) -> Self { - var newSelf = self - newSelf.hasFrame = hasFrame - return newSelf + modify { $0.hasFrame = hasFrame } } /// The name of the icon used to automatically populate the button. public func iconName(_ iconName: String?) -> Self { - var newSelf = self - newSelf.iconName = iconName - return newSelf + modify { $0.iconName = iconName } } /// Text of the label inside the button, if the button contains a label widget. public func label(_ label: String?) -> Self { - var newSelf = self - newSelf.label = label - return newSelf + modify { $0.label = label } } /// If set, an underline in the text indicates that the following character is /// to be used as mnemonic. public func useUnderline(_ useUnderline: Bool? = true) -> Self { - var newSelf = self - newSelf.useUnderline = useUnderline - return newSelf + modify { $0.useUnderline = useUnderline } } /// Emitted to animate press then release. diff --git a/Sources/Adwaita/View/Generated/ToolbarView.swift b/Sources/Adwaita/View/Generated/ToolbarView.swift index d3e7534..885f9fc 100644 --- a/Sources/Adwaita/View/Generated/ToolbarView.swift +++ b/Sources/Adwaita/View/Generated/ToolbarView.swift @@ -2,7 +2,7 @@ // ToolbarView.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -52,7 +52,7 @@ public struct ToolbarView: AdwaitaWidget { /// [`.undershoot-bottom`](style-classes.html var bottomBarStyle: ToolbarStyle? /// The content widget. - var content: (() -> Body)? + var content: Body? /// Whether the content widget can extend behind bottom bars. /// /// This can be used in combination with @@ -121,7 +121,7 @@ public struct ToolbarView: AdwaitaWidget { function(storage, data) } update(storage, data: data, updateProperties: true, type: type) - if let contentStorage = content?().storage(data: data, type: type) { + if let contentStorage = content?.storage(data: data, type: type) { storage.content["content"] = [contentStorage] adw_toolbar_view_set_content(storage.opaquePointer, contentStorage.opaquePointer?.cast()) } @@ -154,7 +154,7 @@ public struct ToolbarView: AdwaitaWidget { adw_toolbar_view_set_bottom_bar_style(widget, bottomBarStyle.gtkValue) } if let widget = storage.content["content"]?.first { - content?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + content?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } if let extendContentToBottomEdge, updateProperties, (storage.previousState as? Self)?.extendContentToBottomEdge != extendContentToBottomEdge { adw_toolbar_view_set_extend_content_to_bottom_edge(widget, extendContentToBottomEdge.cBool) @@ -214,9 +214,7 @@ public struct ToolbarView: AdwaitaWidget { /// /// See ``topBarHeight(_:)``. public func bottomBarHeight(_ bottomBarHeight: Int?) -> Self { - var newSelf = self - newSelf.bottomBarHeight = bottomBarHeight - return newSelf + modify { $0.bottomBarHeight = bottomBarHeight } } /// Appearance of the bottom bars. @@ -225,16 +223,12 @@ public struct ToolbarView: AdwaitaWidget { /// has a subtle undershoot shadow when touching them, same as the /// [`.undershoot-bottom`](style-classes.html public func bottomBarStyle(_ bottomBarStyle: ToolbarStyle?) -> Self { - var newSelf = self - newSelf.bottomBarStyle = bottomBarStyle - return newSelf + modify { $0.bottomBarStyle = bottomBarStyle } } /// The content widget. - public func content(@ViewBuilder _ content: @escaping (() -> Body)) -> Self { - var newSelf = self - newSelf.content = content - return newSelf + public func content(@ViewBuilder _ content: () -> Body) -> Self { + modify { $0.content = content() } } /// Whether the content widget can extend behind bottom bars. @@ -245,9 +239,7 @@ public struct ToolbarView: AdwaitaWidget { /// /// See ``extendContentToTopEdge(_:)``. public func extendContentToBottomEdge(_ extendContentToBottomEdge: Bool? = true) -> Self { - var newSelf = self - newSelf.extendContentToBottomEdge = extendContentToBottomEdge - return newSelf + modify { $0.extendContentToBottomEdge = extendContentToBottomEdge } } /// Whether the content widget can extend behind top bars. @@ -257,9 +249,7 @@ public struct ToolbarView: AdwaitaWidget { /// /// See ``extendContentToBottomEdge(_:)``. public func extendContentToTopEdge(_ extendContentToTopEdge: Bool? = true) -> Self { - var newSelf = self - newSelf.extendContentToTopEdge = extendContentToTopEdge - return newSelf + modify { $0.extendContentToTopEdge = extendContentToTopEdge } } /// Whether bottom bars are visible. @@ -272,9 +262,7 @@ public struct ToolbarView: AdwaitaWidget { /// /// See ``revealTopBars(_:)``. public func revealBottomBars(_ revealBottomBars: Bool? = true) -> Self { - var newSelf = self - newSelf.revealBottomBars = revealBottomBars - return newSelf + modify { $0.revealBottomBars = revealBottomBars } } /// Whether top bars are revealed. @@ -287,9 +275,7 @@ public struct ToolbarView: AdwaitaWidget { /// /// See ``revealBottomBars(_:)``. public func revealTopBars(_ revealTopBars: Bool? = true) -> Self { - var newSelf = self - newSelf.revealTopBars = revealTopBars - return newSelf + modify { $0.revealTopBars = revealTopBars } } /// The current top bar height. @@ -299,9 +285,7 @@ public struct ToolbarView: AdwaitaWidget { /// /// See ``bottomBarHeight(_:)``. public func topBarHeight(_ topBarHeight: Int?) -> Self { - var newSelf = self - newSelf.topBarHeight = topBarHeight - return newSelf + modify { $0.topBarHeight = topBarHeight } } /// Appearance of the top bars. @@ -310,9 +294,7 @@ public struct ToolbarView: AdwaitaWidget { /// subtle undershoot shadow when touching them, same as the /// [`.undershoot-top`](style-classes.html public func topBarStyle(_ topBarStyle: ToolbarStyle?) -> Self { - var newSelf = self - newSelf.topBarStyle = topBarStyle - return newSelf + modify { $0.topBarStyle = topBarStyle } } /// Set the body for "bottom". diff --git a/Sources/Adwaita/View/Generated/WindowTitle.swift b/Sources/Adwaita/View/Generated/WindowTitle.swift index 509e957..9481bb1 100644 --- a/Sources/Adwaita/View/Generated/WindowTitle.swift +++ b/Sources/Adwaita/View/Generated/WindowTitle.swift @@ -2,7 +2,7 @@ // WindowTitle.swift // Adwaita // -// Created by auto-generation on 30.10.25. +// Created by auto-generation on 31.10.25. // import CAdw @@ -85,9 +85,7 @@ public struct WindowTitle: AdwaitaWidget { /// /// The subtitle should give the user additional details. public func subtitle(_ subtitle: String) -> Self { - var newSelf = self - newSelf.subtitle = subtitle - return newSelf + modify { $0.subtitle = subtitle } } /// The title to display. @@ -95,9 +93,7 @@ public struct WindowTitle: AdwaitaWidget { /// The title typically identifies the current view or content item, and /// generally does not use the application name. public func title(_ title: String) -> Self { - var newSelf = self - newSelf.title = title - return newSelf + modify { $0.title = title } } } diff --git a/Sources/Adwaita/View/Toggle.swift b/Sources/Adwaita/View/Toggle.swift index 5a6112a..d926214 100644 --- a/Sources/Adwaita/View/Toggle.swift +++ b/Sources/Adwaita/View/Toggle.swift @@ -42,7 +42,7 @@ extension Toggle { if let child { return .init() .active(active) - .child(child) + .child { child } } else { return .init() .active(active) diff --git a/Sources/Generation/GIR/Property.swift b/Sources/Generation/GIR/Property.swift index 671e314..aec1f80 100644 --- a/Sources/Generation/GIR/Property.swift +++ b/Sources/Generation/GIR/Property.swift @@ -27,6 +27,10 @@ struct Property: Decodable { /// Whether the property is deprecated. var deprecated: Bool? + var isView: Bool { + (self.type?.isWidget ?? false) || (self.type?.isMenu ?? false) + } + /// Get the Swift property name. /// - Parameter configuration: The generation configuration. /// - Returns: The name. @@ -53,11 +57,10 @@ struct Property: Decodable { } else { type = (try? self.type?.generate(configuration: genConfig)) ?? "String" } - if (self.type?.isWidget ?? false) || (self.type?.isMenu ?? false) { - type = "\(modifier ? "@escaping " : "")(() -> Body)" + if isView { + type = modifier ? "() -> Body" : "Body" } - if !config.requiredProperties.contains(name) - && !(((self.type?.isWidget ?? false) || (self.type?.isMenu ?? false)) && modifier) { + if !config.requiredProperties.contains(name) && !(isView && modifier) { type += "?" } if defaultValue, let value = genConfig.defaultModifierValues[type] { @@ -93,9 +96,7 @@ struct Property: Decodable { \(doc?.docComment(configuration: genConfig, indent: " ") ?? "/// \(name)") public func \(convertPropertyName(configuration: genConfig))(\(builder)_ \(mainParameter)) -> Self { - var newSelf = self - newSelf.\(property) = \(property) - return newSelf + modify { $0.\(property) = \(property)\(isView ? "()" : "") } } """ @@ -117,7 +118,7 @@ struct Property: Decodable { guard !(type?.isWidget ?? false) else { return """ if let widget = storage.content["\(name)"]?.first { - \(name)?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type) + \(name)?.updateStorage(widget, data: data, updateProperties: updateProperties, type: type) } """ @@ -125,7 +126,7 @@ struct Property: Decodable { guard !(type?.isMenu ?? false) else { return """ if let menu = storage.content["\(name)"]?.first { - MenuCollection { \(name)?() ?? [] } + MenuCollection { \(name) ?? [] } .updateStorage(menu, data: data.noModifiers, updateProperties: updateProperties, type: MenuContext.self) } @@ -198,7 +199,7 @@ struct Property: Decodable { let name = convertPropertyName(configuration: genConfig) let view = (self.cast ?? config.cast) ? "storage.opaquePointer?.cast()" : "storage.opaquePointer" return """ - if let \(name)Storage = \(name)?().storage(data: data, type: type) { + if let \(name)Storage = \(name)?.storage(data: data, type: type) { storage.content["\(name)"] = [\(name)Storage] \(setter)(\(view), \(name)Storage.opaquePointer?.cast()) } @@ -224,8 +225,8 @@ struct Property: Decodable { let name = convertPropertyName(configuration: genConfig) let view = (self.cast ?? config.cast) ? "storage.opaquePointer?.cast()" : "storage.opaquePointer" return """ - if let menu = \(name)?() { - let childStorage = MenuCollection { menu }.getMenu(data: data) + if let \(name) { + let childStorage = MenuCollection { \(name) }.getMenu(data: data) storage.content["\(name)"] = [childStorage] \(setter)(\(view), childStorage.opaquePointer?.cast()) }