Skip to content

Commit d17245d

Browse files
Add option to push symbols to the edge
1 parent 70a2511 commit d17245d

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Sources/ExtendedDatePicker.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ private extension ExtendedDatePicker {
6767
.contentShape(Circle())
6868
}
6969

70+
if options.spaceOutSymbols {
71+
Spacer()
72+
}
73+
7074
Group {
7175
if let header = options.header {
7276
header(model.selectedDate)
@@ -79,6 +83,10 @@ private extension ExtendedDatePicker {
7983
isPickerPresented = true
8084
}
8185

86+
if options.spaceOutSymbols {
87+
Spacer()
88+
}
89+
8290
if shouldShowButtons {
8391
Button {
8492
model.didPressForward()

Sources/ExtendedDatePickerOptions.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,23 @@ import SwiftUI
55
public struct ExtendedDatePickerOptions {
66
let backSymbol: Image
77
let forwardSymbol: Image
8+
// Push forward and back symbols to the edge.
9+
let spaceOutSymbols: Bool
810
let header: ((Date) -> AnyView)?
911
let spacing: CGFloat?
1012
let shouldUseWheelStyleDatePicker: () -> Bool
1113

1214
public init(
1315
backSymbol: Image = .init(systemName: "chevron.left"),
1416
forwardSymbol: Image = .init(systemName: "chevron.right"),
17+
spaceOutSymbols: Bool = false,
1518
header: ((Date) -> AnyView)? = nil,
1619
spacing: CGFloat? = nil,
1720
shouldUseWheelStyleDatePicker: Bool = true
1821
) {
1922
self.backSymbol = backSymbol
2023
self.forwardSymbol = forwardSymbol
24+
self.spaceOutSymbols = spaceOutSymbols
2125
self.header = header
2226
self.spacing = spacing
2327
self.shouldUseWheelStyleDatePicker = {

0 commit comments

Comments
 (0)