From 5acd3b1c3f85886875fa33619658cd7ca1290d43 Mon Sep 17 00:00:00 2001 From: Domenico Date: Tue, 16 Jul 2019 21:31:13 +0200 Subject: [PATCH] Added maximumIntervalBetweenDate parameter, in order to set a max days range to select --- .../Classes/CalendarDateRangePickerCell.swift | 8 +++--- ...alendarDateRangePickerViewController.swift | 25 +++++++++++++++---- .../project.pbxproj | 19 +++++++------- .../AppDelegate.swift | 2 +- .../AppIcon.appiconset/Contents.json | 17 ++++++++++++- Example/Pods/Pods.xcodeproj/project.pbxproj | 21 ++++++++-------- README.md | 1 + 7 files changed, 62 insertions(+), 31 deletions(-) diff --git a/CalendarDateRangePickerViewController/Classes/CalendarDateRangePickerCell.swift b/CalendarDateRangePickerViewController/Classes/CalendarDateRangePickerCell.swift index b0b64cd..34b9f5a 100644 --- a/CalendarDateRangePickerViewController/Classes/CalendarDateRangePickerCell.swift +++ b/CalendarDateRangePickerViewController/Classes/CalendarDateRangePickerCell.swift @@ -67,7 +67,7 @@ class CalendarDateRangePickerCell: UICollectionViewCell { selectedView?.backgroundColor = selectedColor selectedView?.layer.cornerRadius = height / 2 self.addSubview(selectedView!) - self.sendSubview(toBack: selectedView!) + self.sendSubviewToBack(selectedView!) label.textColor = UIColor.white } @@ -79,7 +79,7 @@ class CalendarDateRangePickerCell: UICollectionViewCell { halfBackgroundView = UIView(frame: CGRect(x: width / 2, y: 0, width: width / 2, height: height)) halfBackgroundView?.backgroundColor = highlightedColor self.addSubview(halfBackgroundView!) - self.sendSubview(toBack: halfBackgroundView!) + self.sendSubviewToBack(halfBackgroundView!) addRoundHighlightView() } @@ -91,7 +91,7 @@ class CalendarDateRangePickerCell: UICollectionViewCell { halfBackgroundView = UIView(frame: CGRect(x: 0, y: 0, width: width / 2, height: height)) halfBackgroundView?.backgroundColor = highlightedColor self.addSubview(halfBackgroundView!) - self.sendSubview(toBack: halfBackgroundView!) + self.sendSubviewToBack(halfBackgroundView!) addRoundHighlightView() } @@ -103,7 +103,7 @@ class CalendarDateRangePickerCell: UICollectionViewCell { roundHighlightView?.backgroundColor = highlightedColor roundHighlightView?.layer.cornerRadius = height / 2 self.addSubview(roundHighlightView!) - self.sendSubview(toBack: roundHighlightView!) + self.sendSubviewToBack(roundHighlightView!) } func highlight() { diff --git a/CalendarDateRangePickerViewController/Classes/CalendarDateRangePickerViewController.swift b/CalendarDateRangePickerViewController/Classes/CalendarDateRangePickerViewController.swift index 3626fdc..dd45a83 100644 --- a/CalendarDateRangePickerViewController/Classes/CalendarDateRangePickerViewController.swift +++ b/CalendarDateRangePickerViewController/Classes/CalendarDateRangePickerViewController.swift @@ -26,6 +26,7 @@ public class CalendarDateRangePickerViewController: UICollectionViewController { public var minimumDate: Date! public var maximumDate: Date! + public var maximumIntervalBetweenDate: Int! public var selectedStartDate: Date? public var selectedEndDate: Date? @@ -43,7 +44,7 @@ public class CalendarDateRangePickerViewController: UICollectionViewController { collectionView?.backgroundColor = UIColor.white collectionView?.register(CalendarDateRangePickerCell.self, forCellWithReuseIdentifier: cellReuseIdentifier) - collectionView?.register(CalendarDateRangePickerHeaderView.self, forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withReuseIdentifier: headerReuseIdentifier) + collectionView?.register(CalendarDateRangePickerHeaderView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: headerReuseIdentifier) collectionView?.contentInset = collectionViewInsets if minimumDate == nil { @@ -53,16 +54,20 @@ public class CalendarDateRangePickerViewController: UICollectionViewController { maximumDate = Calendar.current.date(byAdding: .year, value: 3, to: minimumDate) } + if maximumIntervalBetweenDate == nil { + maximumIntervalBetweenDate = 36500 // 100 years + } + self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Cancel", style: .plain, target: self, action: #selector(CalendarDateRangePickerViewController.didTapCancel)) self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Done", style: .done, target: self, action: #selector(CalendarDateRangePickerViewController.didTapDone)) self.navigationItem.rightBarButtonItem?.isEnabled = selectedStartDate != nil && selectedEndDate != nil } - func didTapCancel() { + @objc func didTapCancel() { delegate.didCancelPickingDateRange() } - func didTapDone() { + @objc func didTapDone() { if selectedStartDate == nil || selectedEndDate == nil { return } @@ -132,7 +137,7 @@ extension CalendarDateRangePickerViewController { override public func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { switch kind { - case UICollectionElementKindSectionHeader: + case UICollectionView.elementKindSectionHeader: let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: headerReuseIdentifier, for: indexPath) as! CalendarDateRangePickerHeaderView headerView.label.text = getMonthLabel(date: getFirstDateForSection(section: indexPath.section)) return headerView @@ -156,7 +161,8 @@ extension CalendarDateRangePickerViewController : UICollectionViewDelegateFlowLa if selectedStartDate == nil { selectedStartDate = cell.date } else if selectedEndDate == nil { - if isBefore(dateA: selectedStartDate!, dateB: cell.date!) { + if isBefore(dateA: selectedStartDate!, dateB: cell.date!) + && !isOverMaximumDays(dateA: selectedStartDate!, dateB: cell.date!, maxDays: self.maximumIntervalBetweenDate){ selectedEndDate = cell.date self.navigationItem.rightBarButtonItem?.isEnabled = true } else { @@ -248,4 +254,13 @@ extension CalendarDateRangePickerViewController { return Calendar.current.compare(dateA, to: dateB, toGranularity: .day) == ComparisonResult.orderedAscending } + func isOverMaximumDays(dateA: Date, dateB: Date, maxDays: Int) -> Bool { + let diffInDays = Calendar.current.dateComponents([.day], from: dateA, to: dateB).day + + if let unwDiffDays = diffInDays { + return unwDiffDays > maxDays + } + return false + } + } diff --git a/Example/CalendarDateRangePickerViewController.xcodeproj/project.pbxproj b/Example/CalendarDateRangePickerViewController.xcodeproj/project.pbxproj index 2525d1c..150ecdb 100644 --- a/Example/CalendarDateRangePickerViewController.xcodeproj/project.pbxproj +++ b/Example/CalendarDateRangePickerViewController.xcodeproj/project.pbxproj @@ -215,7 +215,7 @@ TargetAttributes = { 607FACCF1AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; - DevelopmentTeam = 3EKA2B3YUL; + DevelopmentTeam = 89D52653SY; LastSwiftMigration = 0900; }; 607FACE41AFB9204008FA782 = { @@ -230,6 +230,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -455,7 +456,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -501,7 +502,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -511,14 +512,14 @@ baseConfigurationReference = 863F34A79DF14110025EE9E4 /* Pods-CalendarDateRangePickerViewController_Example.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = 3EKA2B3YUL; + DEVELOPMENT_TEAM = 89D52653SY; INFOPLIST_FILE = CalendarDateRangePickerViewController/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "com.miraan.CalendarDateRangePickerViewController-Example"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -527,14 +528,14 @@ baseConfigurationReference = C9304EBA1ACFB048B6759598 /* Pods-CalendarDateRangePickerViewController_Example.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = 3EKA2B3YUL; + DEVELOPMENT_TEAM = 89D52653SY; INFOPLIST_FILE = CalendarDateRangePickerViewController/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "com.miraan.CalendarDateRangePickerViewController-Example"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -555,7 +556,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -572,7 +573,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/Example/CalendarDateRangePickerViewController/AppDelegate.swift b/Example/CalendarDateRangePickerViewController/AppDelegate.swift index 8f91c84..6e63624 100644 --- a/Example/CalendarDateRangePickerViewController/AppDelegate.swift +++ b/Example/CalendarDateRangePickerViewController/AppDelegate.swift @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } diff --git a/Example/CalendarDateRangePickerViewController/Images.xcassets/AppIcon.appiconset/Contents.json b/Example/CalendarDateRangePickerViewController/Images.xcassets/AppIcon.appiconset/Contents.json index d3942e9..19882d5 100644 --- a/Example/CalendarDateRangePickerViewController/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/Example/CalendarDateRangePickerViewController/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "29x29", @@ -29,10 +39,15 @@ "idiom" : "iphone", "size" : "60x60", "scale" : "3x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { "version" : 1, "author" : "xcode" } -} +} \ No newline at end of file diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index 9655cf0..f1adf7c 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -32,7 +32,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 0148BAA8FDBE646D63A642E62711E291 /* Pods-CalendarDateRangePickerViewController_Example.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = "Pods-CalendarDateRangePickerViewController_Example.modulemap"; sourceTree = ""; }; + 0148BAA8FDBE646D63A642E62711E291 /* Pods-CalendarDateRangePickerViewController_Example.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = "Pods-CalendarDateRangePickerViewController_Example.modulemap"; sourceTree = ""; }; 0A49805888B49A3A37F661EB44FC04FA /* CalendarDateRangePickerViewController.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = CalendarDateRangePickerViewController.swift; sourceTree = ""; }; 0B149CD46FB0FF6E7364E973FADA68D5 /* Pods-CalendarDateRangePickerViewController_Example-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-CalendarDateRangePickerViewController_Example-acknowledgements.markdown"; sourceTree = ""; }; 1673A5479D44E2FC82AE481FCBFFE742 /* CalendarDateRangePickerViewController-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "CalendarDateRangePickerViewController-umbrella.h"; sourceTree = ""; }; @@ -41,22 +41,22 @@ 3F7AB8A77F735D9B114F2BC4DED68270 /* Pods-CalendarDateRangePickerViewController_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CalendarDateRangePickerViewController_Tests.debug.xcconfig"; sourceTree = ""; }; 3FE25D3424A69F085B96399278B5035E /* Pods-CalendarDateRangePickerViewController_Tests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-CalendarDateRangePickerViewController_Tests-umbrella.h"; sourceTree = ""; }; 4740F54E33287DBB42E7F91759B2C268 /* Pods-CalendarDateRangePickerViewController_Example-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-CalendarDateRangePickerViewController_Example-umbrella.h"; sourceTree = ""; }; - 56A93C888A18F1A479C489856C4033BE /* CalendarDateRangePickerViewController.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = CalendarDateRangePickerViewController.modulemap; sourceTree = ""; }; + 56A93C888A18F1A479C489856C4033BE /* CalendarDateRangePickerViewController.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = CalendarDateRangePickerViewController.modulemap; sourceTree = ""; }; 6604A7D69453B4569E4E4827FB9155A9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 715A77DD2FAF7EB2E3141C961C905971 /* Pods-CalendarDateRangePickerViewController_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CalendarDateRangePickerViewController_Example.release.xcconfig"; sourceTree = ""; }; 7812E19A58DDDF1DA9A161C2DA9B79E4 /* Pods-CalendarDateRangePickerViewController_Example-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-CalendarDateRangePickerViewController_Example-acknowledgements.plist"; sourceTree = ""; }; 81B0504AFABE1A3AD56E87DA8BFCA5C1 /* Pods-CalendarDateRangePickerViewController_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CalendarDateRangePickerViewController_Example.debug.xcconfig"; sourceTree = ""; }; - 83C670EA4CF3822AD954DA801FBF3132 /* Pods_CalendarDateRangePickerViewController_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_CalendarDateRangePickerViewController_Tests.framework; path = "Pods-CalendarDateRangePickerViewController_Tests.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + 83C670EA4CF3822AD954DA801FBF3132 /* Pods_CalendarDateRangePickerViewController_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CalendarDateRangePickerViewController_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 8D75C979600E8A5FBF5F42F5CC5FA9DA /* CalendarDateRangePickerHeaderView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = CalendarDateRangePickerHeaderView.swift; sourceTree = ""; }; - 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; - 9DA2125F305F25D93B32CBB177390C16 /* CalendarDateRangePickerViewController.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = CalendarDateRangePickerViewController.framework; path = CalendarDateRangePickerViewController.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 9DA2125F305F25D93B32CBB177390C16 /* CalendarDateRangePickerViewController.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CalendarDateRangePickerViewController.framework; sourceTree = BUILT_PRODUCTS_DIR; }; A3897269F90EB5F8D49BBFC6F2474DF3 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; A67FE854740E4F36D86A94599E52ABE6 /* Pods-CalendarDateRangePickerViewController_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CalendarDateRangePickerViewController_Tests.release.xcconfig"; sourceTree = ""; }; A8178AD51DBB17E31CD43FF9A46689C9 /* Pods-CalendarDateRangePickerViewController_Tests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-CalendarDateRangePickerViewController_Tests-dummy.m"; sourceTree = ""; }; A84C1CB842AC8B9771C7ECD192D480B0 /* Pods-CalendarDateRangePickerViewController_Example-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-CalendarDateRangePickerViewController_Example-dummy.m"; sourceTree = ""; }; A96ABA7F3EC8F5D41F82CF610954DA7C /* Pods-CalendarDateRangePickerViewController_Example-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CalendarDateRangePickerViewController_Example-frameworks.sh"; sourceTree = ""; }; B2F126D011F5C4835D5E7EA8050FCAA1 /* Pods-CalendarDateRangePickerViewController_Tests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CalendarDateRangePickerViewController_Tests-frameworks.sh"; sourceTree = ""; }; - BC88B657ED483FF70FB465C9035D9B5D /* Pods_CalendarDateRangePickerViewController_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_CalendarDateRangePickerViewController_Example.framework; path = "Pods-CalendarDateRangePickerViewController_Example.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + BC88B657ED483FF70FB465C9035D9B5D /* Pods_CalendarDateRangePickerViewController_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CalendarDateRangePickerViewController_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C0B516091F6B38006FCD868D3E17FD38 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; DFCD66755972151678CC738E9327BBD2 /* Pods-CalendarDateRangePickerViewController_Tests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-CalendarDateRangePickerViewController_Tests-acknowledgements.markdown"; sourceTree = ""; }; E36FA64337EC90F33E32EDB2DDD18C97 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -65,7 +65,7 @@ F32B3971F72639D1F18CE5E5D1CBB999 /* CalendarDateRangePickerViewController-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "CalendarDateRangePickerViewController-dummy.m"; sourceTree = ""; }; F63988E25133FD68B56845D05B8C834A /* Pods-CalendarDateRangePickerViewController_Tests-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CalendarDateRangePickerViewController_Tests-resources.sh"; sourceTree = ""; }; FB3659AFE2022112C87D34DD540FD0F6 /* CalendarDateRangePickerViewController-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "CalendarDateRangePickerViewController-prefix.pch"; sourceTree = ""; }; - FBF491DFA46BA5963C0D4239F06D5EB0 /* Pods-CalendarDateRangePickerViewController_Tests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = "Pods-CalendarDateRangePickerViewController_Tests.modulemap"; sourceTree = ""; }; + FBF491DFA46BA5963C0D4239F06D5EB0 /* Pods-CalendarDateRangePickerViewController_Tests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = "Pods-CalendarDateRangePickerViewController_Tests.modulemap"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -173,7 +173,6 @@ 8D75C979600E8A5FBF5F42F5CC5FA9DA /* CalendarDateRangePickerHeaderView.swift */, 0A49805888B49A3A37F661EB44FC04FA /* CalendarDateRangePickerViewController.swift */, ); - name = Classes; path = Classes; sourceTree = ""; }; @@ -182,7 +181,6 @@ children = ( 8477E267C7DCBA3A3DE1A3C65D5AFF7E /* Classes */, ); - name = CalendarDateRangePickerViewController; path = CalendarDateRangePickerViewController; sourceTree = ""; }; @@ -326,6 +324,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = 7DB346D0F39D3F0E887471402A8071AB; @@ -600,7 +599,7 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -683,7 +682,7 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; diff --git a/README.md b/README.md index e56da6e..8468464 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ You can also set additional options to override the defaults: ```swift dateRangePickerViewController.minimumDate = Date() dateRangePickerViewController.maximumDate = Calendar.current.date(byAdding: .year, value: 2, to: Date()) +dateRangePickerViewController.maximumIntervalBetweenDate = 7 dateRangePickerViewController.selectedStartDate = Date() dateRangePickerViewController.selectedEndDate = Calendar.current.date(byAdding: .day, value: 10, to: Date()) dateRangePickerViewController.selectedColor = UIColor.red