From 079841d8076c3c6cc7e90a146f6b645f84494f52 Mon Sep 17 00:00:00 2001 From: Alexandr Romanov Date: Wed, 25 Dec 2024 23:54:55 +0300 Subject: [PATCH] Format and updates for macOS (#45) --- Example/Shared/DemoPages/GridSelectDemo.swift | 36 +- .../Controls/Background/Background.swift | 9 +- Sources/OversizeUI/Controls/Badge/Bage.swift | 26 +- .../Controls/Button/FieldButtonStyle.swift | 35 +- .../Controls/Checkbox/Checkbox.swift | 22 +- .../ColorSelector/ColorSelector.swift | 10 +- .../Controls/ContentView/ContentView.swift | 16 +- .../Controls/GridSelect/GridSelect.swift | 168 +++++--- .../Controls/GridSelect/GridSelectStyle.swift | 40 +- .../Controls/IconPicker/IconPicker.swift | 9 +- .../Controls/Loader/LoaderOverlayView.swift | 15 +- .../Controls/Notice/NoticeView.swift | 28 +- .../OversizeUI/Controls/PageView/Page.swift | 402 ++++++++++-------- .../Controls/Premium/PremiumLabel.swift | 7 +- Sources/OversizeUI/Controls/Radio/Radio.swift | 24 +- .../Controls/Radio/RadioPicker.swift | 15 +- Sources/OversizeUI/Controls/Row/Row.swift | 84 ++-- .../OversizeUI/Controls/Row/RowButton.swift | 11 +- .../SegmentedControl/SegmentedControl.swift | 175 +++++--- .../SegmentedControlStyle.swift | 46 +- .../Support/SegmentedControl+Extensions.swift | 18 +- .../Controls/Select/MultiSelect.swift | 25 +- .../OversizeUI/Controls/Select/Select.swift | 35 +- .../Controls/Select/SelectPicker.swift | 10 +- .../Controls/Surface/MaterialSurface.swift | 13 +- .../OversizeUI/Controls/Surface/Surface.swift | 32 +- .../TextField/TextFieldExtended.swift | 34 +- .../ScreenSizeEnvironment.swift | 29 +- Sources/OversizeUI/Core/Shadow.swift | 50 ++- .../NavigationBar/ModalNavigationBar.swift | 259 +++++------ Sources/OversizeUI/Deprecated/PageView.swift | 145 ++++--- .../Deprecated/ScrollViewOffset.swift | 13 +- .../Extensions/Padding/Padding.swift | 19 +- .../Extensions/View/View+Background.swift | 13 +- .../Shapes/RoundedRectangleCorner.swift | 39 +- 35 files changed, 1084 insertions(+), 828 deletions(-) diff --git a/Example/Shared/DemoPages/GridSelectDemo.swift b/Example/Shared/DemoPages/GridSelectDemo.swift index 6fc20c5..60f3287 100644 --- a/Example/Shared/DemoPages/GridSelectDemo.swift +++ b/Example/Shared/DemoPages/GridSelectDemo.swift @@ -17,24 +17,30 @@ struct GridSelectDemo: View { PageView("Grid select") { VStack(spacing: .xSmall) { ScrollView { - GridSelect(items, selection: $selection, - content: { item, _ in - VStack { - IconDeprecated(.circle) - Text(item) - }.padding() - }) + GridSelect( + items, + selection: $selection, + content: { item, _ in + VStack { + IconDeprecated(.circle) + Text(item) + }.padding() + } + ) } - GridSelect(items2, selection: $selection, - content: { item, _ in - VStack { - IconDeprecated(.circle) - Text(item) - }.padding() - }) + GridSelect( + items2, + selection: $selection, + content: { item, _ in + VStack { + IconDeprecated(.circle) + Text(item) + }.padding() + } + ) - .gridSelectStyle(SelectionOnlyGridSelectStyle()) + .gridSelectStyle(SelectionOnlyGridSelectStyle()) } .padding() } diff --git a/Sources/OversizeUI/Controls/Background/Background.swift b/Sources/OversizeUI/Controls/Background/Background.swift index e7197a3..eeae015 100644 --- a/Sources/OversizeUI/Controls/Background/Background.swift +++ b/Sources/OversizeUI/Controls/Background/Background.swift @@ -33,10 +33,11 @@ public struct Background: View { private let background: BackgroundColor public var padding: BackgroundPadding - public init(background: BackgroundColor = .primary, - padding: BackgroundPadding = .medium, - @ViewBuilder content: () -> Content) - { + public init( + background: BackgroundColor = .primary, + padding: BackgroundPadding = .medium, + @ViewBuilder content: () -> Content + ) { self.content = content() self.padding = padding self.background = background diff --git a/Sources/OversizeUI/Controls/Badge/Bage.swift b/Sources/OversizeUI/Controls/Badge/Bage.swift index 320ddf8..80db649 100644 --- a/Sources/OversizeUI/Controls/Badge/Bage.swift +++ b/Sources/OversizeUI/Controls/Badge/Bage.swift @@ -26,18 +26,22 @@ public struct Bage: View { .padding(.vertical, .xxxSmall) .padding(.horizontal, .xxSmall) .background( - RoundedRectangle(cornerRadius: controlRadius, - style: .continuous) - .fill(color.opacity(0.1)) - .overlay( - RoundedRectangle(cornerRadius: controlRadius, - style: .continuous) - .stroke( - theme.borderSurface - ? Color.border - : Color.clear - ) + RoundedRectangle( + cornerRadius: controlRadius, + style: .continuous + ) + .fill(color.opacity(0.1)) + .overlay( + RoundedRectangle( + cornerRadius: controlRadius, + style: .continuous ) + .stroke( + theme.borderSurface + ? Color.border + : Color.clear + ) + ) ) } } diff --git a/Sources/OversizeUI/Controls/Button/FieldButtonStyle.swift b/Sources/OversizeUI/Controls/Button/FieldButtonStyle.swift index 2af80b3..6df0c9f 100644 --- a/Sources/OversizeUI/Controls/Button/FieldButtonStyle.swift +++ b/Sources/OversizeUI/Controls/Button/FieldButtonStyle.swift @@ -30,19 +30,27 @@ public struct FieldButtonStyle: ButtonStyle { .fill(isPressed ? Color.surfaceTertiary : Color.surfaceSecondary) .overlay( RoundedRectangleCorner(radius: Radius.medium, corners: backgroundShapeCorners) - .stroke(theme.borderTextFields - ? Color.border - : Color.surfaceSecondary, lineWidth: CGFloat(theme.borderSize)) + .stroke( + theme.borderTextFields + ? Color.border + : Color.surfaceSecondary, + lineWidth: CGFloat(theme.borderSize) + ) ) #else RoundedRectangle(cornerRadius: Radius.medium, style: .continuous) .fill(isPressed ? Color.surfaceTertiary : Color.surfaceSecondary) .overlay( - RoundedRectangle(cornerRadius: Radius.medium, - style: .continuous) - .stroke(theme.borderTextFields + RoundedRectangle( + cornerRadius: Radius.medium, + style: .continuous + ) + .stroke( + theme.borderTextFields ? Color.border - : Color.surfaceSecondary, lineWidth: CGFloat(theme.borderSize)) + : Color.surfaceSecondary, + lineWidth: CGFloat(theme.borderSize) + ) ) #endif @@ -50,11 +58,16 @@ public struct FieldButtonStyle: ButtonStyle { RoundedRectangle(cornerRadius: Radius.medium, style: .continuous) .fill(isPressed ? Color.surfaceTertiary : Color.surfaceSecondary) .overlay( - RoundedRectangle(cornerRadius: Radius.medium, - style: .continuous) - .stroke(theme.borderTextFields + RoundedRectangle( + cornerRadius: Radius.medium, + style: .continuous + ) + .stroke( + theme.borderTextFields ? Color.border - : Color.surfaceSecondary, lineWidth: CGFloat(theme.borderSize)) + : Color.surfaceSecondary, + lineWidth: CGFloat(theme.borderSize) + ) ) } } diff --git a/Sources/OversizeUI/Controls/Checkbox/Checkbox.swift b/Sources/OversizeUI/Controls/Checkbox/Checkbox.swift index 2a77b9d..2257b62 100644 --- a/Sources/OversizeUI/Controls/Checkbox/Checkbox.swift +++ b/Sources/OversizeUI/Controls/Checkbox/Checkbox.swift @@ -18,11 +18,12 @@ public struct Checkbox: View { private var title: String? private let action: (() -> Void)? - public init(isOn: Binding, - alignment: CheckboxAlignment = .trailing, - action: (() -> Void)? = nil, - @ViewBuilder label: @escaping () -> Label? = { nil }) - { + public init( + isOn: Binding, + alignment: CheckboxAlignment = .trailing, + action: (() -> Void)? = nil, + @ViewBuilder label: @escaping () -> Label? = { nil } + ) { _isOn = isOn self.alignment = alignment self.action = action @@ -102,11 +103,12 @@ public struct Checkbox: View { } public extension Checkbox where Label == EmptyView { - init(_ title: String, - isOn: Binding, - alignment: CheckboxAlignment = .trailing, - action: (() -> Void)? = nil) - { + init( + _ title: String, + isOn: Binding, + alignment: CheckboxAlignment = .trailing, + action: (() -> Void)? = nil + ) { self.title = title _isOn = isOn self.alignment = alignment diff --git a/Sources/OversizeUI/Controls/ColorSelector/ColorSelector.swift b/Sources/OversizeUI/Controls/ColorSelector/ColorSelector.swift index 91377d2..9b92590 100644 --- a/Sources/OversizeUI/Controls/ColorSelector/ColorSelector.swift +++ b/Sources/OversizeUI/Controls/ColorSelector/ColorSelector.swift @@ -90,9 +90,13 @@ public struct ColorPickerWithoutBorder: View { .cornerRadius(19.0) .background( ZStack { - AngularGradient(gradient: Gradient(colors: - [.red, .yellow, .green, .blue, .purple, .red]), - center: .center, startAngle: .zero, endAngle: .degrees(360)).cornerRadius(16) + AngularGradient( + gradient: Gradient(colors: + [.red, .yellow, .green, .blue, .purple, .red]), + center: .center, + startAngle: .zero, + endAngle: .degrees(360) + ).cornerRadius(16) .frame(width: 32, height: 32) Circle() diff --git a/Sources/OversizeUI/Controls/ContentView/ContentView.swift b/Sources/OversizeUI/Controls/ContentView/ContentView.swift index 93b4d0f..41f8a94 100644 --- a/Sources/OversizeUI/Controls/ContentView/ContentView.swift +++ b/Sources/OversizeUI/Controls/ContentView/ContentView.swift @@ -27,12 +27,13 @@ public struct ContentView: View { private let primaryButton: ContenButtonType? private let secondaryButton: ContenButtonType? - public init(image: Image? = nil, - title: String, - subtitle: String? = nil, - primaryButton: ContenButtonType? = nil, - secondaryButton: ContenButtonType? = nil) - { + public init( + image: Image? = nil, + title: String, + subtitle: String? = nil, + primaryButton: ContenButtonType? = nil, + secondaryButton: ContenButtonType? = nil + ) { self.image = image self.title = title self.subtitle = subtitle @@ -45,7 +46,8 @@ public struct ContentView: View { VStack(alignment: vStackAlignment, spacing: .large) { if let image { image - .frame(width: 218, height: 218, alignment: .bottom) + .resizable() + .frame(width: 128, height: 128, alignment: .bottom) } TextBox( diff --git a/Sources/OversizeUI/Controls/GridSelect/GridSelect.swift b/Sources/OversizeUI/Controls/GridSelect/GridSelect.swift index 44a0d86..4c1fe7e 100644 --- a/Sources/OversizeUI/Controls/GridSelect/GridSelect.swift +++ b/Sources/OversizeUI/Controls/GridSelect/GridSelect.swift @@ -26,14 +26,15 @@ public struct GridSelect: View private let content: (Data.Element, Bool) -> Content private let action: (() -> Void)? - public init(_ data: Data, - selection: Binding, - radius: Radius = .medium, - spacing: Space = .xSmall, - @ViewBuilder content: @escaping (Data.Element, Bool) -> Content, - @ViewBuilder selectionView: @escaping () -> Selection? = { nil }, - action: (() -> Void)? = nil) - { + public init( + _ data: Data, + selection: Binding, + radius: Radius = .medium, + spacing: Space = .xSmall, + @ViewBuilder content: @escaping (Data.Element, Bool) -> Content, + @ViewBuilder selectionView: @escaping () -> Selection? = { nil }, + action: (() -> Void)? = nil + ) { self.data = data self.content = content self.selectionView = selectionView @@ -41,8 +42,10 @@ public struct GridSelect: View self.spacing = spacing self.action = action _selection = selection - _frames = State(wrappedValue: Array(repeating: .zero, - count: data.count)) + _frames = State(wrappedValue: Array( + repeating: .zero, + count: data.count + )) } public var body: some View { @@ -55,9 +58,10 @@ public struct GridSelect: View } private var gridSelect: some View { - LazyVGrid(columns: [GridItem(spacing: spacing), GridItem(spacing: spacing)], - spacing: spacing) - { + LazyVGrid( + columns: [GridItem(spacing: spacing), GridItem(spacing: spacing)], + spacing: spacing + ) { ForEach(data.indices, id: \.self) { index in Button(action: { @@ -70,8 +74,10 @@ public struct GridSelect: View // .animation(.easeInOut(duration: 0.3)) .overlay(selectedIndex == index ? itemBackground - .frame(width: frames[selectedIndex ?? 0].width, - height: frames[selectedIndex ?? 0].height) + .frame( + width: frames[selectedIndex ?? 0].width, + height: frames[selectedIndex ?? 0].height + ) : nil) } .background(getUnselection(unselectionStyle: style.unseletionStyle)) @@ -107,26 +113,37 @@ public struct GridSelect: View private func getSelection(selectionStyle: GridSelectSeletionStyle) -> some View { switch selectionStyle { case .shadowSurface: - RoundedRectangle(cornerRadius: radius, - style: .continuous) - .fill(Color.surfacePrimary) - .overlay( - RoundedRectangle(cornerRadius: radius, - style: .continuous) - .stroke(theme.borderControls - ? Color.border - : Color.surfaceSecondary, lineWidth: CGFloat(theme.borderSize)) + RoundedRectangle( + cornerRadius: radius, + style: .continuous + ) + .fill(Color.surfacePrimary) + .overlay( + RoundedRectangle( + cornerRadius: radius, + style: .continuous + ) + .stroke( + theme.borderControls + ? Color.border + : Color.surfaceSecondary, + lineWidth: CGFloat(theme.borderSize) ) - .shadowElevaton(.z2) + ) + .shadowElevaton(.z2) case .graySurface: - RoundedRectangle(cornerRadius: radius, - style: .continuous) - .strokeBorder(Color.onSurfaceSecondary, lineWidth: 2) + RoundedRectangle( + cornerRadius: radius, + style: .continuous + ) + .strokeBorder(Color.onSurfaceSecondary, lineWidth: 2) case .accentSurface: - RoundedRectangle(cornerRadius: radius.rawValue, - style: .continuous) - .strokeBorder(Color.blue, lineWidth: 2) + RoundedRectangle( + cornerRadius: radius.rawValue, + style: .continuous + ) + .strokeBorder(Color.blue, lineWidth: 2) } } @@ -137,16 +154,23 @@ public struct GridSelect: View EmptyView() case .surface: - RoundedRectangle(cornerRadius: radius, - style: .continuous) - .fill(Color.surfaceSecondary) - .overlay( - RoundedRectangle(cornerRadius: radius, - style: .continuous) - .stroke(theme.borderControls - ? Color.border - : Color.surfaceSecondary, lineWidth: CGFloat(theme.borderSize)) + RoundedRectangle( + cornerRadius: radius, + style: .continuous + ) + .fill(Color.surfaceSecondary) + .overlay( + RoundedRectangle( + cornerRadius: radius, + style: .continuous + ) + .stroke( + theme.borderControls + ? Color.border + : Color.surfaceSecondary, + lineWidth: CGFloat(theme.borderSize) ) + ) } } @@ -185,14 +209,14 @@ public struct GridSelect: View } public extension GridSelect where Selection == EmptyView { - init(_ data: Data, - selection: Binding, - radius: Radius = .medium, - spacing: Space = .xSmall, - @ViewBuilder content: @escaping (Data.Element, Bool) -> Content, - action: (() -> Void)? = nil) - - { + init( + _ data: Data, + selection: Binding, + radius: Radius = .medium, + spacing: Space = .xSmall, + @ViewBuilder content: @escaping (Data.Element, Bool) -> Content, + action: (() -> Void)? = nil + ) { self.data = data self.content = content self.radius = radius @@ -201,8 +225,10 @@ public extension GridSelect where Selection == EmptyView { self.action = action _selection = selection - _frames = State(wrappedValue: Array(repeating: .zero, - count: data.count)) + _frames = State(wrappedValue: Array( + repeating: .zero, + count: data.count + )) } } @@ -215,24 +241,30 @@ struct GridSelect_Preview: PreviewProvider { var body: some View { Group { - GridSelect(items, selection: $selection, - content: { item, _ in - VStack { - IconDeprecated(.circle) - Text(item) - }.padding() - }) - .previewDisplayName("Default") - - GridSelect(items, selection: $selection, - content: { item, _ in - VStack { - IconDeprecated(.circle) - Text(item) - }.padding() - }) - .previewDisplayName("Selection Only") - .gridSelectStyle(SelectionOnlyGridSelectStyle()) + GridSelect( + items, + selection: $selection, + content: { item, _ in + VStack { + IconDeprecated(.circle) + Text(item) + }.padding() + } + ) + .previewDisplayName("Default") + + GridSelect( + items, + selection: $selection, + content: { item, _ in + VStack { + IconDeprecated(.circle) + Text(item) + }.padding() + } + ) + .previewDisplayName("Selection Only") + .gridSelectStyle(SelectionOnlyGridSelectStyle()) } .previewLayout(.sizeThatFits) .padding() diff --git a/Sources/OversizeUI/Controls/GridSelect/GridSelectStyle.swift b/Sources/OversizeUI/Controls/GridSelect/GridSelectStyle.swift index d097c13..bcce5b8 100644 --- a/Sources/OversizeUI/Controls/GridSelect/GridSelectStyle.swift +++ b/Sources/OversizeUI/Controls/GridSelect/GridSelectStyle.swift @@ -18,17 +18,21 @@ public extension View { case let .default(selected: selected, icon: icon): let style: IslandGridSelectStyle = .init() - return environment(\.gridSelectStyle, AnyGridSelectStyle(seletionStyle: selected, - unseletionStyle: style.unseletionStyle, - icon: icon, - style: style)) + return environment(\.gridSelectStyle, AnyGridSelectStyle( + seletionStyle: selected, + unseletionStyle: style.unseletionStyle, + icon: icon, + style: style + )) case let .onlySelection(selected: selected, icon: icon): let style: SelectionOnlyGridSelectStyle = .init() - return environment(\.gridSelectStyle, AnyGridSelectStyle(seletionStyle: selected, - unseletionStyle: style.unseletionStyle, - icon: icon, - style: style)) + return environment(\.gridSelectStyle, AnyGridSelectStyle( + seletionStyle: selected, + unseletionStyle: style.unseletionStyle, + icon: icon, + style: style + )) } } } @@ -125,10 +129,12 @@ public struct AnyGridSelectStyle: GridSelectStyle { } struct GridSelectStyleKey: EnvironmentKey { - public static let defaultValue = AnyGridSelectStyle(seletionStyle: .accentSurface, - unseletionStyle: .surface, - icon: .none, - style: IslandGridSelectStyle()) + public static let defaultValue = AnyGridSelectStyle( + seletionStyle: .accentSurface, + unseletionStyle: .surface, + icon: .none, + style: IslandGridSelectStyle() + ) } public extension EnvironmentValues { @@ -140,9 +146,11 @@ public extension EnvironmentValues { public extension View { func gridSelectStyle(_ style: some GridSelectStyle) -> some View { - environment(\.gridSelectStyle, AnyGridSelectStyle(seletionStyle: style.seletionStyle, - unseletionStyle: style.unseletionStyle, - icon: style.icon, - style: style)) + environment(\.gridSelectStyle, AnyGridSelectStyle( + seletionStyle: style.seletionStyle, + unseletionStyle: style.unseletionStyle, + icon: style.icon, + style: style + )) } } diff --git a/Sources/OversizeUI/Controls/IconPicker/IconPicker.swift b/Sources/OversizeUI/Controls/IconPicker/IconPicker.swift index ba5562d..5a68296 100644 --- a/Sources/OversizeUI/Controls/IconPicker/IconPicker.swift +++ b/Sources/OversizeUI/Controls/IconPicker/IconPicker.swift @@ -30,10 +30,11 @@ public struct IconPicker: View { } } - public init(_ label: String, - _ icons: [Image], - selection: Binding) - { + public init( + _ label: String, + _ icons: [Image], + selection: Binding + ) { self.label = label self.icons = icons _selection = selection diff --git a/Sources/OversizeUI/Controls/Loader/LoaderOverlayView.swift b/Sources/OversizeUI/Controls/Loader/LoaderOverlayView.swift index 155bc71..fd4f842 100644 --- a/Sources/OversizeUI/Controls/Loader/LoaderOverlayView.swift +++ b/Sources/OversizeUI/Controls/Loader/LoaderOverlayView.swift @@ -32,13 +32,14 @@ public struct LoaderOverlayView: View { _isLoading = isLoading } - public init(type: LoaderOverlayType = .spiner, - showText: Bool = false, - text: String = "", - surface: Bool = false, - isShowBackground: Bool = true, - isLoading: Binding = .constant(true)) - { + public init( + type: LoaderOverlayType = .spiner, + showText: Bool = false, + text: String = "", + surface: Bool = false, + isShowBackground: Bool = true, + isLoading: Binding = .constant(true) + ) { loaderType = type self.showText = showText self.text = text diff --git a/Sources/OversizeUI/Controls/Notice/NoticeView.swift b/Sources/OversizeUI/Controls/Notice/NoticeView.swift index 71ecae7..734c3d9 100644 --- a/Sources/OversizeUI/Controls/Notice/NoticeView.swift +++ b/Sources/OversizeUI/Controls/Notice/NoticeView.swift @@ -13,13 +13,14 @@ public struct NoticeView: View where A: View { let actions: Group? let closeAction: (() -> Void)? - public init(_ title: String, - subtitle: String? = nil, - image: Image? = nil, - imageURL: URL? = nil, - @ViewBuilder actions: @escaping () -> A, - closeAction: (() -> Void)? = nil) - { + public init( + _ title: String, + subtitle: String? = nil, + image: Image? = nil, + imageURL: URL? = nil, + @ViewBuilder actions: @escaping () -> A, + closeAction: (() -> Void)? = nil + ) { self.title = title self.subtitle = subtitle self.image = image @@ -96,12 +97,13 @@ public struct NoticeView: View where A: View { } public extension NoticeView where A == EmptyView { - init(_ title: String, - subtitle: String? = nil, - image: Image? = nil, - imageURL: URL? = nil, - closeAction: (() -> Void)? = nil) - { + init( + _ title: String, + subtitle: String? = nil, + image: Image? = nil, + imageURL: URL? = nil, + closeAction: (() -> Void)? = nil + ) { self.title = title self.subtitle = subtitle self.image = image diff --git a/Sources/OversizeUI/Controls/PageView/Page.swift b/Sources/OversizeUI/Controls/PageView/Page.swift index cbdd36f..b855992 100644 --- a/Sources/OversizeUI/Controls/PageView/Page.swift +++ b/Sources/OversizeUI/Controls/PageView/Page.swift @@ -353,10 +353,12 @@ public struct Page Content) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -439,12 +442,13 @@ public extension Page where LeadingBar == EmptyView, TitleLabel == EmptyView, He @available(iOS 16.0, *) public extension Page where TrailingBar == EmptyView, TitleLabel == EmptyView, Header == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -461,12 +465,13 @@ public extension Page where TrailingBar == EmptyView, TitleLabel == EmptyView, H @available(iOS 16.0, *) public extension Page where TrailingBar == EmptyView, LeadingBar == EmptyView, TitleLabel == EmptyView, Header == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -484,12 +489,13 @@ public extension Page where TrailingBar == EmptyView, LeadingBar == EmptyView, T @available(iOS 16.0, *) public extension Page where TrailingBar == EmptyView, LeadingBar == EmptyView, TopToolbar == EmptyView, TitleLabel == EmptyView, Header == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -508,12 +514,13 @@ public extension Page where TrailingBar == EmptyView, LeadingBar == EmptyView, T @available(iOS 16.0, *) public extension Page where LeadingBar == EmptyView, TopToolbar == EmptyView, TitleLabel == EmptyView, Header == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -531,12 +538,13 @@ public extension Page where LeadingBar == EmptyView, TopToolbar == EmptyView, Ti @available(iOS 16.0, *) public extension Page where TrailingBar == EmptyView, TopToolbar == EmptyView, TitleLabel == EmptyView, Header == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -554,12 +562,13 @@ public extension Page where TrailingBar == EmptyView, TopToolbar == EmptyView, T @available(iOS 16.0, *) public extension Page where TopToolbar == EmptyView, TitleLabel == EmptyView, Header == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -576,12 +585,13 @@ public extension Page where TopToolbar == EmptyView, TitleLabel == EmptyView, He @available(iOS 16.0, *) public extension Page where TrailingBar == EmptyView, LeadingBar == EmptyView, TopToolbar == EmptyView, Header == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -599,12 +609,13 @@ public extension Page where TrailingBar == EmptyView, LeadingBar == EmptyView, T @available(iOS 16.0, *) public extension Page where TrailingBar == EmptyView, TopToolbar == EmptyView, Header == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -621,12 +632,13 @@ public extension Page where TrailingBar == EmptyView, TopToolbar == EmptyView, H @available(iOS 16.0, *) public extension Page where LeadingBar == EmptyView, TopToolbar == EmptyView, Header == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -643,12 +655,13 @@ public extension Page where LeadingBar == EmptyView, TopToolbar == EmptyView, He @available(iOS 16.0, *) public extension Page where TrailingBar == EmptyView, Header == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -664,12 +677,13 @@ public extension Page where TrailingBar == EmptyView, Header == EmptyView { @available(iOS 16.0, *) public extension Page where LeadingBar == EmptyView, Header == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -685,12 +699,13 @@ public extension Page where LeadingBar == EmptyView, Header == EmptyView { @available(iOS 16.0, *) public extension Page where TopToolbar == EmptyView, Header == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -706,12 +721,13 @@ public extension Page where TopToolbar == EmptyView, Header == EmptyView { @available(iOS 16.0, *) public extension Page where TitleLabel == EmptyView, Header == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -727,13 +743,14 @@ public extension Page where TitleLabel == EmptyView, Header == EmptyView { @available(iOS 16.0, *) public extension Page where LeadingBar == EmptyView, TitleLabel == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content, - @ViewBuilder header: () -> Header) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content, + @ViewBuilder header: () -> Header + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -750,13 +767,14 @@ public extension Page where LeadingBar == EmptyView, TitleLabel == EmptyView { @available(iOS 16.0, *) public extension Page where TrailingBar == EmptyView, TitleLabel == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content, - @ViewBuilder header: () -> Header) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content, + @ViewBuilder header: () -> Header + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -773,13 +791,14 @@ public extension Page where TrailingBar == EmptyView, TitleLabel == EmptyView { @available(iOS 16.0, *) public extension Page where TrailingBar == EmptyView, LeadingBar == EmptyView, TitleLabel == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content, - @ViewBuilder header: () -> Header) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content, + @ViewBuilder header: () -> Header + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -797,13 +816,14 @@ public extension Page where TrailingBar == EmptyView, LeadingBar == EmptyView, T @available(iOS 16.0, *) public extension Page where TrailingBar == EmptyView, LeadingBar == EmptyView, TopToolbar == EmptyView, TitleLabel == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content, - @ViewBuilder header: () -> Header) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content, + @ViewBuilder header: () -> Header + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -822,13 +842,14 @@ public extension Page where TrailingBar == EmptyView, LeadingBar == EmptyView, T @available(iOS 16.0, *) public extension Page where LeadingBar == EmptyView, TopToolbar == EmptyView, TitleLabel == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content, - @ViewBuilder header: () -> Header) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content, + @ViewBuilder header: () -> Header + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -846,13 +867,14 @@ public extension Page where LeadingBar == EmptyView, TopToolbar == EmptyView, Ti @available(iOS 16.0, *) public extension Page where TrailingBar == EmptyView, TopToolbar == EmptyView, TitleLabel == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content, - @ViewBuilder header: () -> Header) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content, + @ViewBuilder header: () -> Header + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -870,13 +892,14 @@ public extension Page where TrailingBar == EmptyView, TopToolbar == EmptyView, T @available(iOS 16.0, *) public extension Page where TopToolbar == EmptyView, TitleLabel == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content, - @ViewBuilder header: () -> Header) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content, + @ViewBuilder header: () -> Header + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -893,13 +916,14 @@ public extension Page where TopToolbar == EmptyView, TitleLabel == EmptyView { @available(iOS 16.0, *) public extension Page where TrailingBar == EmptyView, LeadingBar == EmptyView, TopToolbar == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content, - @ViewBuilder header: () -> Header) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content, + @ViewBuilder header: () -> Header + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -917,13 +941,14 @@ public extension Page where TrailingBar == EmptyView, LeadingBar == EmptyView, T @available(iOS 16.0, *) public extension Page where TrailingBar == EmptyView, TopToolbar == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content, - @ViewBuilder header: () -> Header) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content, + @ViewBuilder header: () -> Header + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -940,13 +965,14 @@ public extension Page where TrailingBar == EmptyView, TopToolbar == EmptyView { @available(iOS 16.0, *) public extension Page where LeadingBar == EmptyView, TopToolbar == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content, - @ViewBuilder header: () -> Header) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content, + @ViewBuilder header: () -> Header + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -963,13 +989,14 @@ public extension Page where LeadingBar == EmptyView, TopToolbar == EmptyView { @available(iOS 16.0, *) public extension Page where TrailingBar == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content, - @ViewBuilder header: () -> Header) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content, + @ViewBuilder header: () -> Header + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -985,13 +1012,14 @@ public extension Page where TrailingBar == EmptyView { @available(iOS 16.0, *) public extension Page where LeadingBar == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content, - @ViewBuilder header: () -> Header) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content, + @ViewBuilder header: () -> Header + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -1007,13 +1035,14 @@ public extension Page where LeadingBar == EmptyView { @available(iOS 16.0, *) public extension Page where TopToolbar == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content, - @ViewBuilder header: () -> Header) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content, + @ViewBuilder header: () -> Header + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight @@ -1029,13 +1058,14 @@ public extension Page where TopToolbar == EmptyView { @available(iOS 16.0, *) public extension Page where TitleLabel == EmptyView { - init(_ title: String? = nil, - headerHeight: CGFloat = 0, - headerMinHeight: CGFloat? = nil, - onScroll: ScrollAction? = nil, - @ViewBuilder content: () -> Content, - @ViewBuilder header: () -> Header) - { + init( + _ title: String? = nil, + headerHeight: CGFloat = 0, + headerMinHeight: CGFloat? = nil, + onScroll: ScrollAction? = nil, + @ViewBuilder content: () -> Content, + @ViewBuilder header: () -> Header + ) { self.title = title self.onScroll = onScroll custumHeaderHeight = headerHeight diff --git a/Sources/OversizeUI/Controls/Premium/PremiumLabel.swift b/Sources/OversizeUI/Controls/Premium/PremiumLabel.swift index 1cde093..f457752 100644 --- a/Sources/OversizeUI/Controls/Premium/PremiumLabel.swift +++ b/Sources/OversizeUI/Controls/Premium/PremiumLabel.swift @@ -50,13 +50,16 @@ public struct PremiumLabel: View { .fill(Color.onPrimary) } else { RoundedRectangle(cornerRadius: radius, style: .continuous) - .fill(LinearGradient(gradient: Gradient(colors: [ + .fill(LinearGradient( + gradient: Gradient(colors: [ Color(red: 0.918, green: 0.671, blue: 0.267), Color(red: 0.824, green: 0.29, blue: 0.267), Color(red: 0.612, green: 0.357, blue: 0.635), Color(red: 0.294, green: 0.357, blue: 0.58), ]), - startPoint: .topLeading, endPoint: .bottomTrailing)) + startPoint: .topLeading, + endPoint: .bottomTrailing + )) } } } diff --git a/Sources/OversizeUI/Controls/Radio/Radio.swift b/Sources/OversizeUI/Controls/Radio/Radio.swift index ccd7f4a..c3287f1 100644 --- a/Sources/OversizeUI/Controls/Radio/Radio.swift +++ b/Sources/OversizeUI/Controls/Radio/Radio.swift @@ -19,12 +19,13 @@ public struct Radio: View { private var title: String? private let action: (() -> Void)? - public init(isOn: Bool, - alignment: RadioAlignment = .trailing, - verticalAlignment: VerticalAlignment = .center, - action: (() -> Void)? = nil, - @ViewBuilder label: @escaping () -> Label? = { nil }) - { + public init( + isOn: Bool, + alignment: RadioAlignment = .trailing, + verticalAlignment: VerticalAlignment = .center, + action: (() -> Void)? = nil, + @ViewBuilder label: @escaping () -> Label? = { nil } + ) { self.isOn = isOn self.alignment = alignment self.verticalAlignment = verticalAlignment @@ -108,11 +109,12 @@ public struct Radio: View { } public extension Radio where Label == EmptyView { - init(_ title: String, - isOn: Bool, - alignment: RadioAlignment = .trailing, - action: (() -> Void)? = nil) - { + init( + _ title: String, + isOn: Bool, + alignment: RadioAlignment = .trailing, + action: (() -> Void)? = nil + ) { self.title = title self.isOn = isOn self.alignment = alignment diff --git a/Sources/OversizeUI/Controls/Radio/RadioPicker.swift b/Sources/OversizeUI/Controls/Radio/RadioPicker.swift index d05b5d2..e2a51c8 100644 --- a/Sources/OversizeUI/Controls/Radio/RadioPicker.swift +++ b/Sources/OversizeUI/Controls/Radio/RadioPicker.swift @@ -15,13 +15,14 @@ public struct RadioPicker: View where Content: View private let verticalAlignment: VerticalAlignment private let content: (Data.Element) -> Content - public init(_ data: Data, - selection: Binding, - defaultSelection: Bool = true, - alignment: RadioAlignment = .trailing, - verticalAlignment: VerticalAlignment = .center, - @ViewBuilder content: @escaping (Data.Element) -> Content) - { + public init( + _ data: Data, + selection: Binding, + defaultSelection: Bool = true, + alignment: RadioAlignment = .trailing, + verticalAlignment: VerticalAlignment = .center, + @ViewBuilder content: @escaping (Data.Element) -> Content + ) { self.data = data _selection = selection self.defaultSelection = defaultSelection diff --git a/Sources/OversizeUI/Controls/Row/Row.swift b/Sources/OversizeUI/Controls/Row/Row.swift index 5a175d4..aae07af 100644 --- a/Sources/OversizeUI/Controls/Row/Row.swift +++ b/Sources/OversizeUI/Controls/Row/Row.swift @@ -238,11 +238,12 @@ public extension View { // MARK: - Image init public extension Row where LeadingLabel == Image, TrailingLabel == EmptyView { - init(_ title: String, - subtitle: String? = nil, - action: (() -> Void)? = nil, - @ViewBuilder leading: () -> LeadingLabel) - { + init( + _ title: String, + subtitle: String? = nil, + action: (() -> Void)? = nil, + @ViewBuilder leading: () -> LeadingLabel + ) { self.title = title self.subtitle = subtitle self.action = action @@ -257,10 +258,11 @@ public extension Row where LeadingLabel == Image, TrailingLabel == EmptyView { } public extension Row where LeadingLabel == Image, TrailingLabel == EmptyView { - init(_ title: String, - subtitle: String? = nil, - @ViewBuilder leading: () -> LeadingLabel) - { + init( + _ title: String, + subtitle: String? = nil, + @ViewBuilder leading: () -> LeadingLabel + ) { self.title = title self.subtitle = subtitle action = nil @@ -275,11 +277,12 @@ public extension Row where LeadingLabel == Image, TrailingLabel == EmptyView { } public extension Row where LeadingLabel == Image { - init(_ title: String, - subtitle: String? = nil, - @ViewBuilder leading: () -> LeadingLabel, - @ViewBuilder trailing: () -> TrailingLabel) - { + init( + _ title: String, + subtitle: String? = nil, + @ViewBuilder leading: () -> LeadingLabel, + @ViewBuilder trailing: () -> TrailingLabel + ) { self.title = title self.subtitle = subtitle action = nil @@ -295,12 +298,13 @@ public extension Row where LeadingLabel == Image { } public extension Row where LeadingLabel == Image { - init(_ title: String, - subtitle: String? = nil, - action: (() -> Void)? = nil, - @ViewBuilder leading: () -> LeadingLabel, - @ViewBuilder trailing: () -> TrailingLabel) - { + init( + _ title: String, + subtitle: String? = nil, + action: (() -> Void)? = nil, + @ViewBuilder leading: () -> LeadingLabel, + @ViewBuilder trailing: () -> TrailingLabel + ) { self.title = title self.subtitle = subtitle self.action = action @@ -319,10 +323,11 @@ public extension Row where LeadingLabel == Image { // MARK: - EmptyView public extension Row where LeadingLabel == EmptyView, TrailingLabel == EmptyView { - init(_ title: String, - subtitle: String? = nil, - action: (() -> Void)? = nil) - { + init( + _ title: String, + subtitle: String? = nil, + action: (() -> Void)? = nil + ) { self.title = title self.subtitle = subtitle self.action = action @@ -334,11 +339,12 @@ public extension Row where LeadingLabel == EmptyView, TrailingLabel == EmptyView } public extension Row where TrailingLabel == EmptyView { - init(_ title: String, - subtitle: String? = nil, - action: (() -> Void)? = nil, - @ViewBuilder leading: () -> LeadingLabel) - { + init( + _ title: String, + subtitle: String? = nil, + action: (() -> Void)? = nil, + @ViewBuilder leading: () -> LeadingLabel + ) { self.title = title self.subtitle = subtitle self.action = action @@ -348,10 +354,11 @@ public extension Row where TrailingLabel == EmptyView { leadingRadius = nil } - init(_ title: String, - subtitle: String? = nil, - @ViewBuilder leading: () -> LeadingLabel) - { + init( + _ title: String, + subtitle: String? = nil, + @ViewBuilder leading: () -> LeadingLabel + ) { self.title = title self.subtitle = subtitle action = nil @@ -363,11 +370,12 @@ public extension Row where TrailingLabel == EmptyView { } public extension Row where LeadingLabel == EmptyView { - init(_ title: String, - subtitle: String? = nil, - action: (() -> Void)? = nil, - @ViewBuilder trailing: () -> TrailingLabel) - { + init( + _ title: String, + subtitle: String? = nil, + action: (() -> Void)? = nil, + @ViewBuilder trailing: () -> TrailingLabel + ) { self.title = title self.subtitle = subtitle self.action = action diff --git a/Sources/OversizeUI/Controls/Row/RowButton.swift b/Sources/OversizeUI/Controls/Row/RowButton.swift index df27aef..c60d94f 100644 --- a/Sources/OversizeUI/Controls/Row/RowButton.swift +++ b/Sources/OversizeUI/Controls/Row/RowButton.swift @@ -19,11 +19,12 @@ public struct RowButton: View { public var icon: IconsNames public var tapAction: () -> Void - public init(_ text: String, - style: RowButtonStyle = .row, - icon: IconsNames = .none, - action: @escaping () -> Void) - { + public init( + _ text: String, + style: RowButtonStyle = .row, + icon: IconsNames = .none, + action: @escaping () -> Void + ) { self.text = text self.style = style self.icon = icon diff --git a/Sources/OversizeUI/Controls/SegmentedControl/SegmentedControl.swift b/Sources/OversizeUI/Controls/SegmentedControl/SegmentedControl.swift index 1a8ac31..020d038 100644 --- a/Sources/OversizeUI/Controls/SegmentedControl/SegmentedControl.swift +++ b/Sources/OversizeUI/Controls/SegmentedControl/SegmentedControl.swift @@ -23,19 +23,22 @@ public struct SegmentedPickerSelector: V private let content: (Data.Element, Bool) -> Content private let action: (() -> Void)? - public init(_ data: Data, - selection: Binding, - @ViewBuilder content: @escaping (Data.Element, Bool) -> Content, - @ViewBuilder selectionView: @escaping () -> Selection? = { nil }, - action: (() -> Void)? = nil) - { + public init( + _ data: Data, + selection: Binding, + @ViewBuilder content: @escaping (Data.Element, Bool) -> Content, + @ViewBuilder selectionView: @escaping () -> Selection? = { nil }, + action: (() -> Void)? = nil + ) { self.data = data self.content = content self.selectionView = selectionView self.action = action _selection = selection - _frames = State(wrappedValue: Array(repeating: .zero, - count: data.count)) + _frames = State(wrappedValue: Array( + repeating: .zero, + count: data.count + )) } public var body: some View { @@ -103,27 +106,33 @@ public struct SegmentedPickerSelector: V }, label: { HStack(spacing: 0) { - content(data[index], - selectedIndex == index) - .body(.semibold) - .foregroundColor(style.seletionStyle == .accentSurface && selectedIndex == index ? Color.onPrimary : Color.onSurfacePrimary) - .multilineTextAlignment(.center) - .contentShape(Rectangle()) - .frame( - maxWidth: .infinity, - alignment: .center - ) + content( + data[index], + selectedIndex == index + ) + .body(.semibold) + .foregroundColor(style.seletionStyle == .accentSurface && selectedIndex == index ? Color.onPrimary : Color.onSurfacePrimary) + .multilineTextAlignment(.center) + .contentShape(Rectangle()) + .frame( + maxWidth: .infinity, + alignment: .center + ) } .padding(.leading, controlPadding.leading) .padding(.trailing, controlPadding.trailing) - .padding(.top, - controlPadding.top != Space.zero || controlPadding.top != Space.xxSmall - ? controlPadding.top.rawValue - Space.xxSmall.rawValue - : Space.zero.rawValue) - .padding(.bottom, - controlPadding.bottom != Space.zero || controlPadding.bottom != Space.xxSmall - ? controlPadding.bottom.rawValue - Space.xxSmall.rawValue - : Space.zero.rawValue) + .padding( + .top, + controlPadding.top != Space.zero || controlPadding.top != Space.xxSmall + ? controlPadding.top.rawValue - Space.xxSmall.rawValue + : Space.zero.rawValue + ) + .padding( + .bottom, + controlPadding.bottom != Space.zero || controlPadding.bottom != Space.xxSmall + ? controlPadding.bottom.rawValue - Space.xxSmall.rawValue + : Space.zero.rawValue + ) .background(selectedIndex != index ? getUnselection(unselectionStyle: style.unseletionStyle) : nil) @@ -148,16 +157,19 @@ public struct SegmentedPickerSelector: V } private var leadingSegmentedControl: some View { - ZStack(alignment: Alignment(horizontal: .horizontalCenterAlignment, - vertical: .center)) - { + ZStack(alignment: Alignment( + horizontal: .horizontalCenterAlignment, + vertical: .center + )) { if let selectedIndex { HStack { selectionView() .contentShape(Rectangle()) } - .frame(width: frames[selectedIndex].width, - height: frames[selectedIndex].height) + .frame( + width: frames[selectedIndex].width, + height: frames[selectedIndex].height + ) .alignmentGuide(.horizontalCenterAlignment) { dimensions in dimensions[HorizontalAlignment.center] } @@ -178,14 +190,18 @@ public struct SegmentedPickerSelector: V .multilineTextAlignment(.center) .padding(.leading, controlPadding.leading) .padding(.trailing, controlPadding.trailing) - .padding(.top, - controlPadding.top != Space.zero || controlPadding.top != Space.xxSmall - ? controlPadding.top.rawValue - Space.xxSmall.rawValue - : Space.zero.rawValue) - .padding(.bottom, - controlPadding.bottom != Space.zero || controlPadding.bottom != Space.xxSmall - ? controlPadding.bottom.rawValue - Space.xxSmall.rawValue - : Space.zero.rawValue) + .padding( + .top, + controlPadding.top != Space.zero || controlPadding.top != Space.xxSmall + ? controlPadding.top.rawValue - Space.xxSmall.rawValue + : Space.zero.rawValue + ) + .padding( + .bottom, + controlPadding.bottom != Space.zero || controlPadding.bottom != Space.xxSmall + ? controlPadding.bottom.rawValue - Space.xxSmall.rawValue + : Space.zero.rawValue + ) .background(selectedIndex != index ? getUnselection(unselectionStyle: style.unseletionStyle) : nil) @@ -213,40 +229,56 @@ public struct SegmentedPickerSelector: V switch selectionStyle { case .shadowSurface: - RoundedRectangle(cornerRadius: style.isShowBackground ? controlRadius.rawValue - 4 : controlRadius.rawValue, - style: .continuous) - .fill(Color.surfacePrimary) - .overlay( - RoundedRectangle(cornerRadius: style.isShowBackground + RoundedRectangle( + cornerRadius: style.isShowBackground ? controlRadius.rawValue - 4 : controlRadius.rawValue, + style: .continuous + ) + .fill(Color.surfacePrimary) + .overlay( + RoundedRectangle( + cornerRadius: style.isShowBackground ? controlRadius.rawValue - 4 : controlRadius.rawValue, - style: .continuous) - .stroke(theme.borderControls - ? Color.border - : Color.surfaceSecondary, lineWidth: CGFloat(theme.borderSize)) + style: .continuous + ) + .stroke( + theme.borderControls + ? Color.border + : Color.surfaceSecondary, + lineWidth: CGFloat(theme.borderSize) ) - .shadowElevaton(platform == .macOS ? .z0 : .z2) + ) + .shadowElevaton(platform == .macOS ? .z0 : .z2) case .graySurface: if style.unseletionStyle == .clean { - RoundedRectangle(cornerRadius: controlRadius, - style: .continuous) - .fill(Color.surfaceSecondary) - .overlay( - RoundedRectangle(cornerRadius: controlRadius, - style: .continuous) - .stroke(theme.borderControls - ? Color.border - : Color.surfaceSecondary, lineWidth: CGFloat(theme.borderSize)) + RoundedRectangle( + cornerRadius: controlRadius, + style: .continuous + ) + .fill(Color.surfaceSecondary) + .overlay( + RoundedRectangle( + cornerRadius: controlRadius, + style: .continuous + ) + .stroke( + theme.borderControls + ? Color.border + : Color.surfaceSecondary, + lineWidth: CGFloat(theme.borderSize) ) + ) } else { - RoundedRectangle(cornerRadius: style.isShowBackground - ? controlRadius.rawValue - 4 - : controlRadius.rawValue, - style: .continuous) - .strokeBorder(Color.onSurfaceSecondary, lineWidth: 2) + RoundedRectangle( + cornerRadius: style.isShowBackground + ? controlRadius.rawValue - 4 + : controlRadius.rawValue, + style: .continuous + ) + .strokeBorder(Color.onSurfaceSecondary, lineWidth: 2) } case .accentSurface: @@ -286,18 +318,21 @@ public struct SegmentedPickerSelector: V } public extension SegmentedPickerSelector where Selection == EmptyView { - init(_ data: Data, - selection: Binding, - @ViewBuilder content: @escaping (Data.Element, Bool) -> Content, - action: (() -> Void)? = nil) - { + init( + _ data: Data, + selection: Binding, + @ViewBuilder content: @escaping (Data.Element, Bool) -> Content, + action: (() -> Void)? = nil + ) { self.data = data self.content = content self.action = action selectionView = { nil } _selection = selection - _frames = State(wrappedValue: Array(repeating: .zero, - count: data.count)) + _frames = State(wrappedValue: Array( + repeating: .zero, + count: data.count + )) } } diff --git a/Sources/OversizeUI/Controls/SegmentedControl/SegmentedControlStyle.swift b/Sources/OversizeUI/Controls/SegmentedControl/SegmentedControlStyle.swift index 7d634db..ec4e777 100644 --- a/Sources/OversizeUI/Controls/SegmentedControl/SegmentedControlStyle.swift +++ b/Sources/OversizeUI/Controls/SegmentedControl/SegmentedControlStyle.swift @@ -129,11 +129,12 @@ public extension View { // swiftlint:disable function_body_length superfluous_disable_command public struct RectangleSegmentedControlStyle: SegmentedControlStyle { - public init(isEquallySpacing: Bool = true, - isShowBackground: Bool = true, - seletionStyle: SegmentedControlSeletionStyle = .shadowSurface, - unseletionStyle: SegmentedControlUnseletionStyle = .clean) - { + public init( + isEquallySpacing: Bool = true, + isShowBackground: Bool = true, + seletionStyle: SegmentedControlSeletionStyle = .shadowSurface, + unseletionStyle: SegmentedControlUnseletionStyle = .clean + ) { self.isEquallySpacing = isEquallySpacing self.isShowBackground = isShowBackground self.seletionStyle = seletionStyle @@ -173,11 +174,12 @@ public struct ScrollSegmentedControlStyle: SegmentedControlStyle { public var seletionStyle: SegmentedControlSeletionStyle = .graySurface public var unseletionStyle: SegmentedControlUnseletionStyle = .clean - public init(isEquallySpacing: Bool = false, - isShowBackground: Bool = false, - seletionStyle: SegmentedControlSeletionStyle = .graySurface, - unseletionStyle: SegmentedControlUnseletionStyle = .clean) - { + public init( + isEquallySpacing: Bool = false, + isShowBackground: Bool = false, + seletionStyle: SegmentedControlSeletionStyle = .graySurface, + unseletionStyle: SegmentedControlUnseletionStyle = .clean + ) { self.isEquallySpacing = isEquallySpacing self.isShowBackground = isShowBackground self.seletionStyle = seletionStyle @@ -197,11 +199,12 @@ public struct IslandSegmentedControlStyle: SegmentedControlStyle { public var seletionStyle: SegmentedControlSeletionStyle = .shadowSurface public var unseletionStyle: SegmentedControlUnseletionStyle = .surface - public init(isEquallySpacing: Bool = false, - isShowBackground: Bool = false, - seletionStyle: SegmentedControlSeletionStyle = .shadowSurface, - unseletionStyle: SegmentedControlUnseletionStyle = .surface) - { + public init( + isEquallySpacing: Bool = false, + isShowBackground: Bool = false, + seletionStyle: SegmentedControlSeletionStyle = .shadowSurface, + unseletionStyle: SegmentedControlUnseletionStyle = .surface + ) { self.isEquallySpacing = isEquallySpacing self.isShowBackground = isShowBackground self.seletionStyle = seletionStyle @@ -250,12 +253,13 @@ public struct AnySegmentedControlStyle: SegmentedControlStyle, Sendable { private var _makeBody: @Sendable (Configuration) -> AnyView - public init(isEquallySpacing: Bool, - isShowBackground: Bool, - seletionStyle: SegmentedControlSeletionStyle, - unseletionStyle: SegmentedControlUnseletionStyle, - style: some SegmentedControlStyle) - { + public init( + isEquallySpacing: Bool, + isShowBackground: Bool, + seletionStyle: SegmentedControlSeletionStyle, + unseletionStyle: SegmentedControlUnseletionStyle, + style: some SegmentedControlStyle + ) { self.isEquallySpacing = isEquallySpacing self.isShowBackground = isShowBackground self.seletionStyle = seletionStyle diff --git a/Sources/OversizeUI/Controls/SegmentedControl/Support/SegmentedControl+Extensions.swift b/Sources/OversizeUI/Controls/SegmentedControl/Support/SegmentedControl+Extensions.swift index 5210817..68ed40b 100644 --- a/Sources/OversizeUI/Controls/SegmentedControl/Support/SegmentedControl+Extensions.swift +++ b/Sources/OversizeUI/Controls/SegmentedControl/Support/SegmentedControl+Extensions.swift @@ -19,10 +19,11 @@ extension HorizontalAlignment { extension View { @ViewBuilder - @inlinable func alignmentGuide(_ alignment: HorizontalAlignment, - isActive: Bool, - computeValue: @Sendable @escaping (ViewDimensions) -> CGFloat) -> some View - { + @inlinable func alignmentGuide( + _ alignment: HorizontalAlignment, + isActive: Bool, + computeValue: @Sendable @escaping (ViewDimensions) -> CGFloat + ) -> some View { if isActive { alignmentGuide(alignment, computeValue: computeValue) } else { @@ -31,10 +32,11 @@ extension View { } @ViewBuilder - @inlinable func alignmentGuide(_ alignment: VerticalAlignment, - isActive: Bool, - computeValue: @Sendable @escaping (ViewDimensions) -> CGFloat) -> some View - { + @inlinable func alignmentGuide( + _ alignment: VerticalAlignment, + isActive: Bool, + computeValue: @Sendable @escaping (ViewDimensions) -> CGFloat + ) -> some View { if isActive { alignmentGuide(alignment, computeValue: computeValue) } else { diff --git a/Sources/OversizeUI/Controls/Select/MultiSelect.swift b/Sources/OversizeUI/Controls/Select/MultiSelect.swift index a63fd76..5201834 100644 --- a/Sources/OversizeUI/Controls/Select/MultiSelect.swift +++ b/Sources/OversizeUI/Controls/Select/MultiSelect.swift @@ -68,16 +68,23 @@ public struct MultiSelect: View { private var border: Color? private var material: Material = .regular - public init(action: (() -> Void)? = nil, - @ViewBuilder label: () -> Label) - { + public init( + action: (() -> Void)? = nil, + @ViewBuilder label: () -> Label + ) { self.label = label() self.action = action } @@ -50,8 +51,10 @@ public struct MaterialSurface: View { .padding( EdgeSpaceInsets(top: controlPadding.top, leading: controlPadding.leading, bottom: controlPadding.bottom, trailing: controlPadding.trailing) ) - .background(material, - in: RoundedRectangle(cornerRadius: controlRadius, style: .continuous)) + .background( + material, + in: RoundedRectangle(cornerRadius: controlRadius, style: .continuous) + ) .overlay(overlayView) .shadowElevaton(elevation) } diff --git a/Sources/OversizeUI/Controls/Surface/Surface.swift b/Sources/OversizeUI/Controls/Surface/Surface.swift index 3b4982e..8a1efb1 100644 --- a/Sources/OversizeUI/Controls/Surface/Surface.swift +++ b/Sources/OversizeUI/Controls/Surface/Surface.swift @@ -236,11 +236,12 @@ public extension View { } @available(*, deprecated, message: "Use without elevation") - func surface(elevation: Elevation = .z0, - background: SurfaceStyle = .primary, - padding: Space = .medium, - radius: Radius = .medium) -> some View - { + func surface( + elevation: Elevation = .z0, + background: SurfaceStyle = .primary, + padding: Space = .medium, + radius: Radius = .medium + ) -> some View { Surface { self } .surfaceStyle(background) .controlPadding(padding) @@ -250,9 +251,10 @@ public extension View { } public extension Surface where Label == VStack, Row)>> { - init(action: (() -> Void)? = nil, - @ViewBuilder label: () -> Label) - { + init( + action: (() -> Void)? = nil, + @ViewBuilder label: () -> Label + ) { self.label = label() self.action = action forceContentInsets = .init(horizontal: .zero, vertical: .small) @@ -260,9 +262,10 @@ public extension Surface where Label == VStack, } public extension Surface where Label == Row { - init(action: (() -> Void)? = nil, - @ViewBuilder label: () -> Label) - { + init( + action: (() -> Void)? = nil, + @ViewBuilder label: () -> Label + ) { self.label = label() self.action = action forceContentInsets = .init(horizontal: .zero, vertical: .small) @@ -270,9 +273,10 @@ public extension Surface where Label == Row { } public extension Surface where Label == Row { - init(action: (() -> Void)? = nil, - @ViewBuilder label: () -> Label) - { + init( + action: (() -> Void)? = nil, + @ViewBuilder label: () -> Label + ) { self.label = label() self.action = action forceContentInsets = .init(horizontal: .zero, vertical: .small) diff --git a/Sources/OversizeUI/Controls/TextField/TextFieldExtended.swift b/Sources/OversizeUI/Controls/TextField/TextFieldExtended.swift index e28dc21..2602b77 100644 --- a/Sources/OversizeUI/Controls/TextField/TextFieldExtended.swift +++ b/Sources/OversizeUI/Controls/TextField/TextFieldExtended.swift @@ -28,15 +28,16 @@ public struct TextFieldExtended: View { public var secure: Bool @State private var focused: Bool = false - public init(_ placeholder: String, - text: Binding, - helperText: Binding = .constant(""), - helperStyle: Binding = .constant(.none), - leadingImage: IconsNames = .none, - trallingImage: IconsNames = .none, - placeholderPosition: TextFieldPlaceholderPosition = .overField, - secure: Bool = false) - { + public init( + _ placeholder: String, + text: Binding, + helperText: Binding = .constant(""), + helperStyle: Binding = .constant(.none), + leadingImage: IconsNames = .none, + trallingImage: IconsNames = .none, + placeholderPosition: TextFieldPlaceholderPosition = .overField, + secure: Bool = false + ) { self.placeholder = placeholder _text = text _helperText = helperText @@ -76,12 +77,15 @@ public struct TextFieldExtended: View { if secure { SecureField(placeholderPosition == .standart ? placeholder : "", text: $text) } else { - TextField(placeholderPosition == .standart ? placeholder : "", text: $text, - onEditingChanged: { focused in - self.focused = focused - }) - .headline() - .foregroundColor(.onSurfacePrimary) + TextField( + placeholderPosition == .standart ? placeholder : "", + text: $text, + onEditingChanged: { focused in + self.focused = focused + } + ) + .headline() + .foregroundColor(.onSurfacePrimary) } if trallingImage != .none { diff --git a/Sources/OversizeUI/Core/EnvironmentKeys/ScreenSizeEnvironment.swift b/Sources/OversizeUI/Core/EnvironmentKeys/ScreenSizeEnvironment.swift index cc86468..f093d8f 100644 --- a/Sources/OversizeUI/Core/EnvironmentKeys/ScreenSizeEnvironment.swift +++ b/Sources/OversizeUI/Core/EnvironmentKeys/ScreenSizeEnvironment.swift @@ -30,13 +30,14 @@ public struct ScreenSize: Sendable { safeAreaTrailing = 0 } - public init(width: CGFloat, - height: CGFloat, - safeAreaTop: CGFloat, - safeAreaBottom: CGFloat, - safeAreaLeading: CGFloat, - safeAreaTrailing: CGFloat) - { + public init( + width: CGFloat, + height: CGFloat, + safeAreaTop: CGFloat, + safeAreaBottom: CGFloat, + safeAreaLeading: CGFloat, + safeAreaTrailing: CGFloat + ) { safeAreaWidth = width safeAreaHeight = height self.safeAreaTop = safeAreaTop @@ -46,12 +47,14 @@ public struct ScreenSize: Sendable { } public init(geometry: GeometryProxy) { - self.init(width: geometry.size.width, - height: geometry.size.height, - safeAreaTop: geometry.safeAreaInsets.top, - safeAreaBottom: geometry.safeAreaInsets.bottom, - safeAreaLeading: geometry.safeAreaInsets.leading, - safeAreaTrailing: geometry.safeAreaInsets.trailing) + self.init( + width: geometry.size.width, + height: geometry.size.height, + safeAreaTop: geometry.safeAreaInsets.top, + safeAreaBottom: geometry.safeAreaInsets.bottom, + safeAreaLeading: geometry.safeAreaInsets.leading, + safeAreaTrailing: geometry.safeAreaInsets.trailing + ) } } diff --git a/Sources/OversizeUI/Core/Shadow.swift b/Sources/OversizeUI/Core/Shadow.swift index aa7d7ce..2371542 100644 --- a/Sources/OversizeUI/Core/Shadow.swift +++ b/Sources/OversizeUI/Core/Shadow.swift @@ -19,34 +19,44 @@ public struct Shadow: ViewModifier { switch elevation { case .z0: content - .shadow(color: .clear, - radius: 0, - x: 0, - y: 0) + .shadow( + color: .clear, + radius: 0, + x: 0, + y: 0 + ) case .z1: content - .shadow(color: color.opacity(0.08), - radius: 8, - x: 0, - y: 2) + .shadow( + color: color.opacity(0.08), + radius: 8, + x: 0, + y: 2 + ) case .z2: content - .shadow(color: color.opacity(0.08), - radius: 16, - x: 0, - y: 4) + .shadow( + color: color.opacity(0.08), + radius: 16, + x: 0, + y: 4 + ) case .z3: content - .shadow(color: color.opacity(0.12), - radius: 24, - x: 0, - y: 8) + .shadow( + color: color.opacity(0.12), + radius: 24, + x: 0, + y: 8 + ) case .z4: content - .shadow(color: color.opacity(0.16), - radius: 34, - x: 0, - y: 12) + .shadow( + color: color.opacity(0.16), + radius: 34, + x: 0, + y: 12 + ) } } } diff --git a/Sources/OversizeUI/Deprecated/NavigationBar/ModalNavigationBar.swift b/Sources/OversizeUI/Deprecated/NavigationBar/ModalNavigationBar.swift index 7d69182..543026c 100644 --- a/Sources/OversizeUI/Deprecated/NavigationBar/ModalNavigationBar.swift +++ b/Sources/OversizeUI/Deprecated/NavigationBar/ModalNavigationBar.swift @@ -21,17 +21,18 @@ public struct ModalNavigationBar = .constant(CGPoint(x: 0, y: 0)), - background: Color = Color.backgroundPrimary, - alwaysSlideSmallTile: Bool = false, - @ViewBuilder leadingBar: @escaping () -> LeadingBar, - @ViewBuilder trailingBar: @escaping () -> TrailingBar, - @ViewBuilder bottomBar: @escaping () -> BottomBar, - @ViewBuilder titleLabel: @escaping () -> TitleLabel) - { + public init( + title: String, + largeTitle: Bool = true, + isDisableScrollShadow: Bool = false, + offset: Binding = .constant(CGPoint(x: 0, y: 0)), + background: Color = Color.backgroundPrimary, + alwaysSlideSmallTile: Bool = false, + @ViewBuilder leadingBar: @escaping () -> LeadingBar, + @ViewBuilder trailingBar: @escaping () -> TrailingBar, + @ViewBuilder bottomBar: @escaping () -> BottomBar, + @ViewBuilder titleLabel: @escaping () -> TitleLabel + ) { self.title = title self.largeTitle = largeTitle _offset = offset @@ -66,10 +67,12 @@ public struct ModalNavigationBar = .constant(CGPoint(x: 0, y: 0)), - alwaysSlideSmallTile: Bool = false) - { + init( + title: String, + largeTitle: Bool = true, + background: Color = Color.backgroundPrimary, + isDisableScrollShadow: Bool = false, + offset: Binding = .constant(CGPoint(x: 0, y: 0)), + alwaysSlideSmallTile: Bool = false + ) { self.title = title self.largeTitle = largeTitle self.background = background @@ -236,15 +240,16 @@ public extension ModalNavigationBar BottomBar == EmptyView, TitleLabel == EmptyView { - init(title: String, - largeTitle: Bool = true, - background: Color = Color.backgroundPrimary, - isDisableScrollShadow: Bool = false, - offset: Binding = .constant(CGPoint(x: 0, y: 0)), - alwaysSlideSmallTile: Bool = false, - @ViewBuilder leadingBar: @escaping () -> LeadingBar, - @ViewBuilder trailingBar: @escaping () -> TrailingBar) - { + init( + title: String, + largeTitle: Bool = true, + background: Color = Color.backgroundPrimary, + isDisableScrollShadow: Bool = false, + offset: Binding = .constant(CGPoint(x: 0, y: 0)), + alwaysSlideSmallTile: Bool = false, + @ViewBuilder leadingBar: @escaping () -> LeadingBar, + @ViewBuilder trailingBar: @escaping () -> TrailingBar + ) { self.title = title self.largeTitle = largeTitle self.background = background @@ -264,15 +269,16 @@ public extension ModalNavigationBar BottomBar == EmptyView, TitleLabel == EmptyView { - init(title: String, - largeTitle: Bool = true, - background: Color = Color.backgroundPrimary, - isDisableScrollShadow: Bool = false, - offset: Binding = .constant(CGPoint(x: 0, y: 0)), - modalityPresent _: Bool = true, - alwaysSlideSmallTile: Bool = false, - @ViewBuilder leadingBar: @escaping () -> LeadingBar) - { + init( + title: String, + largeTitle: Bool = true, + background: Color = Color.backgroundPrimary, + isDisableScrollShadow: Bool = false, + offset: Binding = .constant(CGPoint(x: 0, y: 0)), + modalityPresent _: Bool = true, + alwaysSlideSmallTile: Bool = false, + @ViewBuilder leadingBar: @escaping () -> LeadingBar + ) { self.title = title self.largeTitle = largeTitle self.background = background @@ -292,15 +298,16 @@ public extension ModalNavigationBar BottomBar == EmptyView, TitleLabel == EmptyView { - init(title: String, - largeTitle: Bool = true, - background: Color = Color.backgroundPrimary, - isDisableScrollShadow: Bool = false, - offset: Binding = .constant(CGPoint(x: 0, y: 0)), - modalityPresent _: Bool = true, - alwaysSlideSmallTile: Bool = false, - @ViewBuilder trailingBar: @escaping () -> TrailingBar) - { + init( + title: String, + largeTitle: Bool = true, + background: Color = Color.backgroundPrimary, + isDisableScrollShadow: Bool = false, + offset: Binding = .constant(CGPoint(x: 0, y: 0)), + modalityPresent _: Bool = true, + alwaysSlideSmallTile: Bool = false, + @ViewBuilder trailingBar: @escaping () -> TrailingBar + ) { self.title = title self.largeTitle = largeTitle self.background = background @@ -320,15 +327,16 @@ public extension ModalNavigationBar TrailingBar == EmptyView, TitleLabel == EmptyView { - init(title: String, - largeTitle: Bool = true, - background: Color = Color.backgroundPrimary, - isDisableScrollShadow: Bool = false, - offset: Binding = .constant(CGPoint(x: 0, y: 0)), - modalityPresent _: Bool = true, - alwaysSlideSmallTile: Bool = false, - @ViewBuilder bottomBar: @escaping () -> BottomBar) - { + init( + title: String, + largeTitle: Bool = true, + background: Color = Color.backgroundPrimary, + isDisableScrollShadow: Bool = false, + offset: Binding = .constant(CGPoint(x: 0, y: 0)), + modalityPresent _: Bool = true, + alwaysSlideSmallTile: Bool = false, + @ViewBuilder bottomBar: @escaping () -> BottomBar + ) { self.title = title self.largeTitle = largeTitle self.background = background @@ -347,15 +355,16 @@ public extension ModalNavigationBar LeadingBar == EmptyView, TitleLabel == EmptyView { - init(title: String, - largeTitle: Bool = true, - background: Color = Color.backgroundPrimary, - isDisableScrollShadow: Bool = false, - offset: Binding = .constant(CGPoint(x: 0, y: 0)), - alwaysSlideSmallTile: Bool = false, - @ViewBuilder trailingBar: @escaping () -> TrailingBar, - @ViewBuilder bottomBar: @escaping () -> BottomBar) - { + init( + title: String, + largeTitle: Bool = true, + background: Color = Color.backgroundPrimary, + isDisableScrollShadow: Bool = false, + offset: Binding = .constant(CGPoint(x: 0, y: 0)), + alwaysSlideSmallTile: Bool = false, + @ViewBuilder trailingBar: @escaping () -> TrailingBar, + @ViewBuilder bottomBar: @escaping () -> BottomBar + ) { self.title = title self.largeTitle = largeTitle self.background = background @@ -374,15 +383,16 @@ public extension ModalNavigationBar TrailingBar == EmptyView, TitleLabel == EmptyView { - init(title: String, - largeTitle: Bool = true, - background: Color = Color.backgroundPrimary, - isDisableScrollShadow: Bool = false, - offset: Binding = .constant(CGPoint(x: 0, y: 0)), - alwaysSlideSmallTile: Bool = false, - @ViewBuilder leadingBar: @escaping () -> LeadingBar, - @ViewBuilder bottomBar: @escaping () -> BottomBar) - { + init( + title: String, + largeTitle: Bool = true, + background: Color = Color.backgroundPrimary, + isDisableScrollShadow: Bool = false, + offset: Binding = .constant(CGPoint(x: 0, y: 0)), + alwaysSlideSmallTile: Bool = false, + @ViewBuilder leadingBar: @escaping () -> LeadingBar, + @ViewBuilder bottomBar: @escaping () -> BottomBar + ) { self.title = title self.largeTitle = largeTitle self.background = background @@ -402,14 +412,15 @@ public extension ModalNavigationBar TrailingBar == EmptyView, BottomBar == EmptyView { - init(title: String, - largeTitle: Bool = true, - background: Color = Color.backgroundPrimary, - isDisableScrollShadow: Bool = false, - offset: Binding = .constant(CGPoint(x: 0, y: 0)), - alwaysSlideSmallTile: Bool = false, - @ViewBuilder titleLabel: @escaping () -> TitleLabel) - { + init( + title: String, + largeTitle: Bool = true, + background: Color = Color.backgroundPrimary, + isDisableScrollShadow: Bool = false, + offset: Binding = .constant(CGPoint(x: 0, y: 0)), + alwaysSlideSmallTile: Bool = false, + @ViewBuilder titleLabel: @escaping () -> TitleLabel + ) { self.title = title self.largeTitle = largeTitle self.background = background @@ -427,16 +438,17 @@ public extension ModalNavigationBar where TrailingBar == EmptyView { - init(title: String, - largeTitle: Bool = true, - background: Color = Color.backgroundPrimary, - isDisableScrollShadow: Bool = false, - offset: Binding = .constant(CGPoint(x: 0, y: 0)), - alwaysSlideSmallTile: Bool = false, - @ViewBuilder titleLabel: @escaping () -> TitleLabel, - @ViewBuilder bottomBar: @escaping () -> BottomBar, - @ViewBuilder leadingBar: @escaping () -> LeadingBar) - { + init( + title: String, + largeTitle: Bool = true, + background: Color = Color.backgroundPrimary, + isDisableScrollShadow: Bool = false, + offset: Binding = .constant(CGPoint(x: 0, y: 0)), + alwaysSlideSmallTile: Bool = false, + @ViewBuilder titleLabel: @escaping () -> TitleLabel, + @ViewBuilder bottomBar: @escaping () -> BottomBar, + @ViewBuilder leadingBar: @escaping () -> LeadingBar + ) { self.title = title self.largeTitle = largeTitle self.background = background @@ -454,16 +466,17 @@ public extension ModalNavigationBar where LeadingBar == EmptyView { - init(title: String, - largeTitle: Bool = true, - background: Color = Color.backgroundPrimary, - isDisableScrollShadow: Bool = false, - offset: Binding = .constant(CGPoint(x: 0, y: 0)), - alwaysSlideSmallTile: Bool = false, - @ViewBuilder titleLabel: @escaping () -> TitleLabel, - @ViewBuilder bottomBar: @escaping () -> BottomBar, - @ViewBuilder trailingBar: @escaping () -> TrailingBar) - { + init( + title: String, + largeTitle: Bool = true, + background: Color = Color.backgroundPrimary, + isDisableScrollShadow: Bool = false, + offset: Binding = .constant(CGPoint(x: 0, y: 0)), + alwaysSlideSmallTile: Bool = false, + @ViewBuilder titleLabel: @escaping () -> TitleLabel, + @ViewBuilder bottomBar: @escaping () -> BottomBar, + @ViewBuilder trailingBar: @escaping () -> TrailingBar + ) { self.title = title self.largeTitle = largeTitle self.background = background @@ -482,15 +495,16 @@ public extension ModalNavigationBar TrailingBar == EmptyView, BottomBar == EmptyView { - init(title: String, - largeTitle: Bool = true, - background: Color = Color.backgroundPrimary, - isDisableScrollShadow: Bool = false, - offset: Binding = .constant(CGPoint(x: 0, y: 0)), - alwaysSlideSmallTile: Bool = false, - @ViewBuilder titleLabel: @escaping () -> TitleLabel, - @ViewBuilder leadingBar: @escaping () -> LeadingBar) - { + init( + title: String, + largeTitle: Bool = true, + background: Color = Color.backgroundPrimary, + isDisableScrollShadow: Bool = false, + offset: Binding = .constant(CGPoint(x: 0, y: 0)), + alwaysSlideSmallTile: Bool = false, + @ViewBuilder titleLabel: @escaping () -> TitleLabel, + @ViewBuilder leadingBar: @escaping () -> LeadingBar + ) { self.title = title self.largeTitle = largeTitle self.background = background @@ -509,15 +523,16 @@ public extension ModalNavigationBar LeadingBar == EmptyView, BottomBar == EmptyView { - init(title: String, - largeTitle: Bool = true, - background: Color = Color.backgroundPrimary, - isDisableScrollShadow: Bool = false, - offset: Binding = .constant(CGPoint(x: 0, y: 0)), - alwaysSlideSmallTile: Bool = false, - @ViewBuilder titleLabel: @escaping () -> TitleLabel, - @ViewBuilder trailingBar: @escaping () -> TrailingBar) - { + init( + title: String, + largeTitle: Bool = true, + background: Color = Color.backgroundPrimary, + isDisableScrollShadow: Bool = false, + offset: Binding = .constant(CGPoint(x: 0, y: 0)), + alwaysSlideSmallTile: Bool = false, + @ViewBuilder titleLabel: @escaping () -> TitleLabel, + @ViewBuilder trailingBar: @escaping () -> TrailingBar + ) { self.title = title self.largeTitle = largeTitle self.background = background diff --git a/Sources/OversizeUI/Deprecated/PageView.swift b/Sources/OversizeUI/Deprecated/PageView.swift index 1b9a899..9db492a 100644 --- a/Sources/OversizeUI/Deprecated/PageView.swift +++ b/Sources/OversizeUI/Deprecated/PageView.swift @@ -33,10 +33,11 @@ public struct PageView private let onOffsetChanged: (CGFloat) -> Void - public init(_ title: String? = nil, - onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, - @ViewBuilder content: () -> Content) - { + public init( + _ title: String? = nil, + onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, + @ViewBuilder content: () -> Content + ) { self.title = title self.onOffsetChanged = onOffsetChanged self.content = content() @@ -247,10 +248,12 @@ public struct PageView if style == .gradient { VStack { Spacer() - LinearGradient(colors: [backgroundColor.opacity(0), Color.surfacePrimary.opacity(1)], - startPoint: .top, - endPoint: .bottom) - .frame(height: 60) + LinearGradient( + colors: [backgroundColor.opacity(0), Color.surfacePrimary.opacity(1)], + startPoint: .top, + endPoint: .bottom + ) + .frame(height: 60) } } if style == .none { @@ -285,10 +288,11 @@ public extension PageView { @available(iOS 15.0, macOS 14, tvOS 15.0, watchOS 9.0, *) public extension PageView where LeadingBar == EmptyView, TitleLabel == EmptyView { - init(_ title: String? = nil, - onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, + @ViewBuilder content: () -> Content + ) { self.title = title self.onOffsetChanged = onOffsetChanged self.content = content() @@ -301,10 +305,11 @@ public extension PageView where LeadingBar == EmptyView, TitleLabel == EmptyView @available(iOS 15.0, macOS 14, tvOS 15.0, watchOS 9.0, *) public extension PageView where TrailingBar == EmptyView, TitleLabel == EmptyView { - init(_ title: String? = nil, - onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, + @ViewBuilder content: () -> Content + ) { self.title = title self.onOffsetChanged = onOffsetChanged self.content = content() @@ -317,10 +322,11 @@ public extension PageView where TrailingBar == EmptyView, TitleLabel == EmptyVie @available(iOS 15.0, macOS 14, tvOS 15.0, watchOS 9.0, *) public extension PageView where TrailingBar == EmptyView, LeadingBar == EmptyView, TitleLabel == EmptyView { - init(_ title: String? = nil, - onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, + @ViewBuilder content: () -> Content + ) { self.title = title self.onOffsetChanged = onOffsetChanged self.content = content() @@ -334,10 +340,11 @@ public extension PageView where TrailingBar == EmptyView, LeadingBar == EmptyVie @available(iOS 15.0, macOS 14, tvOS 15.0, watchOS 9.0, *) public extension PageView where TrailingBar == EmptyView, LeadingBar == EmptyView, TopToolbar == EmptyView, TitleLabel == EmptyView { - init(_ title: String? = nil, - onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, + @ViewBuilder content: () -> Content + ) { self.title = title self.onOffsetChanged = onOffsetChanged self.content = content() @@ -352,10 +359,11 @@ public extension PageView where TrailingBar == EmptyView, LeadingBar == EmptyVie @available(iOS 15.0, macOS 14, tvOS 15.0, watchOS 9.0, *) public extension PageView where LeadingBar == EmptyView, TopToolbar == EmptyView, TitleLabel == EmptyView { - init(_ title: String? = nil, - onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, + @ViewBuilder content: () -> Content + ) { self.title = title self.onOffsetChanged = onOffsetChanged self.content = content() @@ -369,10 +377,11 @@ public extension PageView where LeadingBar == EmptyView, TopToolbar == EmptyView @available(iOS 15.0, macOS 14, tvOS 15.0, watchOS 9.0, *) public extension PageView where TrailingBar == EmptyView, TopToolbar == EmptyView, TitleLabel == EmptyView { - init(_ title: String? = nil, - onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, + @ViewBuilder content: () -> Content + ) { self.title = title self.onOffsetChanged = onOffsetChanged self.content = content() @@ -386,10 +395,11 @@ public extension PageView where TrailingBar == EmptyView, TopToolbar == EmptyVie @available(iOS 15.0, macOS 14, tvOS 15.0, watchOS 9.0, *) public extension PageView where TopToolbar == EmptyView, TitleLabel == EmptyView { - init(_ title: String? = nil, - onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, + @ViewBuilder content: () -> Content + ) { self.title = title self.onOffsetChanged = onOffsetChanged self.content = content() @@ -402,10 +412,11 @@ public extension PageView where TopToolbar == EmptyView, TitleLabel == EmptyView @available(iOS 15.0, macOS 14, tvOS 15.0, watchOS 9.0, *) public extension PageView where TrailingBar == EmptyView, LeadingBar == EmptyView, TopToolbar == EmptyView { - init(_ title: String? = nil, - onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, + @ViewBuilder content: () -> Content + ) { self.title = title self.onOffsetChanged = onOffsetChanged self.content = content() @@ -419,10 +430,11 @@ public extension PageView where TrailingBar == EmptyView, LeadingBar == EmptyVie @available(iOS 15.0, macOS 14, tvOS 15.0, watchOS 9.0, *) public extension PageView where TrailingBar == EmptyView, TopToolbar == EmptyView { - init(_ title: String? = nil, - onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, + @ViewBuilder content: () -> Content + ) { self.title = title self.onOffsetChanged = onOffsetChanged self.content = content() @@ -435,10 +447,11 @@ public extension PageView where TrailingBar == EmptyView, TopToolbar == EmptyVie @available(iOS 15.0, macOS 14, tvOS 15.0, watchOS 9.0, *) public extension PageView where LeadingBar == EmptyView, TopToolbar == EmptyView { - init(_ title: String? = nil, - onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, + @ViewBuilder content: () -> Content + ) { self.title = title self.onOffsetChanged = onOffsetChanged self.content = content() @@ -451,10 +464,11 @@ public extension PageView where LeadingBar == EmptyView, TopToolbar == EmptyView @available(iOS 15.0, macOS 14, tvOS 15.0, watchOS 9.0, *) public extension PageView where TrailingBar == EmptyView { - init(_ title: String? = nil, - onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, + @ViewBuilder content: () -> Content + ) { self.title = title self.onOffsetChanged = onOffsetChanged self.content = content() @@ -466,10 +480,11 @@ public extension PageView where TrailingBar == EmptyView { @available(iOS 15.0, macOS 14, tvOS 15.0, watchOS 9.0, *) public extension PageView where LeadingBar == EmptyView { - init(_ title: String? = nil, - onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, + @ViewBuilder content: () -> Content + ) { self.title = title self.onOffsetChanged = onOffsetChanged self.content = content() @@ -481,10 +496,11 @@ public extension PageView where LeadingBar == EmptyView { @available(iOS 15.0, macOS 14, tvOS 15.0, watchOS 9.0, *) public extension PageView where TopToolbar == EmptyView { - init(_ title: String? = nil, - onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, + @ViewBuilder content: () -> Content + ) { self.title = title self.onOffsetChanged = onOffsetChanged self.content = content() @@ -496,10 +512,11 @@ public extension PageView where TopToolbar == EmptyView { @available(iOS 15.0, macOS 14, tvOS 15.0, watchOS 9.0, *) public extension PageView where TitleLabel == EmptyView { - init(_ title: String? = nil, - onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, - @ViewBuilder content: () -> Content) - { + init( + _ title: String? = nil, + onOffsetChanged: @escaping (CGFloat) -> Void = { _ in }, + @ViewBuilder content: () -> Content + ) { self.title = title self.onOffsetChanged = onOffsetChanged self.content = content() diff --git a/Sources/OversizeUI/Deprecated/ScrollViewOffset.swift b/Sources/OversizeUI/Deprecated/ScrollViewOffset.swift index 45d36d5..520b5a3 100644 --- a/Sources/OversizeUI/Deprecated/ScrollViewOffset.swift +++ b/Sources/OversizeUI/Deprecated/ScrollViewOffset.swift @@ -14,12 +14,13 @@ public struct ScrollViewOffset: View { @State private var startOffset: CGPoint = .zero private let coordinateSpace: CoordinateSpace - public init(offset: Binding, - showIndicators: Bool = false, - axis: Axis.Set = .vertical, - coordinateSpace: CoordinateSpace = .global, - @ViewBuilder content: () -> Content) - { + public init( + offset: Binding, + showIndicators: Bool = false, + axis: Axis.Set = .vertical, + coordinateSpace: CoordinateSpace = .global, + @ViewBuilder content: () -> Content + ) { contnt = content() _offset = offset self.showIndicators = showIndicators diff --git a/Sources/OversizeUI/Extensions/Padding/Padding.swift b/Sources/OversizeUI/Extensions/Padding/Padding.swift index 8efd8ad..292b421 100644 --- a/Sources/OversizeUI/Extensions/Padding/Padding.swift +++ b/Sources/OversizeUI/Extensions/Padding/Padding.swift @@ -26,10 +26,12 @@ public struct PaddingEdgeInsetsModifier: ViewModifier { public func body(content: Content) -> some View { content.padding( - EdgeInsets(top: insets.top.rawValue, - leading: insets.leading.rawValue, - bottom: insets.bottom.rawValue, - trailing: insets.trailing.rawValue) + EdgeInsets( + top: insets.top.rawValue, + leading: insets.leading.rawValue, + bottom: insets.bottom.rawValue, + trailing: insets.trailing.rawValue + ) ) } } @@ -40,9 +42,12 @@ public struct ContentPaddingModifier: ViewModifier { let edges: Edge.Set let length = Space.medium public func body(content: Content) -> some View { - content.padding(edges, horizontalSizeClass == .compact - ? length.rawValue - : length.rawValue + Space.large.rawValue) + content.padding( + edges, + horizontalSizeClass == .compact + ? length.rawValue + : length.rawValue + Space.large.rawValue + ) } #else let edges: Edge.Set diff --git a/Sources/OversizeUI/Extensions/View/View+Background.swift b/Sources/OversizeUI/Extensions/View/View+Background.swift index 3ef06c7..c5e9c75 100644 --- a/Sources/OversizeUI/Extensions/View/View+Background.swift +++ b/Sources/OversizeUI/Extensions/View/View+Background.swift @@ -7,10 +7,13 @@ import SwiftUI // swiftlint:disable opening_brace public extension View { - func embedInBackground(background: BackgroundColor = .primary, - padding: BackgroundPadding = .medium) -> some View - { - Background(background: background, - padding: padding) { self } + func embedInBackground( + background: BackgroundColor = .primary, + padding: BackgroundPadding = .medium + ) -> some View { + Background( + background: background, + padding: padding + ) { self } } } diff --git a/Sources/OversizeUI/Shapes/RoundedRectangleCorner.swift b/Sources/OversizeUI/Shapes/RoundedRectangleCorner.swift index 3ec5799..fd3b770 100644 --- a/Sources/OversizeUI/Shapes/RoundedRectangleCorner.swift +++ b/Sources/OversizeUI/Shapes/RoundedRectangleCorner.swift @@ -40,8 +40,11 @@ public struct RoundedRectangleCorner: Shape { public func path(in rect: CGRect) -> Path { #if canImport(UIKit) - let path = UIBezierPath(roundedRect: rect, byRoundingCorners: corners, - cornerRadii: CGSize(width: radius, height: radius)) + let path = UIBezierPath( + roundedRect: rect, + byRoundingCorners: corners, + cornerRadii: CGSize(width: radius, height: radius) + ) return Path(path.cgPath) #else let path = NSBezierPath() @@ -55,30 +58,38 @@ public struct RoundedRectangleCorner: Shape { path.line(to: CGPoint(x: rect.maxX - topRightRadius, y: rect.minY)) if topRightRadius > 0 { - path.curve(to: CGPoint(x: rect.maxX, y: rect.minY + topRightRadius), - controlPoint1: CGPoint(x: rect.maxX - topRightRadius / 2, y: rect.minY), - controlPoint2: CGPoint(x: rect.maxX, y: rect.minY + topRightRadius / 2)) + path.curve( + to: CGPoint(x: rect.maxX, y: rect.minY + topRightRadius), + controlPoint1: CGPoint(x: rect.maxX - topRightRadius / 2, y: rect.minY), + controlPoint2: CGPoint(x: rect.maxX, y: rect.minY + topRightRadius / 2) + ) } path.line(to: CGPoint(x: rect.maxX, y: rect.maxY - bottomRightRadius)) if bottomRightRadius > 0 { - path.curve(to: CGPoint(x: rect.maxX - bottomRightRadius, y: rect.maxY), - controlPoint1: CGPoint(x: rect.maxX, y: rect.maxY - bottomRightRadius / 2), - controlPoint2: CGPoint(x: rect.maxX - bottomRightRadius / 2, y: rect.maxY)) + path.curve( + to: CGPoint(x: rect.maxX - bottomRightRadius, y: rect.maxY), + controlPoint1: CGPoint(x: rect.maxX, y: rect.maxY - bottomRightRadius / 2), + controlPoint2: CGPoint(x: rect.maxX - bottomRightRadius / 2, y: rect.maxY) + ) } path.line(to: CGPoint(x: rect.minX + bottomLeftRadius, y: rect.maxY)) if bottomLeftRadius > 0 { - path.curve(to: CGPoint(x: rect.minX, y: rect.maxY - bottomLeftRadius), - controlPoint1: CGPoint(x: rect.minX + bottomLeftRadius / 2, y: rect.maxY), - controlPoint2: CGPoint(x: rect.minX, y: rect.maxY - bottomLeftRadius / 2)) + path.curve( + to: CGPoint(x: rect.minX, y: rect.maxY - bottomLeftRadius), + controlPoint1: CGPoint(x: rect.minX + bottomLeftRadius / 2, y: rect.maxY), + controlPoint2: CGPoint(x: rect.minX, y: rect.maxY - bottomLeftRadius / 2) + ) } path.line(to: CGPoint(x: rect.minX, y: rect.minY + topLeftRadius)) if topLeftRadius > 0 { - path.curve(to: CGPoint(x: rect.minX + topLeftRadius, y: rect.minY), - controlPoint1: CGPoint(x: rect.minX, y: rect.minY + topLeftRadius / 2), - controlPoint2: CGPoint(x: rect.minX + topLeftRadius / 2, y: rect.minY)) + path.curve( + to: CGPoint(x: rect.minX + topLeftRadius, y: rect.minY), + controlPoint1: CGPoint(x: rect.minX, y: rect.minY + topLeftRadius / 2), + controlPoint2: CGPoint(x: rect.minX + topLeftRadius / 2, y: rect.minY) + ) } path.close()