Skip to content

Commit

Permalink
Remove duplicate logic
Browse files Browse the repository at this point in the history
  • Loading branch information
abdullah-original committed Jul 15, 2024
1 parent fef8f4f commit 690bee0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Sources/ExtendedDatePicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public struct ExtendedDatePicker: View {
}

public var body: some View {
if options.shouldUseWheelStyleDatePicker(), #available(iOS 16.4, macCatalyst 16.4, macOS 13.3, *) {
if options.shouldUseWheelStyleDatePicker, #available(iOS 16.4, macCatalyst 16.4, macOS 13.3, *) {
header()
.popover(isPresented: $isPickerPresented) {
datePicker()
Expand Down
10 changes: 2 additions & 8 deletions Sources/ExtendedDatePickerOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public struct ExtendedDatePickerOptions {
let header: ((Date) -> AnyView)?
// Provide .infinity to push symbols to the edge
let spacing: CGFloat?
let shouldUseWheelStyleDatePicker: () -> Bool
let shouldUseWheelStyleDatePicker: Bool

public init(
backSymbol: Image = .init(systemName: "chevron.left"),
Expand All @@ -22,12 +22,6 @@ public struct ExtendedDatePickerOptions {
self.forwardSymbol = forwardSymbol
self.header = header
self.spacing = spacing
self.shouldUseWheelStyleDatePicker = {
if #available(iOS 16.4, macCatalyst 16.4, macOS 13.3, *), shouldUseWheelStyleDatePicker {
return true
}

return false
}
self.shouldUseWheelStyleDatePicker = shouldUseWheelStyleDatePicker
}
}

0 comments on commit 690bee0

Please sign in to comment.