From 0792148d41b74bbf4cc4cc732ca5b2fcb007f9a9 Mon Sep 17 00:00:00 2001 From: Alexandr Romanov Date: Sat, 29 Oct 2022 01:56:38 +0300 Subject: [PATCH] Fix and up minimal wathOS version --- Package.swift | 2 +- .../Controls/ColorSelector/ColorSelectorStyle.swift | 4 ++-- .../Controls/GridSelect/GridSelectStyle.swift | 6 +++--- .../Controls/NavigationBar/ModalNavigationBar.swift | 6 +++++- Sources/OversizeUI/Controls/Row/Row.swift | 13 +++++++------ .../SegmentedControl/SegmentedControlStyle.swift | 12 ++++++------ Sources/OversizeUI/Controls/Shapes/AnyShape.swift | 2 +- 7 files changed, 25 insertions(+), 20 deletions(-) diff --git a/Package.swift b/Package.swift index 15121f9..94a9ded 100644 --- a/Package.swift +++ b/Package.swift @@ -11,7 +11,7 @@ let package = Package( .iOS(.v15), .macOS(.v12), .tvOS(.v15), - .watchOS(.v8), + .watchOS(.v9), ], products: [ .library(name: "OversizeUI", targets: ["OversizeUI"]), diff --git a/Sources/OversizeUI/Controls/ColorSelector/ColorSelectorStyle.swift b/Sources/OversizeUI/Controls/ColorSelector/ColorSelectorStyle.swift index 53405c4..66dc7fa 100644 --- a/Sources/OversizeUI/Controls/ColorSelector/ColorSelectorStyle.swift +++ b/Sources/OversizeUI/Controls/ColorSelector/ColorSelectorStyle.swift @@ -14,7 +14,7 @@ public protocol ColorSelectorStyle { public struct ColorSelectorConfiguration { public struct Label: View { - public init(content: Content) { + public init(content: some View) { body = AnyView(content) } @@ -57,7 +57,7 @@ public struct DefaultColorSelectorStyle: ColorSelectorStyle { public struct AnyColorSelectorStyle: ColorSelectorStyle { private var _makeBody: (Configuration) -> AnyView - public init(style: S) { + public init(style: some ColorSelectorStyle) { _makeBody = { configuration in AnyView(style.makeBody(configuration: configuration)) } diff --git a/Sources/OversizeUI/Controls/GridSelect/GridSelectStyle.swift b/Sources/OversizeUI/Controls/GridSelect/GridSelectStyle.swift index 695d921..b398a21 100644 --- a/Sources/OversizeUI/Controls/GridSelect/GridSelectStyle.swift +++ b/Sources/OversizeUI/Controls/GridSelect/GridSelectStyle.swift @@ -88,7 +88,7 @@ public protocol GridSelectStyle { public struct GridSelectConfiguration { /// A type-erased content of a `Card`. public struct Label: View { - init(content: Content) { + init(content: some View) { body = AnyView(content) } @@ -105,11 +105,11 @@ public struct AnyGridSelectStyle: GridSelectStyle { private var _makeBody: (Configuration) -> AnyView - public init( + public init( seletionStyle: GridSelectSeletionStyle, unseletionStyle: GridSelectUnseletionStyle, icon: GridSelectSeletionIconStyle, - style: S + style: some GridSelectStyle ) { self.seletionStyle = seletionStyle self.unseletionStyle = unseletionStyle diff --git a/Sources/OversizeUI/Controls/NavigationBar/ModalNavigationBar.swift b/Sources/OversizeUI/Controls/NavigationBar/ModalNavigationBar.swift index e881e09..9c1a270 100644 --- a/Sources/OversizeUI/Controls/NavigationBar/ModalNavigationBar.swift +++ b/Sources/OversizeUI/Controls/NavigationBar/ModalNavigationBar.swift @@ -132,7 +132,11 @@ public struct ModalNavigationBar) case toggle(isOn: Binding) case toggleWithArrowButton(isOn: Binding, action: (() -> Void)? = nil) + @available(watchOS, unavailable) case timePicker(date: Binding) case arrowIcon case text(_ text: String) @@ -230,9 +231,12 @@ public struct Row: View { Icon(.chevronRight, color: .onSurfaceDisabled) case let .timePicker(date: date): - DatePicker("", selection: date, displayedComponents: .hourAndMinute) - .labelsHidden() - + #if os(watchOS) + EmptyView() + #elseif os(iOS) + DatePicker("", selection: date, displayedComponents: .hourAndMinute) + .labelsHidden() + #endif case let .text(text): Text(text) .subheadline() @@ -376,9 +380,6 @@ struct ListRow_Previews: PreviewProvider { Row("Title", subtitle: "Subtitle") .rowTrailing(.button("Button", action: {})) - Row("Title") - .rowTrailing(.timePicker(date: .constant(Date()))) - Row("Title", subtitle: "Red") .premium() } diff --git a/Sources/OversizeUI/Controls/SegmentedControl/SegmentedControlStyle.swift b/Sources/OversizeUI/Controls/SegmentedControl/SegmentedControlStyle.swift index f285f0f..a322663 100644 --- a/Sources/OversizeUI/Controls/SegmentedControl/SegmentedControlStyle.swift +++ b/Sources/OversizeUI/Controls/SegmentedControl/SegmentedControlStyle.swift @@ -201,7 +201,7 @@ public protocol SegmentedControlStyle { public struct SegmentedControlConfiguration { public struct Label: View { - public init(content: Content) { + public init(content: some View) { body = AnyView(content) } @@ -222,11 +222,11 @@ public struct AnySegmentedControlStyle: SegmentedControlStyle { private var _makeBody: (Configuration) -> AnyView - public init(isEquallySpacing: Bool, - isShowBackground: Bool, - seletionStyle: SegmentedControlSeletionStyle, - unseletionStyle: SegmentedControlUnseletionStyle, - style: S) + public init(isEquallySpacing: Bool, + isShowBackground: Bool, + seletionStyle: SegmentedControlSeletionStyle, + unseletionStyle: SegmentedControlUnseletionStyle, + style: some SegmentedControlStyle) { self.isEquallySpacing = isEquallySpacing self.isShowBackground = isShowBackground diff --git a/Sources/OversizeUI/Controls/Shapes/AnyShape.swift b/Sources/OversizeUI/Controls/Shapes/AnyShape.swift index e5199af..4b149e0 100644 --- a/Sources/OversizeUI/Controls/Shapes/AnyShape.swift +++ b/Sources/OversizeUI/Controls/Shapes/AnyShape.swift @@ -12,7 +12,7 @@ public struct AnyShape: Shape { self.make = make } - public init(_ shape: S) { + public init(_ shape: some Shape) { make = { rect, path in path = shape.path(in: rect) }