Skip to content

Commit

Permalink
Fix and up minimal wathOS version
Browse files Browse the repository at this point in the history
  • Loading branch information
aromanov91 committed Oct 28, 2022
1 parent ae8b8d2 commit 0792148
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let package = Package(
.iOS(.v15),
.macOS(.v12),
.tvOS(.v15),
.watchOS(.v8),
.watchOS(.v9),
],
products: [
.library(name: "OversizeUI", targets: ["OversizeUI"]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public protocol ColorSelectorStyle {

public struct ColorSelectorConfiguration {
public struct Label: View {
public init<Content: View>(content: Content) {
public init(content: some View) {
body = AnyView(content)
}

Expand Down Expand Up @@ -57,7 +57,7 @@ public struct DefaultColorSelectorStyle: ColorSelectorStyle {
public struct AnyColorSelectorStyle: ColorSelectorStyle {
private var _makeBody: (Configuration) -> AnyView

public init<S: ColorSelectorStyle>(style: S) {
public init(style: some ColorSelectorStyle) {
_makeBody = { configuration in
AnyView(style.makeBody(configuration: configuration))
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/OversizeUI/Controls/GridSelect/GridSelectStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public protocol GridSelectStyle {
public struct GridSelectConfiguration {
/// A type-erased content of a `Card`.
public struct Label: View {
init<Content: View>(content: Content) {
init(content: some View) {
body = AnyView(content)
}

Expand All @@ -105,11 +105,11 @@ public struct AnyGridSelectStyle: GridSelectStyle {

private var _makeBody: (Configuration) -> AnyView

public init<S: GridSelectStyle>(
public init(
seletionStyle: GridSelectSeletionStyle,
unseletionStyle: GridSelectUnseletionStyle,
icon: GridSelectSeletionIconStyle,
style: S
style: some GridSelectStyle
) {
self.seletionStyle = seletionStyle
self.unseletionStyle = unseletionStyle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ public struct ModalNavigationBar<LeadingBar: View, TrailingBar: View, BottomBar:
}

private var smallBackgroundOpacity: Double {
Double(offset.y * 0.1)
if offset.y < 1 {
return 0
} else {
return Double(offset.y * 0.1)
}
}

private var sadowOpacity: Double {
Expand Down
13 changes: 7 additions & 6 deletions Sources/OversizeUI/Controls/Row/Row.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public enum RowTrailingType {
case checkbox(isOn: Binding<Bool>)
case toggle(isOn: Binding<Bool>)
case toggleWithArrowButton(isOn: Binding<Bool>, action: (() -> Void)? = nil)
@available(watchOS, unavailable)
case timePicker(date: Binding<Date>)
case arrowIcon
case text(_ text: String)
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public protocol SegmentedControlStyle {

public struct SegmentedControlConfiguration {
public struct Label: View {
public init<Content: View>(content: Content) {
public init(content: some View) {
body = AnyView(content)
}

Expand All @@ -222,11 +222,11 @@ public struct AnySegmentedControlStyle: SegmentedControlStyle {

private var _makeBody: (Configuration) -> AnyView

public init<S: SegmentedControlStyle>(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
Expand Down
2 changes: 1 addition & 1 deletion Sources/OversizeUI/Controls/Shapes/AnyShape.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public struct AnyShape: Shape {
self.make = make
}

public init<S: Shape>(_ shape: S) {
public init(_ shape: some Shape) {
make = { rect, path in
path = shape.path(in: rect)
}
Expand Down

0 comments on commit 0792148

Please sign in to comment.