diff --git a/.swift-version b/.swift-version deleted file mode 100644 index 5186d07..0000000 --- a/.swift-version +++ /dev/null @@ -1 +0,0 @@ -4.0 diff --git a/Colander.podspec b/Colander.podspec index 03ac6c2..09562ab 100644 --- a/Colander.podspec +++ b/Colander.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Colander' - s.version = '0.2.2' + s.version = '0.2.3' s.summary = 'A highly customizable iOS calendar view' s.description = <<-DESC @@ -14,11 +14,13 @@ Pod::Spec.new do |s| s.author = { 'Bryan Oltman' => 'bryan.oltman@blueapron.com' } s.source = { :git => 'https://github.com/blueapron/Colander.git', :tag => s.version.to_s } - s.ios.deployment_target = '8.0' + s.ios.deployment_target = '10.0' + s.swift_version = '5.0' + s.source_files = 'Colander/Classes/**/*' - s.dependency 'SnapKit', '~> 4.0' - s.dependency 'SwiftDate', '~> 4.5.0' + s.dependency 'SnapKit', '~> 5.0.0' + s.dependency 'SwiftDate', '~> 6.0.3' end diff --git a/Colander/Classes/CalendarView.swift b/Colander/Classes/CalendarView.swift index 8f8897a..b3acad4 100644 --- a/Colander/Classes/CalendarView.swift +++ b/Colander/Classes/CalendarView.swift @@ -160,7 +160,7 @@ public class CalendarView: UIView { let view = supplementaryViewType.init(frame: CGRect.zero) view.setNeedsLayout() view.layoutIfNeeded() - headerHeight = view.systemLayoutSizeFitting(UILayoutFittingCompressedSize).height + headerHeight = view.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).height } /** @@ -193,7 +193,7 @@ public class CalendarView: UIView { */ public func select(date: Date) { guard !selectedDates.contains(date) else { return } - selectedDates.append(date.startOfDay) + selectedDates.append(DateInRegion(date).dateAt(.startOfDay).date) collectionView.selectItem(at: viewModel?.indexPath(from: date), animated: false, scrollPosition: []) } @@ -203,8 +203,9 @@ public class CalendarView: UIView { - parameter date: the date to deselect */ public func deselect(date: Date) { - guard let indexPath = viewModel?.indexPath(from: date.startOfDay) else { return } - if let index = selectedDates.index(of: date.startOfDay) { + let startOfDay = DateInRegion(date).dateAt(.startOfDay).date + guard let indexPath = viewModel?.indexPath(from: startOfDay) else { return } + if let index = selectedDates.firstIndex(of: startOfDay) { selectedDates.remove(at: index) } collectionView.deselectItem(at: indexPath, animated: false) @@ -239,7 +240,7 @@ public class CalendarView: UIView { - parameter position: the position to scroll to (defaults to centeredVertically) - parameter animated: whether the scrolling should be animated (defaults to true) */ - public func scroll(toDate date: Date, position: UICollectionViewScrollPosition = .centeredVertically, animated: Bool = true) { + public func scroll(toDate date: Date, position: UICollectionView.ScrollPosition = .centeredVertically, animated: Bool = true) { guard let indexPath = viewModel?.indexPath(from: date) else { return } scroll(toIndexPath: indexPath, position: position, animated: animated) } @@ -251,7 +252,7 @@ public class CalendarView: UIView { - parameter position: the position to scroll to (defaults to centeredVertically) - parameter animated: whether the scrolling should be animated (defaults to true) */ - public func scroll(toIndexPath indexPath: IndexPath, position: UICollectionViewScrollPosition = .centeredVertically, animated: Bool = true) { + public func scroll(toIndexPath indexPath: IndexPath, position: UICollectionView.ScrollPosition = .centeredVertically, animated: Bool = true) { collectionView.scrollToItem(at: indexPath, at: .centeredVertically, animated: animated) } } diff --git a/Colander/Classes/CalendarViewModel.swift b/Colander/Classes/CalendarViewModel.swift index 3de1ddd..e21430f 100644 --- a/Colander/Classes/CalendarViewModel.swift +++ b/Colander/Classes/CalendarViewModel.swift @@ -44,7 +44,7 @@ class CalendarViewModel { init(startDate: Date, endDate: Date, showLeadingWeeks: Bool = true, showTrailingWeeks: Bool = true, calendar: Calendar = Calendar.gregorian) throws { - if startDate > endDate && !startDate.isInSameDayOf(date: endDate) { + if startDate > endDate && !DateInRegion(startDate).compare(.isSameDay(endDate)) { throw DateError.InvalidDateOrdering } @@ -53,7 +53,7 @@ class CalendarViewModel { self.showLeadingWeeks = showLeadingWeeks self.showTrailingWeeks = showTrailingWeeks self.calendar = calendar - Date.setDefaultRegion(Region(tz: TimeZone.current, cal: calendar, loc: Locale.current)) + SwiftDate.defaultRegion = Region(calendar: calendar, zone: TimeZone.current, locale: Locale.current) self.monthInfos = try CalendarViewModel.makeMonthInfos(startDate: startDate, endDate: endDate, calendar: calendar) } @@ -72,7 +72,7 @@ class CalendarViewModel { } let zeroIndexDate = firstDisplayDate(for: section, showLeadingWeeks: showLeadingWeeks) // 1 hour is added to make this calculation correct for the beginning of Daylight Saving Time. I don't like it either. - let intervalDiff = (date + 1.hour) - zeroIndexDate + let intervalDiff = (date + 1.hours) - zeroIndexDate return IndexPath(item: intervalDiff.in(.day) ?? 0, section: section) } diff --git a/Colander/Classes/DateExtensions.swift b/Colander/Classes/DateExtensions.swift index a7e8bc1..b6ed093 100644 --- a/Colander/Classes/DateExtensions.swift +++ b/Colander/Classes/DateExtensions.swift @@ -6,11 +6,13 @@ extension Calendar { extension Date { var beginningOfMonth: Date { - return self.startOf(component: .month) + var firstDayOfStartMonth = Calendar.gregorian.dateComponents( [.era, .year, .month], from: self) + firstDayOfStartMonth.day = 1 + return Calendar.gregorian.date(from: firstDayOfStartMonth) ?? Date.nowAt(.startOfMonth) } var beginningOfWeek: Date { - return self.startOf(component: .weekOfMonth) + return Calendar.gregorian.date(from: Calendar.gregorian.dateComponents([.yearForWeekOfYear, .weekOfYear], from: self)) ?? Date.nowAt(.startOfWeek) } var endOfWeek: Date { diff --git a/Example/Colander.xcodeproj/project.pbxproj b/Example/Colander.xcodeproj/project.pbxproj index 5cbe799..85f149a 100644 --- a/Example/Colander.xcodeproj/project.pbxproj +++ b/Example/Colander.xcodeproj/project.pbxproj @@ -20,8 +20,8 @@ 62FAC0221F3E06E8007FE44C /* CalendarViewModelSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62FAC01F1F3E06E8007FE44C /* CalendarViewModelSpec.swift */; }; 62FAC0231F3E06E8007FE44C /* Date+Mock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62FAC0201F3E06E8007FE44C /* Date+Mock.swift */; }; 62FAC0241F3E06E8007FE44C /* MonthInfoSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62FAC0211F3E06E8007FE44C /* MonthInfoSpec.swift */; }; - DC3B97E0EE8549D688C2F6FF /* Pods_Colander_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EF2D5041AB069CEB3298E3FD /* Pods_Colander_Example.framework */; }; - DE58271D71A9CB481A3375B0 /* Pods_Colander_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FD2A63ECA11845C57821BD31 /* Pods_Colander_Tests.framework */; }; + 742F5ECD784B10712C6E2697 /* Pods_Colander_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E2AE24330433B58DE569374 /* Pods_Colander_Tests.framework */; }; + F55364AA1604AA718830276E /* Pods_Colander_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAB82305CD655860B9FCB63F /* Pods_Colander_Example.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -37,8 +37,7 @@ /* Begin PBXFileReference section */ 1089385E523011FABC5B870B /* Colander.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = Colander.podspec; path = ../Colander.podspec; sourceTree = ""; }; 1939F3CCD64571E5E090650F /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; - 2AAD174CA339E5E90645876B /* Pods-Colander_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Colander_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Colander_Example/Pods-Colander_Example.debug.xcconfig"; sourceTree = ""; }; - 56A83F39EA407F2CDFD0D53D /* Pods-Colander_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Colander_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Colander_Tests/Pods-Colander_Tests.debug.xcconfig"; sourceTree = ""; }; + 3E2AE24330433B58DE569374 /* Pods_Colander_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Colander_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 607FACD01AFB9204008FA782 /* Colander_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Colander_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -53,14 +52,15 @@ 62260F5A1F3E04390008655B /* CalendarMonthHeaderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CalendarMonthHeaderView.swift; sourceTree = ""; }; 62260F5C1F3E04390008655B /* MultiSelectionCalendarViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MultiSelectionCalendarViewController.swift; sourceTree = ""; }; 625381921F420BE8005AE56A /* InteractiveDataSourceViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InteractiveDataSourceViewController.swift; sourceTree = ""; }; + 6295B1EB882CCFE4E0133EEB /* Pods-Colander_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Colander_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-Colander_Tests/Pods-Colander_Tests.release.xcconfig"; sourceTree = ""; }; 62FAC01F1F3E06E8007FE44C /* CalendarViewModelSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CalendarViewModelSpec.swift; sourceTree = ""; }; 62FAC0201F3E06E8007FE44C /* Date+Mock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Date+Mock.swift"; sourceTree = ""; }; 62FAC0211F3E06E8007FE44C /* MonthInfoSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MonthInfoSpec.swift; sourceTree = ""; }; - 7D1A1B8CC3CDD70797A53DF4 /* Pods-Colander_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Colander_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-Colander_Tests/Pods-Colander_Tests.release.xcconfig"; sourceTree = ""; }; + 7294F3BA7EF1A7A9FE26D21E /* Pods-Colander_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Colander_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-Colander_Example/Pods-Colander_Example.release.xcconfig"; sourceTree = ""; }; 92A05200074333A60C779902 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; - A790538AC1E9E5D6B9ED2FC2 /* Pods-Colander_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Colander_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-Colander_Example/Pods-Colander_Example.release.xcconfig"; sourceTree = ""; }; - EF2D5041AB069CEB3298E3FD /* Pods_Colander_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Colander_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - FD2A63ECA11845C57821BD31 /* Pods_Colander_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Colander_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + C6363956A69578F91E7397AB /* Pods-Colander_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Colander_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Colander_Tests/Pods-Colander_Tests.debug.xcconfig"; sourceTree = ""; }; + D6F026F00D08FBFA1277A828 /* Pods-Colander_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Colander_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Colander_Example/Pods-Colander_Example.debug.xcconfig"; sourceTree = ""; }; + DAB82305CD655860B9FCB63F /* Pods_Colander_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Colander_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -68,7 +68,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - DC3B97E0EE8549D688C2F6FF /* Pods_Colander_Example.framework in Frameworks */, + F55364AA1604AA718830276E /* Pods_Colander_Example.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -76,13 +76,33 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - DE58271D71A9CB481A3375B0 /* Pods_Colander_Tests.framework in Frameworks */, + 742F5ECD784B10712C6E2697 /* Pods_Colander_Tests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 27192816F2F6D84826A53B44 /* Pods */ = { + isa = PBXGroup; + children = ( + D6F026F00D08FBFA1277A828 /* Pods-Colander_Example.debug.xcconfig */, + 7294F3BA7EF1A7A9FE26D21E /* Pods-Colander_Example.release.xcconfig */, + C6363956A69578F91E7397AB /* Pods-Colander_Tests.debug.xcconfig */, + 6295B1EB882CCFE4E0133EEB /* Pods-Colander_Tests.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + 3947210A513998C7223043E5 /* Frameworks */ = { + isa = PBXGroup; + children = ( + DAB82305CD655860B9FCB63F /* Pods_Colander_Example.framework */, + 3E2AE24330433B58DE569374 /* Pods_Colander_Tests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; 607FACC71AFB9204008FA782 = { isa = PBXGroup; children = ( @@ -90,8 +110,8 @@ 607FACD21AFB9204008FA782 /* Example for Colander */, 607FACE81AFB9204008FA782 /* Tests */, 607FACD11AFB9204008FA782 /* Products */, - B0A09B9D253E8725D29ED2A4 /* Pods */, - 74F79B780FBB22A88E9A2E22 /* Frameworks */, + 27192816F2F6D84826A53B44 /* Pods */, + 3947210A513998C7223043E5 /* Frameworks */, ); sourceTree = ""; }; @@ -192,26 +212,6 @@ path = InteractiveDataSource; sourceTree = ""; }; - 74F79B780FBB22A88E9A2E22 /* Frameworks */ = { - isa = PBXGroup; - children = ( - EF2D5041AB069CEB3298E3FD /* Pods_Colander_Example.framework */, - FD2A63ECA11845C57821BD31 /* Pods_Colander_Tests.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - B0A09B9D253E8725D29ED2A4 /* Pods */ = { - isa = PBXGroup; - children = ( - 2AAD174CA339E5E90645876B /* Pods-Colander_Example.debug.xcconfig */, - A790538AC1E9E5D6B9ED2FC2 /* Pods-Colander_Example.release.xcconfig */, - 56A83F39EA407F2CDFD0D53D /* Pods-Colander_Tests.debug.xcconfig */, - 7D1A1B8CC3CDD70797A53DF4 /* Pods-Colander_Tests.release.xcconfig */, - ); - name = Pods; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -219,12 +219,11 @@ isa = PBXNativeTarget; buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "Colander_Example" */; buildPhases = ( - 4DEFF058E8F50092D2D50FA0 /* [CP] Check Pods Manifest.lock */, + 431A0ADD19E1DB4437968714 /* [CP] Check Pods Manifest.lock */, 607FACCC1AFB9204008FA782 /* Sources */, 607FACCD1AFB9204008FA782 /* Frameworks */, 607FACCE1AFB9204008FA782 /* Resources */, - 2F0C454F9E2E3E6B20DB5B14 /* [CP] Embed Pods Frameworks */, - 5C07E3DD4EC64BF966CE041E /* [CP] Copy Pods Resources */, + 74A97AB080D006262EF50883 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -239,12 +238,11 @@ isa = PBXNativeTarget; buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "Colander_Tests" */; buildPhases = ( - 82B266FA1054288E47798369 /* [CP] Check Pods Manifest.lock */, + B3060291EC9B55999E1EBEBE /* [CP] Check Pods Manifest.lock */, 607FACE11AFB9204008FA782 /* Sources */, 607FACE21AFB9204008FA782 /* Frameworks */, 607FACE31AFB9204008FA782 /* Resources */, - 8DE4B7D9D5369CFBF4404C81 /* [CP] Embed Pods Frameworks */, - CD14EBD41A722BB95B81E554 /* [CP] Copy Pods Resources */, + FB8F4F77D555BC27EAED868E /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -269,11 +267,11 @@ 607FACCF1AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; DevelopmentTeam = WE32AWW3XR; - LastSwiftMigration = 0910; + LastSwiftMigration = 1020; }; 607FACE41AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; - LastSwiftMigration = 0910; + LastSwiftMigration = 1020; TestTargetID = 607FACCF1AFB9204008FA782; }; }; @@ -283,6 +281,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -317,31 +316,7 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 2F0C454F9E2E3E6B20DB5B14 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-Colander_Example/Pods-Colander_Example-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/Colander/Colander.framework", - "${PODS_ROOT}/Reveal-SDK/RevealServer-12/iOS/RevealServer.framework", - "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework", - "${BUILT_PRODUCTS_DIR}/SwiftDate/SwiftDate.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Colander.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RevealServer.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SnapKit.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftDate.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Colander_Example/Pods-Colander_Example-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 4DEFF058E8F50092D2D50FA0 /* [CP] Check Pods Manifest.lock */ = { + 431A0ADD19E1DB4437968714 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -359,22 +334,29 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 5C07E3DD4EC64BF966CE041E /* [CP] Copy Pods Resources */ = { + 74A97AB080D006262EF50883 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-Colander_Example/Pods-Colander_Example-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/Colander/Colander.framework", + "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework", + "${BUILT_PRODUCTS_DIR}/SwiftDate/SwiftDate.framework", ); - name = "[CP] Copy Pods Resources"; + name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Colander.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SnapKit.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftDate.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Colander_Example/Pods-Colander_Example-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Colander_Example/Pods-Colander_Example-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 82B266FA1054288E47798369 /* [CP] Check Pods Manifest.lock */ = { + B3060291EC9B55999E1EBEBE /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -392,7 +374,7 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 8DE4B7D9D5369CFBF4404C81 /* [CP] Embed Pods Frameworks */ = { + FB8F4F77D555BC27EAED868E /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -412,21 +394,6 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Colander_Tests/Pods-Colander_Tests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - CD14EBD41A722BB95B81E554 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Colander_Tests/Pods-Colander_Tests-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -522,7 +489,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.3; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -568,7 +535,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.3; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; @@ -578,41 +545,64 @@ }; 607FACF01AFB9204008FA782 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 2AAD174CA339E5E90645876B /* Pods-Colander_Example.debug.xcconfig */; + baseConfigurationReference = D6F026F00D08FBFA1277A828 /* Pods-Colander_Example.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = WE32AWW3XR; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "\"${PODS_CONFIGURATION_BUILD_DIR}/Colander\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/SnapKit\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/SwiftDate\"", + ); INFOPLIST_FILE = Colander/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ExampleApp; + OTHER_LDFLAGS = ( + "$(inherited)", + "-ObjC", + "-l\"z\"", + "-framework", + "\"CFNetwork\"", + "-framework", + "\"Colander\"", + "-framework", + "\"CoreGraphics\"", + "-framework", + "\"QuartzCore\"", + "-framework", + "\"SnapKit\"", + "-framework", + "\"SwiftDate\"", + ); PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; 607FACF11AFB9204008FA782 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = A790538AC1E9E5D6B9ED2FC2 /* Pods-Colander_Example.release.xcconfig */; + baseConfigurationReference = 7294F3BA7EF1A7A9FE26D21E /* Pods-Colander_Example.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = WE32AWW3XR; INFOPLIST_FILE = Colander/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; }; 607FACF31AFB9204008FA782 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 56A83F39EA407F2CDFD0D53D /* Pods-Colander_Tests.debug.xcconfig */; + baseConfigurationReference = C6363956A69578F91E7397AB /* Pods-Colander_Tests.debug.xcconfig */; buildSettings = { FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", @@ -626,15 +616,14 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Colander_Example.app/Colander_Example"; }; name = Debug; }; 607FACF41AFB9204008FA782 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7D1A1B8CC3CDD70797A53DF4 /* Pods-Colander_Tests.release.xcconfig */; + baseConfigurationReference = 6295B1EB882CCFE4E0133EEB /* Pods-Colander_Tests.release.xcconfig */; buildSettings = { FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", @@ -644,8 +633,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Colander_Example.app/Colander_Example"; }; name = Release; diff --git a/Example/Colander/AppDelegate.swift b/Example/Colander/AppDelegate.swift index 3d49807..dc6b7d4 100644 --- a/Example/Colander/AppDelegate.swift +++ b/Example/Colander/AppDelegate.swift @@ -13,7 +13,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 { let tabController = UITabBarController() tabController.viewControllers = [BasicCalendarViewController(), CustomCalendarViewController(), diff --git a/Example/Colander/Basic/BasicCalendarViewController.swift b/Example/Colander/Basic/BasicCalendarViewController.swift index d16d780..8861de3 100644 --- a/Example/Colander/Basic/BasicCalendarViewController.swift +++ b/Example/Colander/Basic/BasicCalendarViewController.swift @@ -29,7 +29,7 @@ class BasicCalendarViewController: UIViewController { view.backgroundColor = .white calendarView.register(cellType: CalendarDayCell.self) - calendarView.register(supplementaryViewType: CalendarMonthHeaderView.self, ofKind: UICollectionElementKindSectionHeader) + calendarView.register(supplementaryViewType: CalendarMonthHeaderView.self, ofKind: UICollectionView.elementKindSectionHeader) calendarView.dataSource = self calendarView.delegate = self view.addSubview(calendarView) diff --git a/Example/Colander/CustomViews/CustomCalendarViewController.swift b/Example/Colander/CustomViews/CustomCalendarViewController.swift index 1d5a729..bf0f4e8 100644 --- a/Example/Colander/CustomViews/CustomCalendarViewController.swift +++ b/Example/Colander/CustomViews/CustomCalendarViewController.swift @@ -28,7 +28,7 @@ class CustomCalendarViewController: UIViewController { view.backgroundColor = .white calendarView.register(cellType: SpecializedDayCell.self) - calendarView.register(supplementaryViewType: SpecializedHeaderView.self, ofKind: UICollectionElementKindSectionHeader) + calendarView.register(supplementaryViewType: SpecializedHeaderView.self, ofKind: UICollectionView.elementKindSectionHeader) calendarView.dataSource = self calendarView.delegate = self view.addSubview(calendarView) diff --git a/Example/Colander/InteractiveDataSource/InteractiveDataSourceViewController.swift b/Example/Colander/InteractiveDataSource/InteractiveDataSourceViewController.swift index 3c69c18..6fe8755 100644 --- a/Example/Colander/InteractiveDataSource/InteractiveDataSourceViewController.swift +++ b/Example/Colander/InteractiveDataSource/InteractiveDataSourceViewController.swift @@ -87,7 +87,7 @@ class InteractiveDataSourceViewController: UIViewController, CalendarViewDataSou } calendarView.register(cellType: SpecializedDayCell.self) - calendarView.register(supplementaryViewType: SpecializedHeaderView.self, ofKind: UICollectionElementKindSectionHeader) + calendarView.register(supplementaryViewType: SpecializedHeaderView.self, ofKind: UICollectionView.elementKindSectionHeader) view.addSubview(calendarView) calendarView.snp.makeConstraints { make in make.left.top.right.equalToSuperview() diff --git a/Example/Colander/MultiSelection/MultiSelectionCalendarViewController.swift b/Example/Colander/MultiSelection/MultiSelectionCalendarViewController.swift index 2c1a976..0a40538 100644 --- a/Example/Colander/MultiSelection/MultiSelectionCalendarViewController.swift +++ b/Example/Colander/MultiSelection/MultiSelectionCalendarViewController.swift @@ -28,14 +28,14 @@ class MultiSelectionCalendarViewController: UIViewController { view.backgroundColor = .white calendarView.register(cellType: SpecializedDayCell.self) - calendarView.register(supplementaryViewType: SpecializedHeaderView.self, ofKind: UICollectionElementKindSectionHeader) + calendarView.register(supplementaryViewType: SpecializedHeaderView.self, ofKind: UICollectionView.elementKindSectionHeader) calendarView.allowsMultipleSelection = true calendarView.dataSource = self calendarView.delegate = self calendarView.select(date: Date()) - calendarView.select(date: Date() + 1.week) + calendarView.select(date: Date() + 1.weeks) calendarView.select(date: Date() + 2.weeks) - calendarView.select(date: Date() + 1.month) + calendarView.select(date: Date() + 1.months) view.addSubview(calendarView) calendarView.snp.makeConstraints { make in make.edges.equalToSuperview().inset(20) diff --git a/Example/Podfile b/Example/Podfile index afca8b7..2430ab7 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -1,14 +1,13 @@ -platform :ios, '8.0' +platform :ios, '10.0' use_frameworks! target 'Colander_Example' do pod 'Colander', :path => '../' - pod 'Reveal-SDK', :configurations => ['Debug'] target 'Colander_Tests' do inherit! :search_paths - pod 'Quick', '~> 1.2.0' - pod 'Nimble', '~> 7.0.3' + pod 'Quick', '~> 2.1.0' + pod 'Nimble', '~> 8.0.1' end end diff --git a/Example/Podfile.lock b/Example/Podfile.lock index ab6015d..6ba60d8 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,31 +1,35 @@ PODS: - - Colander (0.2.1): - - SnapKit (~> 4.0) - - SwiftDate (~> 4.5.0) - - Nimble (7.0.3) - - Quick (1.2.0) - - Reveal-SDK (12) - - SnapKit (4.0.0) - - SwiftDate (4.5.0) + - Colander (0.2.3): + - SnapKit (~> 5.0.0) + - SwiftDate (~> 6.0.3) + - Nimble (8.0.1) + - Quick (2.1.0) + - SnapKit (5.0.0) + - SwiftDate (6.0.3) DEPENDENCIES: - Colander (from `../`) - - Nimble (~> 7.0.3) - - Quick (~> 1.2.0) - - Reveal-SDK + - Nimble (~> 8.0.1) + - Quick (~> 2.1.0) + +SPEC REPOS: + https://github.com/cocoapods/specs.git: + - Nimble + - Quick + - SnapKit + - SwiftDate EXTERNAL SOURCES: Colander: - :path: ../ + :path: "../" SPEC CHECKSUMS: - Colander: 5b0f56adaa5baa86b2cb58f87946fef90069d28a - Nimble: 7f5a9c447a33002645a071bddafbfb24ea70e0ac - Quick: 58d203b1c5e27fff7229c4c1ae445ad7069a7a08 - Reveal-SDK: 58517b2a4d5d69dcb98e62aa4a5e62c84b5e0061 - SnapKit: a42d492c16e80209130a3379f73596c3454b7694 - SwiftDate: 17dd829c004a2d60432ef63ffcdb26ca2eb97a60 + Colander: fcc5af3359a55ff63098c9d31a81156955a83c20 + Nimble: 45f786ae66faa9a709624227fae502db55a8bdd0 + Quick: 4be43f6634acfa727dd106bdf3929ce125ffa79d + SnapKit: fd22d10eb9aff484d79a8724eab922c1ddf89bcf + SwiftDate: 8d4f14bf1ef68e95094511504856547bf9e3e1a6 -PODFILE CHECKSUM: 2174826a9b4793f3ae8d4bddc99e84fb9437e818 +PODFILE CHECKSUM: 8986d9112fcd8cc93adf8e946860b85e291ba26f -COCOAPODS: 1.3.1 +COCOAPODS: 1.5.3 diff --git a/Example/Tests/CalendarViewModelSpec.swift b/Example/Tests/CalendarViewModelSpec.swift index dd95f92..ef8fef2 100644 --- a/Example/Tests/CalendarViewModelSpec.swift +++ b/Example/Tests/CalendarViewModelSpec.swift @@ -16,7 +16,7 @@ class CalendarViewModelSpec: QuickSpec { describe("init") { it("creates the correct month infos for a single month") { let startDate = Date.mockDateFrom(year: 2017, month: 8, day: 4) - let endDate = startDate + 1.week + let endDate = startDate + 1.weeks let subject = try! CalendarViewModel(startDate: startDate, endDate: endDate) expect(subject.monthInfos.count).to(equal(1)) let mockMonthInfo = try! MonthInfo(forMonthContaining: startDate) @@ -53,7 +53,7 @@ class CalendarViewModelSpec: QuickSpec { it("throws an error if startDate is later than endDate") { let startDate = Date.mockDateFrom(year: 2017, month: 8, day: 4) - let endDate = startDate - 1.day + let endDate = startDate - 1.days try? expect(testCalendarViewModel(startDate: startDate, endDate: endDate)).to(throwError()) // ...but *not* if it's in the same day try! testCalendarViewModel(startDate: endDate + 2.minutes, endDate: endDate) diff --git a/Example/Tests/Date+Mock.swift b/Example/Tests/Date+Mock.swift index 45e6fc3..bd8460f 100644 --- a/Example/Tests/Date+Mock.swift +++ b/Example/Tests/Date+Mock.swift @@ -10,8 +10,8 @@ extension Date { /// - day: the desired day /// - Returns: a new instance of `Date` with the given components static func mockDateFrom(year: Int, month: Int, day: Int, hour: Int = 0) -> Date { - let c: [Calendar.Component : Int] = [.year: year, .month: month, .day: day, .hour: hour] - let dateInRegion = DateInRegion(components: c, fromRegion: nil)! - return dateInRegion.absoluteDate + let c = DateComponents(year: year, month: month, day: day, hour: hour) + let dateInRegion : DateInRegion = DateInRegion(components: c, region: nil)! + return dateInRegion.date } }