Skip to content

Commit 7d300e2

Browse files
committed
UNT-T20317: PR comments fixes, optimization and date picker configuration changes
1 parent 4990b5c commit 7d300e2

23 files changed

Lines changed: 323 additions & 322 deletions

DateTimePicker/DateTimePicker.xcodeproj/project.pbxproj

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
6507209C2B0F4D4500AC1FB6 /* SSCalendarConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6507209B2B0F4D4500AC1FB6 /* SSCalendarConfiguration.swift */; };
11-
6507209E2B0F538400AC1FB6 /* SSCalendarConstant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6507209D2B0F538400AC1FB6 /* SSCalendarConstant.swift */; };
10+
6507209C2B0F4D4500AC1FB6 /* SSDatePickerConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6507209B2B0F4D4500AC1FB6 /* SSDatePickerConfiguration.swift */; };
11+
6507209E2B0F538400AC1FB6 /* SSPickerConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6507209D2B0F538400AC1FB6 /* SSPickerConstants.swift */; };
1212
650720A22B0F644000AC1FB6 /* WeekDatesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 650720A12B0F644000AC1FB6 /* WeekDatesView.swift */; };
1313
650720A62B0F6BE600AC1FB6 /* DateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 650720A52B0F6BE600AC1FB6 /* DateView.swift */; };
1414
650720AA2B0F819F00AC1FB6 /* ImageConstant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 650720A92B0F819F00AC1FB6 /* ImageConstant.swift */; };
@@ -22,9 +22,10 @@
2222
650720C02B10CBA100AC1FB6 /* Bundle+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 650720BF2B10CBA100AC1FB6 /* Bundle+Extension.swift */; };
2323
650720C22B10CBC500AC1FB6 /* Color+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 650720C12B10CBC500AC1FB6 /* Color+Extension.swift */; };
2424
650720C62B13BE4D00AC1FB6 /* SSDatePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 650720C52B13BE4D00AC1FB6 /* SSDatePicker.swift */; };
25-
650720C82B146E9500AC1FB6 /* SSCalendarManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 650720C72B146E9500AC1FB6 /* SSCalendarManager.swift */; };
25+
650720C82B146E9500AC1FB6 /* SSDatePickerManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 650720C72B146E9500AC1FB6 /* SSDatePickerManager.swift */; };
2626
650720CB2B181E5400AC1FB6 /* View+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 650720CA2B181E5400AC1FB6 /* View+Extension.swift */; };
2727
650720CD2B18257600AC1FB6 /* CornerRadiusStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 650720CC2B18257600AC1FB6 /* CornerRadiusStyle.swift */; };
28+
650720EF2B19FD7A00AC1FB6 /* ThemeButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 650720EE2B19FD7A00AC1FB6 /* ThemeButton.swift */; };
2829
65E058102B0E2B260049A7BA /* DateTimePicker.docc in Sources */ = {isa = PBXBuildFile; fileRef = 65E0580F2B0E2B260049A7BA /* DateTimePicker.docc */; };
2930
65E058162B0E2B260049A7BA /* DateTimePicker.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65E0580B2B0E2B260049A7BA /* DateTimePicker.framework */; };
3031
65E0581B2B0E2B260049A7BA /* DateTimePickerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E0581A2B0E2B260049A7BA /* DateTimePickerTests.swift */; };
@@ -42,8 +43,8 @@
4243
/* End PBXContainerItemProxy section */
4344

4445
/* Begin PBXFileReference section */
45-
6507209B2B0F4D4500AC1FB6 /* SSCalendarConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SSCalendarConfiguration.swift; sourceTree = "<group>"; };
46-
6507209D2B0F538400AC1FB6 /* SSCalendarConstant.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SSCalendarConstant.swift; sourceTree = "<group>"; };
46+
6507209B2B0F4D4500AC1FB6 /* SSDatePickerConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SSDatePickerConfiguration.swift; sourceTree = "<group>"; };
47+
6507209D2B0F538400AC1FB6 /* SSPickerConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SSPickerConstants.swift; sourceTree = "<group>"; };
4748
650720A12B0F644000AC1FB6 /* WeekDatesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeekDatesView.swift; sourceTree = "<group>"; };
4849
650720A52B0F6BE600AC1FB6 /* DateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateView.swift; sourceTree = "<group>"; };
4950
650720A92B0F819F00AC1FB6 /* ImageConstant.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageConstant.swift; sourceTree = "<group>"; };
@@ -57,9 +58,10 @@
5758
650720BF2B10CBA100AC1FB6 /* Bundle+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Bundle+Extension.swift"; sourceTree = "<group>"; };
5859
650720C12B10CBC500AC1FB6 /* Color+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Color+Extension.swift"; sourceTree = "<group>"; };
5960
650720C52B13BE4D00AC1FB6 /* SSDatePicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SSDatePicker.swift; sourceTree = "<group>"; };
60-
650720C72B146E9500AC1FB6 /* SSCalendarManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SSCalendarManager.swift; sourceTree = "<group>"; };
61+
650720C72B146E9500AC1FB6 /* SSDatePickerManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SSDatePickerManager.swift; sourceTree = "<group>"; };
6162
650720CA2B181E5400AC1FB6 /* View+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+Extension.swift"; sourceTree = "<group>"; };
6263
650720CC2B18257600AC1FB6 /* CornerRadiusStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CornerRadiusStyle.swift; sourceTree = "<group>"; };
64+
650720EE2B19FD7A00AC1FB6 /* ThemeButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemeButton.swift; sourceTree = "<group>"; };
6365
65E0580B2B0E2B260049A7BA /* DateTimePicker.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DateTimePicker.framework; sourceTree = BUILT_PRODUCTS_DIR; };
6466
65E0580E2B0E2B260049A7BA /* DateTimePicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DateTimePicker.h; sourceTree = "<group>"; };
6567
65E0580F2B0E2B260049A7BA /* DateTimePicker.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = DateTimePicker.docc; sourceTree = "<group>"; };
@@ -101,11 +103,12 @@
101103
650720A42B0F645600AC1FB6 /* Common */ = {
102104
isa = PBXGroup;
103105
children = (
104-
6507209D2B0F538400AC1FB6 /* SSCalendarConstant.swift */,
105-
6507209B2B0F4D4500AC1FB6 /* SSCalendarConfiguration.swift */,
106+
6507209D2B0F538400AC1FB6 /* SSPickerConstants.swift */,
107+
6507209B2B0F4D4500AC1FB6 /* SSDatePickerConfiguration.swift */,
106108
650720A92B0F819F00AC1FB6 /* ImageConstant.swift */,
107-
650720C72B146E9500AC1FB6 /* SSCalendarManager.swift */,
109+
650720C72B146E9500AC1FB6 /* SSDatePickerManager.swift */,
108110
650720CC2B18257600AC1FB6 /* CornerRadiusStyle.swift */,
111+
650720EE2B19FD7A00AC1FB6 /* ThemeButton.swift */,
109112
);
110113
path = Common;
111114
sourceTree = "<group>";
@@ -285,12 +288,13 @@
285288
650720AA2B0F819F00AC1FB6 /* ImageConstant.swift in Sources */,
286289
650720BE2B10CB7300AC1FB6 /* DateFormatter+Extension.swift in Sources */,
287290
650720B52B10881900AC1FB6 /* YearSelectionView.swift in Sources */,
288-
650720C82B146E9500AC1FB6 /* SSCalendarManager.swift in Sources */,
289-
6507209E2B0F538400AC1FB6 /* SSCalendarConstant.swift in Sources */,
291+
650720C82B146E9500AC1FB6 /* SSDatePickerManager.swift in Sources */,
292+
6507209E2B0F538400AC1FB6 /* SSPickerConstants.swift in Sources */,
290293
65E058102B0E2B260049A7BA /* DateTimePicker.docc in Sources */,
291294
650720BC2B10CB5000AC1FB6 /* Date+Extension.swift in Sources */,
295+
650720EF2B19FD7A00AC1FB6 /* ThemeButton.swift in Sources */,
292296
650720C22B10CBC500AC1FB6 /* Color+Extension.swift in Sources */,
293-
6507209C2B0F4D4500AC1FB6 /* SSCalendarConfiguration.swift in Sources */,
297+
6507209C2B0F4D4500AC1FB6 /* SSDatePickerConfiguration.swift in Sources */,
294298
);
295299
runOnlyForDeploymentPostprocessing = 0;
296300
};

DateTimePicker/DateTimePicker.xcodeproj/xcuserdata/rizwana.xcuserdatad/xcschemes/xcschememanagement.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<key>DateTimePicker.xcscheme_^#shared#^_</key>
88
<dict>
99
<key>orderHint</key>
10-
<integer>0</integer>
10+
<integer>1</integer>
1111
</dict>
1212
</dict>
1313
</dict>

DateTimePicker/DateTimePicker/Common/CornerRadiusStyle.swift

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,32 @@ import SwiftUI
1010

1111
struct CornerRadiusStyle: ViewModifier {
1212

13+
//MARK: - Property
14+
1315
var radius: CGFloat
1416
var corners: UIRectCorner
15-
16-
struct CornerRadiusShape: Shape {
17-
18-
var radius = CGFloat.infinity
19-
var corners = UIRectCorner.allCorners
20-
21-
func path(in rect: CGRect) -> Path {
22-
let path = UIBezierPath(roundedRect: rect, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
23-
return Path(path.cgPath)
24-
}
25-
}
2617

18+
//MARK: - Body
19+
2720
func body(content: Content) -> some View {
2821
content
2922
.clipShape(CornerRadiusShape(radius: radius, corners: corners))
3023
}
24+
25+
}
26+
27+
struct CornerRadiusShape: Shape {
28+
29+
//MARK: - Property
30+
31+
var radius = CGFloat.infinity
32+
var corners = UIRectCorner.allCorners
33+
34+
//MARK: - Methods
35+
36+
func path(in rect: CGRect) -> Path {
37+
let path = UIBezierPath(roundedRect: rect, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
38+
return Path(path.cgPath)
39+
}
40+
3141
}

DateTimePicker/DateTimePicker/Common/ImageConstant.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Foundation
99

1010
struct ImageConstant {
1111

12-
static let chevronRight = "chevron.right"
13-
static let chevronLeft = "chevron.left"
12+
static let chevronRight = "chevron.right"
13+
static let chevronLeft = "chevron.left"
1414

1515
}

DateTimePicker/DateTimePicker/Common/SSCalendarConstant.swift

Lines changed: 0 additions & 31 deletions
This file was deleted.

DateTimePicker/DateTimePicker/Common/SSCalendarConfiguration.swift renamed to DateTimePicker/DateTimePicker/Common/SSDatePickerConfiguration.swift

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,37 @@ import Foundation
99
import SwiftUI
1010

1111

12-
public struct SSCalendarConfiguration {
12+
public struct SSDatePickerConfiguration {
1313

1414
// Colors
15-
var headerTitleColor: Color = Color.gray
16-
var headerDateColor: Color = Color.black
17-
var weekdayTextColor: Color = Color.gray
18-
var dateMonthYearTextColor: Color = Color.black
19-
var selectionForegroundColor: Color = Color.white
20-
var selectionBackgroundColor: Color
21-
var todayColor: Color = Color.black
22-
var todaySelectionColor: Color = Color.clear
23-
var buttonsForegroundColor: Color
24-
var pickerBackgroundColor: Color
25-
var nextPrevButtonColor: Color = Color.black
26-
var monthYearNavigationLabelColor: Color = Color.black
27-
28-
// Date format
29-
var headerDateFormat: String = DateFormat.monthDateYear
30-
15+
public var headerTitleColor: Color = Color.gray
16+
public var headerDateColor: Color = Color.black
17+
public var weekdayTextColor: Color = Color.gray
18+
public var dateMonthYearTextColor: Color = Color.black
19+
public var selectionForegroundColor: Color = Color.white
20+
public var selectionBackgroundColor: Color
21+
public var todayColor: Color = Color.black
22+
public var todaySelectionColor: Color = Color.clear
23+
public var buttonsForegroundColor: Color
24+
public var pickerBackgroundColor: Color
25+
public var nextPrevButtonColor: Color = Color.black
26+
public var monthYearNavigationLabelColor: Color = Color.black
27+
public var popupOverlayColor: Color = Color.black.opacity(0.5)
28+
3129
// Corner radius
32-
var pickerViewRadius: CGFloat = 15
30+
public var pickerViewRadius: CGFloat = 15
3331

34-
//
32+
// Configuration options for date selection.
3533
public var allowMultipleSelection: Bool = false
3634
public var allowRangeSelection: Bool = false
37-
public var shouldHeighLightCurrentDate: Bool = false
38-
3935
public var minimumDate: Date?
4036
public var maximumDate: Date?
41-
42-
var calendar: Calendar = Calendar.current
37+
public var disableFutureDates: Bool = false
38+
public var disablePastDates: Bool = false
39+
public var calendar: Calendar = Calendar.current
40+
41+
// Date format
42+
public var headerDateFormat: String = DateFormat.monthDateYear
4343

4444
public init(pickerBackgroundColor: Color, selectionColor: Color) {
4545
self.selectionBackgroundColor = selectionColor
@@ -53,18 +53,16 @@ public struct SSCalendarConfiguration {
5353
self.pickerBackgroundColor = .lightPink
5454
}
5555

56-
5756
}
5857

59-
6058
protocol ConfigurationDirectAccess {
6159

62-
var configuration: SSCalendarConfiguration { get }
60+
var configuration: SSDatePickerConfiguration { get }
6361

6462
}
6563

6664
extension ConfigurationDirectAccess {
67-
65+
6866
var calendar: Calendar {
6967
configuration.calendar
7068
}
@@ -108,7 +106,7 @@ extension ConfigurationDirectAccess {
108106
var pickerBackgroundColor: Color {
109107
configuration.pickerBackgroundColor
110108
}
111-
109+
112110
// date format
113111
var headerDateFormat: String {
114112
configuration.headerDateFormat
@@ -118,14 +116,6 @@ extension ConfigurationDirectAccess {
118116
configuration.pickerViewRadius
119117
}
120118

121-
var okBtnColor: Color {
122-
configuration.buttonsForegroundColor
123-
}
124-
125-
var cancelBtnColor: Color {
126-
configuration.buttonsForegroundColor
127-
}
128-
129119
var nextPrevButtonColor: Color {
130120
configuration.nextPrevButtonColor
131121
}
@@ -150,5 +140,16 @@ extension ConfigurationDirectAccess {
150140
configuration.maximumDate
151141
}
152142

143+
var popupOverlayColor: Color {
144+
configuration.popupOverlayColor
145+
}
153146

147+
var disablePastDates: Bool {
148+
configuration.disablePastDates
149+
}
150+
151+
var disableFutureDates: Bool {
152+
configuration.disableFutureDates
153+
}
154+
154155
}

0 commit comments

Comments
 (0)