diff --git a/.github/ISSUE_TEMPLATE b/.github/ISSUE_TEMPLATE
deleted file mode 100644
index ea0906e2..00000000
--- a/.github/ISSUE_TEMPLATE
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-**(Required) Version Number:**
-
-## Description
-
-## Steps To Reproduce
-
-## Expected Behavior
-
-## Additional Context
diff --git a/.gitignore b/.gitignore
index 15e0f003..45e8ddf0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,38 +1,4 @@
-# OS X
+_site
+.sass-cache
+.jekyll-metadata
.DS_Store
-
-# Xcode
-build/
-*.pbxuser
-!default.pbxuser
-*.mode1v3
-!default.mode1v3
-*.mode2v3
-!default.mode2v3
-*.perspectivev3
-!default.perspectivev3
-xcuserdata
-*.xccheckout
-profile
-*.moved-aside
-DerivedData
-*.hmap
-*.ipa
-
-# Bundler
-.bundle
-
-Carthage
-# We recommend against adding the Pods directory to your .gitignore. However
-# you should judge for yourself, the pros and cons are mentioned at:
-# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
-#
-# Note: if you ignore the Pods directory, make sure to uncomment
-# `pod install` in .travis.yml
-#
-# Pods/
-#xcshareddata
-/.swiftlint.yml
-/.swift-version
-/Index
-xbcbb2nb
diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
deleted file mode 100644
index 919434a6..00000000
--- a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
diff --git a/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
deleted file mode 100644
index 18d98100..00000000
--- a/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
- IDEDidComputeMac32BitWarning
-
-
-
diff --git a/.tailor.yml b/.tailor.yml
deleted file mode 100644
index 5408f311..00000000
--- a/.tailor.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-except:
- - upper-camel-case
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 476308a3..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,36 +0,0 @@
-language: objective-c
-osx_image: xcode10
-env:
- global:
- - LC_CTYPE=en_US.UTF-8
- - LANG=en_US.UTF-8
- - WORKSPACE=JTAppleCalendar.xcworkspace
- - IOS_FRAMEWORK_SCHEME="JTAppleCalendar iOSTests"
- - TVOS_FRAMEWORK_SCHEME="JTAppleCalendar tvOSTests"
- - IOS_SDK=iphonesimulator12.0
- - TVOS_SDK=appletvsimulator12.0
- - EXAMPLE_SCHEME_IOS="JTAppleCalendar iOS Example"
- matrix:
- - DESTINATION="OS=10.0,name=iPhone 7 Plus" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" EXAMPLE_SCHEME="$EXAMPLE_SCHEME_IOS" POD_LINT="NO"
- - DESTINATION="OS=10.0,name=Apple TV 1080p" SCHEME="$TVOS_FRAMEWORK_SCHEME" SDK="$TVOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO"
-script:
- - set -o pipefail
- - xcodebuild -version
- - xcodebuild -showsdks
-
- # Build Framework in Debug and Run Tests if specified
- - if [ $RUN_TESTS == "YES" ]; then
- xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES test | xcpretty -c;
- else
- xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO build | xcpretty -c;
- fi
-
- # Build Example in Debug if specified
- - if [ $BUILD_EXAMPLE == "YES" ]; then
- xcodebuild -workspace "$WORKSPACE" -scheme "$EXAMPLE_SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO build | xcpretty -c;
- fi
-
- # Run `pod lib lint` if specified
- - if [ $POD_LINT == "YES" ]; then
- pod lib lint;
- fi
diff --git a/CHANGELOG.md b/CHANGELOG.md
deleted file mode 100644
index 92533c71..00000000
--- a/CHANGELOG.md
+++ /dev/null
@@ -1,357 +0,0 @@
-# Change Log
-All notable changes to this project will be documented in this file.
-`JTAppleCalendar` adheres to [Semantic Versioning](http://semver.org/).
-#### 8.x Releases
-- `8.0.0` Releases - [8.0.0](#800)|[8.0.1](#801)|[8.0.2](#802)|[8.0.3](#803)|[8.0.4](#804)|[8.0.5](#805)
-#### 7.x Releases
-- `7.1.0` Releases - [7.1.0](#710)|[7.1.1](#711)|[7.1.2](#712)|[7.1.3](#713)|[7.1.4](#714)|[7.1.5](#715)|[7.1.6](#716)|[7.1.7](#717)
-- `7.0.0` Releases - [7.0.0](#700)|[7.0.1](#701)|[7.0.2](#702)|[7.0.3](#703)|[7.0.4](#704)|[7.0.5](#705)|[7.0.6](#706)
-
-#### 6.x Releases
-- `6.1.0` Releases - [6.1.0](#610)|[6.1.1](#611)|[6.1.2](#612)|[6.1.3](#613)|[6.1.4](#614)|[6.1.5](#615)|[6.1.6](#616)
-- `6.0.0` Releases - [6.0.0](#600)|[6.0.1](#601)|[6.0.2](#602)|[6.0.3](#603)|[6.0.4](#604)|[6.0.5](#605)
-- `6.0.0` Betas - [6.0.0-beta.1](#600-beta1)
-
-#### 5.x Releases
-- `5.0.0` Releases - [5.0.0](#500)|[5.0.1](#501)
-
-#### 4.x Releases
-- `4.1.0` Releases - [4.1.0](#410)|[4.1.1](#411)|[4.1.2](#412)|[4.1.3](#413)|[4.1.4](#414)
-- `4.0.0` Releases - [4.0.0](#400)|[4.0.1](#401)|[4.0.2](#402)|[4.0.3](#403)
-
-#### 3.x Releases
-- `3.0.0` Releases - [3.0.0](#300)|[3.0.1](#301)
-
-#### 2.x Releases
-- `2.1.0` Releases - [2.1.0](#210)|[2.1.1](#211)|[2.1.2](#212)
-- `2.0.0` Releases - [2.0.0](#200)|[2.0.1](#201)|[2.0.2](#202)|[2.0.3](#203)
-
-#### 1.x Releases
-- `1.1.x` Releases - [1.1.0](#110)| [1.1.1](#111)
-- `1.0.x` Releases - [1.0.0](#100)
-
----
-## [8.0.5](https://github.com/patchthecode/JTAppleCalendar/releases/tag/8.0.5)
-- fixed latest iOS update issues (https://github.com/patchthecode/JTAppleCalendar/pull/1370)
-- Respect animation parameter (https://github.com/patchthecode/JTAppleCalendar/commit/72e4ac3b5a5af8abe5c094aceefc00801044dfa4)
-- Added preferred position is scoll mode is .none (https://github.com/patchthecode/JTAppleCalendar/commit/31c00c4215e5ae2ab97cd0415cdd41acaebef1f1#diff-0471218aece98915af0d556e7389b414ef1397d811c0fbf94d96ea8323bdc9a4R551-R564)
-## [8.0.4](https://github.com/patchthecode/JTAppleCalendar/releases/tag/8.0.4)
-- fixed warnings (https://github.com/patchthecode/JTAppleCalendar/issues/1307)
-## [8.0.3](https://github.com/patchthecode/JTAppleCalendar/releases/tag/8.0.3)
-- [removed side effect on allowsRangedSelection](https://github.com/patchthecode/JTAppleCalendar/issues/1122)
-- Carthage tag now works again.
-## [8.0.2](https://github.com/patchthecode/JTAppleCalendar/releases/tag/8.0.2)
-- updated range selection . Now you can choose mode as being continous or segmented
-## [8.0.1](https://github.com/patchthecode/JTAppleCalendar/releases/tag/8.0.1)
-- [fixed memory leak](https://github.com/patchthecode/JTAppleCalendar/pull/1081)
-## [8.0.0](https://github.com/patchthecode/JTAppleCalendar/releases/tag/8.0.0)
-https://github.com/patchthecode/JTAppleCalendar/commit/
-- ScrollToDate should now respect section insets
-- [Some dates could not be selected](https://github.com/patchthecode/JTAppleCalendar/commit/eea5725b2fb84e998b2998cf3ba724194b1eb705)
-- updated to Swift 5
-- [Updated range selection logic. Every section is reated as a group](https://github.com/patchthecode/JTAppleCalendar/commit/a28f3b273d8f4d043d8ae1227e351723ed6ea7c7)
-- [StrictBoundary = false together with section inset causes misaligned sections](https://github.com/patchthecode/JTAppleCalendar/commit/23347b26ccda3e65a4f387859263a386b7ef227f)
-- [Single cell deletion fix](https://github.com/patchthecode/JTAppleCalendar/commit/62501f95b5b5a693ab4caa967736d1ee120d0b5d)
-- [Fix crash for japanese calendar](https://github.com/patchthecode/JTAppleCalendar/commit/c06f0eec472e4ef39ac97e031ae55ec1231df1c1)
-- [Animations on the calendar now looks smooth](https://github.com/patchthecode/JTAppleCalendar/commit/a131d7fd2d447a81854194e4d0198519f7ea526e)
-- Can now work with app extensions
-- dropped support for both iOS 8 & 9
-- Added year view support
-- Other enhancements
-
-## [7.1.7](https://github.com/patchthecode/JTAppleCalendar/releases/tag/7.1.7)
-- fixed broken cell size change
-- fixed rotation code
-- fixed scrolling issue
-
-## [7.1.6](https://github.com/patchthecode/JTAppleCalendar/releases/tag/7.1.6)
-- Updated to swift 4.2
-- small bug fixes
-
-## [7.1.5](https://github.com/patchthecode/JTAppleCalendar/releases/tag/7.1.5)
-- Fixed inset bug #419
-- Fixed unowned Crash #624
-
-- Updated by [JayT](https://github.com/patchthecode).
-## [7.1.4](https://github.com/patchthecode/JTAppleCalendar/releases/tag/7.1.4)
-- Fixed [programatic selection bug](https://github.com/patchthecode/JTAppleCalendar/commit/de5f0023fb6b157bddb2afa9637c7be0a1bbc636)
-- Updated by [JayT](https://github.com/patchthecode).
-
-## [7.1.3](https://github.com/patchthecode/JTAppleCalendar/releases/tag/7.1.3)
-- Fixed rounding error
-- Updated by [JayT](https://github.com/patchthecode).
-
-## [7.1.2](https://github.com/patchthecode/JTAppleCalendar/releases/tag/7.1.2)
-- Fixed rounding error - https://github.com/patchthecode/JTAppleCalendar/commit/c4059147f03695b66a044c16cc4f0ec67d87eae2
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [7.1.1](https://github.com/patchthecode/JTAppleCalendar/releases/tag/7.1.1)
-- Fixed errors - https://github.com/patchthecode/JTAppleCalendar/issues/598
-
-## [7.1.0](https://github.com/patchthecode/JTAppleCalendar/releases/tag/7.1.0)
-- Fixed errors.
-- Made library compatible with iOS8
-- CellState now informs if library made programatic vs user selected tap on cell
-
-## [7.0.6](https://github.com/patchthecode/JTAppleCalendar/releases/tag/7.0.6)
-- [bug fix - accidentaly introduced in 7.0.5](https://github.com/patchthecode/JTAppleCalendar/commit/7f60c8c5b2265954ad0041ac4f150c6f4862cdb7)
-- Other code cleanup
- - Updated by [JayT](https://github.com/patchthecode).
- - Updated by [mayurdzk](https://github.com/mayurdzk).
- - Updated by [mgurreta](https://github.com/mgurreta).
-
-## [7.0.5](https://github.com/patchthecode/JTAppleCalendar/releases/tag/7.0.5)
-- [bug fix](https://github.com/patchthecode/JTAppleCalendar/commit/bcbb2bc5696cb2f15a6e87e1023c3a9cdf3dfdff)
-- [added anchor dates on reload](https://github.com/patchthecode/JTAppleCalendar/commit/b81158dfd7600e1d31143be4fbfba32af2187253)
- - Sometimes on reload you do not want to see scrolling. Anchor dates solved that problem.
-- [Fixed double reloading of calendar](https://github.com/patchthecode/JTAppleCalendar/commit/05c6f518de9484d19faba2ae2f7fba2ffb8e9cba)
-- [Fixed crash when resizing from zero height/width](https://github.com/patchthecode/JTAppleCalendar/commit/765d919bb91fa3817d79d78f735bee0b720f3ba3)
-- [Added function to get month data](https://github.com/patchthecode/JTAppleCalendar/commit/502d53d7a815f93e099bb2b81b4c4b6e125b26bb)
-
-## [7.0.4](https://github.com/patchthecode/JTAppleCalendar/releases/tag/7.0.4)
-- [Function signature change to fix issue on shouldSelect/shouldDeselect function](https://github.com/patchthecode/JTAppleCalendar/commit/64b2bd1aa8ecab97c8a2bc92020724e97702887a)
-- Reverted unavailability of isSelected on date cells.
-
-## [7.0.3](https://github.com/patchthecode/JTAppleCalendar/releases/tag/7.0.3)
-- [Changed order in which delegates are called](https://github.com/patchthecode/JTAppleCalendar/issues/431)
-- [Fixed recursive loop error](https://github.com/patchthecode/JTAppleCalendar/commit/e95ec9806ef932a619329b3f40062ad125b4a17e)
-- [Potential crash fix. Incorrectly used statdard function instead of custom](https://github.com/patchthecode/JTAppleCalendar/commit/3cbfab2382ccb7168a5c22e0081504f43d0d76e6)
-- [ShouldSelect should be called on programatic selection](https://github.com/patchthecode/JTAppleCalendar/commit/4f528d17842848bf3cca4b80ce2fb89958caf614)
-
-## [7.0.2](https://github.com/patchthecode/JTAppleCalendar/releases/tag/7.0.2)
-- [Fixed visible scrolling issue](https://github.com/patchthecode/JTAppleCalendar/issues/263)
-- Added check if dev forcefully calls layoutIfNeeded(). Layout should be re-created.
-
-## [7.0.1](https://github.com/patchthecode/JTAppleCalendar/releases/tag/7.0.1)
-- Quickfix for Charthage users. Correct header file was included.
-
-## [7.0.0](https://github.com/patchthecode/JTAppleCalendar/releases/tag/7.0.0)
-- Massive changes and minor bug fixes
- - JTAppleCalendar is now a UICollectionView subclass and can be designed on interface builder.
- - Months sections distance is now configurable
- - [Scroll to date can now be done with an offset](https://github.com/patchthecode/JTAppleCalendar/issues/332)
- - [Decoration-views added](https://github.com/patchthecode/JTAppleCalendar/issues/296). You can now design the calendar with whatever view you choose
- - Performance load time of dates has been decreased
- - [Visible fixed](https://github.com/patchthecode/JTAppleCalendar/issues/263)
-
-## [6.1.6](https://github.com/patchthecode/JTAppleCalendar/releases/tag/6.1.6)
-- Fixed - [Memory leak](https://github.com/patchthecode/JTAppleCalendar/issues/333)
-- Fixed - [Over scrolling in vertical mode when scrolled to last date](https://github.com/patchthecode/JTAppleCalendar/issues/344)
-
-## [6.1.5](https://github.com/patchthecode/JTAppleCalendar/releases/tag/6.1.5)
-- Fixed - [Crash on reloading items](https://github.com/patchthecode/JTAppleCalendar/issues/327)
-
-## [6.1.4](https://github.com/patchthecode/JTAppleCalendar/releases/tag/6.1.4)
-- Fixed - [Crash in speific regions](https://github.com/patchthecode/JTAppleCalendar/issues/323)
-- Fixed - [Scroll to date delegate not called. New introduced bug](https://github.com/patchthecode/JTAppleCalendar/issues/325)
-
-## [6.1.3](https://github.com/patchthecode/JTAppleCalendar/releases/tag/6.1.3)
-- Fixed - [Incorrect selected position](https://github.com/patchthecode/JTAppleCalendar/issues/280) when using range selection.
-- Behavior change - Changing the frame size no longer automatically reloads the calendar. This should explicitly be done by the developer.
-- Fixed error - [Reloading cells asynchronously](https://github.com/patchthecode/JTAppleCalendar/issues/304) which caused two errors [here](https://github.com/patchthecode/JTAppleCalendar/issues/304) and [here](https://github.com/patchthecode/JTAppleCalendar/issues/277) - JayT
-- Fixed error - [Last saved offset fixed programatically](https://github.com/patchthecode/JTAppleCalendar/pull/276) - by [KyleConway](https://github.com/KyleConway)
-- Fixed error - [visibleDates() function should exclude headers](https://github.com/patchthecode/JTAppleCalendar/pull/278) - by [KyleConway](https://github.com/KyleConway)
-
-## [6.1.2](https://github.com/patchthecode/JTAppleCalendar/releases/tag/6.1.2)
-- Fixed error - deselect all dates should work as expected
-- Fixed error - Introduced in last version. DidScroll delegate was not being called.
-- Fixed error - Vertical calendar was not being displayed correctly in some configurations.
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [6.1.1](https://github.com/patchthecode/JTAppleCalendar/releases/tag/6.1.1)
-- Documentation updates
-
-## [6.1.0](https://github.com/patchthecode/JTAppleCalendar/releases/tag/6.1.0)
-- [Fixed error - triggerScrollToDateDelegate was not called](https://github.com/patchthecode/JTAppleCalendar/issues/235)
-- [Fixed error introduced in last version - scroll To date broke](https://github.com/patchthecode/JTAppleCalendar/issues/223)
-- Performance updates
-- Behavior change - [Library will now honour time zones based on Calenda() instance](https://github.com/patchthecode/JTAppleCalendar/issues/222)
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [6.0.5](https://github.com/patchthecode/JTAppleCalendar/releases/tag/6.0.5)
-- [Floating point error fix](https://github.com/patchthecode/JTAppleCalendar/issues/211)
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [6.0.4](https://github.com/patchthecode/JTAppleCalendar/releases/tag/6.0.4)
-- [Fixed wrong date bug](https://github.com/patchthecode/JTAppleCalendar/commit/1689586c70e2fbd9785794c4fc8c5f094403e98f)
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [6.0.3](https://github.com/patchthecode/JTAppleCalendar/releases/tag/6.0.3)
-- [Fixed wrong date bug](https://github.com/patchthecode/JTAppleCalendar/issues/210)
-- Fixed Scrolling issues with new segment code
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [6.0.2](https://github.com/patchthecode/JTAppleCalendar/releases/tag/6.0.2)
-- Fixed error: [Cells are not updated properly because of pre-fetching](https://github.com/patchthecode/JTAppleCalendar/issues/196)
-- New Feature: Gesture functionality added
-- Fixed error: [Fix for vertical direction](https://github.com/patchthecode/JTAppleCalendar/commit/4d48c594e00864dbe470dc64dbfd2e8790dbe783)
-- Fixed error: [Vertical cell size](https://github.com/patchthecode/JTAppleCalendar/commit/8e85b784bfe5ff8669157f42aee17aaee99a9429)
-- Fixed error: [Reload data completionhandler does not work when view is first loaded](https://github.com/patchthecode/JTAppleCalendar/commit/da0a0ad9b22b6e50fa2feec644afaa6902ad4a5e)
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [6.0.1](https://github.com/patchthecode/JTAppleCalendar/releases/tag/6.0.1)
-- Fixed error: [Left over artifacts](https://github.com/patchthecode/JTAppleCalendar/commit/f5be1e1c281cb08337ede276403311b3ee4a4e9f)
-- Fixed error: [Potential infinite loop on scrollViewDidEnd](https://github.com/patchthecode/JTAppleCalendar/commit/a115ff9301118fd93ab8ed960ba33ebeb28b8f7b)
-- Update: [Changed variable names for consistency](https://github.com/patchthecode/JTAppleCalendar/commit/3eca0fddc79a6425c146b65aabd2ff31b0c0d05d)
-- Update: [Added functionality to flip calendar horizontally for ethnic calendars](https://github.com/patchthecode/JTAppleCalendar/commit/a991b898a2ce5bc3a678bcf0b43a8e381e56a840)
-- Update: `ConfigureCaneldar` function signature has changed.
-- Fixed error: [XCode 8.1 has a bug](https://github.com/patchthecode/JTAppleCalendar/commit/97363897006877b62ebfb357cb98160a1b5b291b). So a work around was implemented
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [6.0.0](https://github.com/patchthecode/JTAppleCalendar/releases/tag/6.0.0)
-- Added functionality to get dateCell by CGPoint
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [6.0.0-beta.1](https://github.com/patchthecode/JTAppleCalendar/releases/tag/6.0.0-beta.1)
-- Made function names more standardised
-- Added ability enable/disable in-dates/out-dates generation
-- Added ability to choose buldle for xib files
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [5.0.1](https://github.com/patchthecode/JTAppleCalendar/releases/tag/5.0.1)
-- Bug Fix: [Crash on negative scroll in vertical mode](https://github.com/patchthecode/JTAppleCalendar/issues/115)
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [5.0.0](https://github.com/patchthecode/JTAppleCalendar/releases/tag/5.0.0)
-- Bug Fix: [Double calling of delegate method on finger lift](https://github.com/patchthecode/JTAppleCalendar/issues/102)
-- Bug Fix: [Delegate call fixed when user scrolls to top using status bar](https://github.com/patchthecode/JTAppleCalendar/issues/89)
-- Bug Fix: [Crash when calenader switched to single row](https://github.com/patchthecode/JTAppleCalendar/issues/111)
-- Update: Added range selection
-- Update: [Deprecations](https://github.com/patchthecode/JTAppleCalendar/wiki/Message-to-testers-working-on-master-branch)
-- Update: JTApplecalendar now works for tvOS
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [4.1.4](https://github.com/patchthecode/JTAppleCalendar/releases/tag/4.1.4)
-- Bug Fixes: [Scroll to section bug introduced](https://github.com/patchthecode/JTAppleCalendar/issues/96)
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [4.1.3](https://github.com/patchthecode/JTAppleCalendar/releases/tag/4.1.3)
-- Added missing functionality: To give dev a chance to clean up the cell before being reused.
-- Added missing functionality: Headers can now be registered using classes.
-- Bug Fixes: [Crash when using multiplel instance of JTAppleCalendar](https://github.com/patchthecode/JTAppleCalendar/issues/75)
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [4.1.2](https://github.com/patchthecode/JTAppleCalendar/releases/tag/4.1.1)
-- Fixed issue: removed forced unwrapping of date on deselection. [Caused crash](https://github.com/patchthecode/JTAppleCalendar/issues/69)
-- Fixed issue: on reloading index paths, removed dupicates. Caused visual glitch.
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [4.1.1](https://github.com/patchthecode/JTAppleCalendar/releases/tag/4.1.1)
-- Fixed issue: Various bug fixes and enhancements
- - [Days of the week can now be used in calculations]()
- - [Cells cannot be decelected sometimes](https://github.com/patchthecode/JTAppleCalendar/issues/67)
- - [Bug on multiple selection](https://github.com/patchthecode/JTAppleCalendar/issues/64)
- - [Bug when 2 months are displayed](https://github.com/patchthecode/JTAppleCalendar/issues/63)
- - performance fix
-- Added functoin to generate dates and select date range
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [4.1.0](https://github.com/patchthecode/JTAppleCalendar/releases/tag/4.1.0)
-- Feature Added: Devs can now configure the width and height of a dateCell.
-- Fixed issue: Synchonization issues on calendar start
-- Fixed issue: Fixed layout [Bug](https://github.com/patchthecode/JTAppleCalendar/issues/57)
-- performance fixes
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [4.0.3](https://github.com/patchthecode/JTAppleCalendar/releases/tag/4.0.3)
-- Fixed issue: Performance fixes - Library should work smooth on an iPhone 4s
-- Fixed issue: Scroll to segments were not calling completion handlers
-- Fixed issue: Added fix for device orientation
-- Added missing functionality: Devs can now register cells by type
- - Updated by [JayT](https://github.com/patchthecode).
- - Fix added by: [Baptiste Sansierra](https://github.com/patchthecode/JTAppleCalendar/pull/48)
- - Functionality added by: [Encero](https://github.com/patchthecode/JTAppleCalendar/pull/49)
-
-## [4.0.2](https://github.com/patchthecode/JTAppleCalendar/releases/tag/4.0.2)
-- Fixed issue: Layout issue in 4.0.1.
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [4.0.1](https://github.com/patchthecode/JTAppleCalendar/releases/tag/4.0.1)
-- Fixed issue: Performance fixes
-- Fixed issue: Layout issues
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [4.0.0](https://github.com/patchthecode/JTAppleCalendar/releases/tag/4.0.0)
-- Fixed issue: Performance fixes
-- Fixed issue: Changed way numberOfRows is configured. New way solves concurrency issues
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [3.0.1](https://github.com/patchthecode/JTAppleCalendar/releases/tag/3.0.1)
-- Fixed issue: Cell Inset was borken with 3.0.0 release
-- Fixed issue: canSelectDate always returned true.
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [3.0.0](https://github.com/patchthecode/JTAppleCalendar/releases/tag/3.0.0)
-- Fixed: Issue [#20](https://github.com/patchthecode/JTAppleCalendar/issues/20). Layout should be set to needsUpdate when firstDayOfWeek changes
-- Update: Issue [#19](https://github.com/patchthecode/JTAppleCalendar/issues/19). DidScroll delegate will now only get called when user scolls. This makes clear system actions vs user actions.
-- Fixed: Issue [#18](https://github.com/patchthecode/JTAppleCalendar/issues/18). Selecting out-dates now also select their date counterparts.
-- Update: Issue [#16](https://github.com/patchthecode/JTAppleCalendar/issues/16). Headers are now added to the project.
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [2.1.2](https://github.com/patchthecode/JTAppleCalendar/releases/tag/2.1.2)
-- Fixed: When selecting date with delegates disabled, calendar shifted to month offset. This was due to the newly added smooth scrolling feature
-- Update: The CellState for a date now returns more information. It now returns (added to its previous info) a date and a day.
-- Update: New function added so user can query the visible dateCells on the screen: cellStatusForDateAtRow(_: Int, column: Int)
-- Update: With paging disbled, the scrolling now snaps to day
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [2.1.1](https://github.com/patchthecode/JTAppleCalendar/releases/tag/2.1.1)
-- Crash on using NSDate() without a formatter for date ranges [Issue 11](https://github.com/patchthecode/JTAppleCalendar/issues/11)
- - Updated by [JayT](https://github.com/patchthecode).
-
-## [2.1.0](https://github.com/patchthecode/JTAppleCalendar/releases/tag/2.1.0)
-- Calendar paging is now an option
-- Scroll to date method will now scroll to a date if paging is set to off. [Issue 10](https://github.com/patchthecode/JTAppleCalendar/issues/10)
- - Updated by [JayT](https://github.com/patchthecode).
-
-
-## [2.0.3](https://github.com/patchthecode/JTAppleCalendar/releases/tag/2.0.3)
-- Fixed visual bug. Now there should be no flickering when scrolling dates.
-- Updated sample code
- - Updated by [JayT](https://github.com/patchthecode).
-
-
-## [2.0.2](https://github.com/patchthecode/JTAppleCalendar/releases/tag/2.0.2)
-- Added functionality to not trigger delegates on selecting dates
-- Updated sample code
- - Updated by [JayT](https://github.com/patchthecode).
-
-
-## [2.0.1](https://github.com/patchthecode/JTAppleCalendar/releases/tag/2.0.0)
-- Added function to handle date selection in Arrays
- - Updated by [JayT](https://github.com/patchthecode).
-
-
-## [2.0.0](https://github.com/patchthecode/JTAppleCalendar/releases/tag/2.0.0)
-Released on 2016-04-5. All issues associated with this milestone can be found using this
-[filter](https://github.com/patchthecode/JTAppleCalendar/milestones/Obvious%20things%20that%20were%20missed%20in%20Initial%20Coding)
-
-#### Updated
-- fixed date selection method.
-- made didSelectDate function return an optional object. The value can be nil if the selected date is off the screen.
- - Updated by [JayT](https://github.com/patchthecode).
-
-
-## [1.1.1](https://github.com/patchthecode/JTAppleCalendar/releases/tag/1.1.1)
-Released on 2016-03-20.
-
-#### Updated
-- Updated packages
-- Updated by [JayT](https://github.com/patchthecode).
-
-
-## [1.1.0](https://github.com/patchthecode/JTAppleCalendar/releases/tag/1.1.0)
-Released on 2016-03-28.
-
-#### Updated
-- Added functionality to query current date section
-- Calendar-view now reloads on datasource change
- - Updated by [JayT](https://github.com/patchthecode).
-
-
-## [1.0.0](https://github.com/patchthecode/JTAppleCalendar/releases/tag/1.0.0)
-Released on 2016-03-27.
-
-#### Added
-- Initial release of JTAppleCalendar.
- - Added by [JayT](https://github.com/patchthecode).
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index 8894b62e..00000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,2 +0,0 @@
-> [!CAUTION]
-> This document has not been written yet. Please consider submitting a PR to help out
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 00000000..109959e8
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,24 @@
+source "https://rubygems.org"
+ruby RUBY_VERSION
+
+# Hello! This is where you manage which Jekyll version is used to run.
+# When you want to use a different version, change it below, save the
+# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
+#
+# bundle exec jekyll serve
+#
+# This will help ensure the proper Jekyll version is running.
+# Happy Jekylling!
+gem "jekyll", "3.2.1"
+
+# This is the default theme for new Jekyll sites. You may change this to anything you like.
+gem "minima"
+
+# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
+# uncomment the line below. To upgrade, run `bundle update github-pages`.
+# gem "github-pages", group: :jekyll_plugins
+
+# If you have any plugins, put them here!
+# group :jekyll_plugins do
+# gem "jekyll-github-metadata", "~> 1.0"
+# end
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644
index 00000000..94088ecd
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,48 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ colorator (1.1.0)
+ ffi (1.9.14)
+ forwardable-extended (2.6.0)
+ jekyll (3.2.1)
+ colorator (~> 1.0)
+ jekyll-sass-converter (~> 1.0)
+ jekyll-watch (~> 1.1)
+ kramdown (~> 1.3)
+ liquid (~> 3.0)
+ mercenary (~> 0.3.3)
+ pathutil (~> 0.9)
+ rouge (~> 1.7)
+ safe_yaml (~> 1.0)
+ jekyll-sass-converter (1.4.0)
+ sass (~> 3.4)
+ jekyll-watch (1.5.0)
+ listen (~> 3.0, < 3.1)
+ kramdown (1.12.0)
+ liquid (3.0.6)
+ listen (3.0.8)
+ rb-fsevent (~> 0.9, >= 0.9.4)
+ rb-inotify (~> 0.9, >= 0.9.7)
+ mercenary (0.3.6)
+ minima (1.2.0)
+ pathutil (0.14.0)
+ forwardable-extended (~> 2.6)
+ rb-fsevent (0.9.7)
+ rb-inotify (0.9.7)
+ ffi (>= 0.5.0)
+ rouge (1.11.1)
+ safe_yaml (1.0.4)
+ sass (3.4.22)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ jekyll (= 3.2.1)
+ minima
+
+RUBY VERSION
+ ruby 2.0.0p648
+
+BUNDLED WITH
+ 1.13.2
diff --git a/JTAppleCalendar.podspec b/JTAppleCalendar.podspec
deleted file mode 100644
index c867c682..00000000
--- a/JTAppleCalendar.podspec
+++ /dev/null
@@ -1,23 +0,0 @@
-Pod::Spec.new do |s|
- s.name = "JTAppleCalendar"
- s.version = "8.0.5"
- s.summary = "The Unofficial Swift Apple Calendar Library. View. Control. for iOS & tvOS"
- s.description = <<-DESC
-A highly configurable Apple calendar control. Contains features like boundary dates, month and week view. Very light weight.
- DESC
-
- s.homepage = "https://patchthecode.com"
- # s.screenshots = "https://patchthecode.github.io/"
- s.license = 'MIT'
- s.author = { "JayT" => "patchthecode@gmail.com" }
- s.source = { :git => "https://github.com/patchthecode/JTAppleCalendar.git", :tag => s.version.to_s }
-
- s.swift_version = '5'
-
- s.ios.deployment_target = '11.0'
- s.tvos.deployment_target = '11.0'
-
- s.source_files = 'Sources/JTAppleCalendar/*.swift'
- s.resource_bundles = {'JTAppleCalendar' => ['Sources/JTAppleCalendar/PrivacyInfo.xcprivacy']}
-end
-
diff --git a/JTAppleCalendar.xcodeproj/project.pbxproj b/JTAppleCalendar.xcodeproj/project.pbxproj
deleted file mode 100644
index 9fd26ba3..00000000
--- a/JTAppleCalendar.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,434 +0,0 @@
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 50;
- objects = {
-
-/* Begin PBXBuildFile section */
- 3B8DA771233A359100A95526 /* JTACMonthReusableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA758233A358F00A95526 /* JTACMonthReusableView.swift */; };
- 3B8DA772233A359100A95526 /* JTACYearViewProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA759233A358F00A95526 /* JTACYearViewProtocols.swift */; };
- 3B8DA773233A359100A95526 /* JTACMonthView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA75A233A359000A95526 /* JTACMonthView.swift */; };
- 3B8DA774233A359100A95526 /* CalendarStructs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA75B233A359000A95526 /* CalendarStructs.swift */; };
- 3B8DA775233A359100A95526 /* JTACMonthActionFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA75C233A359000A95526 /* JTACMonthActionFunctions.swift */; };
- 3B8DA776233A359100A95526 /* JTACMonthLayoutProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA75D233A359000A95526 /* JTACMonthLayoutProtocol.swift */; };
- 3B8DA777233A359100A95526 /* JTACInteractionYearFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA75E233A359000A95526 /* JTACInteractionYearFunctions.swift */; };
- 3B8DA778233A359100A95526 /* JTACYearView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA75F233A359000A95526 /* JTACYearView.swift */; };
- 3B8DA779233A359100A95526 /* JTAppleCalendar.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B8DA760233A359000A95526 /* JTAppleCalendar.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 3B8DA77A233A359100A95526 /* JTACMonthLayoutVerticalCalendar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA761233A359000A95526 /* JTACMonthLayoutVerticalCalendar.swift */; };
- 3B8DA77B233A359100A95526 /* JTACMonthDelegateProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA762233A359000A95526 /* JTACMonthDelegateProtocol.swift */; };
- 3B8DA77C233A359100A95526 /* JTACDayCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA763233A359000A95526 /* JTACDayCell.swift */; };
- 3B8DA77D233A359100A95526 /* JTACMonthLayoutHorizontalCalendar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA764233A359000A95526 /* JTACMonthLayoutHorizontalCalendar.swift */; };
- 3B8DA77E233A359100A95526 /* JTACMonthViewProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA765233A359000A95526 /* JTACMonthViewProtocols.swift */; };
- 3B8DA77F233A359100A95526 /* JTACCollectionMonthViewDelegates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA766233A359000A95526 /* JTACCollectionMonthViewDelegates.swift */; };
- 3B8DA780233A359100A95526 /* GlobalFunctionsAndExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA767233A359000A95526 /* GlobalFunctionsAndExtensions.swift */; };
- 3B8DA781233A359100A95526 /* JTACInteractionMonthFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA768233A359000A95526 /* JTACInteractionMonthFunctions.swift */; };
- 3B8DA782233A359100A95526 /* JTACScrollViewDelegates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA769233A359000A95526 /* JTACScrollViewDelegates.swift */; };
- 3B8DA784233A359100A95526 /* JTACCollectionYearViewDelegates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA76B233A359000A95526 /* JTACCollectionYearViewDelegates.swift */; };
- 3B8DA785233A359100A95526 /* JTACMonthCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA76C233A359000A95526 /* JTACMonthCell.swift */; };
- 3B8DA786233A359100A95526 /* JTACMonthLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA76D233A359000A95526 /* JTACMonthLayout.swift */; };
- 3B8DA787233A359100A95526 /* CalendarEnums.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA76E233A359000A95526 /* CalendarEnums.swift */; };
- 3B8DA788233A359100A95526 /* JTACMonthQueryFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA76F233A359000A95526 /* JTACMonthQueryFunctions.swift */; };
- 3B8DA789233A359100A95526 /* JTACVariables.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8DA770233A359100A95526 /* JTACVariables.swift */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXFileReference section */
- 3B8DA758233A358F00A95526 /* JTACMonthReusableView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JTACMonthReusableView.swift; path = Sources/JTAppleCalendar/JTACMonthReusableView.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA759233A358F00A95526 /* JTACYearViewProtocols.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JTACYearViewProtocols.swift; path = Sources/JTAppleCalendar/JTACYearViewProtocols.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA75A233A359000A95526 /* JTACMonthView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JTACMonthView.swift; path = Sources/JTAppleCalendar/JTACMonthView.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA75B233A359000A95526 /* CalendarStructs.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CalendarStructs.swift; path = Sources/JTAppleCalendar/CalendarStructs.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA75C233A359000A95526 /* JTACMonthActionFunctions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JTACMonthActionFunctions.swift; path = Sources/JTAppleCalendar/JTACMonthActionFunctions.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA75D233A359000A95526 /* JTACMonthLayoutProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JTACMonthLayoutProtocol.swift; path = Sources/JTAppleCalendar/JTACMonthLayoutProtocol.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA75E233A359000A95526 /* JTACInteractionYearFunctions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JTACInteractionYearFunctions.swift; path = Sources/JTAppleCalendar/JTACInteractionYearFunctions.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA75F233A359000A95526 /* JTACYearView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JTACYearView.swift; path = Sources/JTAppleCalendar/JTACYearView.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA760233A359000A95526 /* JTAppleCalendar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JTAppleCalendar.h; path = Sources/JTAppleCalendar/JTAppleCalendar.h; sourceTree = SOURCE_ROOT; };
- 3B8DA761233A359000A95526 /* JTACMonthLayoutVerticalCalendar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JTACMonthLayoutVerticalCalendar.swift; path = Sources/JTAppleCalendar/JTACMonthLayoutVerticalCalendar.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA762233A359000A95526 /* JTACMonthDelegateProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JTACMonthDelegateProtocol.swift; path = Sources/JTAppleCalendar/JTACMonthDelegateProtocol.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA763233A359000A95526 /* JTACDayCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JTACDayCell.swift; path = Sources/JTAppleCalendar/JTACDayCell.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA764233A359000A95526 /* JTACMonthLayoutHorizontalCalendar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JTACMonthLayoutHorizontalCalendar.swift; path = Sources/JTAppleCalendar/JTACMonthLayoutHorizontalCalendar.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA765233A359000A95526 /* JTACMonthViewProtocols.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JTACMonthViewProtocols.swift; path = Sources/JTAppleCalendar/JTACMonthViewProtocols.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA766233A359000A95526 /* JTACCollectionMonthViewDelegates.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JTACCollectionMonthViewDelegates.swift; path = Sources/JTAppleCalendar/JTACCollectionMonthViewDelegates.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA767233A359000A95526 /* GlobalFunctionsAndExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GlobalFunctionsAndExtensions.swift; path = Sources/JTAppleCalendar/GlobalFunctionsAndExtensions.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA768233A359000A95526 /* JTACInteractionMonthFunctions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JTACInteractionMonthFunctions.swift; path = Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA769233A359000A95526 /* JTACScrollViewDelegates.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JTACScrollViewDelegates.swift; path = Sources/JTAppleCalendar/JTACScrollViewDelegates.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA76A233A359000A95526 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; name = Info.plist; path = Sources/JTAppleCalendar/Info.plist; sourceTree = SOURCE_ROOT; };
- 3B8DA76B233A359000A95526 /* JTACCollectionYearViewDelegates.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JTACCollectionYearViewDelegates.swift; path = Sources/JTAppleCalendar/JTACCollectionYearViewDelegates.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA76C233A359000A95526 /* JTACMonthCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JTACMonthCell.swift; path = Sources/JTAppleCalendar/JTACMonthCell.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA76D233A359000A95526 /* JTACMonthLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JTACMonthLayout.swift; path = Sources/JTAppleCalendar/JTACMonthLayout.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA76E233A359000A95526 /* CalendarEnums.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CalendarEnums.swift; path = Sources/JTAppleCalendar/CalendarEnums.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA76F233A359000A95526 /* JTACMonthQueryFunctions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JTACMonthQueryFunctions.swift; path = Sources/JTAppleCalendar/JTACMonthQueryFunctions.swift; sourceTree = SOURCE_ROOT; };
- 3B8DA770233A359100A95526 /* JTACVariables.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JTACVariables.swift; path = Sources/JTAppleCalendar/JTACVariables.swift; sourceTree = SOURCE_ROOT; };
- 3BE7994F233A346B00A37CA8 /* JTAppleCalendar.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = JTAppleCalendar.framework; sourceTree = BUILT_PRODUCTS_DIR; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
- 3BE7994C233A346B00A37CA8 /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
- 3BE79945233A346B00A37CA8 = {
- isa = PBXGroup;
- children = (
- 3BE79951233A346B00A37CA8 /* JTAppleCalendar */,
- 3BE79950233A346B00A37CA8 /* Products */,
- );
- sourceTree = "";
- };
- 3BE79950233A346B00A37CA8 /* Products */ = {
- isa = PBXGroup;
- children = (
- 3BE7994F233A346B00A37CA8 /* JTAppleCalendar.framework */,
- );
- name = Products;
- sourceTree = "";
- };
- 3BE79951233A346B00A37CA8 /* JTAppleCalendar */ = {
- isa = PBXGroup;
- children = (
- 3B8DA76E233A359000A95526 /* CalendarEnums.swift */,
- 3B8DA75B233A359000A95526 /* CalendarStructs.swift */,
- 3B8DA767233A359000A95526 /* GlobalFunctionsAndExtensions.swift */,
- 3B8DA76A233A359000A95526 /* Info.plist */,
- 3B8DA766233A359000A95526 /* JTACCollectionMonthViewDelegates.swift */,
- 3B8DA76B233A359000A95526 /* JTACCollectionYearViewDelegates.swift */,
- 3B8DA763233A359000A95526 /* JTACDayCell.swift */,
- 3B8DA768233A359000A95526 /* JTACInteractionMonthFunctions.swift */,
- 3B8DA75E233A359000A95526 /* JTACInteractionYearFunctions.swift */,
- 3B8DA75C233A359000A95526 /* JTACMonthActionFunctions.swift */,
- 3B8DA76C233A359000A95526 /* JTACMonthCell.swift */,
- 3B8DA762233A359000A95526 /* JTACMonthDelegateProtocol.swift */,
- 3B8DA76D233A359000A95526 /* JTACMonthLayout.swift */,
- 3B8DA764233A359000A95526 /* JTACMonthLayoutHorizontalCalendar.swift */,
- 3B8DA75D233A359000A95526 /* JTACMonthLayoutProtocol.swift */,
- 3B8DA761233A359000A95526 /* JTACMonthLayoutVerticalCalendar.swift */,
- 3B8DA76F233A359000A95526 /* JTACMonthQueryFunctions.swift */,
- 3B8DA758233A358F00A95526 /* JTACMonthReusableView.swift */,
- 3B8DA75A233A359000A95526 /* JTACMonthView.swift */,
- 3B8DA765233A359000A95526 /* JTACMonthViewProtocols.swift */,
- 3B8DA769233A359000A95526 /* JTACScrollViewDelegates.swift */,
- 3B8DA770233A359100A95526 /* JTACVariables.swift */,
- 3B8DA75F233A359000A95526 /* JTACYearView.swift */,
- 3B8DA759233A358F00A95526 /* JTACYearViewProtocols.swift */,
- 3B8DA760233A359000A95526 /* JTAppleCalendar.h */,
- );
- path = JTAppleCalendar;
- sourceTree = "";
- };
-/* End PBXGroup section */
-
-/* Begin PBXHeadersBuildPhase section */
- 3BE7994A233A346B00A37CA8 /* Headers */ = {
- isa = PBXHeadersBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 3B8DA779233A359100A95526 /* JTAppleCalendar.h in Headers */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXHeadersBuildPhase section */
-
-/* Begin PBXNativeTarget section */
- 3BE7994E233A346B00A37CA8 /* JTAppleCalendar */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = 3BE79957233A346B00A37CA8 /* Build configuration list for PBXNativeTarget "JTAppleCalendar" */;
- buildPhases = (
- 3BE7994A233A346B00A37CA8 /* Headers */,
- 3BE7994B233A346B00A37CA8 /* Sources */,
- 3BE7994C233A346B00A37CA8 /* Frameworks */,
- 3BE7994D233A346B00A37CA8 /* Resources */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = JTAppleCalendar;
- productName = JTAppleCalendar;
- productReference = 3BE7994F233A346B00A37CA8 /* JTAppleCalendar.framework */;
- productType = "com.apple.product-type.framework";
- };
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
- 3BE79946233A346B00A37CA8 /* Project object */ = {
- isa = PBXProject;
- attributes = {
- LastUpgradeCheck = 1100;
- ORGANIZATIONNAME = "Arnaud Boudou";
- TargetAttributes = {
- 3BE7994E233A346B00A37CA8 = {
- CreatedOnToolsVersion = 11.0;
- LastSwiftMigration = 1100;
- };
- };
- };
- buildConfigurationList = 3BE79949233A346B00A37CA8 /* Build configuration list for PBXProject "JTAppleCalendar" */;
- compatibilityVersion = "Xcode 9.3";
- developmentRegion = en;
- hasScannedForEncodings = 0;
- knownRegions = (
- en,
- Base,
- );
- mainGroup = 3BE79945233A346B00A37CA8;
- productRefGroup = 3BE79950233A346B00A37CA8 /* Products */;
- projectDirPath = "";
- projectRoot = "";
- targets = (
- 3BE7994E233A346B00A37CA8 /* JTAppleCalendar */,
- );
- };
-/* End PBXProject section */
-
-/* Begin PBXResourcesBuildPhase section */
- 3BE7994D233A346B00A37CA8 /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXResourcesBuildPhase section */
-
-/* Begin PBXSourcesBuildPhase section */
- 3BE7994B233A346B00A37CA8 /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 3B8DA77D233A359100A95526 /* JTACMonthLayoutHorizontalCalendar.swift in Sources */,
- 3B8DA787233A359100A95526 /* CalendarEnums.swift in Sources */,
- 3B8DA775233A359100A95526 /* JTACMonthActionFunctions.swift in Sources */,
- 3B8DA784233A359100A95526 /* JTACCollectionYearViewDelegates.swift in Sources */,
- 3B8DA77E233A359100A95526 /* JTACMonthViewProtocols.swift in Sources */,
- 3B8DA789233A359100A95526 /* JTACVariables.swift in Sources */,
- 3B8DA788233A359100A95526 /* JTACMonthQueryFunctions.swift in Sources */,
- 3B8DA771233A359100A95526 /* JTACMonthReusableView.swift in Sources */,
- 3B8DA777233A359100A95526 /* JTACInteractionYearFunctions.swift in Sources */,
- 3B8DA782233A359100A95526 /* JTACScrollViewDelegates.swift in Sources */,
- 3B8DA77C233A359100A95526 /* JTACDayCell.swift in Sources */,
- 3B8DA778233A359100A95526 /* JTACYearView.swift in Sources */,
- 3B8DA781233A359100A95526 /* JTACInteractionMonthFunctions.swift in Sources */,
- 3B8DA786233A359100A95526 /* JTACMonthLayout.swift in Sources */,
- 3B8DA773233A359100A95526 /* JTACMonthView.swift in Sources */,
- 3B8DA785233A359100A95526 /* JTACMonthCell.swift in Sources */,
- 3B8DA77F233A359100A95526 /* JTACCollectionMonthViewDelegates.swift in Sources */,
- 3B8DA77A233A359100A95526 /* JTACMonthLayoutVerticalCalendar.swift in Sources */,
- 3B8DA774233A359100A95526 /* CalendarStructs.swift in Sources */,
- 3B8DA776233A359100A95526 /* JTACMonthLayoutProtocol.swift in Sources */,
- 3B8DA772233A359100A95526 /* JTACYearViewProtocols.swift in Sources */,
- 3B8DA77B233A359100A95526 /* JTACMonthDelegateProtocol.swift in Sources */,
- 3B8DA780233A359100A95526 /* GlobalFunctionsAndExtensions.swift in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXSourcesBuildPhase section */
-
-/* Begin XCBuildConfiguration section */
- 3BE79955233A346B00A37CA8 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_ANALYZER_NONNULL = YES;
- CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_ARC = YES;
- CLANG_ENABLE_OBJC_WEAK = YES;
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
- CLANG_WARN_BOOL_CONVERSION = YES;
- CLANG_WARN_COMMA = YES;
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
- CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INFINITE_RECURSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
- CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
- CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
- CLANG_WARN_STRICT_PROTOTYPES = YES;
- CLANG_WARN_SUSPICIOUS_MOVE = YES;
- CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
- CLANG_WARN_UNREACHABLE_CODE = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 1;
- DEBUG_INFORMATION_FORMAT = dwarf;
- ENABLE_STRICT_OBJC_MSGSEND = YES;
- ENABLE_TESTABILITY = YES;
- GCC_C_LANGUAGE_STANDARD = gnu11;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_NO_COMMON_BLOCKS = YES;
- GCC_OPTIMIZATION_LEVEL = 0;
- GCC_PREPROCESSOR_DEFINITIONS = (
- "DEBUG=1",
- "$(inherited)",
- );
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
- GCC_WARN_UNDECLARED_SELECTOR = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 11.0;
- MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
- MTL_FAST_MATH = YES;
- ONLY_ACTIVE_ARCH = YES;
- SDKROOT = iphoneos;
- SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
- SWIFT_OPTIMIZATION_LEVEL = "-Onone";
- VERSIONING_SYSTEM = "apple-generic";
- VERSION_INFO_PREFIX = "";
- };
- name = Debug;
- };
- 3BE79956233A346B00A37CA8 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_ANALYZER_NONNULL = YES;
- CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_ARC = YES;
- CLANG_ENABLE_OBJC_WEAK = YES;
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
- CLANG_WARN_BOOL_CONVERSION = YES;
- CLANG_WARN_COMMA = YES;
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
- CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INFINITE_RECURSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
- CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
- CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
- CLANG_WARN_STRICT_PROTOTYPES = YES;
- CLANG_WARN_SUSPICIOUS_MOVE = YES;
- CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
- CLANG_WARN_UNREACHABLE_CODE = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 1;
- DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- ENABLE_NS_ASSERTIONS = NO;
- ENABLE_STRICT_OBJC_MSGSEND = YES;
- GCC_C_LANGUAGE_STANDARD = gnu11;
- GCC_NO_COMMON_BLOCKS = YES;
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
- GCC_WARN_UNDECLARED_SELECTOR = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 11.0;
- MTL_ENABLE_DEBUG_INFO = NO;
- MTL_FAST_MATH = YES;
- SDKROOT = iphoneos;
- SWIFT_COMPILATION_MODE = wholemodule;
- SWIFT_OPTIMIZATION_LEVEL = "-O";
- VALIDATE_PRODUCT = YES;
- VERSIONING_SYSTEM = "apple-generic";
- VERSION_INFO_PREFIX = "";
- };
- name = Release;
- };
- 3BE79958233A346B00A37CA8 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- CLANG_ENABLE_MODULES = YES;
- CODE_SIGN_STYLE = Manual;
- DEFINES_MODULE = YES;
- DEVELOPMENT_TEAM = "";
- DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 1;
- DYLIB_INSTALL_NAME_BASE = "@rpath";
- INFOPLIST_FILE = "$(SRCROOT)/Sources/JTAppleCalendar/Info.plist";
- INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
- IPHONEOS_DEPLOYMENT_TARGET = 11.0;
- LD_RUNPATH_SEARCH_PATHS = (
- "$(inherited)",
- "@executable_path/Frameworks",
- "@loader_path/Frameworks",
- );
- PRODUCT_BUNDLE_IDENTIFIER = com.patchthecode.JTAppleCalendar;
- PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
- PROVISIONING_PROFILE_SPECIFIER = "";
- SKIP_INSTALL = YES;
- SUPPORTS_MACCATALYST = NO;
- SWIFT_OPTIMIZATION_LEVEL = "-Onone";
- SWIFT_VERSION = 5.0;
- TARGETED_DEVICE_FAMILY = "1,2";
- };
- name = Debug;
- };
- 3BE79959233A346B00A37CA8 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- CLANG_ENABLE_MODULES = YES;
- CODE_SIGN_STYLE = Manual;
- DEFINES_MODULE = YES;
- DEVELOPMENT_TEAM = "";
- DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 1;
- DYLIB_INSTALL_NAME_BASE = "@rpath";
- INFOPLIST_FILE = "$(SRCROOT)/Sources/JTAppleCalendar/Info.plist";
- INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
- IPHONEOS_DEPLOYMENT_TARGET = 11.0;
- LD_RUNPATH_SEARCH_PATHS = (
- "$(inherited)",
- "@executable_path/Frameworks",
- "@loader_path/Frameworks",
- );
- PRODUCT_BUNDLE_IDENTIFIER = com.patchthecode.JTAppleCalendar;
- PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
- PROVISIONING_PROFILE_SPECIFIER = "";
- SKIP_INSTALL = YES;
- SUPPORTS_MACCATALYST = NO;
- SWIFT_VERSION = 5.0;
- TARGETED_DEVICE_FAMILY = "1,2";
- };
- name = Release;
- };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
- 3BE79949233A346B00A37CA8 /* Build configuration list for PBXProject "JTAppleCalendar" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 3BE79955233A346B00A37CA8 /* Debug */,
- 3BE79956233A346B00A37CA8 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- 3BE79957233A346B00A37CA8 /* Build configuration list for PBXNativeTarget "JTAppleCalendar" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 3BE79958233A346B00A37CA8 /* Debug */,
- 3BE79959233A346B00A37CA8 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
-/* End XCConfigurationList section */
- };
- rootObject = 3BE79946233A346B00A37CA8 /* Project object */;
-}
diff --git a/JTAppleCalendar.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/JTAppleCalendar.xcodeproj/project.xcworkspace/contents.xcworkspacedata
deleted file mode 100644
index 4d4178d4..00000000
--- a/JTAppleCalendar.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
diff --git a/JTAppleCalendar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/JTAppleCalendar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
deleted file mode 100644
index 18d98100..00000000
--- a/JTAppleCalendar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
- IDEDidComputeMac32BitWarning
-
-
-
diff --git a/JTAppleCalendar.xcodeproj/xcshareddata/xcschemes/JTAppleCalendar.xcscheme b/JTAppleCalendar.xcodeproj/xcshareddata/xcschemes/JTAppleCalendar.xcscheme
deleted file mode 100644
index 082b53bd..00000000
--- a/JTAppleCalendar.xcodeproj/xcshareddata/xcschemes/JTAppleCalendar.xcscheme
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 678796d9..00000000
--- a/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2016 JayT
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/Package.swift b/Package.swift
deleted file mode 100644
index dd6ee33a..00000000
--- a/Package.swift
+++ /dev/null
@@ -1,25 +0,0 @@
-// swift-tools-version:5.3
-// The swift-tools-version declares the minimum version of Swift required to build this package.
-
-import PackageDescription
-
-let package = Package(
- name: "JTAppleCalendar",
- platforms: [
- .iOS(.v12),
- ],
- products: [
- .library(
- name: "JTAppleCalendar",
- targets: ["JTAppleCalendar"]),
- ],
- targets: [
- .target(
- name: "JTAppleCalendar",
- dependencies: [],
- resources: [.copy("PrivacyInfo.xcprivacy")]),
- .testTarget(
- name: "JTAppleCalendarTests",
- dependencies: ["JTAppleCalendar"]),
- ]
-)
diff --git a/README.md b/README.md
deleted file mode 100644
index 7ac9c899..00000000
--- a/README.md
+++ /dev/null
@@ -1,67 +0,0 @@
-[](https://github.com/patchthecode/JTAppleCalendar)
-
-[](http://cocoapods.org/pods/JTAppleCalendar) [](https://github.com/Carthage/Carthage) [](http://cocoapods.org/pods/JTAppleCalendar) [](http://cocoapods.org/pods/JTAppleCalendar) [](https://github.com/patchthecode/JTAppleCalendar/wiki/Support) [](#backers) [](#sponsors) [](https://www.codetriage.com/patchthecode/jtapplecalendar)
-
-#### Q: How will my calendar dateCells look with this library?
-
-**A**: However you want them to look.
-
-
-
-
-
-
-
- More Images
-
-
-## Features
-
----
-
-- [x] Range selection - select dates in a range. The design is entirely up to you.
-- [x] Boundary dates - limit the calendar date range
-- [x] [Week/month mode](./docs/switch-month-to-week-view/Switch%20between%20month-view%20and%20week-view.md) - show 1 row of weekdays. Or 2, 3 or 6
-- [x] Custom cells - make your day-cells look however you want, with any functionality you want
-- [x] Custom calendar view - make your calendar look however you want, with what ever functionality you want
-- [x] First Day of week - pick anyday to be first day of the week
-- [x] Horizontal or vertical mode
-- [x] Ability to add [month headers](./docs/headers/Headers.md) in varying sizes/styles of your liking
-- [x] Ability to scroll to any month by simply using the date
-- [x] Ability to design your calendar [however you want.](https://github.com/patchthecode/JTAppleCalendar/issues/2) You want it, you build it
-
----
-
-## How do I use this library?
-
-> [!WARNING]
-> The wiki currently links to an external site that is down. It is recommended to [view the docs](./docs/get-started/Get%20Started.md) at this time, but be aware they may not be up to date currently
-
-### >> [Read the wiki](https://github.com/patchthecode/JTAppleCalendar/wiki/Tutorials) for Tutorials and example code to download or [view the docs](./docs/get-started/Get%20Started.md)
-
-## [Version 8.0.0 migration guide](./docs/migration-guide/v8%20Migration%20Guide.md)
-
----
-
-## Sponsors
-
-Support this project by becoming a sponsor. Your logo will show up here with a link to your website.
-Want to become a sponsor? Send an email to patchthecode@gmail.com
-
-
-
-
-## Contributors
-
-This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
-
-
-## Backers
-
-Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/JTAppleCalendar#backer)]
-
-
-
-## License
-
-JTAppleCalendar is available under the MIT license. See the LICENSE file for more info.
diff --git a/SampleJTAppleCalendar.xcodeproj/project.pbxproj b/SampleJTAppleCalendar.xcodeproj/project.pbxproj
deleted file mode 100644
index d2dd99ef..00000000
--- a/SampleJTAppleCalendar.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,611 +0,0 @@
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 52;
- objects = {
-
-/* Begin PBXBuildFile section */
- 6B4E465422C202DD00D0F78E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B4E465322C202DD00D0F78E /* AppDelegate.swift */; };
- 6B4E465622C202DD00D0F78E /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B4E465522C202DD00D0F78E /* SceneDelegate.swift */; };
- 6B4E465D22C202DF00D0F78E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6B4E465C22C202DF00D0F78E /* Assets.xcassets */; };
- 6B4E466022C202DF00D0F78E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6B4E465E22C202DF00D0F78E /* LaunchScreen.storyboard */; };
- 6B4E468822C2150100D0F78E /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B4E468222C2150100D0F78E /* ViewController.swift */; };
- 6B4E468922C2150100D0F78E /* TestRangeSelectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B4E468322C2150100D0F78E /* TestRangeSelectionViewController.swift */; };
- 6B4E468A22C2150100D0F78E /* TestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B4E468422C2150100D0F78E /* TestViewController.swift */; };
- 6B4E468B22C2150100D0F78E /* TestOrientationChanges.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B4E468522C2150100D0F78E /* TestOrientationChanges.swift */; };
- 6B4E468C22C2150100D0F78E /* TestYearViewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B4E468622C2150100D0F78E /* TestYearViewViewController.swift */; };
- 6B4E468D22C2150100D0F78E /* TestPersianCalendar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B4E468722C2150100D0F78E /* TestPersianCalendar.swift */; };
- 6B4E469422C2151500D0F78E /* CodeCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B4E469022C2151500D0F78E /* CodeCellView.swift */; };
- 6B4E469522C2151500D0F78E /* CellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B4E469222C2151500D0F78E /* CellView.swift */; };
- 6B4E469622C2151500D0F78E /* CellView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6B4E469322C2151500D0F78E /* CellView.xib */; };
- 6B4E46A022C2151E00D0F78E /* CodeWhiteSectionHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B4E469922C2151E00D0F78E /* CodeWhiteSectionHeaderView.swift */; };
- 6B4E46A122C2151E00D0F78E /* CodePinkSectionHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B4E469A22C2151E00D0F78E /* CodePinkSectionHeaderView.swift */; };
- 6B4E46A222C2151E00D0F78E /* WhiteSectionHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B4E469C22C2151E00D0F78E /* WhiteSectionHeaderView.swift */; };
- 6B4E46A322C2151E00D0F78E /* PinkSectionHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6B4E469D22C2151E00D0F78E /* PinkSectionHeaderView.xib */; };
- 6B4E46A422C2151E00D0F78E /* PinkSectionHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B4E469E22C2151E00D0F78E /* PinkSectionHeaderView.swift */; };
- 6B4E46A522C2151E00D0F78E /* WhiteSectionHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6B4E469F22C2151E00D0F78E /* WhiteSectionHeaderView.xib */; };
- 6B4E46E622C2174C00D0F78E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6B4E46E522C2174C00D0F78E /* Main.storyboard */; };
- 6BBDD4DF22E3E7FF001BE4E0 /* JTAppleCalendar in Frameworks */ = {isa = PBXBuildFile; productRef = 6BBDD4DE22E3E7FF001BE4E0 /* JTAppleCalendar */; };
- 6BE6BE5C23807BA600148D6E /* SampleJTAppleCalendarUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BE6BE5B23807BA600148D6E /* SampleJTAppleCalendarUITests.swift */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXContainerItemProxy section */
- 6BE6BE5E23807BA600148D6E /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 6B4E464822C202DD00D0F78E /* Project object */;
- proxyType = 1;
- remoteGlobalIDString = 6B4E464F22C202DD00D0F78E;
- remoteInfo = SampleJTAppleCalendar;
- };
-/* End PBXContainerItemProxy section */
-
-/* Begin PBXFileReference section */
- 6B4E465022C202DD00D0F78E /* SampleJTAppleCalendar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SampleJTAppleCalendar.app; sourceTree = BUILT_PRODUCTS_DIR; };
- 6B4E465322C202DD00D0F78E /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
- 6B4E465522C202DD00D0F78E /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; };
- 6B4E465C22C202DF00D0F78E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
- 6B4E465F22C202DF00D0F78E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
- 6B4E466122C202DF00D0F78E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
- 6B4E466722C202FB00D0F78E /* JTAppleCalendar */ = {isa = PBXFileReference; lastKnownFileType = folder; name = JTAppleCalendar; path = ../JTAppleCalendar; sourceTree = ""; };
- 6B4E468222C2150100D0F78E /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
- 6B4E468322C2150100D0F78E /* TestRangeSelectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestRangeSelectionViewController.swift; sourceTree = ""; };
- 6B4E468422C2150100D0F78E /* TestViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestViewController.swift; sourceTree = ""; };
- 6B4E468522C2150100D0F78E /* TestOrientationChanges.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestOrientationChanges.swift; sourceTree = ""; };
- 6B4E468622C2150100D0F78E /* TestYearViewViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestYearViewViewController.swift; sourceTree = ""; };
- 6B4E468722C2150100D0F78E /* TestPersianCalendar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestPersianCalendar.swift; sourceTree = ""; };
- 6B4E469022C2151500D0F78E /* CodeCellView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodeCellView.swift; sourceTree = ""; };
- 6B4E469222C2151500D0F78E /* CellView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CellView.swift; sourceTree = ""; };
- 6B4E469322C2151500D0F78E /* CellView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CellView.xib; sourceTree = ""; };
- 6B4E469922C2151E00D0F78E /* CodeWhiteSectionHeaderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodeWhiteSectionHeaderView.swift; sourceTree = ""; };
- 6B4E469A22C2151E00D0F78E /* CodePinkSectionHeaderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodePinkSectionHeaderView.swift; sourceTree = ""; };
- 6B4E469C22C2151E00D0F78E /* WhiteSectionHeaderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WhiteSectionHeaderView.swift; sourceTree = ""; };
- 6B4E469D22C2151E00D0F78E /* PinkSectionHeaderView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PinkSectionHeaderView.xib; sourceTree = ""; };
- 6B4E469E22C2151E00D0F78E /* PinkSectionHeaderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PinkSectionHeaderView.swift; sourceTree = ""; };
- 6B4E469F22C2151E00D0F78E /* WhiteSectionHeaderView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = WhiteSectionHeaderView.xib; sourceTree = ""; };
- 6B4E46E522C2174C00D0F78E /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; };
- 6BE6BE5923807BA600148D6E /* SampleJTAppleCalendarUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SampleJTAppleCalendarUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
- 6BE6BE5B23807BA600148D6E /* SampleJTAppleCalendarUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleJTAppleCalendarUITests.swift; sourceTree = ""; };
- 6BE6BE5D23807BA600148D6E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
- 6B4E464D22C202DD00D0F78E /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 6BBDD4DF22E3E7FF001BE4E0 /* JTAppleCalendar in Frameworks */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- 6BE6BE5623807BA600148D6E /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
- 6B4E464722C202DD00D0F78E = {
- isa = PBXGroup;
- children = (
- 6B4E466722C202FB00D0F78E /* JTAppleCalendar */,
- 6B4E465222C202DD00D0F78E /* SampleJTAppleCalendar */,
- 6BE6BE5A23807BA600148D6E /* SampleJTAppleCalendarUITests */,
- 6B4E465122C202DD00D0F78E /* Products */,
- 6B4E466822C2032B00D0F78E /* Frameworks */,
- );
- sourceTree = "";
- };
- 6B4E465122C202DD00D0F78E /* Products */ = {
- isa = PBXGroup;
- children = (
- 6B4E465022C202DD00D0F78E /* SampleJTAppleCalendar.app */,
- 6BE6BE5923807BA600148D6E /* SampleJTAppleCalendarUITests.xctest */,
- );
- name = Products;
- sourceTree = "";
- };
- 6B4E465222C202DD00D0F78E /* SampleJTAppleCalendar */ = {
- isa = PBXGroup;
- children = (
- 6B4E46E522C2174C00D0F78E /* Main.storyboard */,
- 6B4E468122C2150100D0F78E /* Example Calendars */,
- 6B4E468E22C2151500D0F78E /* ExampleDateCells */,
- 6B4E469722C2151E00D0F78E /* ExampleSectionHeaders */,
- 6B4E465322C202DD00D0F78E /* AppDelegate.swift */,
- 6B4E465522C202DD00D0F78E /* SceneDelegate.swift */,
- 6B4E465C22C202DF00D0F78E /* Assets.xcassets */,
- 6B4E465E22C202DF00D0F78E /* LaunchScreen.storyboard */,
- 6B4E466122C202DF00D0F78E /* Info.plist */,
- );
- path = SampleJTAppleCalendar;
- sourceTree = "";
- };
- 6B4E466822C2032B00D0F78E /* Frameworks */ = {
- isa = PBXGroup;
- children = (
- );
- name = Frameworks;
- sourceTree = "";
- };
- 6B4E468122C2150100D0F78E /* Example Calendars */ = {
- isa = PBXGroup;
- children = (
- 6B4E468222C2150100D0F78E /* ViewController.swift */,
- 6B4E468322C2150100D0F78E /* TestRangeSelectionViewController.swift */,
- 6B4E468422C2150100D0F78E /* TestViewController.swift */,
- 6B4E468522C2150100D0F78E /* TestOrientationChanges.swift */,
- 6B4E468622C2150100D0F78E /* TestYearViewViewController.swift */,
- 6B4E468722C2150100D0F78E /* TestPersianCalendar.swift */,
- );
- path = "Example Calendars";
- sourceTree = "";
- };
- 6B4E468E22C2151500D0F78E /* ExampleDateCells */ = {
- isa = PBXGroup;
- children = (
- 6B4E468F22C2151500D0F78E /* DateCellCreatedWithCode */,
- 6B4E469122C2151500D0F78E /* DateCellCreatedWithXIB */,
- );
- path = ExampleDateCells;
- sourceTree = "";
- };
- 6B4E468F22C2151500D0F78E /* DateCellCreatedWithCode */ = {
- isa = PBXGroup;
- children = (
- 6B4E469022C2151500D0F78E /* CodeCellView.swift */,
- );
- path = DateCellCreatedWithCode;
- sourceTree = "";
- };
- 6B4E469122C2151500D0F78E /* DateCellCreatedWithXIB */ = {
- isa = PBXGroup;
- children = (
- 6B4E469222C2151500D0F78E /* CellView.swift */,
- 6B4E469322C2151500D0F78E /* CellView.xib */,
- );
- path = DateCellCreatedWithXIB;
- sourceTree = "";
- };
- 6B4E469722C2151E00D0F78E /* ExampleSectionHeaders */ = {
- isa = PBXGroup;
- children = (
- 6B4E469822C2151E00D0F78E /* HeaderAsClass */,
- 6B4E469B22C2151E00D0F78E /* HeaderAsXibs */,
- );
- path = ExampleSectionHeaders;
- sourceTree = "";
- };
- 6B4E469822C2151E00D0F78E /* HeaderAsClass */ = {
- isa = PBXGroup;
- children = (
- 6B4E469922C2151E00D0F78E /* CodeWhiteSectionHeaderView.swift */,
- 6B4E469A22C2151E00D0F78E /* CodePinkSectionHeaderView.swift */,
- );
- path = HeaderAsClass;
- sourceTree = "";
- };
- 6B4E469B22C2151E00D0F78E /* HeaderAsXibs */ = {
- isa = PBXGroup;
- children = (
- 6B4E469C22C2151E00D0F78E /* WhiteSectionHeaderView.swift */,
- 6B4E469D22C2151E00D0F78E /* PinkSectionHeaderView.xib */,
- 6B4E469E22C2151E00D0F78E /* PinkSectionHeaderView.swift */,
- 6B4E469F22C2151E00D0F78E /* WhiteSectionHeaderView.xib */,
- );
- path = HeaderAsXibs;
- sourceTree = "";
- };
- 6BE6BE5A23807BA600148D6E /* SampleJTAppleCalendarUITests */ = {
- isa = PBXGroup;
- children = (
- 6BE6BE5B23807BA600148D6E /* SampleJTAppleCalendarUITests.swift */,
- 6BE6BE5D23807BA600148D6E /* Info.plist */,
- );
- path = SampleJTAppleCalendarUITests;
- sourceTree = "";
- };
-/* End PBXGroup section */
-
-/* Begin PBXNativeTarget section */
- 6B4E464F22C202DD00D0F78E /* SampleJTAppleCalendar */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = 6B4E466422C202DF00D0F78E /* Build configuration list for PBXNativeTarget "SampleJTAppleCalendar" */;
- buildPhases = (
- 6B4E464C22C202DD00D0F78E /* Sources */,
- 6B4E464D22C202DD00D0F78E /* Frameworks */,
- 6B4E464E22C202DD00D0F78E /* Resources */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = SampleJTAppleCalendar;
- packageProductDependencies = (
- 6BBDD4DE22E3E7FF001BE4E0 /* JTAppleCalendar */,
- );
- productName = SampleJTAppleCalendar;
- productReference = 6B4E465022C202DD00D0F78E /* SampleJTAppleCalendar.app */;
- productType = "com.apple.product-type.application";
- };
- 6BE6BE5823807BA600148D6E /* SampleJTAppleCalendarUITests */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = 6BE6BE6223807BA600148D6E /* Build configuration list for PBXNativeTarget "SampleJTAppleCalendarUITests" */;
- buildPhases = (
- 6BE6BE5523807BA600148D6E /* Sources */,
- 6BE6BE5623807BA600148D6E /* Frameworks */,
- 6BE6BE5723807BA600148D6E /* Resources */,
- );
- buildRules = (
- );
- dependencies = (
- 6BE6BE5F23807BA600148D6E /* PBXTargetDependency */,
- );
- name = SampleJTAppleCalendarUITests;
- productName = SampleJTAppleCalendarUITests;
- productReference = 6BE6BE5923807BA600148D6E /* SampleJTAppleCalendarUITests.xctest */;
- productType = "com.apple.product-type.bundle.ui-testing";
- };
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
- 6B4E464822C202DD00D0F78E /* Project object */ = {
- isa = PBXProject;
- attributes = {
- LastSwiftUpdateCheck = 1110;
- LastUpgradeCheck = 1100;
- ORGANIZATIONNAME = OsTech;
- TargetAttributes = {
- 6B4E464F22C202DD00D0F78E = {
- CreatedOnToolsVersion = 11.0;
- };
- 6BE6BE5823807BA600148D6E = {
- CreatedOnToolsVersion = 11.1;
- TestTargetID = 6B4E464F22C202DD00D0F78E;
- };
- };
- };
- buildConfigurationList = 6B4E464B22C202DD00D0F78E /* Build configuration list for PBXProject "SampleJTAppleCalendar" */;
- compatibilityVersion = "Xcode 9.3";
- developmentRegion = en;
- hasScannedForEncodings = 0;
- knownRegions = (
- en,
- Base,
- );
- mainGroup = 6B4E464722C202DD00D0F78E;
- packageReferences = (
- 6BBDD4DD22E3E7FF001BE4E0 /* XCRemoteSwiftPackageReference "JTAppleCalendar" */,
- );
- productRefGroup = 6B4E465122C202DD00D0F78E /* Products */;
- projectDirPath = "";
- projectRoot = "";
- targets = (
- 6B4E464F22C202DD00D0F78E /* SampleJTAppleCalendar */,
- 6BE6BE5823807BA600148D6E /* SampleJTAppleCalendarUITests */,
- );
- };
-/* End PBXProject section */
-
-/* Begin PBXResourcesBuildPhase section */
- 6B4E464E22C202DD00D0F78E /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 6B4E46E622C2174C00D0F78E /* Main.storyboard in Resources */,
- 6B4E469622C2151500D0F78E /* CellView.xib in Resources */,
- 6B4E46A522C2151E00D0F78E /* WhiteSectionHeaderView.xib in Resources */,
- 6B4E466022C202DF00D0F78E /* LaunchScreen.storyboard in Resources */,
- 6B4E465D22C202DF00D0F78E /* Assets.xcassets in Resources */,
- 6B4E46A322C2151E00D0F78E /* PinkSectionHeaderView.xib in Resources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- 6BE6BE5723807BA600148D6E /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXResourcesBuildPhase section */
-
-/* Begin PBXSourcesBuildPhase section */
- 6B4E464C22C202DD00D0F78E /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 6B4E469422C2151500D0F78E /* CodeCellView.swift in Sources */,
- 6B4E46A222C2151E00D0F78E /* WhiteSectionHeaderView.swift in Sources */,
- 6B4E468D22C2150100D0F78E /* TestPersianCalendar.swift in Sources */,
- 6B4E468B22C2150100D0F78E /* TestOrientationChanges.swift in Sources */,
- 6B4E468C22C2150100D0F78E /* TestYearViewViewController.swift in Sources */,
- 6B4E46A422C2151E00D0F78E /* PinkSectionHeaderView.swift in Sources */,
- 6B4E468A22C2150100D0F78E /* TestViewController.swift in Sources */,
- 6B4E468822C2150100D0F78E /* ViewController.swift in Sources */,
- 6B4E46A022C2151E00D0F78E /* CodeWhiteSectionHeaderView.swift in Sources */,
- 6B4E469522C2151500D0F78E /* CellView.swift in Sources */,
- 6B4E46A122C2151E00D0F78E /* CodePinkSectionHeaderView.swift in Sources */,
- 6B4E465422C202DD00D0F78E /* AppDelegate.swift in Sources */,
- 6B4E465622C202DD00D0F78E /* SceneDelegate.swift in Sources */,
- 6B4E468922C2150100D0F78E /* TestRangeSelectionViewController.swift in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- 6BE6BE5523807BA600148D6E /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 6BE6BE5C23807BA600148D6E /* SampleJTAppleCalendarUITests.swift in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXSourcesBuildPhase section */
-
-/* Begin PBXTargetDependency section */
- 6BE6BE5F23807BA600148D6E /* PBXTargetDependency */ = {
- isa = PBXTargetDependency;
- target = 6B4E464F22C202DD00D0F78E /* SampleJTAppleCalendar */;
- targetProxy = 6BE6BE5E23807BA600148D6E /* PBXContainerItemProxy */;
- };
-/* End PBXTargetDependency section */
-
-/* Begin PBXVariantGroup section */
- 6B4E465E22C202DF00D0F78E /* LaunchScreen.storyboard */ = {
- isa = PBXVariantGroup;
- children = (
- 6B4E465F22C202DF00D0F78E /* Base */,
- );
- name = LaunchScreen.storyboard;
- sourceTree = "";
- };
-/* End PBXVariantGroup section */
-
-/* Begin XCBuildConfiguration section */
- 6B4E466222C202DF00D0F78E /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_ANALYZER_NONNULL = YES;
- CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_ARC = YES;
- CLANG_ENABLE_OBJC_WEAK = YES;
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
- CLANG_WARN_BOOL_CONVERSION = YES;
- CLANG_WARN_COMMA = YES;
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
- CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INFINITE_RECURSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
- CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
- CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
- CLANG_WARN_STRICT_PROTOTYPES = YES;
- CLANG_WARN_SUSPICIOUS_MOVE = YES;
- CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
- CLANG_WARN_UNREACHABLE_CODE = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = NO;
- DEBUG_INFORMATION_FORMAT = dwarf;
- ENABLE_STRICT_OBJC_MSGSEND = YES;
- ENABLE_TESTABILITY = YES;
- GCC_C_LANGUAGE_STANDARD = gnu11;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_NO_COMMON_BLOCKS = YES;
- GCC_OPTIMIZATION_LEVEL = 0;
- GCC_PREPROCESSOR_DEFINITIONS = (
- "DEBUG=1",
- "$(inherited)",
- );
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
- GCC_WARN_UNDECLARED_SELECTOR = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 13.0;
- MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
- MTL_FAST_MATH = YES;
- ONLY_ACTIVE_ARCH = YES;
- SDKROOT = iphoneos;
- SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
- SWIFT_OPTIMIZATION_LEVEL = "-Onone";
- };
- name = Debug;
- };
- 6B4E466322C202DF00D0F78E /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_ANALYZER_NONNULL = YES;
- CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_ARC = YES;
- CLANG_ENABLE_OBJC_WEAK = YES;
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
- CLANG_WARN_BOOL_CONVERSION = YES;
- CLANG_WARN_COMMA = YES;
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
- CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INFINITE_RECURSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
- CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
- CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
- CLANG_WARN_STRICT_PROTOTYPES = YES;
- CLANG_WARN_SUSPICIOUS_MOVE = YES;
- CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
- CLANG_WARN_UNREACHABLE_CODE = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = NO;
- DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- ENABLE_NS_ASSERTIONS = NO;
- ENABLE_STRICT_OBJC_MSGSEND = YES;
- GCC_C_LANGUAGE_STANDARD = gnu11;
- GCC_NO_COMMON_BLOCKS = YES;
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
- GCC_WARN_UNDECLARED_SELECTOR = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 13.0;
- MTL_ENABLE_DEBUG_INFO = NO;
- MTL_FAST_MATH = YES;
- SDKROOT = iphoneos;
- SWIFT_COMPILATION_MODE = wholemodule;
- SWIFT_OPTIMIZATION_LEVEL = "-O";
- VALIDATE_PRODUCT = YES;
- };
- name = Release;
- };
- 6B4E466522C202DF00D0F78E /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
- CODE_SIGN_STYLE = Automatic;
- DEVELOPMENT_TEAM = WE23L742P8;
- INFOPLIST_FILE = SampleJTAppleCalendar/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = (
- "$(inherited)",
- "@executable_path/Frameworks",
- );
- PRODUCT_BUNDLE_IDENTIFIER = com.Ostech.SampleJTAppleCalendar;
- PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_VERSION = 5.0;
- TARGETED_DEVICE_FAMILY = "1,2";
- };
- name = Debug;
- };
- 6B4E466622C202DF00D0F78E /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
- CODE_SIGN_STYLE = Automatic;
- DEVELOPMENT_TEAM = WE23L742P8;
- INFOPLIST_FILE = SampleJTAppleCalendar/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = (
- "$(inherited)",
- "@executable_path/Frameworks",
- );
- PRODUCT_BUNDLE_IDENTIFIER = com.Ostech.SampleJTAppleCalendar;
- PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_VERSION = 5.0;
- TARGETED_DEVICE_FAMILY = "1,2";
- };
- name = Release;
- };
- 6BE6BE6023807BA600148D6E /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- CODE_SIGN_STYLE = Automatic;
- DEVELOPMENT_TEAM = WE23L742P8;
- INFOPLIST_FILE = SampleJTAppleCalendarUITests/Info.plist;
- IPHONEOS_DEPLOYMENT_TARGET = 13.1;
- LD_RUNPATH_SEARCH_PATHS = (
- "$(inherited)",
- "@executable_path/Frameworks",
- "@loader_path/Frameworks",
- );
- PRODUCT_BUNDLE_IDENTIFIER = NoneInc.SampleJTAppleCalendarUITests;
- PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_VERSION = 5.0;
- TARGETED_DEVICE_FAMILY = "1,2";
- TEST_TARGET_NAME = SampleJTAppleCalendar;
- };
- name = Debug;
- };
- 6BE6BE6123807BA600148D6E /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- CODE_SIGN_STYLE = Automatic;
- DEVELOPMENT_TEAM = WE23L742P8;
- INFOPLIST_FILE = SampleJTAppleCalendarUITests/Info.plist;
- IPHONEOS_DEPLOYMENT_TARGET = 13.1;
- LD_RUNPATH_SEARCH_PATHS = (
- "$(inherited)",
- "@executable_path/Frameworks",
- "@loader_path/Frameworks",
- );
- PRODUCT_BUNDLE_IDENTIFIER = NoneInc.SampleJTAppleCalendarUITests;
- PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_VERSION = 5.0;
- TARGETED_DEVICE_FAMILY = "1,2";
- TEST_TARGET_NAME = SampleJTAppleCalendar;
- };
- name = Release;
- };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
- 6B4E464B22C202DD00D0F78E /* Build configuration list for PBXProject "SampleJTAppleCalendar" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 6B4E466222C202DF00D0F78E /* Debug */,
- 6B4E466322C202DF00D0F78E /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- 6B4E466422C202DF00D0F78E /* Build configuration list for PBXNativeTarget "SampleJTAppleCalendar" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 6B4E466522C202DF00D0F78E /* Debug */,
- 6B4E466622C202DF00D0F78E /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- 6BE6BE6223807BA600148D6E /* Build configuration list for PBXNativeTarget "SampleJTAppleCalendarUITests" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 6BE6BE6023807BA600148D6E /* Debug */,
- 6BE6BE6123807BA600148D6E /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
-/* End XCConfigurationList section */
-
-/* Begin XCRemoteSwiftPackageReference section */
- 6BBDD4DD22E3E7FF001BE4E0 /* XCRemoteSwiftPackageReference "JTAppleCalendar" */ = {
- isa = XCRemoteSwiftPackageReference;
- repositoryURL = "https://github.com/patchthecode/JTAppleCalendar";
- requirement = {
- kind = upToNextMajorVersion;
- minimumVersion = 8.0.1;
- };
- };
-/* End XCRemoteSwiftPackageReference section */
-
-/* Begin XCSwiftPackageProductDependency section */
- 6BBDD4DE22E3E7FF001BE4E0 /* JTAppleCalendar */ = {
- isa = XCSwiftPackageProductDependency;
- package = 6BBDD4DD22E3E7FF001BE4E0 /* XCRemoteSwiftPackageReference "JTAppleCalendar" */;
- productName = JTAppleCalendar;
- };
-/* End XCSwiftPackageProductDependency section */
- };
- rootObject = 6B4E464822C202DD00D0F78E /* Project object */;
-}
diff --git a/SampleJTAppleCalendar.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/SampleJTAppleCalendar.xcodeproj/project.xcworkspace/contents.xcworkspacedata
deleted file mode 100644
index 919434a6..00000000
--- a/SampleJTAppleCalendar.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
diff --git a/SampleJTAppleCalendar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SampleJTAppleCalendar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
deleted file mode 100644
index 18d98100..00000000
--- a/SampleJTAppleCalendar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
- IDEDidComputeMac32BitWarning
-
-
-
diff --git a/SampleJTAppleCalendar.xcodeproj/xcshareddata/xcschemes/SampleJTAppleCalendar.xcscheme b/SampleJTAppleCalendar.xcodeproj/xcshareddata/xcschemes/SampleJTAppleCalendar.xcscheme
deleted file mode 100644
index fe6da97d..00000000
--- a/SampleJTAppleCalendar.xcodeproj/xcshareddata/xcschemes/SampleJTAppleCalendar.xcscheme
+++ /dev/null
@@ -1,88 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/SampleJTAppleCalendar/AppDelegate.swift b/SampleJTAppleCalendar/AppDelegate.swift
deleted file mode 100644
index ac0abfae..00000000
--- a/SampleJTAppleCalendar/AppDelegate.swift
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// AppDelegate.swift
-// SampleJTAppleCalendar
-//
-// Created by Jeron Thomas on 2019-06-25.
-// Copyright © 2019 OsTech. All rights reserved.
-//
-
-import UIKit
-
-@UIApplicationMain
-class AppDelegate: UIResponder, UIApplicationDelegate {
-
-
-
- func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
- // Override point for customization after application launch.
- return true
- }
-
- func applicationWillTerminate(_ application: UIApplication) {
- // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
- }
-
- // MARK: UISceneSession Lifecycle
-
- func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
- // Called when a new scene session is being created.
- // Use this method to select a configuration to create the new scene with.
- return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
- }
-
- func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) {
- // Called when the user discards a scene session.
- // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
- // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
- }
-
-
-}
-
diff --git a/SampleJTAppleCalendar/Assets.xcassets/AppIcon.appiconset/Contents.json b/SampleJTAppleCalendar/Assets.xcassets/AppIcon.appiconset/Contents.json
deleted file mode 100644
index d8db8d65..00000000
--- a/SampleJTAppleCalendar/Assets.xcassets/AppIcon.appiconset/Contents.json
+++ /dev/null
@@ -1,98 +0,0 @@
-{
- "images" : [
- {
- "idiom" : "iphone",
- "size" : "20x20",
- "scale" : "2x"
- },
- {
- "idiom" : "iphone",
- "size" : "20x20",
- "scale" : "3x"
- },
- {
- "idiom" : "iphone",
- "size" : "29x29",
- "scale" : "2x"
- },
- {
- "idiom" : "iphone",
- "size" : "29x29",
- "scale" : "3x"
- },
- {
- "idiom" : "iphone",
- "size" : "40x40",
- "scale" : "2x"
- },
- {
- "idiom" : "iphone",
- "size" : "40x40",
- "scale" : "3x"
- },
- {
- "idiom" : "iphone",
- "size" : "60x60",
- "scale" : "2x"
- },
- {
- "idiom" : "iphone",
- "size" : "60x60",
- "scale" : "3x"
- },
- {
- "idiom" : "ipad",
- "size" : "20x20",
- "scale" : "1x"
- },
- {
- "idiom" : "ipad",
- "size" : "20x20",
- "scale" : "2x"
- },
- {
- "idiom" : "ipad",
- "size" : "29x29",
- "scale" : "1x"
- },
- {
- "idiom" : "ipad",
- "size" : "29x29",
- "scale" : "2x"
- },
- {
- "idiom" : "ipad",
- "size" : "40x40",
- "scale" : "1x"
- },
- {
- "idiom" : "ipad",
- "size" : "40x40",
- "scale" : "2x"
- },
- {
- "idiom" : "ipad",
- "size" : "76x76",
- "scale" : "1x"
- },
- {
- "idiom" : "ipad",
- "size" : "76x76",
- "scale" : "2x"
- },
- {
- "idiom" : "ipad",
- "size" : "83.5x83.5",
- "scale" : "2x"
- },
- {
- "idiom" : "ios-marketing",
- "size" : "1024x1024",
- "scale" : "1x"
- }
- ],
- "info" : {
- "version" : 1,
- "author" : "xcode"
- }
-}
\ No newline at end of file
diff --git a/SampleJTAppleCalendar/Assets.xcassets/Contents.json b/SampleJTAppleCalendar/Assets.xcassets/Contents.json
deleted file mode 100644
index da4a164c..00000000
--- a/SampleJTAppleCalendar/Assets.xcassets/Contents.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "info" : {
- "version" : 1,
- "author" : "xcode"
- }
-}
\ No newline at end of file
diff --git a/SampleJTAppleCalendar/Assets.xcassets/cube.imageset/Contents.json b/SampleJTAppleCalendar/Assets.xcassets/cube.imageset/Contents.json
deleted file mode 100644
index 883a2587..00000000
--- a/SampleJTAppleCalendar/Assets.xcassets/cube.imageset/Contents.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "images" : [
- {
- "idiom" : "universal",
- "filename" : "cube.png",
- "scale" : "1x"
- },
- {
- "idiom" : "universal",
- "scale" : "2x"
- },
- {
- "idiom" : "universal",
- "scale" : "3x"
- }
- ],
- "info" : {
- "version" : 1,
- "author" : "xcode"
- }
-}
\ No newline at end of file
diff --git a/SampleJTAppleCalendar/Assets.xcassets/cube.imageset/cube.png b/SampleJTAppleCalendar/Assets.xcassets/cube.imageset/cube.png
deleted file mode 100644
index 473d0ce7..00000000
Binary files a/SampleJTAppleCalendar/Assets.xcassets/cube.imageset/cube.png and /dev/null differ
diff --git a/SampleJTAppleCalendar/Base.lproj/LaunchScreen.storyboard b/SampleJTAppleCalendar/Base.lproj/LaunchScreen.storyboard
deleted file mode 100644
index 865e9329..00000000
--- a/SampleJTAppleCalendar/Base.lproj/LaunchScreen.storyboard
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/SampleJTAppleCalendar/Example Calendars/TestOrientationChanges.swift b/SampleJTAppleCalendar/Example Calendars/TestOrientationChanges.swift
deleted file mode 100644
index 33075fef..00000000
--- a/SampleJTAppleCalendar/Example Calendars/TestOrientationChanges.swift
+++ /dev/null
@@ -1,20 +0,0 @@
-//
-// TestOrientationChanges.swift
-// JTAppleCalendar
-//
-// Created by Jay Thomas on 2017-08-19.
-//
-
-import UIKit
-
-class TestOrientationChanges: UIViewController {
-
- override func viewDidLoad() {
- super.viewDidLoad()
-
- // Do any additional setup after loading the view.
- }
-
-
-
-}
diff --git a/SampleJTAppleCalendar/Example Calendars/TestPersianCalendar.swift b/SampleJTAppleCalendar/Example Calendars/TestPersianCalendar.swift
deleted file mode 100644
index 792a80d9..00000000
--- a/SampleJTAppleCalendar/Example Calendars/TestPersianCalendar.swift
+++ /dev/null
@@ -1,143 +0,0 @@
-//
-// TestPersianCalendar.swift
-// SampleCalendar
-//
-// Copyright © 2017 Aminous. All rights reserved.
-//
-
-import UIKit
-import JTAppleCalendar
-
-class TestPersianCalendar: UIViewController {
-
- @IBOutlet weak var calendarView: JTACMonthView!
-
- lazy var dateFormatter: DateFormatter = {
- let dateFormatter = DateFormatter()
- dateFormatter.timeZone = TimeZone(abbreviation: "UTC")
- dateFormatter.dateFormat = "hh:mm"
- return dateFormatter
- }()
-
- let persianDateFormatter: DateFormatter = {
- let dateFormatter = DateFormatter()
- dateFormatter.calendar = Calendar(identifier: .persian)
- dateFormatter.dateFormat = "yyyy/MM/dd"
- return dateFormatter
- }()
-
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do any additional setup after loading the view, typically from a nib.
- setupCalendarView()
- calendarView.calendarDataSource = self
- calendarView.calendarDelegate = self
- }
-
- override func didReceiveMemoryWarning() {
- super.didReceiveMemoryWarning()
- // Dispose of any resources that can be recreated.
- }
-
-
- func handleCellSelected(cell: JTACDayCell?, cellState: CellState){
- guard let validCell = cell as? CalendarCell else { return }
- if cellState.isSelected {
- validCell.selectedView.isHidden = false
- } else {
- validCell.selectedView.isHidden = true
- }
- }
-
- func handleCellTextColor(cell: JTACDayCell?, cellState: CellState){
- guard let validCell = cell as? CalendarCell else { return }
- if cellState.isSelected {
- validCell.dateLabel.textColor = UIColor.white
- } else {
- let today = Date()
- persianDateFormatter.dateFormat = "yyyy MM dd"
- let todayDateStr = persianDateFormatter.string(from: today)
- dateFormatter.dateFormat = "yyyy MM dd"
- let cellDateStr = dateFormatter.string(from: cellState.date)
-
- if todayDateStr == cellDateStr {
- validCell.dateLabel.textColor = UIColor.yellow
- } else {
- if cellState.dateBelongsTo == .thisMonth {
- validCell.dateLabel.textColor = UIColor.white
- } else { //i.e. case it belongs to inDate or outDate
- validCell.dateLabel.textColor = UIColor.gray
- }
- }
- }
- }
-
-
- func setupCalendarView(){
- //Setup calendar spacing
- calendarView.minimumLineSpacing = 0
- calendarView.minimumInteritemSpacing = 0
-
- }
-}
-
-extension TestPersianCalendar: JTACMonthViewDataSource {
- func configureCalendar(_ calendar: JTACMonthView) -> ConfigurationParameters {
-
- let persianCalendar = Calendar(identifier: .persian)
-
- let testFotmatter = DateFormatter()
- testFotmatter.dateFormat = "yyyy/MM/dd"
- testFotmatter.timeZone = persianCalendar.timeZone
- testFotmatter.locale = persianCalendar.locale
-
- let startDate = testFotmatter.date(from: "2017/01/01")!
- let endDate = testFotmatter.date(from: "2017/09/30")!
-
-
- let parameters = ConfigurationParameters(startDate: startDate, endDate: endDate, calendar: persianCalendar)
- return parameters
- }
-}
-
-extension TestPersianCalendar: JTACMonthViewDelegate {
- func calendar(_ calendar: JTACMonthView, willDisplay cell: JTACDayCell, forItemAt date: Date, cellState: CellState, indexPath: IndexPath) {
- // The code here is the same as cellForItem function
- let cell = cell as! CellView
- cell.dayLabel.text = cellState.text
-
- handleCellSelected(cell: cell, cellState: cellState)
- handleCellTextColor(cell: cell, cellState: cellState)
- }
-
- func calendar(_ calendar: JTACMonthView, cellForItemAt date: Date, cellState: CellState, indexPath: IndexPath) -> JTACDayCell {
- let cell = calendar.dequeueReusableJTAppleCell(withReuseIdentifier: "mainInfo_CalenderCell", for: indexPath) as! CellView
- cell.dayLabel.text = cellState.text
-
- handleCellSelected(cell: cell, cellState: cellState)
- handleCellTextColor(cell: cell, cellState: cellState)
-
- return cell
- }
-
-
- func calendar(_ calendar: JTACMonthView, didSelectDate date: Date, cell: JTACDayCell?, cellState: CellState) {
- print(cellState.dateBelongsTo)
- handleCellSelected(cell: cell, cellState: cellState)
- handleCellTextColor(cell: cell, cellState: cellState)
- }
-
- func calendar(_ calendar: JTACMonthView, didDeselectDate date: Date, cell: JTACDayCell?, cellState: CellState) {
- handleCellSelected(cell: cell, cellState: cellState)
- handleCellTextColor(cell: cell, cellState: cellState)
- }
-
-
-}
-
-class CalendarCell: JTACDayCell {
- @IBOutlet weak var dateLabel: UILabel!
- @IBOutlet weak var selectedView: UIView!
-}
-
-
diff --git a/SampleJTAppleCalendar/Example Calendars/TestRangeSelectionViewController.swift b/SampleJTAppleCalendar/Example Calendars/TestRangeSelectionViewController.swift
deleted file mode 100644
index 423527e0..00000000
--- a/SampleJTAppleCalendar/Example Calendars/TestRangeSelectionViewController.swift
+++ /dev/null
@@ -1,122 +0,0 @@
-//
-// TestRangeSelectionViewController.swift
-// JTAppleCalendar iOS
-//
-// Created by Jay Thomas on 2018-08-07.
-//
-
-import UIKit
-import JTAppleCalendar
-
-class TestRangeSelectionViewController: UIViewController {
-
- @IBOutlet weak var monthLabel: UILabel!
- @IBOutlet weak var calendarView: JTACMonthView!
- let df = DateFormatter()
-
- override func viewDidLoad() {
- super.viewDidLoad()
-
- calendarView.visibleDates() { visibleDates in
- self.setupMonthLabel(date: visibleDates.monthDates.first!.date)
- }
-
- calendarView.allowsMultipleSelection = true
- calendarView.allowsMultipleSelection = true
-
- }
-
- func setupMonthLabel(date: Date) {
- df.dateFormat = "MMM"
- monthLabel.text = df.string(from: date)
- }
-
- func handleConfiguration(cell: JTACDayCell?, cellState: CellState) {
- guard let cell = cell as? TestRangeSelectionViewControllerCell else { return }
- handleCellColor(cell: cell, cellState: cellState)
- handleCellSelection(cell: cell, cellState: cellState)
- }
-
- func handleCellColor(cell: TestRangeSelectionViewControllerCell, cellState: CellState) {
- if cellState.dateBelongsTo == .thisMonth {
- cell.label.textColor = .black
- } else {
- cell.label.textColor = .gray
- }
- }
-
- func handleCellSelection(cell: TestRangeSelectionViewControllerCell, cellState: CellState) {
- cell.selectedView.isHidden = !cellState.isSelected
-
- switch cellState.selectedPosition() {
- case .left:
- cell.selectedView.layer.cornerRadius = 20
- cell.selectedView.layer.maskedCorners = [.layerMinXMaxYCorner, .layerMinXMinYCorner]
- case .middle:
- cell.selectedView.layer.cornerRadius = 0
- cell.selectedView.layer.maskedCorners = []
- case .right:
- cell.selectedView.layer.cornerRadius = 20
- cell.selectedView.layer.maskedCorners = [.layerMaxXMaxYCorner, .layerMaxXMinYCorner]
- case .full:
- cell.selectedView.layer.cornerRadius = 20
- cell.selectedView.layer.maskedCorners = [.layerMaxXMaxYCorner, .layerMaxXMinYCorner, .layerMinXMaxYCorner, .layerMinXMinYCorner]
- default: break
- }
-
-
-
-
- }
-}
-
-extension TestRangeSelectionViewController: JTACMonthViewDelegate, JTACMonthViewDataSource {
-
- func calendar(_ calendar: JTACMonthView, willDisplay cell: JTACDayCell, forItemAt date: Date, cellState: CellState, indexPath: IndexPath) {
- handleConfiguration(cell: cell, cellState: cellState)
- }
-
- func calendar(_ calendar: JTACMonthView, cellForItemAt date: Date, cellState: CellState, indexPath: IndexPath) -> JTACDayCell {
- let cell = calendar.dequeueReusableJTAppleCell(withReuseIdentifier: "cell", for: indexPath) as! TestRangeSelectionViewControllerCell
- cell.label.text = cellState.text
- self.calendar(calendar, willDisplay: cell, forItemAt: date, cellState: cellState, indexPath: indexPath)
- return cell
- }
-
- func calendar(_ calendar: JTACMonthView, didScrollToDateSegmentWith visibleDates: DateSegmentInfo) {
- setupMonthLabel(date: visibleDates.monthDates.first!.date)
- }
-
- func calendar(_ calendar: JTACMonthView, didSelectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) {
- handleConfiguration(cell: cell, cellState: cellState)
- }
-
- func calendar(_ calendar: JTACMonthView, didDeselectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) {
- handleConfiguration(cell: cell, cellState: cellState)
- }
-
- func configureCalendar(_ calendar: JTACMonthView) -> ConfigurationParameters {
- let df = DateFormatter()
- df.dateFormat = "yyyy MM dd"
-
- let startDate = df.date(from: "2017 01 01")!
- let endDate = df.date(from: "2017 12 31")!
-
- let parameter = ConfigurationParameters(startDate: startDate,
- endDate: endDate,
- numberOfRows: 6,
- generateInDates: .forAllMonths,
- generateOutDates: .tillEndOfGrid,
- firstDayOfWeek: .sunday)
- return parameter
- }
-
-
-}
-
-
-
-class TestRangeSelectionViewControllerCell: JTACDayCell {
- @IBOutlet weak var label: UILabel!
- @IBOutlet weak var selectedView: UIView!
-}
diff --git a/SampleJTAppleCalendar/Example Calendars/TestViewController.swift b/SampleJTAppleCalendar/Example Calendars/TestViewController.swift
deleted file mode 100644
index 53f4dd9d..00000000
--- a/SampleJTAppleCalendar/Example Calendars/TestViewController.swift
+++ /dev/null
@@ -1,198 +0,0 @@
-//
-// TestViewController.swift
-// JTAppleCalendar iOS
-//
-// Created by Jay Thomas on 2017-07-11.
-//
-
-import UIKit
-import JTAppleCalendar
-
-class TestViewController: UIViewController {
- @IBOutlet weak var monthLabel: UILabel!
- @IBOutlet var calendarView: JTACMonthView!
- @IBOutlet var theView: UIView!
- @IBOutlet weak var viewHeightConstraint: NSLayoutConstraint!
- let formatter = DateFormatter()
-
- override func viewDidLoad() {
- super.viewDidLoad()
- self.calendarView.visibleDates {[unowned self] (visibleDates: DateSegmentInfo) in
- self.setupViewsOfCalendar(from: visibleDates)
- }
-
- }
- @IBAction func selectABunch(_ sender: UIButton) {
- formatter.dateFormat = "yyyy MM dd"
- let date = formatter.date(from: "2017 01 01")!
- let date2 = formatter.date(from: "2017 12 25")!
- calendarView.selectDates(from: date, to: date2, triggerSelectionDelegate: true)
- }
- @IBAction func zeroHeight(_ sender: UIButton) {
- let frame = calendarView.frame
- calendarView.frame = CGRect(x: frame.origin.x,
- y: frame.origin.y,
- width: frame.width,
- height: 0)
- calendarView.reloadData()
- }
- @IBAction func twoHeight(_ sender: UIButton) {
- let frame = calendarView.frame
- calendarView.frame = CGRect(x: frame.origin.x,
- y: frame.origin.y,
- width: frame.width,
- height: 50)
- calendarView.reloadData()
- }
- @IBAction func twoHundredHeight(_ sender: UIButton) {
- let frame = calendarView.frame
- calendarView.frame = CGRect(x: frame.origin.x,
- y: frame.origin.y,
- width: frame.width,
- height: 200)
- calendarView.reloadData()
- }
-
- @IBAction func zeroHeightView(_ sender: UIButton) {
- viewHeightConstraint.constant = 0
- calendarView.reloadData()
-
- }
- @IBAction func twoHeightView(_ sender: UIButton) {
- viewHeightConstraint.constant = 50
- calendarView.reloadData()
- }
- @IBAction func twoHundredHeightView(_ sender: UIButton) {
- viewHeightConstraint.constant = 200
- calendarView.reloadData()
- }
-
- @IBAction func selectOneDate(_ sender: UIButton) {
- formatter.dateFormat = "yyyy MM dd"
- let date = formatter.date(from: "2017 01 03")!
- calendarView.selectDates([date])
- }
- @IBAction func selectOtherDate(_ sender: UIButton) {
- formatter.dateFormat = "yyyy MM dd"
- let date = formatter.date(from: "2017 01 31")!
- calendarView.selectDates([date])
- }
-
- @IBAction func selectOneMonth(_ sender: UIButton) {
- formatter.dateFormat = "yyyy MM dd"
- let date = formatter.date(from: "2017 02 01")!
- calendarView.selectDates([date])
- }
- @IBAction func reload(_ sender: UIButton) {
- calendarView.reloadData()
- }
-
- @IBAction func debugthis(_ sender: UIButton) {
- print(calendarView.selectedDates)
- }
- @IBAction func singleSelect(_ sender: UIButton) {
- calendarView.allowsMultipleSelection = false
- calendarView.allowsMultipleSelection = false
- }
- @IBAction func multiSelect(_ sender: UIButton) {
- calendarView.allowsMultipleSelection = true
- calendarView.allowsMultipleSelection = true
- }
- func setupViewsOfCalendar(from visibleDates: DateSegmentInfo) {
- guard let startDate = visibleDates.monthDates.first?.date else {
- return
- }
- let month = Calendar.current.dateComponents([.month], from: startDate).month!
- let monthName = DateFormatter().monthSymbols[(month-1) % 12]
- // 0 indexed array
- let year = Calendar.current.component(.year, from: startDate)
- monthLabel.text = monthName + " " + String(year)
- }
-
- func configureCell(view: JTACDayCell?, cellState: CellState) {
- guard let myCustomCell = view as? CellView else { return }
- handleCellTextColor(view: myCustomCell, cellState: cellState)
- handleCellSelection(view: myCustomCell, cellState: cellState)
- }
-
- func handleCellSelection(view: CellView, cellState: CellState) {
- if calendarView.allowsMultipleSelection {
- switch cellState.selectedPosition() {
- case .full: view.backgroundColor = .green
- case .left: view.backgroundColor = .yellow
- case .right: view.backgroundColor = .red
- case .middle: view.backgroundColor = .blue
- case .none: view.backgroundColor = nil
- }
- } else {
- if cellState.isSelected {
- view.backgroundColor = UIColor.red
- } else {
- view.backgroundColor = UIColor.white
- }
- }
- }
- func handleCellTextColor(view: CellView, cellState: CellState) {
- if cellState.dateBelongsTo == .thisMonth {
- view.dayLabel.textColor = UIColor.black
- } else {
- view.dayLabel.textColor = UIColor.gray
- }
- }
-
- var iii: Date?
-}
-
-
-extension TestViewController: JTACMonthViewDataSource, JTACMonthViewDelegate {
- func calendar(_ calendar: JTACMonthView, willDisplay cell: JTACDayCell, forItemAt date: Date, cellState: CellState, indexPath: IndexPath) {
- configureCell(view: cell, cellState: cellState)
- }
-
- func calendar(_ calendar: JTACMonthView, cellForItemAt date: Date, cellState: CellState, indexPath: IndexPath) -> JTACDayCell {
- let cell = calendar.dequeueReusableJTAppleCell(withReuseIdentifier: "cell", for: indexPath) as! CellView
- configureCell(view: cell, cellState: cellState)
- if cellState.text == "1" {
- formatter.dateFormat = "MMM"
- let month = formatter.string(from: date)
- cell.dayLabel .text = "\(month) \(cellState.text)"
- } else {
- cell.dayLabel .text = cellState.text
- }
- return cell
- }
-
- func configureCalendar(_ calendar: JTACMonthView) -> ConfigurationParameters {
- formatter.dateFormat = "yyyy MM dd"
- formatter.timeZone = Calendar.current.timeZone
- formatter.locale = Calendar.current.locale
-
-
- let startDate = formatter.date(from: "2017 01 01")!
- let endDate = formatter.date(from: "2030 02 01")!
-
- let parameters = ConfigurationParameters(startDate: startDate,endDate: endDate)
- return parameters
- }
-
-
- func calendar(_ calendar: JTACMonthView, didScrollToDateSegmentWith visibleDates: DateSegmentInfo) {
- setupViewsOfCalendar(from: visibleDates)
- }
-
- func calendar(_ calendar: JTACMonthView, didSelectDate date: Date, cell: JTACDayCell?, cellState: CellState) {
- configureCell(view: cell, cellState: cellState)
- }
-
- func calendar(_ calendar: JTACMonthView, didDeselectDate date: Date, cell: JTACDayCell?, cellState: CellState) {
- configureCell(view: cell, cellState: cellState)
- }
-
- override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
- calendarView.viewWillTransition(to: size, with: coordinator, anchorDate: iii)
- }
-
-
-}
-
-
diff --git a/SampleJTAppleCalendar/Example Calendars/TestYearViewViewController.swift b/SampleJTAppleCalendar/Example Calendars/TestYearViewViewController.swift
deleted file mode 100644
index af4d79f0..00000000
--- a/SampleJTAppleCalendar/Example Calendars/TestYearViewViewController.swift
+++ /dev/null
@@ -1,107 +0,0 @@
-//
-// TestYearViewViewController.swift
-// JTAppleCalendar
-//
-// Created by JayT on 2019-05-11.
-//
-
-import UIKit
-import JTAppleCalendar
-
-class TestYearViewViewController: UIViewController {
- @IBOutlet var calendarView: JTACYearView!
- let f = DateFormatter()
-
- override func viewDidLoad() {
- calendarView.calendarDataSource = self
- calendarView.calendarDelegate = self
- super.viewDidLoad()
- }
-}
-
-
-extension TestYearViewViewController: JTACYearViewDelegate, JTACYearViewDataSource {
- // Drawing for a whole month cell
- func calendar(_ calendar: JTACYearView, cellFor item: Any, at date: Date, indexPath: IndexPath) -> JTACMonthCell {
- if item is Month {
- let cell = calendar.dequeueReusableJTAppleMonthCell(withReuseIdentifier: "kkk", for: indexPath) as! MyCell
- f.dateFormat = "MMM"
- cell.monthLabel.text = f.string(from: date)
- return cell
- } else {
- let cell = calendar.dequeueReusableJTAppleMonthCell(withReuseIdentifier: "zzz", for: indexPath) as! YearHeaderCell
- f.dateFormat = "yyyy"
- cell.yearLabel.text = f.string(from: date)
- return cell
- }
- }
-
-
-
- func configureCalendar(_ calendar: JTACYearView) -> (configurationParameters: ConfigurationParameters, months: [Any]) {
- let df = DateFormatter()
- df.dateFormat = "yyyy MM dd"
-
- let sDate = df.date(from: "2019 01 01")!
- let eDate = df.date(from: "2050 05 31")!
-
- let configParams = ConfigurationParameters(startDate: sDate,
- endDate: eDate,
- numberOfRows: 6,
- calendar: Calendar(identifier: .gregorian),
- generateInDates: .forAllMonths,
- generateOutDates: .tillEndOfGrid,
- firstDayOfWeek: .sunday,
- hasStrictBoundaries: true)
-
- // Get year data
- let dataSource = calendar.dataSourcefrom(configurationParameters: configParams)
-
- // Modify the data source to include a String every 12 data elements.
- // This string type will be used to add a header.
- var modifiedDataSource: [Any] = []
- for index in (0.. CGSize {
- if item is Month {
- let width = (calendar.frame.width - 41 ) / 3
- let height = width
- return CGSize(width: width, height: height)
- } else {
- let width = calendar.frame.width - 41
- let height:CGFloat = 20
- return CGSize(width: width, height: height)
- }
- }
-}
-
-
-class MyCell: JTACMonthCell {
- @IBOutlet var monthLabel: UILabel!
-}
-
-class YearHeaderCell: JTACMonthCell {
- @IBOutlet var yearLabel: UILabel!
-}
diff --git a/SampleJTAppleCalendar/Example Calendars/ViewController.swift b/SampleJTAppleCalendar/Example Calendars/ViewController.swift
deleted file mode 100644
index 52102392..00000000
--- a/SampleJTAppleCalendar/Example Calendars/ViewController.swift
+++ /dev/null
@@ -1,461 +0,0 @@
-//
-// ViewController.swift
-// JTAppleCalendar iOS Example
-//
-// Created by JayT on 2016-08-10.
-//
-//
-
-import UIKit
-import JTAppleCalendar
-
-class ViewController: UIViewController {
-
- @IBOutlet weak var customColumn: UITextField!
- @IBOutlet weak var calendarView: JTACMonthView!
- @IBOutlet weak var monthLabel: UILabel!
- @IBOutlet weak var weekViewStack: UIStackView!
- @IBOutlet var numbers: [UIButton]!
- @IBOutlet var outDates: [UIButton]!
- @IBOutlet var inDates: [UIButton]!
-
- var numberOfRows = 6
- let formatter = DateFormatter()
- var testCalendar = Calendar.current
- var generateInDates: InDateCellGeneration = .forAllMonths
- var generateOutDates: OutDateCellGeneration = .tillEndOfGrid
- var prePostVisibility: ((CellState, CellView?)->())?
- var hasStrictBoundaries = true
- let disabledColor = UIColor.lightGray
- let enabledColor = UIColor.blue
- var monthSize: MonthSize? = nil
- var prepostHiddenValue = false
- var outsideHeaderVisibilityIsOn = true
- var insideHeaderVisibilityIsOn = false
-
- var currentScrollModeIndex = 0
- var hhh: CGFloat?
- var allScrollModes: [ScrollingMode] = [
- .none,
- .nonStopTo(customInterval: 374, withResistance: 0.5),
- .nonStopToCell(withResistance: 0.5),
- .nonStopToSection(withResistance: 0.5),
- .stopAtEach(customInterval: 374),
- .stopAtEachCalendarFrame,
- .stopAtEachSection
- ]
-
- @IBAction func changeScroll(_ sender: Any) {
- currentScrollModeIndex += 1
- if currentScrollModeIndex >= allScrollModes.count { currentScrollModeIndex = 0 }
- calendarView.scrollingMode = allScrollModes[currentScrollModeIndex]
- print("ScrollMode = \(allScrollModes[currentScrollModeIndex])")
- let sender = sender as! UIButton
- sender.setTitle("\(allScrollModes[currentScrollModeIndex])", for: .normal)
-
- }
-
- @IBAction func showPrepost(_ sender: UIButton) {
- prePostVisibility = {state, cell in
- cell?.isHidden = false
- }
- calendarView.reloadData()
- }
- @IBAction func hidePrepost(_ sender: UIButton) {
- prePostVisibility = {state, cell in
- if state.dateBelongsTo == .thisMonth {
- cell?.isHidden = false
- } else {
- cell?.isHidden = true
- }
- }
- calendarView.reloadData()
- }
-
- @IBAction func toggleInsideHeaders(_ sender: UIButton) {
- if insideHeaderVisibilityIsOn {
- monthSize = nil
- sender.setTitle("Inside Header OFF", for: .normal)
- } else {
- monthSize = MonthSize(defaultSize: 50, months: [75: [.feb, .apr]])
- sender.setTitle("Inside Header ON", for: .normal)
- }
- insideHeaderVisibilityIsOn.toggle()
- calendarView.reloadData()
- }
-
- @IBAction func toggleOutsideHeaders(_ sender: UIButton) {
- if outsideHeaderVisibilityIsOn {
- monthLabel.isHidden = true
- weekViewStack.isHidden = true
- sender.setTitle("Outside Header ON", for: .normal)
- } else {
- monthLabel.isHidden = false
- weekViewStack.isHidden = false
- sender.setTitle("Outside Header OFF", for: .normal)
- }
- outsideHeaderVisibilityIsOn.toggle()
- }
-
- @IBAction func decreaseCellInset(_ sender: UIButton) {
- calendarView.minimumLineSpacing -= 0.5
- calendarView.minimumInteritemSpacing -= 0.5
- calendarView.reloadData()
- }
-
- @IBAction func increaseCellInset(_ sender: UIButton) {
- calendarView.minimumLineSpacing += 0.5
- calendarView.minimumInteritemSpacing += 0.5
- calendarView.reloadData()
- }
-
-
- @IBAction func decreaseItemSize(_ sender: UIButton) {
- calendarView.cellSize -= 1
- calendarView.reloadData()
- }
-
- @IBAction func increaseItemSize(_ sender: UIButton) {
- if calendarView.cellSize == 0 { calendarView.cellSize = 54.0}
- calendarView.cellSize += 1
- calendarView.reloadData()
- }
-
-
- @IBAction func changeToRow(_ sender: UIButton) {
- numberOfRows = Int(sender.title(for: .normal)!)!
-
- for aButton in numbers {
- aButton.tintColor = disabledColor
- }
- sender.tintColor = enabledColor
- calendarView.reloadData()
- }
-
- @IBAction func changeDirection(_ sender: UIButton) {
- if calendarView.scrollDirection == .horizontal {
- calendarView.scrollDirection = .vertical
-// calendarView.cellSize = 25
- sender.setTitle("Scrolling = Vertical", for: .normal)
- } else {
- calendarView.scrollDirection = .horizontal
-// calendarView.cellSize = 0
- sender.setTitle("Scrolling = Horizontal", for: .normal)
- }
- calendarView.reloadData()
- }
-
- @IBAction func toggleStrictBoundary(sender: UIButton) {
- hasStrictBoundaries = !hasStrictBoundaries
- if hasStrictBoundaries {
- sender.tintColor = enabledColor
- } else {
- sender.tintColor = disabledColor
- }
- calendarView.reloadData()
- }
-
- @IBAction func outDateGeneration(_ sender: UIButton) {
- for aButton in outDates {
- aButton.tintColor = disabledColor
- }
- sender.tintColor = enabledColor
-
- switch sender.title(for: .normal)! {
- case "EOR":
- generateOutDates = .tillEndOfRow
- case "EOG":
- generateOutDates = .tillEndOfGrid
- case "OFF":
- generateOutDates = .off
- default:
- break
- }
- calendarView.reloadData()
-
- }
-
- @IBAction func inDateGeneration(_ sender: UIButton) {
- for aButton in inDates {
- aButton.tintColor = disabledColor
- }
- sender.tintColor = enabledColor
-
- switch sender.title(for: .normal)! {
- case "First":
- generateInDates = .forFirstMonthOnly
- case "All":
- generateInDates = .forAllMonths
- case "Off":
- generateInDates = .off
- default:
- break
- }
-
- calendarView.reloadData()
- }
-
- override func viewDidLoad() {
- super.viewDidLoad()
- calendarView.register(UINib(nibName: "PinkSectionHeaderView", bundle: Bundle.main),
- forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader,
- withReuseIdentifier: "PinkSectionHeaderView")
-
-// calendarView.allowsMultipleSelection = true
- calendarView.scrollToDate(Date())
- calendarView.selectDates([Date()])
-
- self.calendarView.visibleDates {[unowned self] (visibleDates: DateSegmentInfo) in
- self.setupViewsOfCalendar(from: visibleDates)
- }
-
- setupScrollMode()
- }
-
- var rangeSelectedDates: [Date] = []
- func didStartRangeSelecting(gesture: UILongPressGestureRecognizer) {
- let point = gesture.location(in: gesture.view!)
- rangeSelectedDates = calendarView.selectedDates
- if let cellState = calendarView.cellStatus(at: point) {
- let date = cellState.date
- if !calendarView.selectedDates.contains(date) {
- let dateRange = calendarView.generateDateRange(from: calendarView.selectedDates.first ?? date, to: date)
- for aDate in dateRange {
- if !rangeSelectedDates.contains(aDate) {
- rangeSelectedDates.append(aDate)
- }
- }
- calendarView.selectDates(from: rangeSelectedDates.first!, to: date, keepSelectionIfMultiSelectionAllowed: true)
- } else {
- let indexOfNewlySelectedDate = rangeSelectedDates.firstIndex(of: date)! + 1
- let lastIndex = rangeSelectedDates.endIndex
- let followingDay = testCalendar.date(byAdding: .day, value: 1, to: date)!
- calendarView.selectDates(from: followingDay, to: rangeSelectedDates.last!, keepSelectionIfMultiSelectionAllowed: false)
- rangeSelectedDates.removeSubrange(indexOfNewlySelectedDate..")
- for date in calendarView.selectedDates {
- print(formatter.string(from: date))
- }
- }
-
- @IBAction func resize(_ sender: UIButton) {
-
-
- calendarView.frame = CGRect(
- x: calendarView.frame.origin.x,
- y: calendarView.frame.origin.y,
- width: calendarView.frame.width,
- height: calendarView.frame.height - 50
- )
-
- let date = calendarView.visibleDates().monthDates.first!.date
- calendarView.reloadData(withAnchor: date)
- }
-
- @IBAction func reloadCalendar(_ sender: UIButton) {
- let date = Date()
- calendarView.reloadData(withAnchor: date)
- }
-
- @IBAction func next(_ sender: UIButton) {
- self.calendarView.scrollToSegment(.next)
- }
-
- @IBAction func previous(_ sender: UIButton) {
- self.calendarView.scrollToSegment(.previous)
- }
-
- func setupViewsOfCalendar(from visibleDates: DateSegmentInfo) {
- guard let startDate = visibleDates.monthDates.first?.date else {
- return
- }
- let month = testCalendar.dateComponents([.month], from: startDate).month!
- let monthName = DateFormatter().monthSymbols[(month-1) % 12]
- // 0 indexed array
- let year = testCalendar.component(.year, from: startDate)
- monthLabel.text = monthName + " " + String(year)
- }
-
- func handleCellConfiguration(cell: JTACDayCell?, cellState: CellState) {
- handleCellSelection(view: cell, cellState: cellState)
- handleCellTextColor(view: cell, cellState: cellState)
- prePostVisibility?(cellState, cell as? CellView)
- }
-
-
- // Function to handle the text color of the calendar
- func handleCellTextColor(view: JTACDayCell?, cellState: CellState) {
- guard let myCustomCell = view as? CellView else {
- return
- }
-
- if cellState.isSelected {
- myCustomCell.dayLabel.textColor = .white
- } else {
- myCustomCell.dayLabel.textColor = .black
- }
-
- myCustomCell.isHidden = cellState.dateBelongsTo != .thisMonth
-
- }
-
- override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
- let visibleDates = calendarView.visibleDates()
- calendarView.viewWillTransition(to: .zero, with: coordinator, anchorDate: visibleDates.monthDates.first?.date)
- }
-
- // Function to handle the calendar selection
- func handleCellSelection(view: JTACDayCell?, cellState: CellState) {
- guard let myCustomCell = view as? CellView else {return }
-// switch cellState.selectedPosition() {
-// case .full:
-// myCustomCell.backgroundColor = .green
-// case .left:
-// myCustomCell.backgroundColor = .yellow
-// case .right:
-// myCustomCell.backgroundColor = .red
-// case .middle:
-// myCustomCell.backgroundColor = .blue
-// case .none:
-// myCustomCell.backgroundColor = nil
-// }
-
- if cellState.isSelected {
- myCustomCell.selectedView.layer.cornerRadius = 13
- myCustomCell.selectedView.isHidden = false
- } else {
- myCustomCell.selectedView.isHidden = true
- }
- }
-
-
- @IBAction func decreaseSectionInset(_ sender: UIButton) {
-
- calendarView.sectionInset.bottom -= 3
- calendarView.sectionInset.top -= 3
- calendarView.sectionInset.left -= 3
- calendarView.sectionInset.right -= 3
-
- calendarView.reloadData()
- }
-
- @IBAction func increaseSectionInset(_ sender: UIButton) {
- calendarView.sectionInset.bottom += 3
- calendarView.sectionInset.top += 3
- calendarView.sectionInset.left += 3
- calendarView.sectionInset.right += 3
- calendarView.reloadData()
- }
-
- func setupScrollMode() {
- currentScrollModeIndex = 6
- calendarView.scrollingMode = allScrollModes[currentScrollModeIndex]
- }
-}
-
-// MARK : JTAppleCalendarDelegate
-extension ViewController: JTACMonthViewDelegate, JTACMonthViewDataSource {
- func configureCalendar(_ calendar: JTACMonthView) -> ConfigurationParameters {
-
- formatter.dateFormat = "yyyy MM dd"
- formatter.timeZone = testCalendar.timeZone
- formatter.locale = testCalendar.locale
-
-
- let startDate = formatter.date(from: "2018 01 01")!
- let endDate = formatter.date(from: "2020 12 01")!
-
- let parameters = ConfigurationParameters(startDate: startDate,
- endDate: endDate,
- numberOfRows: numberOfRows,
- calendar: testCalendar,
- generateInDates: generateInDates,
- generateOutDates: generateOutDates,
- firstDayOfWeek: .sunday,
- hasStrictBoundaries: hasStrictBoundaries)
- return parameters
- }
-
- func configureVisibleCell(myCustomCell: CellView, cellState: CellState, date: Date, indexPath: IndexPath) {
- myCustomCell.dayLabel.text = cellState.text
- if testCalendar.isDateInToday(date) {
- myCustomCell.backgroundColor = .red
- } else {
- myCustomCell.backgroundColor = .white
- }
-
- handleCellConfiguration(cell: myCustomCell, cellState: cellState)
-
-
- if cellState.text == "1" {
- let formatter = DateFormatter()
- formatter.dateFormat = "MMM"
- let month = formatter.string(from: date)
- myCustomCell.monthLabel.text = "\(month) \(cellState.text)"
- } else {
- myCustomCell.monthLabel.text = ""
- }
- }
-
- func calendar(_ calendar: JTACMonthView, willDisplay cell: JTACDayCell, forItemAt date: Date, cellState: CellState, indexPath: IndexPath) {
- // This function should have the same code as the cellForItemAt function
- let myCustomCell = cell as! CellView
- configureVisibleCell(myCustomCell: myCustomCell, cellState: cellState, date: date, indexPath: indexPath)
- }
-
- func calendar(_ calendar: JTACMonthView, cellForItemAt date: Date, cellState: CellState, indexPath: IndexPath) -> JTACDayCell {
- let myCustomCell = calendar.dequeueReusableCell(withReuseIdentifier: "CellView", for: indexPath) as! CellView
- configureVisibleCell(myCustomCell: myCustomCell, cellState: cellState, date: date, indexPath: indexPath)
- return myCustomCell
- }
-
- func calendar(_ calendar: JTACMonthView, didDeselectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) {
- handleCellConfiguration(cell: cell, cellState: cellState)
- }
-
- func calendar(_ calendar: JTACMonthView, didSelectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) {
- handleCellConfiguration(cell: cell, cellState: cellState)
- }
-
- func calendar(_ calendar: JTACMonthView, didScrollToDateSegmentWith visibleDates: DateSegmentInfo) {
-// print("After: \(calendar.contentOffset.y)")
-
- }
-
- func calendar(_ calendar: JTACMonthView, willScrollToDateSegmentWith visibleDates: DateSegmentInfo) {
- setupViewsOfCalendar(from: visibleDates)
- }
-
- func calendar(_ calendar: JTACMonthView, headerViewForDateRange range: (start: Date, end: Date), at indexPath: IndexPath) -> JTACMonthReusableView {
- let date = range.start
- let month = testCalendar.component(.month, from: date)
- formatter.dateFormat = "MMM"
- let header: JTACMonthReusableView
- if month % 2 > 0 {
- header = calendar.dequeueReusableJTAppleSupplementaryView(withReuseIdentifier: "WhiteSectionHeaderView", for: indexPath)
- (header as! WhiteSectionHeaderView).title.text = formatter.string(from: date)
- } else {
- header = calendar.dequeueReusableJTAppleSupplementaryView(withReuseIdentifier: "PinkSectionHeaderView", for: indexPath)
- (header as! PinkSectionHeaderView).title.text = formatter.string(from: date)
- }
- return header
- }
-
- func sizeOfDecorationView(indexPath: IndexPath) -> CGRect {
- let stride = calendarView.frame.width * CGFloat(indexPath.section)
- return CGRect(x: stride + 5, y: 5, width: calendarView.frame.width - 10, height: calendarView.frame.height - 10)
- }
-
- func calendarSizeForMonths(_ calendar: JTACMonthView?) -> MonthSize? {
- return monthSize
- }
-}
diff --git a/SampleJTAppleCalendar/ExampleDateCells/DateCellCreatedWithCode/CodeCellView.swift b/SampleJTAppleCalendar/ExampleDateCells/DateCellCreatedWithCode/CodeCellView.swift
deleted file mode 100644
index 9f8bf5fc..00000000
--- a/SampleJTAppleCalendar/ExampleDateCells/DateCellCreatedWithCode/CodeCellView.swift
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// CodeCellView.swift
-// JTAppleCalendar
-//
-// Created by JayT on 2016-05-26.
-// Copyright © 2016 CocoaPods. All rights reserved.
-//
-
-import UIKit
-import JTAppleCalendar
-
-class CodeCellView: JTACDayCell {
- let bgColor = UIColor.red
- // Only override drawRect: if you perform custom drawing.
- // An empty implementation adversely affects performance during animation.
-
- override func draw(_ rect: CGRect) {
- let context = UIGraphicsGetCurrentContext()
- context?.setFillColor(red: 1.0, green: 0.5, blue: 0.0, alpha: 1.0)
- let r1 = CGRect(x: 0, y: 0, width: 25, height: 25)
- context?.addRect(r1)
- context?.fillPath()
- context?.setStrokeColor(red: 1.0, green: 1.0, blue: 0.5, alpha: 1.0)
- context?.addEllipse(in: CGRect(x: 0, y: 0, width: 25, height: 25))
- context?.strokePath()
- }
-
-}
diff --git a/SampleJTAppleCalendar/ExampleDateCells/DateCellCreatedWithXIB/CellView.swift b/SampleJTAppleCalendar/ExampleDateCells/DateCellCreatedWithXIB/CellView.swift
deleted file mode 100644
index 47ffe23a..00000000
--- a/SampleJTAppleCalendar/ExampleDateCells/DateCellCreatedWithXIB/CellView.swift
+++ /dev/null
@@ -1,16 +0,0 @@
-//
-// CellView.swift
-// testApplicationCalendar
-//
-// Created by JayT on 2016-03-04.
-// Copyright © 2016 OS-Tech. All rights reserved.
-//
-
-import UIKit
-import JTAppleCalendar
-
-class CellView: JTACDayCell {
- @IBOutlet var selectedView: UIView!
- @IBOutlet var dayLabel: UILabel!
- @IBOutlet var monthLabel: UILabel!
-}
diff --git a/SampleJTAppleCalendar/ExampleDateCells/DateCellCreatedWithXIB/CellView.xib b/SampleJTAppleCalendar/ExampleDateCells/DateCellCreatedWithXIB/CellView.xib
deleted file mode 100644
index 1564022d..00000000
--- a/SampleJTAppleCalendar/ExampleDateCells/DateCellCreatedWithXIB/CellView.xib
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/SampleJTAppleCalendar/ExampleSectionHeaders/HeaderAsClass/CodePinkSectionHeaderView.swift b/SampleJTAppleCalendar/ExampleSectionHeaders/HeaderAsClass/CodePinkSectionHeaderView.swift
deleted file mode 100644
index 0ced984f..00000000
--- a/SampleJTAppleCalendar/ExampleSectionHeaders/HeaderAsClass/CodePinkSectionHeaderView.swift
+++ /dev/null
@@ -1,25 +0,0 @@
-//
-// CodePinkSectionHeaderView.swift
-// JTAppleCalendar
-//
-// Created by JayT on 2016-07-15.
-// Copyright © 2016 CocoaPods. All rights reserved.
-//
-
-import UIKit
-import JTAppleCalendar
-
-class CodePinkSectionHeaderView: JTACMonthReusableView {
-
- override func draw(_ rect: CGRect) {
- let context = UIGraphicsGetCurrentContext()!
- context.setFillColor(red: 1.0, green: 0.5, blue: 0.0, alpha: 1.0)
- let r1 = CGRect(x: 0, y: 0, width: 25, height: 25)
- context.addRect(r1)
- context.fillPath()
- context.setStrokeColor(red: 1.0, green: 1.0, blue: 0.5, alpha: 1.0)
- context.addEllipse(in: CGRect(x: 0, y: 0, width: 25, height: 25))
- context.strokePath()
- }
-
-}
diff --git a/SampleJTAppleCalendar/ExampleSectionHeaders/HeaderAsClass/CodeWhiteSectionHeaderView.swift b/SampleJTAppleCalendar/ExampleSectionHeaders/HeaderAsClass/CodeWhiteSectionHeaderView.swift
deleted file mode 100644
index 570af386..00000000
--- a/SampleJTAppleCalendar/ExampleSectionHeaders/HeaderAsClass/CodeWhiteSectionHeaderView.swift
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-// CodeWhiteSectionHeaderView.swift
-// JTAppleCalendar
-//
-// Created by JayT on 2016-07-15.
-// Copyright © 2016 CocoaPods. All rights reserved.
-//
-
-import UIKit
-import JTAppleCalendar
-
-class CodeWhiteSectionHeaderView: JTACMonthReusableView {
- // Only override drawRect: if you perform custom drawing.
- // An empty implementation adversely affects performance during animation.
-
- override func draw(_ rect: CGRect) {
- let context = UIGraphicsGetCurrentContext()!
- context.setFillColor(red: 1.0, green: 2.5, blue: 0.3, alpha: 1.0)
- let r1 = CGRect(x: 0, y: 0, width: 25, height: 25) // Size
- context.addRect(r1)
- context.fillPath()
- context.setStrokeColor(red: 1.0, green: 1.0, blue: 0.5, alpha: 1.0)
- context.addEllipse(in: CGRect(x: 0, y: 0, width: 25, height: 25))
- context.strokePath()
- }
-
-}
diff --git a/SampleJTAppleCalendar/ExampleSectionHeaders/HeaderAsXibs/PinkSectionHeaderView.swift b/SampleJTAppleCalendar/ExampleSectionHeaders/HeaderAsXibs/PinkSectionHeaderView.swift
deleted file mode 100644
index 6e274ea5..00000000
--- a/SampleJTAppleCalendar/ExampleSectionHeaders/HeaderAsXibs/PinkSectionHeaderView.swift
+++ /dev/null
@@ -1,14 +0,0 @@
-//
-// PinkSectionHeaderView.swift
-// JTAppleCalendar
-//
-// Created by JayT on 2016-05-11.
-// Copyright © 2016 CocoaPods. All rights reserved.
-//
-
-import UIKit
-import JTAppleCalendar
-
-class PinkSectionHeaderView: JTACMonthReusableView {
- @IBOutlet var title: UILabel!
-}
diff --git a/SampleJTAppleCalendar/ExampleSectionHeaders/HeaderAsXibs/PinkSectionHeaderView.xib b/SampleJTAppleCalendar/ExampleSectionHeaders/HeaderAsXibs/PinkSectionHeaderView.xib
deleted file mode 100644
index 7f73abb1..00000000
--- a/SampleJTAppleCalendar/ExampleSectionHeaders/HeaderAsXibs/PinkSectionHeaderView.xib
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/SampleJTAppleCalendar/ExampleSectionHeaders/HeaderAsXibs/WhiteSectionHeaderView.swift b/SampleJTAppleCalendar/ExampleSectionHeaders/HeaderAsXibs/WhiteSectionHeaderView.swift
deleted file mode 100644
index 046ad917..00000000
--- a/SampleJTAppleCalendar/ExampleSectionHeaders/HeaderAsXibs/WhiteSectionHeaderView.swift
+++ /dev/null
@@ -1,13 +0,0 @@
-//
-// WhiteSectionHeaderView.swift
-// JTAppleCalendar
-//
-// Created by JayT on 2016-05-16.
-// Copyright © 2016 CocoaPods. All rights reserved.
-//
-import UIKit
-import JTAppleCalendar
-
-class WhiteSectionHeaderView: JTACMonthReusableView {
- @IBOutlet weak var title: UILabel!
-}
diff --git a/SampleJTAppleCalendar/ExampleSectionHeaders/HeaderAsXibs/WhiteSectionHeaderView.xib b/SampleJTAppleCalendar/ExampleSectionHeaders/HeaderAsXibs/WhiteSectionHeaderView.xib
deleted file mode 100644
index d4b5c492..00000000
--- a/SampleJTAppleCalendar/ExampleSectionHeaders/HeaderAsXibs/WhiteSectionHeaderView.xib
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/SampleJTAppleCalendar/Info.plist b/SampleJTAppleCalendar/Info.plist
deleted file mode 100644
index a20b6a3f..00000000
--- a/SampleJTAppleCalendar/Info.plist
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-
-
- CFBundleDevelopmentRegion
- $(DEVELOPMENT_LANGUAGE)
- CFBundleExecutable
- $(EXECUTABLE_NAME)
- CFBundleIdentifier
- $(PRODUCT_BUNDLE_IDENTIFIER)
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleName
- $(PRODUCT_NAME)
- CFBundlePackageType
- $(PRODUCT_BUNDLE_PACKAGE_TYPE)
- CFBundleShortVersionString
- 1.0
- CFBundleVersion
- 1
- LSRequiresIPhoneOS
-
- UIApplicationSceneManifest
-
- UIApplicationSupportsMultipleScenes
-
- UISceneConfigurations
-
- UIWindowSceneSessionRoleApplication
-
-
- UILaunchStoryboardName
- LaunchScreen
- UISceneConfigurationName
- Default Configuration
- UISceneDelegateClassName
- $(PRODUCT_MODULE_NAME).SceneDelegate
- UISceneStoryboardFile
- Main
-
-
-
-
- UILaunchStoryboardName
- LaunchScreen
- UIMainStoryboardFile
- Main
- UIRequiredDeviceCapabilities
-
- armv7
-
- UISupportedInterfaceOrientations
-
- UIInterfaceOrientationPortrait
- UIInterfaceOrientationLandscapeLeft
- UIInterfaceOrientationLandscapeRight
-
- UISupportedInterfaceOrientations~ipad
-
- UIInterfaceOrientationPortrait
- UIInterfaceOrientationPortraitUpsideDown
- UIInterfaceOrientationLandscapeLeft
- UIInterfaceOrientationLandscapeRight
-
-
-
diff --git a/SampleJTAppleCalendar/Main.storyboard b/SampleJTAppleCalendar/Main.storyboard
deleted file mode 100644
index 5ea2a0af..00000000
--- a/SampleJTAppleCalendar/Main.storyboard
+++ /dev/null
@@ -1,1416 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/SampleJTAppleCalendar/SceneDelegate.swift b/SampleJTAppleCalendar/SceneDelegate.swift
deleted file mode 100644
index 82743c59..00000000
--- a/SampleJTAppleCalendar/SceneDelegate.swift
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// SceneDelegate.swift
-// SampleJTAppleCalendar
-//
-// Created by Jeron Thomas on 2019-06-25.
-// Copyright © 2019 OsTech. All rights reserved.
-//
-
-import UIKit
-
-class SceneDelegate: UIResponder, UIWindowSceneDelegate {
-
- var window: UIWindow?
-
-
- func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
- // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
- // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
- // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
- guard let _ = (scene as? UIWindowScene) else { return }
- }
-
- func sceneDidDisconnect(_ scene: UIScene) {
- // Called as the scene is being released by the system.
- // This occurs shortly after the scene enters the background, or when its session is discarded.
- // Release any resources associated with this scene that can be re-created the next time the scene connects.
- // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
- }
-
- func sceneDidBecomeActive(_ scene: UIScene) {
- // Called when the scene has moved from an inactive state to an active state.
- // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
- }
-
- func sceneWillResignActive(_ scene: UIScene) {
- // Called when the scene will move from an active state to an inactive state.
- // This may occur due to temporary interruptions (ex. an incoming phone call).
- }
-
- func sceneWillEnterForeground(_ scene: UIScene) {
- // Called as the scene transitions from the background to the foreground.
- // Use this method to undo the changes made on entering the background.
- }
-
- func sceneDidEnterBackground(_ scene: UIScene) {
- // Called as the scene transitions from the foreground to the background.
- // Use this method to save data, release shared resources, and store enough scene-specific state information
- // to restore the scene back to its current state.
- }
-
-
-}
-
diff --git a/SampleJTAppleCalendarUITests/Info.plist b/SampleJTAppleCalendarUITests/Info.plist
deleted file mode 100644
index 64d65ca4..00000000
--- a/SampleJTAppleCalendarUITests/Info.plist
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
- CFBundleDevelopmentRegion
- $(DEVELOPMENT_LANGUAGE)
- CFBundleExecutable
- $(EXECUTABLE_NAME)
- CFBundleIdentifier
- $(PRODUCT_BUNDLE_IDENTIFIER)
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleName
- $(PRODUCT_NAME)
- CFBundlePackageType
- $(PRODUCT_BUNDLE_PACKAGE_TYPE)
- CFBundleShortVersionString
- 1.0
- CFBundleVersion
- 1
-
-
diff --git a/SampleJTAppleCalendarUITests/SampleJTAppleCalendarUITests.swift b/SampleJTAppleCalendarUITests/SampleJTAppleCalendarUITests.swift
deleted file mode 100644
index 266c21d9..00000000
--- a/SampleJTAppleCalendarUITests/SampleJTAppleCalendarUITests.swift
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// SampleJTAppleCalendarUITests.swift
-// SampleJTAppleCalendarUITests
-//
-// Created by Jeron Thomas on 2019-11-16.
-// Copyright © 2019 OsTech. All rights reserved.
-//
-
-import XCTest
-
-class SampleJTAppleCalendarUITests: XCTestCase {
-
- override func setUp() {
- // Put setup code here. This method is called before the invocation of each test method in the class.
-
- // In UI tests it is usually best to stop immediately when a failure occurs.
- continueAfterFailure = false
-
- // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
- }
-
- override func tearDown() {
- // Put teardown code here. This method is called after the invocation of each test method in the class.
- }
-
- func testExample() {
- // UI tests must launch the application that they test.
- let app = XCUIApplication()
- app.launch()
- print("")
-
-
-
- // Use recording to get started writing UI tests.
- // Use XCTAssert and related functions to verify your tests produce the correct results.
- }
-
- func testLaunchPerformance() {
- if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) {
- // This measures how long it takes to launch your application.
- measure(metrics: [XCTOSSignpostMetric.applicationLaunch]) {
- XCUIApplication().launch()
- }
- }
- }
-}
diff --git a/Sources/JTAppleCalendar/CalendarEnums.swift b/Sources/JTAppleCalendar/CalendarEnums.swift
deleted file mode 100644
index b2febda2..00000000
--- a/Sources/JTAppleCalendar/CalendarEnums.swift
+++ /dev/null
@@ -1,149 +0,0 @@
-//
-// CalendarEnums.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-import UIKit
-
-/// Describes a scroll destination
-public enum SegmentDestination {
- /// next the destination is the following segment
- case next
- /// previous the destination is the previous segment
- case previous
- /// start the destination is the start segment
- case start
- /// end the destination is the end segment
- case end
-}
-/// Describes the types of out-date cells to be generated.
-public enum OutDateCellGeneration {
- /// tillEndOfRow will generate dates till it reaches the end of a row.
- /// endOfGrid will continue generating until it has filled a 6x7 grid.
- /// Off-mode will generate no postdates
- case tillEndOfRow, tillEndOfGrid, off
-}
-
-/// Describes the types of out-date cells to be generated.
-public enum InDateCellGeneration {
- /// forFirstMonthOnly will generate dates for the first month only
- /// forAllMonths will generate dates for all months
- /// off setting will generate no dates
- case forFirstMonthOnly, forAllMonths, off
-}
-
-/// Describes the calendar reading direction
-/// Useful for regions that read text from right to left
-public enum ReadingOrientation {
- /// Reading orientation is from right to left
- case rightToLeft
- /// Reading orientation is from left to right
- case leftToRight
-}
-
-/// Configures the behavior of the scrolling mode of the calendar
-public enum ScrollingMode: Equatable {
- /// stopAtEachCalendarFrame - non-continuous scrolling that will stop at each frame
- case stopAtEachCalendarFrame
- /// stopAtEachSection - non-continuous scrolling that will stop at each section
- case stopAtEachSection
- /// stopAtEach - non-continuous scrolling that will stop at each custom interval
- case stopAtEach(customInterval: CGFloat)
- /// nonStopToSection - continuous scrolling that will stop at a section
- case nonStopToSection(withResistance: CGFloat)
- /// nonStopToCell - continuous scrolling that will stop at a cell
- case nonStopToCell(withResistance: CGFloat)
- /// nonStopTo - continuous scrolling that will stop at acustom interval, do not use 0 as custom interval
- case nonStopTo(customInterval: CGFloat, withResistance: CGFloat)
- /// none - continuous scrolling that will eventually stop at a point
- case none
-
- func pagingIsEnabled() -> Bool {
- switch self {
- case .stopAtEachCalendarFrame: return true
- default: return false
- }
- }
-
- public static func ==(lhs: ScrollingMode, rhs: ScrollingMode) -> Bool {
- switch (lhs, rhs) {
- case (.none, .none),
- (.stopAtEachCalendarFrame, .stopAtEachCalendarFrame),
- (.stopAtEachSection, .stopAtEachSection): return true
- case (let .stopAtEach(customInterval: v1), let .stopAtEach(customInterval: v2)): return v1 == v2
- case (let .nonStopToSection(withResistance: v1), let .nonStopToSection(withResistance: v2)): return v1 == v2
- case (let .nonStopToCell(withResistance: v1), let .nonStopToCell(withResistance: v2)): return v1 == v2
- case (let .nonStopTo(customInterval: v1, withResistance: x1), let .nonStopTo(customInterval: v2, withResistance: x2)): return v1 == v2 && x1 == x2
- default: return false
- }
- }
-}
-
-/// Describes which month owns the date
-public enum DateOwner: Int {
- /// Describes which month owns the date
- case thisMonth = 0,
- previousMonthWithinBoundary,
- previousMonthOutsideBoundary,
- followingMonthWithinBoundary,
- followingMonthOutsideBoundary
-}
-/// Months of the year
-public enum MonthsOfYear: Int, CaseIterable {
- case jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec
-}
-
-/// Selection position of a range-selected date cell
-public enum SelectionRangePosition: Int {
- /// Selection position
- case left = 1, middle, right, full, none
-}
-
-/// Between month segments, the range selection can either be visually disconnected or connected
-public enum RangeSelectionMode {
- case segmented, continuous
-}
-
-/// Signifies whether or not a selection was done programatically or by the user
-public enum SelectionType: String {
- /// Selection type
- case programatic, userInitiated
-}
-
-/// Days of the week. By setting your calendar's first day of the week,
-/// you can change which day is the first for the week. Sunday is the default value.
-public enum DaysOfWeek: Int, CaseIterable {
- /// Days of the week.
- case sunday = 1, monday, tuesday, wednesday, thursday, friday, saturday
-}
-
-internal enum DelayedTaskType {
- case scroll, general
-}
-
-internal enum SelectionAction {
- case didSelect, didDeselect
-}
-
-internal enum ShouldSelectionAction {
- case shouldSelect, shouldDeselect
-}
diff --git a/Sources/JTAppleCalendar/CalendarStructs.swift b/Sources/JTAppleCalendar/CalendarStructs.swift
deleted file mode 100644
index 5697d809..00000000
--- a/Sources/JTAppleCalendar/CalendarStructs.swift
+++ /dev/null
@@ -1,409 +0,0 @@
-//
-// CalendarStructs.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-
-import UIKit
-
-/// Describes which month the cell belongs to
-/// - ThisMonth: Cell belongs to the current month
-/// - PreviousMonthWithinBoundary: Cell belongs to the previous month.
-/// Previous month is included in the date boundary you have set in your
-/// delegate - PreviousMonthOutsideBoundary: Cell belongs to the previous
-/// month. Previous month is not included in the date boundary you have set
-/// in your delegate - FollowingMonthWithinBoundary: Cell belongs to the
-/// following month. Following month is included in the date boundary you have
-/// set in your delegate - FollowingMonthOutsideBoundary: Cell belongs to the
-/// following month. Following month is not included in the date boundary you
-/// have set in your delegate You can use these cell states to configure how
-/// you want your date cells to look. Eg. you can have the colors belonging
-/// to the month be in color black, while the colors of previous months be in
-/// color gray.
-public struct CellState {
- /// returns true if a cell is selected
- public let isSelected: Bool
- /// returns the date as a string
- public let text: String
- /// returns the a description of which month owns the date
- public let dateBelongsTo: DateOwner
- /// returns the date
- public let date: Date
- /// returns the day
- public let day: DaysOfWeek
- /// returns the row in which the date cell appears visually
- public let row: () -> Int
- /// returns the column in which the date cell appears visually
- public let column: () -> Int
- /// returns the section the date cell belongs to
- public let dateSection: () -> (range: (start: Date, end: Date), month: Int, rowCount: Int)
- /// returns the position of a selection in the event you wish to do range selection
- public let selectedPosition: () -> SelectionRangePosition
- /// returns the cell.
- /// Useful if you wish to display something at the cell's frame/position
- public var cell: () -> JTACDayCell?
- /// Shows if a cell's selection/deselection was done either programatically or by the user
- /// This variable is guranteed to be non-nil inside of a didSelect/didDeselect function
- public var selectionType: SelectionType? = nil
-}
-
-/// Defines the parameters which configures the calendar.
-public struct ConfigurationParameters {
- /// The start date boundary of your calendar
- var startDate: Date
- /// The end-date boundary of your calendar
- var endDate: Date
- /// Number of rows you want to calendar to display per date section
- var numberOfRows: Int
- /// Your calendar() Instance
- var calendar: Calendar
- /// Describes the types of in-date cells to be generated.
- var generateInDates: InDateCellGeneration
- /// Describes the types of out-date cells to be generated.
- var generateOutDates: OutDateCellGeneration
- /// Sets the first day of week
- var firstDayOfWeek: DaysOfWeek
- /// Determine if dates of a month should stay in its section
- /// or if it can flow into another months section. This value is ignored
- /// if your calendar has registered headers
- var hasStrictBoundaries: Bool
-
- /// init-function
- public init(startDate: Date,
- endDate: Date,
- numberOfRows: Int = 6,
- calendar: Calendar = Calendar.current,
- generateInDates: InDateCellGeneration = .forAllMonths,
- generateOutDates: OutDateCellGeneration = .tillEndOfGrid,
- firstDayOfWeek: DaysOfWeek? = nil,
- hasStrictBoundaries: Bool? = nil) {
- self.startDate = startDate
- self.endDate = endDate
-
- if numberOfRows > 0 && numberOfRows < 7 {
- self.numberOfRows = numberOfRows
- } else {
- self.numberOfRows = 6
- }
-
- if let nonNilHasStrictBoundaries = hasStrictBoundaries {
- self.hasStrictBoundaries = nonNilHasStrictBoundaries
- } else {
- self.hasStrictBoundaries = self.numberOfRows > 1 ? true : false
- }
- self.calendar = calendar
- self.generateInDates = generateInDates
- self.generateOutDates = generateOutDates
-
- if let firstDayOfWeek = firstDayOfWeek {
- self.firstDayOfWeek = firstDayOfWeek
- } else {
- self.firstDayOfWeek = DaysOfWeek(rawValue: calendar.firstWeekday) ?? .sunday
- }
- }
-}
-
-public struct MonthSize {
- var defaultSize: CGFloat
- var months: [CGFloat:[MonthsOfYear]]?
- var dates: [CGFloat: [Date]]?
-
- public init(defaultSize: CGFloat, months: [CGFloat:[MonthsOfYear]]? = nil, dates: [CGFloat: [Date]]? = nil) {
- self.defaultSize = defaultSize
- self.months = months
- self.dates = dates
- }
-}
-
-struct CalendarData {
- var months: [Month]
- var totalSections: Int
- var sectionToMonthMap: [Int: Int]
- var totalDays: Int
-}
-
-/// Defines a month structure.
-public struct Month {
- /// Index of the month
- let index: Int
-
- /// Start index day for the month.
- /// The start is total number of days of previous months
- let startDayIndex: Int
-
- /// Start cell index for the month.
- /// The start is total number of cells of previous months
- let startCellIndex: Int
-
- /// The total number of items in this array are the total number
- /// of sections. The actual number is the number of items in each section
- let sections: [Int]
-
- /// Number of inDates for this month
- public let inDates: Int
-
- /// Number of outDates for this month
- public let outDates: Int
-
- /// Maps a section to the index in the total number of sections
- let sectionIndexMaps: [Int: Int]
-
- /// Number of rows for the month
- public let rows: Int
-
- /// Name of the month
- public let name: MonthsOfYear
-
- // Return the total number of days for the represented month
- public let numberOfDaysInMonth: Int
-
- // Return the total number of day cells
- // to generate for the represented month
- var numberOfDaysInMonthGrid: Int {
- return numberOfDaysInMonth + inDates + outDates
- }
-
- var startSection: Int {
- return sectionIndexMaps.keys.min()!
- }
-
- // Return the section in which a day is contained
- func indexPath(forDay number: Int) -> IndexPath? {
- let sectionInfo = sectionFor(day: number)
- let externalSection = sectionInfo.externalSection
- let internalSection = sectionInfo.internalSection
- let dateOfStartIndex = sections[0.. (externalSection: Int, internalSection: Int) {
- var variableNumber = day
- let possibleSection = sections.firstIndex {
- let retval = variableNumber + inDates <= $0
- variableNumber -= $0
- return retval
- }!
- return (sectionIndexMaps.key(for: possibleSection)!, possibleSection)
- }
-
- // Return the number of rows for a section in the month
- func numberOfRows(for section: Int, developerSetRows: Int) -> Int {
- var retval: Int
- guard let theSection = sectionIndexMaps[section] else {
- return 0
- }
- let fullRows = rows / developerSetRows
- let partial = sections.count - fullRows
-
- if theSection + 1 <= fullRows {
- retval = developerSetRows
- } else if fullRows == 0 && partial > 0 {
- retval = rows
- } else {
- retval = 1
- }
- return retval
- }
-
- // Returns the maximum number of a rows for a completely full section
- func maxNumberOfRowsForFull(developerSetRows: Int) -> Int {
- var retval: Int
- let fullRows = rows / developerSetRows
- if fullRows < 1 {
- retval = rows
- } else {
- retval = developerSetRows
- }
- return retval
- }
-
- func boundaryIndicesFor(section: Int) -> (startIndex: Int, endIndex: Int)? {
- // Check internal sections to see
- if !(0.. (months: [Month], monthMap: [Int: Int], totalSections: Int, totalDays: Int) {
- let differenceComponents = parameters.calendar.dateComponents([.month], from: parameters.startDate, to: parameters.endDate)
- let numberOfMonths = differenceComponents.month! + 1
- // if we are for example on the same month
- // and the difference is 0 we still need 1 to display it
- var monthArray: [Month] = []
- var monthIndexMap: [Int: Int] = [:]
- var section = 0
- var startIndexForMonth = 0
- var startCellIndexForMonth = 0
- var totalDays = 0
- let numberOfRowsPerSectionThatUserWants = parameters.numberOfRows
- // Section represents # of months. section is used as an offset
- // to determine which month to calculate
-
- // Track the month name index
- var monthNameIndex = parameters.calendar.component(.month, from: parameters.startDate) - 1
- let allMonthsOfYear = MonthsOfYear.allCases
-
- for monthIndex in 0 ..< numberOfMonths {
- if let currentMonthDate = parameters.calendar.date(byAdding: .month, value: monthIndex, to: parameters.startDate) {
- var numberOfDaysInMonthVariable = parameters.calendar.range(of: .day, in: .month, for: currentMonthDate)!.count
- let numberOfDaysInMonthFixed = numberOfDaysInMonthVariable
- var numberOfRowsToGenerateForCurrentMonth = 0
- var numberOfPreDatesForThisMonth = 0
- let predatesGeneration = parameters.generateInDates
- if predatesGeneration != .off {
- numberOfPreDatesForThisMonth = numberOfInDatesForMonth(currentMonthDate, firstDayOfWeek: parameters.firstDayOfWeek, calendar: parameters.calendar)
- numberOfDaysInMonthVariable += numberOfPreDatesForThisMonth
- if predatesGeneration == .forFirstMonthOnly && monthIndex != 0 {
- numberOfDaysInMonthVariable -= numberOfPreDatesForThisMonth
- numberOfPreDatesForThisMonth = 0
- }
- }
-
- if parameters.generateOutDates == .tillEndOfGrid {
- numberOfRowsToGenerateForCurrentMonth = maxNumberOfRowsPerMonth
- } else {
- let actualNumberOfRowsForThisMonth = Int(ceil(Float(numberOfDaysInMonthVariable) / Float(maxNumberOfDaysInWeek)))
- numberOfRowsToGenerateForCurrentMonth = actualNumberOfRowsForThisMonth
- }
- var numberOfPostDatesForThisMonth = 0
- let postGeneration = parameters.generateOutDates
- switch postGeneration {
- case .tillEndOfGrid, .tillEndOfRow:
- numberOfPostDatesForThisMonth =
- maxNumberOfDaysInWeek * numberOfRowsToGenerateForCurrentMonth - (numberOfDaysInMonthFixed + numberOfPreDatesForThisMonth)
- numberOfDaysInMonthVariable += numberOfPostDatesForThisMonth
- default:
- break
- }
- var sectionsForTheMonth: [Int] = []
- var sectionIndexMaps: [Int: Int] = [:]
- for index in 0..<6 {
- // Max number of sections in the month
- if numberOfDaysInMonthVariable < 1 {
- break
- }
- monthIndexMap[section] = monthIndex
- sectionIndexMaps[section] = index
- var numberOfDaysInCurrentSection = numberOfRowsPerSectionThatUserWants * maxNumberOfDaysInWeek
- if numberOfDaysInCurrentSection > numberOfDaysInMonthVariable {
- numberOfDaysInCurrentSection = numberOfDaysInMonthVariable
- // assert(false)
- }
- totalDays += numberOfDaysInCurrentSection
- sectionsForTheMonth.append(numberOfDaysInCurrentSection)
- numberOfDaysInMonthVariable -= numberOfDaysInCurrentSection
- section += 1
- }
- monthArray.append(Month(
- index: monthIndex,
- startDayIndex: startIndexForMonth,
- startCellIndex: startCellIndexForMonth,
- sections: sectionsForTheMonth,
- inDates: numberOfPreDatesForThisMonth,
- outDates: numberOfPostDatesForThisMonth,
- sectionIndexMaps: sectionIndexMaps,
- rows: numberOfRowsToGenerateForCurrentMonth,
- name: allMonthsOfYear[monthNameIndex],
- numberOfDaysInMonth: numberOfDaysInMonthFixed
- ))
- startIndexForMonth += numberOfDaysInMonthFixed
- startCellIndexForMonth += numberOfDaysInMonthFixed + numberOfPreDatesForThisMonth + numberOfPostDatesForThisMonth
-
- // Increment month name
- monthNameIndex += 1
- if monthNameIndex > 11 { monthNameIndex = 0 }
- }
- }
- return (monthArray, monthIndexMap, section, totalDays)
- }
-
- private func numberOfInDatesForMonth(_ date: Date, firstDayOfWeek: DaysOfWeek, calendar: Calendar) -> Int {
- let firstDayCalValue: Int
- switch firstDayOfWeek {
- case .monday: firstDayCalValue = 6
- case .tuesday: firstDayCalValue = 5
- case .wednesday: firstDayCalValue = 4
- case .thursday: firstDayCalValue = 10
- case .friday: firstDayCalValue = 9
- case .saturday: firstDayCalValue = 8
- default: firstDayCalValue = 7
- }
-
- var firstWeekdayOfMonthIndex = calendar.component(.weekday, from: date)
- firstWeekdayOfMonthIndex -= 1
- // firstWeekdayOfMonthIndex should be 0-Indexed
- // push it modularly so that we take it back one day so that the
- // first day is Monday instead of Sunday which is the default
- return (firstWeekdayOfMonthIndex + firstDayCalValue) % maxNumberOfDaysInWeek
- }
-}
-
-/// Contains the information for visible dates of the calendar.
-public struct DateSegmentInfo {
- /// Visible pre-dates
- public let indates: [(date: Date, indexPath: IndexPath)]
- /// Visible month-dates
- public let monthDates: [(date: Date, indexPath: IndexPath)]
- /// Visible post-dates
- public let outdates: [(date: Date, indexPath: IndexPath)]
-}
-
-struct SelectedCellData {
- let indexPath: IndexPath
- let date: Date
- var counterIndexPath: IndexPath?
- let cellState: CellState
-
- enum DateOwnerCategory {
- case inDate, outDate, monthDate
- }
-
- var dateBelongsTo: DateOwnerCategory {
- switch cellState.dateBelongsTo {
- case .thisMonth: return .monthDate
- case .previousMonthOutsideBoundary, .previousMonthWithinBoundary: return .inDate
- case .followingMonthWithinBoundary, .followingMonthOutsideBoundary: return .outDate
- }
- }
-
- init(indexPath: IndexPath, counterIndexPath: IndexPath? = nil, date: Date, cellState: CellState) {
- self.indexPath = indexPath
- self.date = date
- self.cellState = cellState
- self.counterIndexPath = counterIndexPath
- }
-}
diff --git a/Sources/JTAppleCalendar/GlobalFunctionsAndExtensions.swift b/Sources/JTAppleCalendar/GlobalFunctionsAndExtensions.swift
deleted file mode 100644
index 9b5eb0a1..00000000
--- a/Sources/JTAppleCalendar/GlobalFunctionsAndExtensions.swift
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-// GlobalFunctionsAndExtensions.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-import Foundation
-
-extension Calendar {
- static let formatter: DateFormatter = {
- let dateFormatter = DateFormatter()
- dateFormatter.dateFormat = "yyyy MM dd"
- dateFormatter.isLenient = true
- return dateFormatter
- }()
-
-
- func startOfMonth(for date: Date) -> Date? {
- guard let interval = self.dateInterval(of: .month, for: date) else { return nil }
- return interval.start
- }
-
- func endOfMonth(for date: Date) -> Date? {
- guard let interval = self.dateInterval(of: .month, for: date) else { return nil }
- return self.date(byAdding: DateComponents(day: -1), to: interval.end)
- }
-
- private func dateFormatterComponents(from date: Date) -> (month: Int, year: Int)? {
-
- // Setup the dateformatter to this instance's settings
- Calendar.formatter.timeZone = self.timeZone
- Calendar.formatter.locale = self.locale
- Calendar.formatter.calendar = self
-
- let comp = self.dateComponents([.year, .month], from: date)
-
- guard
- let month = comp.month,
- let year = comp.year else {
- return nil
- }
- return (month, year)
- }
-}
-
-extension Dictionary where Value: Equatable {
- func key(for value: Value) -> Key? {
- guard let index = firstIndex(where: { $0.1 == value }) else {
- return nil
- }
- return self[index].0
- }
-}
diff --git a/Sources/JTAppleCalendar/Info.plist b/Sources/JTAppleCalendar/Info.plist
deleted file mode 100644
index 9bcb2444..00000000
--- a/Sources/JTAppleCalendar/Info.plist
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
- CFBundleDevelopmentRegion
- $(DEVELOPMENT_LANGUAGE)
- CFBundleExecutable
- $(EXECUTABLE_NAME)
- CFBundleIdentifier
- $(PRODUCT_BUNDLE_IDENTIFIER)
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleName
- $(PRODUCT_NAME)
- CFBundlePackageType
- $(PRODUCT_BUNDLE_PACKAGE_TYPE)
- CFBundleShortVersionString
- 1.0
- CFBundleVersion
- $(CURRENT_PROJECT_VERSION)
-
-
diff --git a/Sources/JTAppleCalendar/JTACCollectionMonthViewDelegates.swift b/Sources/JTAppleCalendar/JTACCollectionMonthViewDelegates.swift
deleted file mode 100644
index f3563b3e..00000000
--- a/Sources/JTAppleCalendar/JTACCollectionMonthViewDelegates.swift
+++ /dev/null
@@ -1,248 +0,0 @@
-//
-// JTACCollectionViewDelegates.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-import UIKit
-
-extension JTACMonthView: UICollectionViewDelegate, UICollectionViewDataSource {
- /// Asks your data source object to provide a
- /// supplementary view to display in the collection view.
- public func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
- guard
- let validDate = monthInfoFromSection(indexPath.section),
- let delegate = calendarDelegate else {
- developerError(string: "Either date could not be generated or delegate was nil")
- assert(false, "Date could not be generated for section. This is a bug. Contact the developer")
- return UICollectionReusableView()
- }
-
- let headerView = delegate.calendar(self, headerViewForDateRange: validDate.range, at: indexPath)
- headerView.transform.a = semanticContentAttribute == .forceRightToLeft ? -1 : 1
- return headerView
- }
-
- public func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
- if !pathsToReload.contains(indexPath) { return }
- pathsToReload.remove(indexPath)
- let cellState: CellState
- if let validCachedCellState = selectedCellData[indexPath]?.cellState {
- cellState = validCachedCellState
- } else {
- cellState = cellStateFromIndexPath(indexPath)
- }
- calendarDelegate!.calendar(self, willDisplay: cell as! JTACDayCell, forItemAt: cellState.date, cellState: cellState, indexPath: indexPath)
- }
-
- /// Tells the delegate that the item at the specified index path was highlighted.
- public func collectionView(_ collectionView: UICollectionView, didHighlightItemAt indexPath: IndexPath) {
- guard
- let delegate = calendarDelegate,
- let infoOfDate = dateOwnerInfoFromPath(indexPath) else {
- return
- }
- let cell = collectionView.cellForItem(at: indexPath) as? JTACDayCell
- let cellState = cellStateFromIndexPath(indexPath, withDateInfo: infoOfDate, selectionType: .userInitiated)
- delegate.calendar(self, didHighlightDate: cellState.date, cell: cell, cellState: cellState, indexPath: indexPath)
- }
-
- /// Tells the delegate that the item at the specified index path was unhighlighted.
- public func collectionView(_ collectionView: UICollectionView, didUnhighlightItemAt indexPath: IndexPath) {
- guard
- let delegate = calendarDelegate,
- let infoOfDate = dateOwnerInfoFromPath(indexPath) else {
- return
- }
- let cell = collectionView.cellForItem(at: indexPath) as? JTACDayCell
- let cellState = cellStateFromIndexPath(indexPath, withDateInfo: infoOfDate, selectionType: .userInitiated)
- delegate.calendar(self, didUnhighlightDate: cellState.date, cell: cell, cellState: cellState, indexPath: indexPath)
- }
-
- /// Asks your data source object for the cell that corresponds
- /// to the specified item in the collection view.
- public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
- guard let delegate = calendarDelegate else {
- print("Your delegate does not conform to JTAppleCalendarMonthViewDelegate")
- assert(false)
- return UICollectionViewCell()
- }
- let cellState = cellStateFromIndexPath(indexPath)
- let configuredCell = delegate.calendar(self, cellForItemAt: cellState.date, cellState: cellState, indexPath: indexPath)
-
- pathsToReload.remove(indexPath)
- configuredCell.transform.a = semanticContentAttribute == .forceRightToLeft ? -1 : 1
- return configuredCell
- }
-
- /// Asks your data sourceobject for the number of sections in
- /// the collection view. The number of sections in collectionView.
- public func numberOfSections(in collectionView: UICollectionView) -> Int {
- return monthMap.count
- }
-
- /// Asks your data source object for the number of items in the
- /// specified section. The number of rows in section.
- public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
- if calendarViewLayout.cellCache.isEmpty {return 0}
- guard let count = calendarViewLayout.cellCache[section]?.count else {
- developerError(string: "cellCacheSection does not exist.")
- return 0
- }
- return count
- }
-
- /// Asks the delegate if the specified item should be selected.
- /// true if the item should be selected or false if it should not.
- public func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool {
- return handleShouldSelectionValueChange(collectionView, action: .shouldSelect, indexPath: indexPath, selectionType: .userInitiated)
- }
-
- /// Asks the delegate if the specified item should be deselected.
- /// true if the item should be deselected or false if it should not.
- public func collectionView(_ collectionView: UICollectionView, shouldDeselectItemAt indexPath: IndexPath) -> Bool {
- return handleShouldSelectionValueChange(collectionView, action: .shouldDeselect, indexPath: indexPath, selectionType: .userInitiated)
- }
-
- /// Tells the delegate that the item at the specified index
- /// path was selected. The collection view calls this method when the
- /// user successfully selects an item in the collection view.
- /// It does not call this method when you programmatically
- /// set the selection.
- public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
- handleSelectionValueChanged(collectionView, action: .didSelect, indexPath: indexPath, selectionType: .userInitiated)
- }
-
- /// Tells the delegate that the item at the specified path was deselected.
- /// The collection view calls this method when the user successfully
- /// deselects an item in the collection view.
- /// It does not call this method when you programmatically deselect items.
- public func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) {
- handleSelectionValueChanged(collectionView, action: .didDeselect, indexPath: indexPath, selectionType: .userInitiated)
- }
-
- public func sizeOfDecorationView(indexPath: IndexPath) -> CGRect {
- guard let size = calendarDelegate?.sizeOfDecorationView(indexPath: indexPath) else { return .zero }
- return size
- }
-
- func handleSelectionValueChanged(_ collectionView: UICollectionView, action: SelectionAction, indexPath: IndexPath, selectionType: SelectionType, shouldTriggerSelectionDelegate: Bool = true) {
- guard
- let delegate = calendarDelegate,
- let infoOfDate = dateOwnerInfoFromPath(indexPath) else {
- return
- }
- // index paths to be reloaded should be index to the left and right of the selected index
- var localPathsToReload: Set = allowsRangedSelection ? validForwardAndBackwordSelectedIndexes(forIndexPath: indexPath, restrictToSection: false).set : []
-
- let cell = collectionView.cellForItem(at: indexPath) as? JTACDayCell
- if !shouldTriggerSelectionDelegate || cell == nil {
- pathsToReload.insert(indexPath)
- localPathsToReload.insert(indexPath)
- }
-
- let isSelected = action == .didSelect ? true : false
-
- // If cell has a counterpart cell, then select it as well
- let cellState = cellStateFromIndexPath(indexPath, withDateInfo: infoOfDate, cell: cell, isSelected: isSelected, selectionType: selectionType)
-
- // Update model
- let cleanupAction: (IndexPath, Date, DateOwner) -> IndexPath?
-
- if action == .didSelect {
- cleanupAction = selectCounterPartCellIndexPath
- addCellToSelectedSet(indexPath, date: infoOfDate.date, cellState: cellState)
- } else {
- cleanupAction = deselectCounterPartCellIndexPath
- deleteCellFromSelectedSetIfSelected(indexPath)
- }
-
- // check if the paths to reload (forward&backward indexes) also have counterpart dates
- if !localPathsToReload.isEmpty {
- let reloadPaths = localPathsToReload
- for path in reloadPaths {
- if let validCounterPath = selectedCellData[path]?.counterIndexPath {
- localPathsToReload.insert(validCounterPath)
- }
- }
- }
-
- if let counterPartIndexPath = cleanupAction(indexPath, infoOfDate.date, cellState.dateBelongsTo) {
- localPathsToReload.insert(counterPartIndexPath)
- let counterPathsToReload = allowsRangedSelection ? validForwardAndBackwordSelectedIndexes(forIndexPath: counterPartIndexPath, restrictToSection: false).set : []
- localPathsToReload.formUnion(counterPathsToReload)
- }
-
- setMinMaxDate()
-
- if shouldTriggerSelectionDelegate {
- if action == .didSelect {
- delegate.calendar(self, didSelectDate: infoOfDate.date, cell: cell, cellState: cellState, indexPath: indexPath)
- } else {
- delegate.calendar(self, didDeselectDate: infoOfDate.date, cell: cell, cellState: cellState, indexPath: indexPath)
- }
- }
-
- if !localPathsToReload.isEmpty {
- batchReloadIndexPaths(Array(localPathsToReload))
- }
- }
-
- func setMinMaxDate() {
- let selectedCellData = self.selectedCellData
- let sortedKeys = selectedCellData.keys.sorted()
- guard
- let firstIndex = sortedKeys.first,
- let lastIndex = sortedKeys.last else {
- selectedCells.first = nil
- selectedCells.last = nil
- return
- }
- let date = selectedCellData[firstIndex]!.date
- selectedCells.first = (date, firstIndex)
- selectedCells.last = (date, lastIndex)
- }
-
- func handleShouldSelectionValueChange(_ collectionView: UICollectionView, action: ShouldSelectionAction, indexPath: IndexPath, selectionType: SelectionType) -> Bool {
- if let
- delegate = calendarDelegate,
- let infoOfDate = dateOwnerInfoFromPath(indexPath) {
- let cell = collectionView.cellForItem(at: indexPath) as? JTACDayCell
- let cellState = cellStateFromIndexPath(indexPath,
- withDateInfo: infoOfDate,
- selectionType: selectionType)
- switch action {
- case .shouldSelect:
- return delegate.calendar(self, shouldSelectDate: infoOfDate.date, cell: cell, cellState: cellState, indexPath: indexPath)
- case .shouldDeselect:
- return delegate.calendar(self, shouldDeselectDate: infoOfDate.date, cell: cell, cellState: cellState, indexPath: indexPath)
- }
- }
- return false
- }
-
- public func indexPathForPreferredFocusedView(in collectionView: UICollectionView) -> IndexPath? {
- if let delegate = calendarDelegate {
- return delegate.indexPathForPreferredFocusedView(in: collectionView)
- }
- return nil
- }
-}
diff --git a/Sources/JTAppleCalendar/JTACCollectionYearViewDelegates.swift b/Sources/JTAppleCalendar/JTACCollectionYearViewDelegates.swift
deleted file mode 100644
index c8bd4144..00000000
--- a/Sources/JTAppleCalendar/JTACCollectionYearViewDelegates.swift
+++ /dev/null
@@ -1,85 +0,0 @@
-//
-// JTACCollectionYearViewDelegates.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-import UIKit
-import Foundation
-
-extension JTACYearView: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
- public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
- return monthData.count
- }
-
- public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
- guard
- let delegate = calendarDelegate,
- monthData.count > indexPath.item else {
- print("Invalid startup parameters. Exiting calendar setup.")
- assert(false)
- return UICollectionViewCell()
- }
-
- if let monthData = monthData[indexPath.item] as? Month {
- guard let date = configurationParameters.calendar.date(byAdding: .month, value: monthData.index, to: configurationParameters.startDate) else {
- print("Invalid startup parameters. Exiting calendar setup.")
- assert(false)
- return UICollectionViewCell()
- }
-
- let cell = delegate.calendar(self, cellFor: self.monthData[indexPath.item], at: date, indexPath: indexPath)
- cell.setupWith(configurationParameters: configurationParameters,
- month: monthData,
- delegate: self)
- return cell
- } else {
- let date = findFirstMonthCellDate(cellIndex: indexPath.item, monthData: monthData)
- return delegate.calendar(self, cellFor: self.monthData[indexPath.item], at: date, indexPath: indexPath)
- }
- }
-
- func findFirstMonthCellDate(cellIndex: Int, monthData: [Any]) -> Date {
- var retval = configurationParameters.endDate
- for index in cellIndex.. CGSize {
- guard let size = calendarDelegate?.calendar(self, sizeFor: monthData[indexPath.item]) else {
- let width: CGFloat = monthData[indexPath.item] is Month ? (frame.width - 40) / 3 : frame.width
- let height = width
- return CGSize(width: width, height: height)
- }
- return size
- }
-}
diff --git a/Sources/JTAppleCalendar/JTACDayCell.swift b/Sources/JTAppleCalendar/JTACDayCell.swift
deleted file mode 100644
index 8365d70f..00000000
--- a/Sources/JTAppleCalendar/JTACDayCell.swift
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-// JTACDayCell.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-import UIKit
-
-/// The JTAppleDayCell class defines the attributes and
-/// behavior of the cells that appear in JTAppleCalendarMonthView objects.
-@available(*, unavailable, renamed: "JTACDayCell")
-open class JTAppleCell: UICollectionViewCell{}
-open class JTACDayCell: UICollectionViewCell {
- @available(*, message: "Using isSelected only to determing when selection occurs is ok. For other cases please use cellState.isSelected to avoid synchronization issues.")
- open override var isSelected: Bool {
- get { return super.isSelected }
- set { super.isSelected = newValue}
- }
-
- /// Cell view that will be customized
- public override init(frame: CGRect) {
- super.init(frame: frame)
- }
-
- /// Returns an object initialized from data in a given unarchiver.
- required public init?(coder aDecoder: NSCoder) {
- super.init(coder: aDecoder)
- }
-
- /// Prepares the receiver for service after it has been loaded from an Interface Builder archive, or nib file.
- open override func awakeFromNib() {
- super.awakeFromNib()
-
- self.contentView.frame = self.bounds
- self.contentView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
- }
-
-}
diff --git a/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift b/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift
deleted file mode 100644
index 5e1a9607..00000000
--- a/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift
+++ /dev/null
@@ -1,630 +0,0 @@
-//
-// JTACInteractionMonthFunctions.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-import UIKit
-
-extension JTACMonthView {
-
- /// Returns the cellStatus of a date that is visible on the screen.
- /// If the row and column for the date cannot be found,
- /// then nil is returned
- /// - Paramater row: Int row of the date to find
- /// - Paramater column: Int column of the date to find
- /// - returns:
- /// - CellState: The state of the found cell
- public func cellStatusForDate(at row: Int, column: Int) -> CellState? {
- guard let section = currentSection() else {
- return nil
- }
- let convertedRow = (row * maxNumberOfDaysInWeek) + column
- let indexPathToFind = IndexPath(item: convertedRow, section: section)
- if let date = dateOwnerInfoFromPath(indexPathToFind) {
- let stateOfCell = cellStateFromIndexPath(indexPathToFind, withDateInfo: date)
- return stateOfCell
- }
- return nil
- }
-
- /// Returns the cell status for a given date
- /// - Parameter: date Date of the cell you want to find
- /// - returns:
- /// - CellState: The state of the found cell
- public func cellStatus(for date: Date) -> CellState? {
- if !calendarLayoutIsLoaded || isReloadDataInProgress { return nil }
- // validate the path
- let paths = pathsFromDates([date])
- // Jt101 change this function to also return
- // information like the dateInfoFromPath function
- if paths.isEmpty { return nil }
- let cell = cellForItem(at: paths[0]) as? JTACDayCell
- let stateOfCell = cellStateFromIndexPath(paths[0], cell: cell)
- return stateOfCell
- }
-
- /// Returns the cell status for a given date
- /// - Parameter: date Date of the cell you want to find
- /// - returns:
- /// - CellState: The state of the found cell
- public func cellStatus(for date: Date, completionHandler: @escaping (_ cellStatus: CellState?) ->()) {
- if !calendarLayoutIsLoaded || isReloadDataInProgress {
- addToDelayedHandlers {[unowned self] in
- self.cellStatus(for: date, completionHandler: completionHandler)
- }
- return
- }
- let retval = cellStatus(for: date)
- completionHandler(retval)
- }
-
- func addToDelayedHandlers(function: @escaping ()->()) {
- if isScrollInProgress {
- scrollDelayedExecutionClosure.append { function() }
- } else {
- generalDelayedExecutionClosure.append { function() }
- }
- }
-
- /// Returns the month status for a given date
- /// - Parameter: date Date of the cell you want to find
- /// - returns:
- /// - Month: The state of the found month
- public func monthStatus(for date: Date) -> Month? {
- guard
- let calendar = _cachedConfiguration?.calendar,
- let startMonth = startOfMonthCache,
- let monthIndex = calendar.dateComponents([.month], from: startMonth, to: date).month else {
- return nil
- }
- return monthInfo[monthIndex]
- }
-
- /// Returns the cell status for a given point
- /// - Parameter: point of the cell you want to find
- /// - returns:
- /// - CellState: The state of the found cell
- public func cellStatus(at point: CGPoint) -> CellState? {
- if let indexPath = indexPathForItem(at: point) {
- let cell = cellForItem(at: indexPath) as? JTACDayCell
- return cellStateFromIndexPath(indexPath, cell: cell)
- }
- return nil
- }
-
- /// Deselect all selected dates
- /// - Parameter: this funciton triggers a delegate call by default. Set this to false if you do not want this
- /// - Parameter keepDeselectionIfMultiSelectionAllowed:
- /// if (in range selection) there are 4 dates. -> selected, unselected, selected, selected. (S | U | S | S)
- /// Deselecting those 4 dates again would give U | S | U | U. With KeepDeselection, this becomes U | U | U | U
- public func deselectAllDates(triggerSelectionDelegate: Bool = true) {
- deselect(dates: selectedDates, triggerSelectionDelegate: triggerSelectionDelegate)
- }
-
- /// Deselect dates
- /// - Parameter: Dates - The dates to deselect
- /// - Parameter: triggerSelectionDelegate - this funciton triggers a delegate call by default. Set this to false if you do not want this
- /// - Parameter keepDeselectionIfMultiSelectionAllowed:
- /// if (in range selection) there are 4 dates. -> selected, unselected, selected, selected. (S | U | S | S)
- /// Deselecting those 4 dates again would give U | S | U | U. With KeepDeselection, this becomes U | U | U | U
- public func deselect(dates: [Date], triggerSelectionDelegate: Bool = true, keepDeselectionIfMultiSelectionAllowed: Bool = false) {
- if allowsMultipleSelection {
- var filteredDates: [Date] = dates
- if keepDeselectionIfMultiSelectionAllowed {
- filteredDates = dates.filter { self.selectedDatesSet.contains(calendar.startOfDay(for: $0)) }
- }
- selectDates(filteredDates, triggerSelectionDelegate: triggerSelectionDelegate, keepSelectionIfMultiSelectionAllowed: false)
- } else {
- let paths = pathsFromDates(dates)
- guard !paths.isEmpty else { return }
- assert(paths.count < 2, "WARNING: you are trying to deselect multiple dates with allowsMultipleSelection == false. Only the first date will be deselected.")
- collectionView(self, didDeselectItemAt: paths[0])
- }
- }
-
- /// Notifies the container that the size of its view is about to change.
- public func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator, anchorDate: Date?) {
- DispatchQueue.main.async { [weak self] in
- guard let _self = self else { return }
- _self.reloadData(withAnchor: anchorDate)
- }
- }
-
- /// Generates a range of dates from from a startDate to an
- /// endDate you provide
- /// Parameter startDate: Start date to generate dates from
- /// Parameter endDate: End date to generate dates to
- /// returns:
- /// - An array of the successfully generated dates
- public func generateDateRange(from startDate: Date, to endDate: Date) -> [Date] {
- if startDate > endDate { return [] }
- var returnDates: [Date] = []
- var currentDate = startDate
- repeat {
- returnDates.append(currentDate)
- currentDate = calendar.startOfDay(for: calendar.date(
- byAdding: .day, value: 1, to: currentDate)!)
- } while currentDate <= endDate
- return returnDates
- }
-
- /// Registers a class for use in creating supplementary views for the collection view.
- /// For now, the calendar only supports: 'UICollectionElementKindSectionHeader' for the forSupplementaryViewOfKind(parameter)
- open override func register(_ viewClass: AnyClass?, forSupplementaryViewOfKind elementKind: String, withReuseIdentifier identifier: String) {
- super.register(viewClass, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: identifier)
- }
-
- /// Registers a class for use in creating supplementary views for the collection view.
- /// For now, the calendar only supports: 'UICollectionElementKindSectionHeader' for the forSupplementaryViewOfKind(parameter)
- open override func register(_ nib: UINib?, forSupplementaryViewOfKind kind: String, withReuseIdentifier identifier: String) {
- super.register(nib, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: identifier)
- }
-
- /// Dequeues re-usable calendar cells
- public func dequeueReusableJTAppleSupplementaryView(withReuseIdentifier identifier: String, for indexPath: IndexPath) -> JTACMonthReusableView {
- guard let headerView = dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader,
- withReuseIdentifier: identifier,
- for: indexPath) as? JTACMonthReusableView else {
- developerError(string: "Error initializing Header View with identifier: '\(identifier)'")
- return JTACMonthReusableView()
- }
- return headerView
- }
-
- /// Registers a nib for use in creating Decoration views for the collection view.
- public func registerDecorationView(nib: UINib?) {
- calendarViewLayout.register(nib, forDecorationViewOfKind: decorationViewID)
- }
- /// Registers a class for use in creating Decoration views for the collection view.
- public func register(viewClass className: AnyClass?, forDecorationViewOfKind kind: String) {
- calendarViewLayout.register(className, forDecorationViewOfKind: decorationViewID)
- }
- /// Dequeues a reuable calendar cell
- public func dequeueReusableJTAppleCell(withReuseIdentifier identifier: String, for indexPath: IndexPath) -> JTACDayCell {
- guard let cell = dequeueReusableCell(withReuseIdentifier: identifier, for: indexPath) as? JTACDayCell else {
- developerError(string: "Error initializing Cell View with identifier: '\(identifier)'")
- return JTACDayCell()
- }
- return cell
- }
-
- /// Reloads the data on the calendar view. Scroll delegates are not
- // triggered with this function.
- /// - Parameter date: An anchordate that the calendar will
- /// scroll to after reload completes
- /// - Parameter animation: Scroll is animated if this is set to true
- /// - Parameter completionHandler: This closure will run after
- /// the reload is complete
- public func reloadData(withAnchor date: Date? = nil, completionHandler: (() -> Void)? = nil) {
- if isReloadDataInProgress {
- calendarViewLayout.delayedExecutionClosure.append {[weak self] in
- guard let _ = self else { return }
- completionHandler?()
- }
- return
- }
- if isScrollInProgress {
- scrollDelayedExecutionClosure.append {[unowned self] in
- self.reloadData(completionHandler: completionHandler)
- }
- return
- }
-
- isReloadDataInProgress = true
- anchorDate = date
-
- let selectedDates = self.selectedDates
- let data = reloadDelegateDataSource()
- if data.shouldReload {
- calendarViewLayout.clearCache()
- setupMonthInfoAndMap(with: data.configParameters)
- selectedCellData = [:]
- }
-
- // Restore the selected index paths if dates were already selected.
- if !selectedDates.isEmpty {
- calendarViewLayout.delayedExecutionClosure.append {[weak self] in
- guard let _self = self else { return}
- _self.isReloadDataInProgress = false
- _self.selectDates(selectedDates, triggerSelectionDelegate: false, keepSelectionIfMultiSelectionAllowed: true)
- }
- }
-
- // Add calendar reload completion
- calendarViewLayout.delayedExecutionClosure.append {[weak self] in
- guard let _self = self else { return }
- _self.isReloadDataInProgress = false
- completionHandler?()
- if !_self.generalDelayedExecutionClosure.isEmpty { _self.executeDelayedTasks(.general) }
- }
- calendarViewLayout.reloadWasTriggered = true
- DispatchQueue.main.async {
- super.reloadData()
- }
- }
-
- /// Reload the date of specified date-cells on the calendar-view
- /// - Parameter dates: Date-cells with these specified
- /// dates will be reloaded
- public func reloadDates(_ dates: [Date]) {
- var paths: Set = []
- for date in dates {
- let aPath = pathsFromDates([date])
- if let validPath = aPath.first {
- paths.insert(validPath)
- let cellState = cellStateFromIndexPath(validPath)
- if let validCounterPartCellPath = indexPathOfdateCellCounterPath(date,dateOwner: cellState.dateBelongsTo) {
- paths.insert(validCounterPartCellPath)
- }
- }
- }
- batchReloadIndexPaths(Array(paths))
- }
-
- /// Select a date-cell range
- /// - Parameter startDate: Date to start the selection from
- /// - Parameter endDate: Date to end the selection from
- /// - Parameter triggerDidSelectDelegate: Triggers the delegate
- /// function only if the value is set to true.
- /// Sometimes it is necessary to setup some dates without triggereing
- /// the delegate e.g. For instance, when youre initally setting up data
- /// in your viewDidLoad
- /// - Parameter keepSelectionIfMultiSelectionAllowed: This is only
- /// applicable in allowedMultiSelection = true.
- /// This overrides the default toggle behavior of selection.
- /// If true, selected cells will remain selected.
- public func selectDates(from startDate: Date, to endDate: Date, triggerSelectionDelegate: Bool = true, keepSelectionIfMultiSelectionAllowed: Bool = false) {
- selectDates(generateDateRange(from: startDate, to: endDate),
- triggerSelectionDelegate: triggerSelectionDelegate,
- keepSelectionIfMultiSelectionAllowed: keepSelectionIfMultiSelectionAllowed)
- }
-
- /// Deselect all selected dates within a range
- /// - Parameter: start - Start of date range to deselect
- /// - Parameter: end of date range to deselect
- /// - Parameter keepDeselectionIfMultiSelectionAllowed:
- /// if (in range selection) there are 4 dates. -> selected, unselected, selected, selected. (S | U | S | S)
- /// Deselecting those 4 dates again would give U | S | U | U. With KeepDeselection, this becomes U | U | U | U
- public func deselectDates(from start: Date, to end: Date? = nil, triggerSelectionDelegate: Bool = true, keepDeselectionIfMultiSelectionAllowed: Bool = false) {
- if selectedDates.isEmpty { return }
- let end = end ?? selectedDates.last!
- let dates = selectedDates.filter { $0 >= start && $0 <= end }
- deselect(dates: dates, triggerSelectionDelegate: triggerSelectionDelegate, keepDeselectionIfMultiSelectionAllowed: keepDeselectionIfMultiSelectionAllowed)
-
- }
-
- /// Select a date-cells
- /// - Parameter date: The date-cell with this date will be selected
- /// - Parameter triggerDidSelectDelegate: Triggers the delegate function
- /// only if the value is set to true.
- /// Sometimes it is necessary to setup some dates without triggereing
- /// the delegate e.g. For instance, when youre initally setting up data
- /// in your viewDidLoad
- /// - Parameter keepSelectionIfMultiSelectionAllowed:
- /// if (in range selection) there are 4 dates. -> selected, unselected, selected, selected. (S | U | S | S)
- /// Selecting those 4 dates again would give U | S | U | U. With KeepSelection, this becomes S | S | S | S
- public func selectDates(_ dates: [Date], triggerSelectionDelegate: Bool = true, keepSelectionIfMultiSelectionAllowed: Bool = false) {
- if dates.isEmpty { return }
- if (!calendarLayoutIsLoaded || isReloadDataInProgress) {
- // If the calendar is not yet fully loaded.
- // Add the task to the delayed queue
- generalDelayedExecutionClosure.append {[unowned self] in
- self.selectDates(dates,
- triggerSelectionDelegate: triggerSelectionDelegate,
- keepSelectionIfMultiSelectionAllowed: keepSelectionIfMultiSelectionAllowed)
- }
- return
- }
- var allIndexPathsToReload: Set = []
- var validDatesToSelect = dates
- // If user is trying to select multiple dates with
- // multiselection disabled, then only select the last object
- if !allowsMultipleSelection, let dateToSelect = dates.last {
- validDatesToSelect = [dateToSelect]
- }
-
- for date in validDatesToSelect {
- let date = calendar.startOfDay(for: date)
- let components = calendar.dateComponents([.year, .month, .day], from: date)
- let firstDayOfDate = calendar.date(from: components)!
-
- // If the date is not within valid boundaries, then exit
- if !(firstDayOfDate >= startOfMonthCache! && firstDayOfDate <= endOfMonthCache!) { continue }
-
- let pathFromDates = pathsFromDates([date])
- // If the date path youre searching for, doesnt exist, return
- if pathFromDates.isEmpty { continue }
- let sectionIndexPath = pathFromDates[0]
-
- // Remove old selections
- if allowsMultipleSelection {
- // If multiple selection is on. Multiple selection behaves differently to singleselection.
- // It behaves like a toggle. unless keepSelectionIfMultiSelectionAllowed is true.
- // If user wants to force selection if multiselection is enabled, then removed the selected dates from generated dates
- if keepSelectionIfMultiSelectionAllowed, selectedDates.contains(date) {
- guard
- let selectedIndexPaths = indexPathsForSelectedItems,
- selectedIndexPaths.contains(sectionIndexPath) else {
- // Select the item if it is not selected (not included in indexPathsForSelectedItems).
- // This makes the cell to be in selected state thus, if selected physically, will call the didDeselect function
- programaticallySelectItem(at: sectionIndexPath, shouldTriggerSelectionDelegate: triggerSelectionDelegate)
- continue
- }
- // Just add it to be reloaded, if it is already selected
- allIndexPathsToReload.insert(sectionIndexPath)
- } else {
- if selectedCellData[sectionIndexPath] != nil { // If this cell is already selected, then deselect it
- programaticallyDeselectItem(at: sectionIndexPath, shouldTriggerSelectionDelegate: triggerSelectionDelegate)
- } else { // If this cell is unselected, then select it
- programaticallySelectItem(at: sectionIndexPath, shouldTriggerSelectionDelegate: triggerSelectionDelegate)
- }
- }
- } else {
- // If single selection is ON
- let selectedIndexPaths = selectedCellData
-
- if let cellData = (selectedIndexPaths.filter { $0.key != sectionIndexPath }.first) {
- programaticallyDeselectItem(at: cellData.value.indexPath, shouldTriggerSelectionDelegate: triggerSelectionDelegate)
- }
- // Add new selections Must be added here. If added in delegate didSelectItemAtIndexPath
- programaticallySelectItem(at: sectionIndexPath, shouldTriggerSelectionDelegate: triggerSelectionDelegate)
- }
- }
- // If triggering was false, although the selectDelegates weren't
- // called, we do want the cell refreshed. Reload to call itemAtIndexPath
- if !triggerSelectionDelegate && !allIndexPathsToReload.isEmpty {
- // Because sometimes if not on main thread, it will not get the
- // visible cells in the following function
- DispatchQueue.main.async {
- self.batchReloadIndexPaths(Array(allIndexPathsToReload))
- }
- }
- }
-
- func programaticallyDeselectItem(at indexPath: IndexPath, shouldTriggerSelectionDelegate: Bool) {
- if !handleShouldSelectionValueChange(self, action: .shouldDeselect, indexPath: indexPath, selectionType: .programatic) { return }
- deselectItem(at: indexPath, animated: false)
- handleSelectionValueChanged(self, action: .didDeselect, indexPath: indexPath, selectionType: .programatic, shouldTriggerSelectionDelegate: shouldTriggerSelectionDelegate)
- }
-
- func programaticallySelectItem(at indexPath: IndexPath, shouldTriggerSelectionDelegate: Bool) {
- if !handleShouldSelectionValueChange(self, action: .shouldSelect, indexPath: indexPath, selectionType: .programatic) { return }
- selectItem(at: indexPath, animated: false, scrollPosition: [])
- handleSelectionValueChanged(self, action: .didSelect, indexPath: indexPath, selectionType: .programatic, shouldTriggerSelectionDelegate: shouldTriggerSelectionDelegate)
- }
-
- /// Scrolls the calendar view to the next section view. It will execute a completion handler at the end of scroll animation if provided.
- /// - Paramater direction: Indicates a direction to scroll
- /// - Paramater animateScroll: Bool indicating if animation should be enabled
- /// - Parameter triggerScrollToDateDelegate: trigger delegate if set to true
- /// - Parameter completionHandler: A completion handler that will be executed at the end of the scroll animation
- public func scrollToSegment(_ destination: SegmentDestination,
- triggerScrollToDateDelegate: Bool = true,
- animateScroll: Bool = true,
- extraAddedOffset: CGFloat = 0,
- completionHandler: (() -> Void)? = nil) {
- if functionIsUnsafeSafeToRun {
- addToDelayedHandlers {[unowned self] in
- self.scrollToSegment(destination,
- triggerScrollToDateDelegate: triggerScrollToDateDelegate,
- animateScroll: animateScroll,
- extraAddedOffset: extraAddedOffset,
- completionHandler: completionHandler)
- }
- return
- }
-
- let fixedScrollSize: CGFloat
- var xOffset: CGFloat = 0
- var yOffset: CGFloat = 0
-
- switch scrollDirection {
- case .horizontal:
- if calendarViewLayout.thereAreHeaders || _cachedConfiguration?.generateOutDates == .tillEndOfGrid {
- fixedScrollSize = calendarViewLayout.sizeOfContentForSection(0)
- } else {
- fixedScrollSize = frame.width
- }
-
- var section = contentOffset.x / fixedScrollSize
- let roundedSection = round(section)
- if abs(roundedSection - section) < errorDelta { section = roundedSection }
- section = CGFloat(Int(section))
-
- xOffset = (fixedScrollSize * section)
- switch destination {
- case .next:
- xOffset += fixedScrollSize
- case .previous:
- xOffset -= fixedScrollSize
- case .end:
- xOffset = contentSize.width - frame.width
- case .start:
- xOffset = 0
- }
-
- if xOffset <= 0 {
- xOffset = 0
- } else if xOffset >= contentSize.width - frame.width {
- xOffset = contentSize.width - frame.width
- }
- case .vertical:
- fallthrough
- default:
- guard let currentSection = currentSection() else { return }
- if (destination == .next && currentSection + 1 >= numberOfSections(in: self)) ||
- destination == .previous && currentSection - 1 < 0 ||
- numberOfSections(in: self) < 0 {
- return
- }
-
- if calendarViewLayout.thereAreHeaders {
-
- switch destination {
- case .next:
- scrollToHeaderInSection(currentSection + 1, extraAddedOffset: extraAddedOffset, completionHandler: completionHandler)
- case .previous:
- scrollToHeaderInSection(currentSection - 1, extraAddedOffset: extraAddedOffset, completionHandler: completionHandler)
- case .start:
- scrollToHeaderInSection(0, extraAddedOffset: extraAddedOffset, completionHandler: completionHandler)
- case .end:
- scrollToHeaderInSection(numberOfSections(in: self) - 1, extraAddedOffset: extraAddedOffset, completionHandler: completionHandler)
- }
- return
- } else {
- switch destination {
- case .next: yOffset = calendarViewLayout.cachedValue(for: 0, section: currentSection + 1)?.3 ?? contentSize.height // Set to max on nil
- case .end: yOffset = contentSize.height // Set to max
- case .previous: yOffset = calendarViewLayout.cachedValue(for: 0, section: currentSection - 1)?.3 ?? 0 // Set min on nil
- case .start: yOffset = 0 // Set to min
- }
- }
-
- if yOffset <= 0 {
- yOffset = 0
- } else if yOffset >= contentSize.height - frame.height {
- yOffset = contentSize.height - frame.height
- }
- }
-
- scrollTo(point: CGPoint(x: xOffset, y: yOffset),
- triggerScrollToDateDelegate: triggerScrollToDateDelegate,
- isAnimationEnabled: animateScroll,
- extraAddedOffset: extraAddedOffset,
- completionHandler: completionHandler)
- }
-
- /// Scrolls the calendar view to the start of a section view containing a specified date.
- /// - Paramater date: The calendar view will scroll to a date-cell containing this date if it exists
- /// - Parameter triggerScrollToDateDelegate: Trigger delegate if set to true
- /// - Paramater animateScroll: Bool indicating if animation should be enabled
- /// - Paramater preferredScrollPositionIndex: Integer indicating the end scroll position on the screen.
- /// This value indicates column number for Horizontal scrolling and row number for a vertical scrolling calendar
- /// - Parameter completionHandler: A completion handler that will be executed at the end of the scroll animation
- public func scrollToDate(_ date: Date,
- triggerScrollToDateDelegate: Bool = true,
- animateScroll: Bool = true,
- preferredScrollPosition: UICollectionView.ScrollPosition? = nil,
- extraAddedOffset: CGFloat = 0,
- completionHandler: (() -> Void)? = nil) {
-
- // Ensure scrolling to date is safe to run
- if functionIsUnsafeSafeToRun {
- if !animateScroll { anchorDate = date} // Gets rid of visible scrolling when calendar starts
- addToDelayedHandlers {[unowned self] in
- self.scrollToDate(date,
- triggerScrollToDateDelegate: triggerScrollToDateDelegate,
- animateScroll: animateScroll,
- preferredScrollPosition: preferredScrollPosition,
- extraAddedOffset: extraAddedOffset,
- completionHandler: completionHandler)
- }
- return
- }
-
- // Set triggereing of delegate on scroll
- self.triggerScrollToDateDelegate = triggerScrollToDateDelegate
-
- // Ensure date is within valid boundary
- let components = calendar.dateComponents([.year, .month, .day], from: date)
- let firstDayOfDate = calendar.date(from: components)!
- if !((firstDayOfDate >= startOfMonthCache!) && (firstDayOfDate <= endOfMonthCache!)) { return }
-
- // Get valid indexPath of date to scroll to
- let retrievedPathsFromDates = pathsFromDates([date])
- if retrievedPathsFromDates.isEmpty { return }
- let sectionIndexPath = pathsFromDates([date])[0]
-
- if scrollingMode == .none {
- self.scrollToItem(at: sectionIndexPath,
- at: preferredScrollPosition ?? (scrollDirection == .horizontal ? .left : .top),
- animated: animateScroll)
- } else {
- guard let point = targetPointForItemAt(indexPath: sectionIndexPath) else {
- assert(false, "Could not determine CGPoint. This is an error. contact developer on github. In production, there will not be a crash, but scrolling will not occur")
- return
- }
- scrollTo(point: point,
- triggerScrollToDateDelegate: triggerScrollToDateDelegate,
- isAnimationEnabled: animateScroll,
- extraAddedOffset: extraAddedOffset,
- completionHandler: completionHandler)
- }
- }
-
- /// Scrolls the calendar view to the start of a section view header.
- /// If the calendar has no headers registered, then this function does nothing
- /// - Paramater date: The calendar view will scroll to the header of
- /// a this provided date
- public func scrollToHeaderForDate(_ date: Date,
- triggerScrollToDateDelegate: Bool = false,
- withAnimation animation: Bool = false,
- extraAddedOffset: CGFloat = 0,
- completionHandler: (() -> Void)? = nil) {
- if functionIsUnsafeSafeToRun {
- if !animation { anchorDate = date}
- addToDelayedHandlers { [unowned self] in
- self.scrollToHeaderForDate(date,
- triggerScrollToDateDelegate: triggerScrollToDateDelegate,
- withAnimation: animation,
- extraAddedOffset: extraAddedOffset,
- completionHandler: completionHandler)
- }
- return
- }
- let path = pathsFromDates([date])
- // Return if date was incalid and no path was returned
- if path.isEmpty { return }
- scrollToHeaderInSection(
- path[0].section,
- triggerScrollToDateDelegate: triggerScrollToDateDelegate,
- withAnimation: animation,
- extraAddedOffset: extraAddedOffset,
- completionHandler: completionHandler
- )
- }
-
- /// Returns the visible dates of the calendar.
- /// - returns:
- /// - DateSegmentInfo
- public func visibleDates()-> DateSegmentInfo {
- return datesAtCurrentOffset()
- }
-
- /// Returns the visible dates of the calendar.
- /// - returns:
- /// - DateSegmentInfo
- public func visibleDates(_ completionHandler: @escaping (_ dateSegmentInfo: DateSegmentInfo) ->()) {
- if functionIsUnsafeSafeToRun {
- addToDelayedHandlers { [unowned self] in self.visibleDates(completionHandler) }
- return
- }
- let retval = visibleDates()
- completionHandler(retval)
- }
-
- /// Retrieves the current section
- public func currentSection() -> Int? {
- let minVisiblePaths = calendarViewLayout.minimumVisibleIndexPaths()
- return minVisiblePaths.cellIndex?.section
- }
-}
diff --git a/Sources/JTAppleCalendar/JTACInteractionYearFunctions.swift b/Sources/JTAppleCalendar/JTACInteractionYearFunctions.swift
deleted file mode 100644
index 7db844e9..00000000
--- a/Sources/JTAppleCalendar/JTACInteractionYearFunctions.swift
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// UserInteractionYearFunctions.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-import Foundation
-
-extension JTACYearView {
-
- /// Dequeues a reuable calendar cell
- public func dequeueReusableJTAppleMonthCell(withReuseIdentifier identifier: String, for indexPath: IndexPath) -> JTACMonthCell {
- guard let cell = dequeueReusableCell(withReuseIdentifier: identifier, for: indexPath) as? JTACMonthCell else {
- assert(false, "Error initializing Cell View with identifier: '\(identifier)'")
- return JTACMonthCell()
- }
- return cell
- }
-
-}
diff --git a/Sources/JTAppleCalendar/JTACMonthActionFunctions.swift b/Sources/JTAppleCalendar/JTACMonthActionFunctions.swift
deleted file mode 100644
index 0c61d3d6..00000000
--- a/Sources/JTAppleCalendar/JTACMonthActionFunctions.swift
+++ /dev/null
@@ -1,314 +0,0 @@
-//
-// JTACMonthActionFunctions.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-import UIKit
-
-extension JTACMonthView {
- /// Lays out subviews.
- override open func layoutSubviews() {
- super.layoutSubviews()
- if !generalDelayedExecutionClosure.isEmpty, calendarLayoutIsLoaded {
- executeDelayedTasks(.general)
- }
- }
-
- func setupMonthInfoAndMap(with data: ConfigurationParameters? = nil) {
- theData = setupMonthInfoDataForStartAndEndDate(with: data)
- }
-
- func developerError(string: String) {
- print(string)
- print(developerErrorMessage)
- assert(false)
- }
-
- func setupNewLayout(from oldLayout: JTACMonthLayoutProtocol) {
- let newLayout = JTACMonthLayout(withDelegate: self)
- newLayout.scrollDirection = oldLayout.scrollDirection
- newLayout.sectionInset = oldLayout.sectionInset
- newLayout.minimumInteritemSpacing = oldLayout.minimumInteritemSpacing
- newLayout.minimumLineSpacing = oldLayout.minimumLineSpacing
-
-
- collectionViewLayout = newLayout
-
- scrollDirection = newLayout.scrollDirection
- sectionInset = newLayout.sectionInset
- minimumLineSpacing = newLayout.minimumLineSpacing
- minimumInteritemSpacing = newLayout.minimumInteritemSpacing
-
- transform.a = semanticContentAttribute == .forceRightToLeft ? -1 : 1
-
- super.dataSource = self
- super.delegate = self
- decelerationRate = .fast
-
- #if os(iOS)
- if isPagingEnabled {
- scrollingMode = .stopAtEachCalendarFrame
- } else {
- scrollingMode = .none
- }
- #endif
- }
-
- func scrollToHeaderInSection(_ section: Int,
- triggerScrollToDateDelegate: Bool = false,
- withAnimation animation: Bool = true,
- extraAddedOffset: CGFloat,
- completionHandler: (() -> Void)? = nil) {
- if !calendarViewLayout.thereAreHeaders { return }
- let indexPath = IndexPath(item: 0, section: section)
- guard let attributes = calendarViewLayout.layoutAttributesForSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, at: indexPath) else { return }
-
- isScrollInProgress = true
- if let validHandler = completionHandler { scrollDelayedExecutionClosure.append(validHandler) }
-
- self.triggerScrollToDateDelegate = triggerScrollToDateDelegate
-
- let maxYCalendarOffset = max(0, self.contentSize.height - self.frame.size.height)
- var topOfHeader = CGPoint(x: attributes.frame.origin.x - sectionInset.left, y: min(maxYCalendarOffset, attributes.frame.origin.y))
- if scrollDirection == .horizontal { topOfHeader.x += extraAddedOffset} else { topOfHeader.y += extraAddedOffset }
- DispatchQueue.main.async {
- self.setContentOffset(topOfHeader, animated: animation)
- if (animation && self.calendarOffsetIsAlreadyAtScrollPosition(forOffset: topOfHeader)) ||
- !animation {
- self.scrollViewDidEndScrollingAnimation(self)
- }
- self.isScrollInProgress = false
- }
- }
-
- // Subclasses cannot use this function
- @available(*, unavailable)
- open override func reloadData() {
- super.reloadData()
- }
-
- func scrollTo(point: CGPoint, triggerScrollToDateDelegate: Bool? = nil, isAnimationEnabled: Bool, extraAddedOffset: CGFloat, completionHandler: (() -> Void)?) {
- isScrollInProgress = true
- if let validCompletionHandler = completionHandler { scrollDelayedExecutionClosure.append(validCompletionHandler) }
- self.triggerScrollToDateDelegate = triggerScrollToDateDelegate
- var point = point
- if scrollDirection == .horizontal { point.x += extraAddedOffset } else { point.y += extraAddedOffset }
- DispatchQueue.main.async() {
- self.setContentOffset(point, animated: isAnimationEnabled)
- if (isAnimationEnabled && self.calendarOffsetIsAlreadyAtScrollPosition(forOffset: point)) ||
- !isAnimationEnabled {
- self.scrollViewDidEndScrollingAnimation(self)
- }
- }
- }
-
- func setupMonthInfoDataForStartAndEndDate(with optionalConfig: ConfigurationParameters? = nil) -> CalendarData {
- var months = [Month]()
- var monthMap = [Int: Int]()
- var totalSections = 0
- var totalDays = 0
-
-
- // first use the config passed in
- // If nil, fetch the config from the datasource
- let possibleConfig = optionalConfig ?? calendarDataSource?.configureCalendar(self)
-
- let validConfig: ConfigurationParameters
- if let valid = possibleConfig {
- validConfig = valid
- } else {
- assert(false, "Using default parameters. Your config should not have been nil here. In production, your dates will be an incorrect default date")
- validConfig = ConfigurationParameters(startDate: Date(), endDate: Date().addingTimeInterval(1))
- }
-
- let comparison = validConfig.calendar.compare(validConfig.startDate, to: validConfig.endDate, toGranularity: .nanosecond)
- if comparison == ComparisonResult.orderedDescending {
- assert(false, "Error, your start date cannot be greater than your end date\n")
- return (CalendarData(months: [], totalSections: 0, sectionToMonthMap: [:], totalDays: 0))
- }
-
- // Set the new cache
- _cachedConfiguration = validConfig
-
- if let
- startMonth = calendar.startOfMonth(for: validConfig.startDate),
- let endMonth = calendar.endOfMonth(for: validConfig.endDate) {
- startOfMonthCache = startMonth
- endOfMonthCache = endMonth
- // Create the parameters for the date format generator
- let parameters = ConfigurationParameters(startDate: startOfMonthCache,
- endDate: endOfMonthCache,
- numberOfRows: validConfig.numberOfRows,
- calendar: calendar,
- generateInDates: validConfig.generateInDates,
- generateOutDates: validConfig.generateOutDates,
- firstDayOfWeek: validConfig.firstDayOfWeek,
- hasStrictBoundaries: validConfig.hasStrictBoundaries)
-
- let generatedData = dateGenerator.setupMonthInfoDataForStartAndEndDate(parameters)
- months = generatedData.months
- monthMap = generatedData.monthMap
- totalSections = generatedData.totalSections
- totalDays = generatedData.totalDays
- }
-
- let data = CalendarData(months: months, totalSections: totalSections, sectionToMonthMap: monthMap, totalDays: totalDays)
- return data
- }
-
- func batchReloadIndexPaths(_ indexPaths: [IndexPath]) {
- let visiblePaths = indexPathsForVisibleItems
- var visibleCellsToReload: [JTACDayCell: IndexPath] = [:]
-
- for path in indexPaths {
- if calendarViewLayout.cachedValue(for: path.item, section: path.section) == nil { continue }
- pathsToReload.insert(path)
- if visiblePaths.contains(path) {
- visibleCellsToReload[cellForItem(at: path) as! JTACDayCell] = path
- }
- }
-
- // Reload the visible paths
- if !visibleCellsToReload.isEmpty {
- for (cell, path) in visibleCellsToReload {
- self.collectionView(self, willDisplay: cell, forItemAt: path)
- }
- }
- }
-
- func addCellToSelectedSet(_ indexPath: IndexPath, date: Date, cellState: CellState) {
- selectedCellData[indexPath] = SelectedCellData(indexPath: indexPath, date: date, cellState: cellState)
- }
-
- func deleteCellFromSelectedSetIfSelected(_ indexPath: IndexPath) {
- selectedCellData.removeValue(forKey: indexPath)
- deselectItem(at: indexPath, animated: false)
- }
-
- // Returns an indexPath if valid one was found
- func deselectCounterPartCellIndexPath(_ indexPath: IndexPath, date: Date, dateOwner: DateOwner) -> IndexPath? {
- guard let counterPartCellIndexPath = indexPathOfdateCellCounterPath(date, dateOwner: dateOwner) else { return nil }
- deleteCellFromSelectedSetIfSelected(counterPartCellIndexPath)
- return counterPartCellIndexPath
- }
-
- func selectCounterPartCellIndexPath(_ indexPath: IndexPath, date: Date, dateOwner: DateOwner) -> IndexPath? {
- guard let counterPartCellIndexPath = indexPathOfdateCellCounterPath(date, dateOwner: dateOwner) else { return nil }
- let counterPartCellState = cellStateFromIndexPath(counterPartCellIndexPath, isSelected: true)
- addCellToSelectedSet(counterPartCellIndexPath, date: date, cellState: counterPartCellState)
-
- // Update the selectedCellData counterIndexPathData
- selectedCellData[indexPath]?.counterIndexPath = counterPartCellIndexPath
- selectedCellData[counterPartCellIndexPath]?.counterIndexPath = indexPath
-
- if allowsMultipleSelection {
- // only if multiple selection is enabled. With single selection, we do not want the counterpart cell to be
- // selected in place of the main cell. With multiselection, however, all can be selected
- selectItem(at: counterPartCellIndexPath, animated: false, scrollPosition: [])
- }
- return counterPartCellIndexPath
- }
-
- func executeDelayedTasks(_ type: DelayedTaskType) {
- let tasksToExecute: [(() -> Void)]
- switch type {
- case .scroll:
- tasksToExecute = scrollDelayedExecutionClosure
- scrollDelayedExecutionClosure.removeAll()
- case .general:
- tasksToExecute = generalDelayedExecutionClosure
- generalDelayedExecutionClosure.removeAll()
- }
- for aTaskToExecute in tasksToExecute { aTaskToExecute() }
- }
-
- // Only reload the dates if the datasource information has changed
- func reloadDelegateDataSource() -> (shouldReload: Bool, configParameters: ConfigurationParameters?) {
- var retval: (Bool, ConfigurationParameters?) = (false, nil)
- if let
- newDateBoundary = calendarDataSource?.configureCalendar(self) {
- // Jt101 do a check in each var to see if
- // user has bad star/end dates
- let newStartOfMonth = calendar.startOfMonth(for: newDateBoundary.startDate)
- let newEndOfMonth = calendar.endOfMonth(for: newDateBoundary.endDate)
- let oldStartOfMonth = calendar.startOfMonth(for: startDateCache)
- let oldEndOfMonth = calendar.endOfMonth(for: endDateCache)
- let newLastMonth = sizesForMonthSection()
- let calendarLayout = calendarViewLayout
-
- if
- // ConfigParameters were changed
- newStartOfMonth != oldStartOfMonth ||
- newEndOfMonth != oldEndOfMonth ||
- newDateBoundary.calendar != _cachedConfiguration?.calendar ||
- newDateBoundary.numberOfRows != _cachedConfiguration?.numberOfRows ||
- newDateBoundary.generateInDates != _cachedConfiguration?.generateInDates ||
- newDateBoundary.generateOutDates != _cachedConfiguration?.generateOutDates ||
- newDateBoundary.firstDayOfWeek != _cachedConfiguration?.firstDayOfWeek ||
- newDateBoundary.hasStrictBoundaries != _cachedConfiguration?.hasStrictBoundaries ||
- // Other layout information were changed
- minimumInteritemSpacing != calendarLayout.minimumInteritemSpacing ||
- minimumLineSpacing != calendarLayout.minimumLineSpacing ||
- sectionInset != calendarLayout.sectionInset ||
- lastMonthSize != newLastMonth ||
- allowsDateCellStretching != calendarLayout.allowsDateCellStretching ||
- scrollDirection != calendarLayout.scrollDirection ||
- calendarLayout.isDirty {
- lastMonthSize = newLastMonth
- retval = (true, newDateBoundary)
- }
- }
-
- return retval
- }
-
- func remapSelectedDatesWithCurrentLayout() -> (selected:(indexPaths:[IndexPath], counterPaths:[IndexPath]), selectedDates: [Date]) {
- var retval = (selected:(indexPaths:[IndexPath](), counterPaths:[IndexPath]()), selectedDates: [Date]())
- if !selectedDates.isEmpty {
- let selectedDates = self.selectedDates
-
- // Get the new paths
- let newPaths = pathsFromDates(selectedDates)
-
- // Get the new counter Paths
- var newCounterPaths: [IndexPath] = []
- for date in selectedDates {
- if let counterPath = indexPathOfdateCellCounterPath(date, dateOwner: .thisMonth) {
- newCounterPaths.append(counterPath)
- }
- }
-
- // Append paths
- retval.selected.indexPaths.append(contentsOf: newPaths)
- retval.selected.counterPaths.append(contentsOf: newCounterPaths)
-
- // Append dates to retval
- for allPaths in [newPaths, newCounterPaths] {
- for path in allPaths {
- guard let dateFromPath = dateOwnerInfoFromPath(path)?.date else { continue }
- retval.selectedDates.append(dateFromPath)
- }
- }
- }
- return retval
- }
-}
diff --git a/Sources/JTAppleCalendar/JTACMonthCell.swift b/Sources/JTAppleCalendar/JTACMonthCell.swift
deleted file mode 100644
index cd0a2daf..00000000
--- a/Sources/JTAppleCalendar/JTACMonthCell.swift
+++ /dev/null
@@ -1,143 +0,0 @@
-//
-// JTACMonthCell.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-import Foundation
-import UIKit
-
-public protocol JTACCellMonthViewDelegate: AnyObject {
- func monthView(_ monthView: JTACCellMonthView,
- drawingFor segmentRect: CGRect,
- with date: Date,
- dateOwner: DateOwner,
- monthIndex: Int)
-}
-
-open class JTACMonthCell: UICollectionViewCell {
- @IBOutlet var monthView: JTACCellMonthView?
- weak var delegate: JTACCellMonthViewDelegate?
-
- func setupWith(configurationParameters: ConfigurationParameters,
- month: Month,
- delegate: JTACCellMonthViewDelegate) {
- guard let monthView = monthView else { assert(false); return }
- self.delegate = delegate
- monthView.setupWith(configurationParameters: configurationParameters,
- month: month,
- delegate: self)
- }
-}
-
-extension JTACMonthCell: JTACCellMonthViewDelegate {
- public func monthView(_ monthView: JTACCellMonthView,
- drawingFor segmentRect: CGRect,
- with date: Date,
- dateOwner: DateOwner,
- monthIndex: Int) {
- delegate?.monthView(monthView, drawingFor: segmentRect, with: date, dateOwner: dateOwner, monthIndex: monthIndex)
- }
-}
-
-
-
-
-open class JTACCellMonthView: UIView {
- var sectionInset = UIEdgeInsets.zero
- var month: Month!
- var configurationParameters: ConfigurationParameters!
- weak var delegate: JTACCellMonthViewDelegate?
- var scrollDirection: UICollectionView.ScrollDirection = .horizontal
-
- func setupWith(configurationParameters: ConfigurationParameters, month: Month, delegate: JTACCellMonthViewDelegate? = nil) {
- self.configurationParameters = configurationParameters
- self.delegate = delegate
- self.month = month
-
- setNeedsDisplay() // force reloading of the drawRect code to update the view.
- }
-
- override open func draw(_ rect: CGRect) {
- super.draw(rect)
-
- var xCellOffset: CGFloat = 0
- var yCellOffset: CGFloat = 0
-
- let numberOfDaysInCurrentSection = month.sections.first!
- for dayCounter in 1...numberOfDaysInCurrentSection {
-
- let width = (frame.width - ((sectionInset.left / 7) + (sectionInset.right / 7))) / 7
- let height = (frame.height - sectionInset.top - sectionInset.bottom) / 6
-
- let rect = CGRect(x: xCellOffset, y: yCellOffset, width: width, height: height)
- guard let dateWithOwner = dateFromIndex(dayCounter - 1, month: month,
- startOfMonthCache: configurationParameters.startDate,
- endOfMonthCache: configurationParameters.endDate) else { continue }
-
-
- delegate?.monthView(self,
- drawingFor: rect,
- with: dateWithOwner.date,
- dateOwner: dateWithOwner.owner,
- monthIndex: month.index)
-
- xCellOffset += width
-
- if dayCounter == numberOfDaysInCurrentSection || dayCounter % maxNumberOfDaysInWeek == 0 {
- // We are at the last item in the section
- // && if we have headers
- xCellOffset = sectionInset.left
- yCellOffset += height
- }
- }
- }
-
- private func dateFromIndex(_ index: Int, month: Month, startOfMonthCache: Date, endOfMonthCache: Date) -> (date: Date, owner: DateOwner)? { // Returns nil if date is out of scope
- // Calculate the offset
- let offSet = month.inDates
-
- let dayIndex = month.startDayIndex + index - offSet
- var dateOwner: DateOwner
-
- guard let validDate = configurationParameters.calendar.date(byAdding: .day, value: dayIndex, to: startOfMonthCache) else { return nil }
-
- if index >= offSet && index < month.numberOfDaysInMonth + offSet {
- dateOwner = .thisMonth
- } else if index < offSet {
- // This is a preDate
-
- if validDate < startOfMonthCache {
- dateOwner = .previousMonthOutsideBoundary
- } else {
- dateOwner = .previousMonthWithinBoundary
- }
- } else {
- // This is a postDate
- if validDate > endOfMonthCache {
- dateOwner = .followingMonthOutsideBoundary
- } else {
- dateOwner = .followingMonthWithinBoundary
- }
- }
- return (validDate, dateOwner)
- }
-}
diff --git a/Sources/JTAppleCalendar/JTACMonthDelegateProtocol.swift b/Sources/JTAppleCalendar/JTACMonthDelegateProtocol.swift
deleted file mode 100644
index f410f0cd..00000000
--- a/Sources/JTAppleCalendar/JTACMonthDelegateProtocol.swift
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// JTACMonthDelegateProtocol.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-import Foundation
-import UIKit
-
-protocol JTACMonthDelegateProtocol: AnyObject {
- // Variables
- var allowsDateCellStretching: Bool {get set}
- var _cachedConfiguration: ConfigurationParameters? {get set}
- var calendarDataSource: JTACMonthViewDataSource? {get set}
- var cellSize: CGFloat {get set}
- var anchorDate: Date? {get set}
- var calendarLayoutIsLoaded: Bool {get}
- var minimumInteritemSpacing: CGFloat {get set}
- var minimumLineSpacing: CGFloat {get set}
- var monthInfo: [Month] {get set}
- var monthMap: [Int: Int] {get set}
- var scrollDirection: UICollectionView.ScrollDirection {get set}
- var sectionInset: UIEdgeInsets {get set}
- var totalDays: Int {get}
- var requestedContentOffset: CGPoint {get}
-
- // Functions
- func pathsFromDates(_ dates: [Date]) -> [IndexPath]
- func sizeOfDecorationView(indexPath: IndexPath) -> CGRect
- func sizesForMonthSection() -> [AnyHashable:CGFloat]
- func targetPointForItemAt(indexPath: IndexPath, preferredScrollPosition: UICollectionView.ScrollPosition?) -> CGPoint?
-}
-
-extension JTACMonthView: JTACMonthDelegateProtocol { }
diff --git a/Sources/JTAppleCalendar/JTACMonthLayout.swift b/Sources/JTAppleCalendar/JTACMonthLayout.swift
deleted file mode 100644
index dfb66430..00000000
--- a/Sources/JTAppleCalendar/JTACMonthLayout.swift
+++ /dev/null
@@ -1,592 +0,0 @@
-//
-// JTACMonthLayout.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-import Foundation
-import UIKit
-
-/// Methods in this class are meant to be overridden and will be called by its collection view to gather layout information.
-class JTACMonthLayout: UICollectionViewLayout, JTACMonthLayoutProtocol {
-
- var allowsDateCellStretching = true
- var firstContentOffsetWasSet = false
-
- var lastSetCollectionViewSize: CGRect = .zero
-
- var cellSize: CGSize = CGSize.zero
- var shouldUseUserItemSizeInsteadOfDefault: Bool { return (delegate?.cellSize ?? 0) == 0 ? false: true }
- var scrollDirection: UICollectionView.ScrollDirection = .horizontal
- var maxMissCount: Int = 0
- var cellCache: [Int: [(item: Int, section: Int, xOffset: CGFloat, yOffset: CGFloat, width: CGFloat, height: CGFloat)]] = [:]
- var headerCache: [Int: (item: Int, section: Int, xOffset: CGFloat, yOffset: CGFloat, width: CGFloat, height: CGFloat)] = [:]
- var decorationCache: [IndexPath:UICollectionViewLayoutAttributes] = [:]
- var endOfSectionOffsets: [CGFloat] = []
- var lastWrittenCellAttribute: (Int, Int, CGFloat, CGFloat, CGFloat, CGFloat)!
- var xStride: CGFloat = 0
- var minimumInteritemSpacing: CGFloat = 0
- var minimumLineSpacing: CGFloat = 0
- var sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
- var headerSizes: [AnyHashable:CGFloat] = [:]
- var focusIndexPath: IndexPath?
- var isCalendarLayoutLoaded: Bool { return !cellCache.isEmpty }
- var layoutIsReadyToBePrepared: Bool {
- guard let delegate = delegate else { return false }
- return !(!cellCache.isEmpty || delegate.calendarDataSource == nil)
- }
-
- var monthMap: [Int: Int] = [:]
- var numberOfRows: Int = 0
- var strictBoundaryRulesShouldApply: Bool = false
- var thereAreHeaders: Bool { return !headerSizes.isEmpty }
- var thereAreDecorationViews = false
-
- weak var delegate: JTACMonthDelegateProtocol?
-
- var currentHeader: (section: Int, size: CGSize)? // Tracks the current header size
- var currentCell: (section: Int, width: CGFloat, height: CGFloat)? // Tracks the current cell size
- var contentHeight: CGFloat = 0 // Content height of calendarView
- var contentWidth: CGFloat = 0 // Content wifth of calendarView
- var xCellOffset: CGFloat = 0
- var yCellOffset: CGFloat = 0
- var endSeparator: CGFloat = 0
- override var flipsHorizontallyInOppositeLayoutDirection: Bool { return true }
-
- var delayedExecutionClosure: [(() -> Void)] = []
- func executeDelayedTasks() {
- DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
- let tasksToExecute = self.delayedExecutionClosure
- self.delayedExecutionClosure.removeAll()
-
- for aTaskToExecute in tasksToExecute {
- aTaskToExecute()
- }
- }
- }
-
- var daysInSection: [Int: Int] = [:] // temporary caching
- var monthInfo: [Month] = []
-
- var reloadWasTriggered = false
- var isDirty: Bool {
- return updatedLayoutCellSize != cellSize
- }
-
- var updatedLayoutCellSize: CGSize {
- guard let delegate = delegate, let cachedConfiguration = delegate._cachedConfiguration else { return .zero }
-
- // Default Item height and width
- var height: CGFloat = collectionView!.bounds.size.height / CGFloat(cachedConfiguration.numberOfRows)
- var width: CGFloat = collectionView!.bounds.size.width / CGFloat(maxNumberOfDaysInWeek)
-
- if shouldUseUserItemSizeInsteadOfDefault { // If delegate item size was set
- if scrollDirection == .horizontal {
- width = delegate.cellSize
- } else {
- height = delegate.cellSize
- }
- }
-
- return CGSize(width: width, height: height)
- }
-
- open override func register(_ nib: UINib?, forDecorationViewOfKind elementKind: String) {
- super.register(nib, forDecorationViewOfKind: elementKind)
- thereAreDecorationViews = true
- }
-
- open override func register(_ viewClass: AnyClass?, forDecorationViewOfKind elementKind: String) {
- super.register(viewClass, forDecorationViewOfKind: elementKind)
- thereAreDecorationViews = true
- }
-
- init(withDelegate delegate: JTACMonthDelegateProtocol) {
- super.init()
- self.delegate = delegate
- }
- /// Tells the layout object to update the current layout.
- open override func prepare() {
-
- // set the last content size before the if statement which can possible return if layout is not yet ready to be prepared. Avoids inf loop
- // with layout subviews
- lastSetCollectionViewSize = collectionView!.frame
-
- if !layoutIsReadyToBePrepared {
- // Layout may not be ready, but user might have reloaded with an anchor date
- let requestedOffset = delegate?.requestedContentOffset ?? .zero
- if requestedOffset != .zero { collectionView!.setContentOffset(requestedOffset, animated: false) }
-
- // execute any other delayed tasks
- executeDelayedTasks()
- return
- }
-
- setupDataFromDelegate()
-
- if scrollDirection == .vertical {
- configureVerticalLayout()
- } else {
- configureHorizontalLayout()
- }
-
- // Get rid of header data if dev didnt register headers.
- // They were used for calculation but are not needed to be displayed
- if !thereAreHeaders {
- headerCache.removeAll()
- }
-
- // Set the first content offset only once. This will prevent scrolling animation on viewDidload.
- if !firstContentOffsetWasSet, let delegate = delegate {
- firstContentOffsetWasSet = true
- let firstContentOffset = delegate.requestedContentOffset
- collectionView!.setContentOffset(firstContentOffset, animated: false)
- }
- daysInSection.removeAll() // Clear chache
- reloadWasTriggered = false
- executeDelayedTasks()
- }
-
- func setupDataFromDelegate() {
- guard let delegate = delegate, let cachedConfiguration = delegate._cachedConfiguration else { return }
- // get information from the delegate
- headerSizes = delegate.sizesForMonthSection() // update first. Other variables below depend on it
- strictBoundaryRulesShouldApply = thereAreHeaders || cachedConfiguration.hasStrictBoundaries
- numberOfRows = cachedConfiguration.numberOfRows
- monthMap = delegate.monthMap
- allowsDateCellStretching = delegate.allowsDateCellStretching
- monthInfo = delegate.monthInfo
- scrollDirection = delegate.scrollDirection
- maxMissCount = scrollDirection == .horizontal ? maxNumberOfRowsPerMonth : maxNumberOfDaysInWeek
- minimumInteritemSpacing = delegate.minimumInteritemSpacing
- minimumLineSpacing = delegate.minimumLineSpacing
- sectionInset = delegate.sectionInset
- cellSize = updatedLayoutCellSize
- }
-
- func indexPath(direction: SegmentDestination, of section:Int, item: Int) -> IndexPath? {
- var retval: IndexPath?
- switch direction {
- case .next:
- if let data = cellCache[section], !data.isEmpty, 0.. [UICollectionViewLayoutAttributes]? {
- let startSectionIndex = startIndexFrom(rectOrigin: rect.origin)
- // keep looping until there were no interception rects
- var attributes: [UICollectionViewLayoutAttributes] = []
- var beganIntercepting = false
- var missCount = 0
-
- outterLoop: for sectionIndex in startSectionIndex.. maxMissCount && beganIntercepting { break outterLoop }
- }
- }
- }
- }
- return attributes
- }
-
- /// Returns the layout attributes for the item at the specified index
- /// path. A layout attributes object containing the information to apply
- /// to the item’s cell.
- override open func layoutAttributesForItem(at indexPath: IndexPath) -> UICollectionViewLayoutAttributes? {
- // If this index is already cached, then return it else,
- // apply a new layout attribut to it
- if let alreadyCachedCellAttrib = cellAttributeFor(indexPath.item, section: indexPath.section) {
- return alreadyCachedCellAttrib
- }
- return nil
- }
-
- func supplementaryAttributeFor(item: Int, section: Int, elementKind: String) -> UICollectionViewLayoutAttributes? {
- var retval: UICollectionViewLayoutAttributes?
- if let cachedData = headerCache[section] {
-
- let attributes = UICollectionViewLayoutAttributes(forSupplementaryViewOfKind: elementKind, with: IndexPath(item: item, section: section))
- attributes.frame = CGRect(x: cachedData.xOffset, y: cachedData.yOffset, width: cachedData.width, height: cachedData.height)
- retval = attributes
- }
- return retval
- }
-
- func cachedValue(for item: Int, section: Int) -> (item: Int, section: Int, xOffset: CGFloat, yOffset: CGFloat, width: CGFloat, height: CGFloat)? {
- if
- let alreadyCachedCellAttrib = cellCache[section],
- item < alreadyCachedCellAttrib.count,
- item >= 0 {
-
- return alreadyCachedCellAttrib[item]
- }
- return nil
- }
-
- func sizeOfSection(_ section: Int) -> CGFloat {
- guard let cellOfSection = cellCache[section]?.first else { return 0 }
- var offSet: CGFloat
- if scrollDirection == .horizontal {
- offSet = cellOfSection.width * 7
- } else {
- offSet = cellOfSection.height * CGFloat(numberOfDaysInSection(section))
- if
- thereAreHeaders,
- let headerHeight = headerCache[section]?.height {
- offSet += headerHeight
- }
- }
-
- let startOfSection = endOfSectionOffsets[section]
- let endOfSection = endOfSectionOffsets[section + 1]
- return endOfSection - startOfSection
- }
-
- func cellAttributeFor(_ item: Int, section: Int) -> UICollectionViewLayoutAttributes? {
- guard let cachedValue = cachedValue(for: item, section: section) else { return nil }
- let attrib = UICollectionViewLayoutAttributes(forCellWith: IndexPath(item: item, section: section))
-
- attrib.frame = CGRect(x: cachedValue.xOffset, y: cachedValue.yOffset, width: cachedValue.width, height: cachedValue.height)
- if minimumInteritemSpacing > 0, minimumLineSpacing > 0 {
- var frame = attrib.frame.insetBy(dx: minimumInteritemSpacing / 2, dy: minimumLineSpacing / 2)
- if frame == .null { frame = attrib.frame.insetBy(dx: 0, dy: 0) }
- attrib.frame = frame
- }
- return attrib
- }
-
- func determineToApplyAttribs(_ item: Int, section: Int)
- -> (item: Int, section: Int, xOffset: CGFloat, yOffset: CGFloat, width: CGFloat, height: CGFloat)? {
- let monthIndex = monthMap[section]!
- let numberOfDays = numberOfDaysInSection(monthIndex)
- // return nil on invalid range
- if !(0...monthMap.count ~= section) || !(0...numberOfDays ~= item) { return nil }
-
- let size = sizeForitemAtIndexPath(item, section: section)
- let y = scrollDirection == .horizontal ? yCellOffset + sectionInset.top : yCellOffset
- return (item, section, xCellOffset + xStride, y, size.width, size.height)
- }
-
- func determineToApplySupplementaryAttribs(_ item: Int, section: Int)
- -> (item: Int, section: Int, xOffset: CGFloat, yOffset: CGFloat, width: CGFloat, height: CGFloat)? {
- var retval: (item: Int, section: Int, xOffset: CGFloat, yOffset: CGFloat, width: CGFloat, height: CGFloat)?
-
- let headerHeight = cachedHeaderHeightForSection(section)
-
- switch scrollDirection {
- case .horizontal:
- let modifiedSize = sizeForitemAtIndexPath(item, section: section)
- let width = (modifiedSize.width * 7)
- retval = (item, section, contentWidth + sectionInset.left, sectionInset.top, width , headerHeight)
- case .vertical:
- // Use the calculaed header size and force the width
- // of the header to take up 7 columns
- // We cache the header here so we dont call the
- // delegate so much
- fallthrough
- default:
- let modifiedSize = (width: collectionView!.frame.width, height: headerHeight)
- retval = (item, section, sectionInset.left, yCellOffset , modifiedSize.width - (sectionInset.left + sectionInset.right), modifiedSize.height)
- }
-
- if retval?.width == 0, retval?.height == 0 {
- return nil
- }
- return retval
- }
-
- open override func layoutAttributesForDecorationView(ofKind elementKind: String, at indexPath: IndexPath) -> UICollectionViewLayoutAttributes? {
- if let alreadyCachedVal = decorationCache[indexPath] { return alreadyCachedVal }
-
- let retval = UICollectionViewLayoutAttributes(forDecorationViewOfKind: decorationViewID, with: indexPath)
- decorationCache[indexPath] = retval
- retval.frame = delegate?.sizeOfDecorationView(indexPath: indexPath) ?? .zero
- retval.zIndex = -1
- return retval
- }
-
-
- /// Returns the layout attributes for the specified supplementary view.
- open override func layoutAttributesForSupplementaryView(ofKind elementKind: String, at indexPath: IndexPath) -> UICollectionViewLayoutAttributes? {
- if let alreadyCachedHeaderAttrib = supplementaryAttributeFor(item: indexPath.item, section: indexPath.section, elementKind: elementKind) {
- return alreadyCachedHeaderAttrib
- }
-
- return nil
- }
-
- func numberOfDaysInSection(_ index: Int) -> Int {
- if let days = daysInSection[index] { return days }
- let days = monthInfo[index].numberOfDaysInMonthGrid
- daysInSection[index] = days
- return days
- }
-
- func numberOfRowsInSection(_ index: Int) -> Int {
- let numberOfDays = CGFloat(numberOfDaysInSection(index))
- return Int(ceil(numberOfDays / CGFloat(numberOfRows)))
- }
-
- func cachedHeaderHeightForSection(_ section: Int) -> CGFloat {
- var retval: CGFloat = 0
- // We look for most specific to less specific
- // Section = specific dates
- // Months = generic months
- // Default = final resort
-
- if let height = headerSizes[section] {
- retval = height
- } else {
- let monthIndex = monthMap[section]!
- let monthName = monthInfo[monthIndex].name
- if let height = headerSizes[monthName] {
- retval = height
- } else if let height = headerSizes["default"] {
- retval = height
- }
- }
-
- return retval
- }
-
- func sizeForitemAtIndexPath(_ item: Int, section: Int) -> (width: CGFloat, height: CGFloat) {
- if let cachedCell = currentCell,
- cachedCell.section == section {
-
- if !strictBoundaryRulesShouldApply, scrollDirection == .horizontal,
- !cellCache.isEmpty {
-
- if let x = cellCache[0]?[0] {
- return (x.width, x.height)
- } else {
- return (0, 0)
- }
- } else {
- return (cachedCell.width, cachedCell.height)
- }
- }
- let width = cellSize.width - ((sectionInset.left / 7) + (sectionInset.right / 7))
- var size: (width: CGFloat, height: CGFloat) = (width, cellSize.height)
- if shouldUseUserItemSizeInsteadOfDefault {
- if scrollDirection == .vertical {
- size.height = cellSize.height
- } else {
- size.width = cellSize.width
- let headerHeight = strictBoundaryRulesShouldApply ? cachedHeaderHeightForSection(section) : 0
- let currentMonth = monthInfo[monthMap[section]!]
- let recalculatedNumOfRows = allowsDateCellStretching ? CGFloat(currentMonth.maxNumberOfRowsForFull(developerSetRows: numberOfRows)) : CGFloat(maxNumberOfRowsPerMonth)
- size.height = (collectionView!.frame.height - headerHeight - sectionInset.top - sectionInset.bottom) / recalculatedNumOfRows
- currentCell = (section: section, width: size.width, height: size.height)
- }
- } else {
- // Get header size if it already cached
- let headerHeight = strictBoundaryRulesShouldApply ? cachedHeaderHeightForSection(section) : 0
- var height: CGFloat = 0
- let currentMonth = monthInfo[monthMap[section]!]
- let numberOfRowsForSection: Int
- if allowsDateCellStretching {
- numberOfRowsForSection
- = strictBoundaryRulesShouldApply ? currentMonth.maxNumberOfRowsForFull(developerSetRows: numberOfRows) : numberOfRows
- } else {
- numberOfRowsForSection = maxNumberOfRowsPerMonth
- }
- height = (collectionView!.frame.height - headerHeight - sectionInset.top - sectionInset.bottom) / CGFloat(numberOfRowsForSection)
- size.height = height > 0 ? height : 0
- currentCell = (section: section, width: size.width, height: size.height)
- }
- return size
- }
-
- func numberOfRowsForMonth(_ index: Int) -> Int {
- let monthIndex = monthMap[index]!
- return monthInfo[monthIndex].rows
- }
-
- func startIndexFrom(rectOrigin offset: CGPoint) -> Int {
- let key = scrollDirection == .horizontal ? offset.x : offset.y
- return startIndexBinarySearch(endOfSectionOffsets, offset: key)
- }
-
- func sizeOfContentForSection(_ section: Int) -> CGFloat {
- switch scrollDirection {
- case .horizontal:
- return cellCache[section]![0].width * CGFloat(maxNumberOfDaysInWeek) + sectionInset.left + sectionInset.right
- case .vertical:
- fallthrough
- default:
- let headerSizeOfSection = !headerCache.isEmpty ? headerCache[section]!.height : 0
- return cellCache[section]![0].height * CGFloat(numberOfRowsForMonth(section)) + headerSizeOfSection
-
- }
- }
-
- func sectionFromOffset(_ theOffSet: CGFloat) -> Int {
- var val: Int = 0
- for (index, sectionSizeValue) in endOfSectionOffsets.enumerated() {
- if abs(theOffSet - sectionSizeValue) < errorDelta {
- continue
- }
- if theOffSet < sectionSizeValue {
- val = index
- break
- }
- }
- return val
- }
-
- func startIndexBinarySearch(_ val: [T], offset: T) -> Int {
- if val.count < 3 {
- return 0
- } // If the range is less than 2 just break here.
- var midIndex: Int = 0
- var startIndex = 0
- var endIndex = val.count - 1
- while startIndex < endIndex {
- midIndex = startIndex + (endIndex - startIndex) / 2
- if midIndex + 1 >= val.count || offset >= val[midIndex] &&
- offset < val[midIndex + 1] || val[midIndex] == offset {
- break
- } else if val[midIndex] < offset {
- startIndex = midIndex + 1
- } else {
- endIndex = midIndex
- }
- }
- return midIndex
- }
-
- /// Returns an object initialized from data in a given unarchiver.
- /// self, initialized using the data in decoder.
- required public init?(coder aDecoder: NSCoder) {
- delegate = (aDecoder.value(forKey: "delegate") as! JTACMonthDelegateProtocol)
- cellCache = aDecoder.value(forKey: "delegate") as! [Int : [(Int, Int, CGFloat, CGFloat, CGFloat, CGFloat)]]
- headerCache = aDecoder.value(forKey: "delegate") as! [Int : (Int, Int, CGFloat, CGFloat, CGFloat, CGFloat)]
- headerSizes = aDecoder.value(forKey: "delegate") as! [AnyHashable:CGFloat]
- super.init(coder: aDecoder)
- }
-
- // This function ignores decoration views //JT101 for setting proposal
- func minimumVisibleIndexPaths() -> (cellIndex: IndexPath?, headerIndex: IndexPath?) {
- let visibleItems: [UICollectionViewLayoutAttributes]
- if scrollDirection == .horizontal {
- visibleItems = elementsAtRect(excludeHeaders: true)
- } else {
- visibleItems = elementsAtRect()
- }
-
- var cells: [IndexPath] = []
- var headers: [IndexPath] = []
- for item in visibleItems {
- switch item.representedElementCategory {
- case .cell:
- cells.append(item.indexPath)
- case .supplementaryView:
- headers.append(item.indexPath)
- case .decorationView:
- fallthrough
- default: break
- }
- }
- return (cells.min(), headers.min())
- }
-
- func elementsAtRect(excludeHeaders: Bool? = false, from rect: CGRect? = nil) -> [UICollectionViewLayoutAttributes] {
- let aRect = rect ?? CGRect(x: collectionView!.contentOffset.x + 1, y: collectionView!.contentOffset.y + 1, width: collectionView!.frame.width - 2, height: collectionView!.frame.height - 2)
- guard let attributes = layoutAttributesForElements(in: aRect), !attributes.isEmpty else {
- return []
- }
- if excludeHeaders == true {
- return attributes.filter { $0.representedElementKind != UICollectionView.elementKindSectionHeader }
- }
- return attributes
- }
-
- func clearCache() {
- headerCache.removeAll()
- cellCache.removeAll()
- endOfSectionOffsets.removeAll()
- decorationCache.removeAll()
- currentHeader = nil
- currentCell = nil
- lastWrittenCellAttribute = nil
- xCellOffset = 0
- yCellOffset = 0
- contentHeight = 0
- contentWidth = 0
- xStride = 0
- firstContentOffsetWasSet = false
- }
-}
diff --git a/Sources/JTAppleCalendar/JTACMonthLayoutHorizontalCalendar.swift b/Sources/JTAppleCalendar/JTACMonthLayoutHorizontalCalendar.swift
deleted file mode 100644
index 76e2a0b7..00000000
--- a/Sources/JTAppleCalendar/JTACMonthLayoutHorizontalCalendar.swift
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-// JTACMonthLayoutHorizontalCalendar.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-extension JTACMonthLayout {
- func configureHorizontalLayout() {
- var virtualSection = 0
- var totalDayCounter = 0
- let fullSection = numberOfRows * maxNumberOfDaysInWeek
-
- xCellOffset = sectionInset.left
- endSeparator = sectionInset.left + sectionInset.right
-
- for aMonth in monthInfo {
- for numberOfDaysInCurrentSection in aMonth.sections {
- // Generate and cache the headers
- if let aHeaderAttr = determineToApplySupplementaryAttribs(0, section: virtualSection) {
- headerCache[virtualSection] = aHeaderAttr
- if strictBoundaryRulesShouldApply {
- contentWidth += aHeaderAttr.width
- yCellOffset = aHeaderAttr.height
- }
- }
- // Generate and cache the cells
- for dayCounter in 1...numberOfDaysInCurrentSection {
- guard let attribute = determineToApplyAttribs(dayCounter - 1, section: virtualSection) else { continue }
- if cellCache[virtualSection] == nil { cellCache[virtualSection] = [] }
- cellCache[virtualSection]!.append(attribute)
- lastWrittenCellAttribute = attribute
- xCellOffset += attribute.width
-
- if strictBoundaryRulesShouldApply {
- if dayCounter == numberOfDaysInCurrentSection || dayCounter % maxNumberOfDaysInWeek == 0 {
- // We are at the last item in the section
- // && if we have headers
- xCellOffset = sectionInset.left
- yCellOffset += attribute.height
- }
- } else {
- totalDayCounter += 1
- if totalDayCounter % fullSection == 0 {
- yCellOffset = 0
- xCellOffset = sectionInset.left
- contentWidth += (attribute.width * 7) + endSeparator
- xStride = contentWidth
- endOfSectionOffsets.append(contentWidth)
- } else {
- if totalDayCounter >= delegate?.totalDays ?? 0 {
- contentWidth += (attribute.width * 7) + endSeparator
- endOfSectionOffsets.append(contentWidth)
- }
- if totalDayCounter % maxNumberOfDaysInWeek == 0 {
- xCellOffset = sectionInset.left
- yCellOffset += attribute.height
- }
- }
- }
- }
-
- // Save the content size for each section
- if strictBoundaryRulesShouldApply {
- contentWidth += endSeparator
- endOfSectionOffsets.append(contentWidth)
- xStride = endOfSectionOffsets[virtualSection]
- }
- virtualSection += 1
- }
- }
- contentHeight = self.collectionView!.bounds.size.height
- }
-}
diff --git a/Sources/JTAppleCalendar/JTACMonthLayoutProtocol.swift b/Sources/JTAppleCalendar/JTACMonthLayoutProtocol.swift
deleted file mode 100644
index be8fd09b..00000000
--- a/Sources/JTAppleCalendar/JTACMonthLayoutProtocol.swift
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// JTACMonthLayoutProtocol.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-import UIKit
-
-protocol JTACMonthLayoutProtocol: AnyObject {
- var minimumInteritemSpacing: CGFloat {get set}
- var minimumLineSpacing: CGFloat {get set}
- var sectionInset: UIEdgeInsets {get set}
- var scrollDirection: UICollectionView.ScrollDirection {get set}
-}
-
-extension UICollectionViewFlowLayout: JTACMonthLayoutProtocol {}
-
diff --git a/Sources/JTAppleCalendar/JTACMonthLayoutVerticalCalendar.swift b/Sources/JTAppleCalendar/JTACMonthLayoutVerticalCalendar.swift
deleted file mode 100644
index 0c341d44..00000000
--- a/Sources/JTAppleCalendar/JTACMonthLayoutVerticalCalendar.swift
+++ /dev/null
@@ -1,98 +0,0 @@
-//
-// JTACMonthLayoutVerticalCalendar.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-extension JTACMonthLayout {
-
- func configureVerticalLayout() {
- var virtualSection = 0
- var totalDayCounter = 0
- let fullSection = numberOfRows * maxNumberOfDaysInWeek
-
- xCellOffset = sectionInset.left
- yCellOffset = sectionInset.top
- contentHeight = sectionInset.top
- endSeparator = sectionInset.top + sectionInset.bottom
-
- for aMonth in monthInfo {
- for numberOfDaysInCurrentSection in aMonth.sections {
- // Generate and cache the headers
- if let aHeaderAttr = determineToApplySupplementaryAttribs(0, section: virtualSection) {
- headerCache[virtualSection] = aHeaderAttr
- if strictBoundaryRulesShouldApply {
- contentHeight += aHeaderAttr.height
- yCellOffset += aHeaderAttr.height
- }
- }
- // Generate and cache the cells
- for dayCounter in 1...numberOfDaysInCurrentSection {
- totalDayCounter += 1
- guard let attribute = determineToApplyAttribs(dayCounter - 1, section: virtualSection) else { continue }
- if cellCache[virtualSection] == nil { cellCache[virtualSection] = [] }
- cellCache[virtualSection]!.append(attribute)
- lastWrittenCellAttribute = attribute
- xCellOffset += attribute.width
-
- if strictBoundaryRulesShouldApply {
- if dayCounter == numberOfDaysInCurrentSection || dayCounter % maxNumberOfDaysInWeek == 0 {
- // We are at the last item in the
- // section && if we have headers
-
- xCellOffset = sectionInset.left
- yCellOffset += attribute.height
- contentHeight += attribute.height
-
- if dayCounter == numberOfDaysInCurrentSection {
- yCellOffset += sectionInset.top
- contentHeight += sectionInset.top
- endOfSectionOffsets.append(contentHeight - sectionInset.top)
- }
- }
- } else {
- if totalDayCounter % fullSection == 0 {
-
- yCellOffset += attribute.height + sectionInset.top
- xCellOffset = sectionInset.left
- contentHeight = yCellOffset
- endOfSectionOffsets.append(contentHeight - sectionInset.top)
-
- } else {
- if totalDayCounter >= delegate?.totalDays ?? 0 {
- yCellOffset += attribute.height + sectionInset.top
- contentHeight = yCellOffset
- endOfSectionOffsets.append(contentHeight - sectionInset.top)
- }
-
- if totalDayCounter % maxNumberOfDaysInWeek == 0 {
- xCellOffset = sectionInset.left
- yCellOffset += attribute.height
- }
- }
- }
- }
- virtualSection += 1
- }
- }
- contentWidth = self.collectionView!.bounds.size.width
- }
-}
diff --git a/Sources/JTAppleCalendar/JTACMonthQueryFunctions.swift b/Sources/JTAppleCalendar/JTACMonthQueryFunctions.swift
deleted file mode 100644
index 8792a36b..00000000
--- a/Sources/JTAppleCalendar/JTACMonthQueryFunctions.swift
+++ /dev/null
@@ -1,474 +0,0 @@
-//
-// JTACMonthQueryFunctions.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-import UIKit
-
-extension JTACMonthView {
- func validForwardAndBackwordSelectedIndexes(forIndexPath indexPath: IndexPath, restrictToSection: Bool = true) -> (forwardIndex: IndexPath?, backIndex: IndexPath?, set: Set) {
- var retval: (forwardIndex: IndexPath?, backIndex: IndexPath?, set: Set) = (forwardIndex: nil, backIndex: nil, set: [])
- if let validForwardIndex = calendarViewLayout.indexPath(direction: .next, of: indexPath.section, item: indexPath.item),
- (restrictToSection ? validForwardIndex.section == indexPath.section : true),
- selectedCellData[validForwardIndex] != nil {
- retval.forwardIndex = validForwardIndex
- retval.set.insert(validForwardIndex)
- }
- if
- let validBackwardIndex = calendarViewLayout.indexPath(direction: .previous, of: indexPath.section, item: indexPath.item),
- (restrictToSection ? validBackwardIndex.section == indexPath.section : true),
- selectedCellData[validBackwardIndex] != nil {
- retval.backIndex = validBackwardIndex
- retval.set.insert(validBackwardIndex)
- }
- return retval
- }
-
- // Determines the CGPoint of an index path. The point will vary depending on the scrollingMode
- func targetPointForItemAt(indexPath: IndexPath, preferredScrollPosition: UICollectionView.ScrollPosition? = nil) -> CGPoint? {
- guard let targetCellFrame = calendarViewLayout.layoutAttributesForItem(at: indexPath)?.frame else { // Jt101 This was changed !!
- return nil
- }
-
- var x: CGFloat = scrollDirection == .horizontal ? targetCellFrame.origin.x : 0
- var y: CGFloat = scrollDirection == .vertical ? targetCellFrame.origin.y : 0
-
- let theTargetContentOffset: CGFloat = scrollDirection == .horizontal ? targetCellFrame.origin.x : targetCellFrame.origin.y
- var fixedScrollSize: CGFloat = 0
- switch scrollingMode {
- case let .stopAtEach(customInterval: x): fixedScrollSize = x
- case let .nonStopTo(customInterval: x, withResistance: _): fixedScrollSize = x
- case .stopAtEachCalendarFrame: fixedScrollSize = scrollDirection == .horizontal ? self.frame.width : self.frame.height
- default: break
- }
-
- switch scrollingMode {
- case .stopAtEachCalendarFrame, .stopAtEach, .nonStopTo:
- assert(fixedScrollSize != 0, "You should not try to divide by zero.")
- let frameSection = theTargetContentOffset / fixedScrollSize
- let roundedFrameSection = floor(frameSection)
- if scrollDirection == .horizontal {
- x = roundedFrameSection * fixedScrollSize
- } else {
- // vertical is fixed scroll segments because here, we're using stop at frame and custom fixed size
- y = roundedFrameSection * fixedScrollSize
- }
- case .stopAtEachSection, .nonStopToSection:
- if scrollDirection == .horizontal {
- let section = calendarViewLayout.sectionFromOffset(theTargetContentOffset)
- guard let validValue = calendarViewLayout.cachedValue(for: 0, section: section)?.2 else { return nil}
- x = validValue - sectionInset.left
- } else {
- // If headers, then find the section headers cgpoint for a cellDate. I no headers, then find the first cell's cgpoint of section
- if !calendarViewLayout.thereAreHeaders {
- let section = calendarViewLayout.sectionFromOffset(theTargetContentOffset)
- guard let validAttrib = calendarViewLayout.cachedValue(for: 0, section: section)?.3 else { return nil }
- y = validAttrib - sectionInset.top
- } else {
- let section = calendarViewLayout.sectionFromOffset(theTargetContentOffset)
- guard let validSectionHeaderData = calendarViewLayout.headerCache[section] else { return nil }
- y = validSectionHeaderData.3 - sectionInset.top
- }
- }
- default: break
- }
- return CGPoint(x: x, y: y)
- }
-
- func calendarOffsetIsAlreadyAtScrollPosition(forOffset offset: CGPoint) -> Bool {
- var retval = false
- // If the scroll is set to animate, and the target content
- // offset is already on the screen, then the
- // didFinishScrollingAnimation
- // delegate will not get called. Once animation is on let's
- // force a scroll so the delegate MUST get caalled
- let theOffset = scrollDirection == .horizontal ? offset.x : offset.y
- let divValue = scrollDirection == .horizontal ? frame.width : frame.height
- let sectionForOffset = Int(theOffset / divValue)
- let calendarCurrentOffset = scrollDirection == .horizontal ? contentOffset.x : contentOffset.y
- if calendarCurrentOffset == theOffset || (scrollingMode.pagingIsEnabled() && (sectionForOffset == currentSection())) {
- retval = true
- }
- return retval
- }
-
- func calendarOffsetIsAlreadyAtScrollPosition(forIndexPath indexPath: IndexPath) -> Bool {
- var retval = false
- // If the scroll is set to animate, and the target content offset
- // is already on the screen, then the didFinishScrollingAnimation
- // delegate will not get called. Once animation is on let's force
- // a scroll so the delegate MUST get caalled
- if let attributes = calendarViewLayout.layoutAttributesForItem(at: indexPath) { // JT101 this was changed!!!!
- let layoutOffset: CGFloat
- let calendarOffset: CGFloat
- if scrollDirection == .horizontal {
- layoutOffset = attributes.frame.origin.x
- calendarOffset = contentOffset.x
- } else {
- layoutOffset = attributes.frame.origin.y
- calendarOffset = contentOffset.y
- }
- if calendarOffset == layoutOffset {
- retval = true
- }
- }
- return retval
- }
-
- func indexPathOfdateCellCounterPath(_ date: Date, dateOwner: DateOwner) -> IndexPath? {
- if (_cachedConfiguration?.generateInDates == .off ||
- _cachedConfiguration?.generateInDates == .forFirstMonthOnly) &&
- _cachedConfiguration?.generateOutDates == .off {
- return nil
- }
- var retval: IndexPath?
- if dateOwner != .thisMonth {
- // If the cell is anything but this month, then the cell belongs
- // to either a previous of following month
- // Get the indexPath of the counterpartCell
- let counterPathIndex = pathsFromDates([date])
- if !counterPathIndex.isEmpty {
- retval = counterPathIndex[0]
- }
- } else {
- // If the date does belong to this month,
- // then lets find out if it has a counterpart date
- if date < startOfMonthCache || date > endOfMonthCache {
- return retval
- }
- guard let dayIndex = calendar.dateComponents([.day], from: date).day else {
- print("Invalid Index")
- return nil
- }
- if case 1...13 = dayIndex {
- // then check the previous month
- // get the index path of the last day of the previous month
- let periodApart = calendar.dateComponents([.month], from: startOfMonthCache, to: date)
- guard
- let monthSectionIndex = periodApart.month, monthSectionIndex - 1 >= 0 else {
- // If there is no previous months,
- // there are no counterpart dates
- return retval
- }
- let previousMonthInfo = monthInfo[monthSectionIndex - 1]
- // If there are no postdates for the previous month,
- // then there are no counterpart dates
- if previousMonthInfo.outDates < 1 || dayIndex > previousMonthInfo.outDates {
- return retval
- }
- guard
- let prevMonth = calendar.date(byAdding: .month, value: -1, to: date),
- let lastDayOfPrevMonth = calendar.endOfMonth(for: prevMonth) else {
- assert(false, "Error generating date in indexPathOfdateCellCounterPath(). Contact the developer on github")
- return retval
- }
-
- let indexPathOfLastDayOfPreviousMonth = pathsFromDates([lastDayOfPrevMonth])
- if indexPathOfLastDayOfPreviousMonth.isEmpty {
- print("out of range error in indexPathOfdateCellCounterPath() upper. This should not happen. Contact developer on github")
- return retval
- }
- let lastDayIndexPath = indexPathOfLastDayOfPreviousMonth[0]
- var section = lastDayIndexPath.section
- var itemIndex = lastDayIndexPath.item + dayIndex
- // Determine if the sections/item needs to be adjusted
-
- let numberOfItemsInSection = collectionView(self, numberOfItemsInSection: section)
- guard numberOfItemsInSection > 0 else {
- assert(false, "Number of sections in calendar = 0. Possible fixes (1) is your calendar visible size 0,0? (2) is your calendar already loaded/visible?")
- return nil
- }
- let extraSection = itemIndex / numberOfItemsInSection
- let extraIndex = itemIndex % numberOfItemsInSection
- section += extraSection
- itemIndex = extraIndex
- let reCalcRapth = IndexPath(item: itemIndex, section: section)
- retval = reCalcRapth
- } else if case 23...31 = dayIndex { // check the following month
- let periodApart = calendar.dateComponents([.month], from: startOfMonthCache, to: date)
- let monthSectionIndex = periodApart.month!
- if monthSectionIndex + 1 >= monthInfo.count {
- return retval
- }
-
- // If there is no following months, there are no counterpart dates
- let followingMonthInfo = monthInfo[monthSectionIndex + 1]
- if followingMonthInfo.inDates < 1 {
- return retval
- }
- // If there are no predates for the following month then there are no counterpart dates
- let lastDateOfCurrentMonth = calendar.endOfMonth(for: date)!
- let lastDay = calendar.component(.day, from: lastDateOfCurrentMonth)
- let section = followingMonthInfo.startSection
- let index = dayIndex - lastDay + (followingMonthInfo.inDates - 1)
- if index < 0 {
- return retval
- }
- retval = IndexPath(item: index, section: section)
- }
- }
- return retval
- }
-
- func sizesForMonthSection() -> [AnyHashable:CGFloat] {
- var retval: [AnyHashable:CGFloat] = [:]
- guard
- let headerSizes = calendarDelegate?.calendarSizeForMonths(self),
- headerSizes.defaultSize > 0 else {
- return retval
- }
-
- // Build the default
- retval["default"] = headerSizes.defaultSize
-
- // Build the every-month data
- if let allMonths = headerSizes.months {
- for (size, months) in allMonths {
- for month in months {
- assert(retval[month] == nil, "You have duplicated months. Please revise your month size data.")
- retval[month] = size
- }
- }
- }
-
- // Build the specific month data
- if let specificSections = headerSizes.dates {
- for (size, dateArray) in specificSections {
- let paths = pathsFromDates(dateArray)
- for path in paths {
- retval[path.section] = size
- }
- }
- }
- return retval
- }
-
- func pathsFromDates(_ dates: [Date]) -> [IndexPath] {
- var returnPaths: [IndexPath] = []
- for date in dates {
- if calendar.startOfDay(for: date) >= startOfMonthCache! && calendar.startOfDay(for: date) <= endOfMonthCache! {
- let periodApart = calendar.dateComponents([.month], from: startOfMonthCache, to: date)
- let day = calendar.dateComponents([.day], from: date).day!
- guard let monthSectionIndex = periodApart.month else { continue }
- let currentMonthInfo = monthInfo[monthSectionIndex]
- if let indexPath = currentMonthInfo.indexPath(forDay: day) {
- returnPaths.append(indexPath)
- }
- }
- }
- return returnPaths
- }
-
- func cellStateFromIndexPath(_ indexPath: IndexPath,
- withDateInfo info: (date: Date, owner: DateOwner)? = nil,
- cell: JTACDayCell? = nil,
- isSelected: Bool? = nil,
- selectionType: SelectionType? = nil) -> CellState {
- let validDateInfo: (date: Date, owner: DateOwner)
- if let nonNilDateInfo = info {
- validDateInfo = nonNilDateInfo
- } else {
- guard let newDateInfo = dateOwnerInfoFromPath(indexPath) else {
- developerError(string: "Error this should not be nil. Contact developer Jay on github by opening a request")
- return CellState(isSelected: false,
- text: "",
- dateBelongsTo: .thisMonth,
- date: Date(),
- day: .sunday,
- row: { return 0 },
- column: { return 0 },
- dateSection: { return (range: (Date(), Date()), month: 0, rowCount: 0) },
- selectedPosition: {return .left},
- cell: {return nil},
- selectionType: nil)
- }
- validDateInfo = newDateInfo
- }
- let date = validDateInfo.date
- let dateBelongsTo = validDateInfo.owner
-
- let currentDay = calendar.component(.day, from: date)
- let componentWeekDay = calendar.component(.weekday, from: date)
- let cellText = String(describing: currentDay)
- let dayOfWeek = DaysOfWeek(rawValue: componentWeekDay)!
-
- let selectedPosition = { [unowned self] () -> SelectionRangePosition in
- let selectedDates = self.selectedDatesSet
- if !selectedDates.contains(date) || selectedDates.isEmpty { return .none }
-
- let isLTRDirection = UIView.userInterfaceLayoutDirection(
- for: self.semanticContentAttribute) == .leftToRight
- let restrictToSection = self.rangeSelectionMode == .segmented
- let validSelectedIndexes = self.validForwardAndBackwordSelectedIndexes(forIndexPath: indexPath, restrictToSection: restrictToSection)
- let dateBeforeIsSelected = validSelectedIndexes.backIndex != nil
- let dateAfterIsSelected = validSelectedIndexes.forwardIndex != nil
-
- var position: SelectionRangePosition
-
- if dateBeforeIsSelected, dateAfterIsSelected {
- position = .middle
- } else if !dateBeforeIsSelected, dateAfterIsSelected {
- position = isLTRDirection ? .left : .right
- } else if dateBeforeIsSelected, !dateAfterIsSelected {
- position = isLTRDirection ? .right : .left
- } else if !dateBeforeIsSelected, !dateAfterIsSelected {
- position = .full
- } else {
- position = .none
- }
-
- return position
- }
-
- let cellState = CellState(
- isSelected: isSelected ?? (selectedCellData[indexPath] != nil),
- text: cellText,
- dateBelongsTo: dateBelongsTo,
- date: date,
- day: dayOfWeek,
- row: { return indexPath.item / maxNumberOfDaysInWeek },
- column: { return indexPath.item % maxNumberOfDaysInWeek },
- dateSection: { [unowned self] in
- return self.monthInfoFromSection(indexPath.section)!
- },
- selectedPosition: selectedPosition,
- cell: { return cell },
- selectionType: selectionType
- )
- return cellState
- }
-
- func monthInfoFromSection(_ section: Int) -> (range: (start: Date, end: Date), month: Int, rowCount: Int)? {
- guard let monthIndex = monthMap[section] else {
- return nil
- }
- let monthData = monthInfo[monthIndex]
-
- guard
- let monthDataMapSection = monthData.sectionIndexMaps[section],
- let indices = monthData.boundaryIndicesFor(section: monthDataMapSection) else {
- return nil
- }
- let startIndexPath = IndexPath(item: indices.startIndex, section: section)
- let endIndexPath = IndexPath(item: indices.endIndex, section: section)
- guard
- let startDate = dateOwnerInfoFromPath(startIndexPath)?.date,
- let endDate = dateOwnerInfoFromPath(endIndexPath)?.date else {
- return nil
- }
- if let monthDate = calendar.date(byAdding: .month, value: monthIndex, to: startDateCache) {
- let monthNumber = calendar.dateComponents([.month], from: monthDate)
- let numberOfRowsForSection = monthData.numberOfRows(for: section, developerSetRows: _cachedConfiguration?.numberOfRows ?? 0)
- return ((startDate, endDate), monthNumber.month!, numberOfRowsForSection)
- }
- return nil
- }
-
- func dateSegmentInfoFrom(visible indexPaths: [IndexPath]) -> DateSegmentInfo {
- var inDates = [(Date, IndexPath)]()
- var monthDates = [(Date, IndexPath)]()
- var outDates = [(Date, IndexPath)]()
-
- for indexPath in indexPaths {
- let info = dateOwnerInfoFromPath(indexPath)
- if let validInfo = info {
- switch validInfo.owner {
- case .thisMonth:
- monthDates.append((validInfo.date, indexPath))
- case .previousMonthWithinBoundary, .previousMonthOutsideBoundary:
- inDates.append((validInfo.date, indexPath))
- default:
- outDates.append((validInfo.date, indexPath))
- }
- }
- }
-
- let retval = DateSegmentInfo(indates: inDates, monthDates: monthDates, outdates: outDates)
- return retval
- }
-
- func dateOwnerInfoFromPath(_ indexPath: IndexPath) -> (date: Date, owner: DateOwner)? { // Returns nil if date is out of scope
- guard let monthIndex = monthMap[indexPath.section] else {
- return nil
- }
- let monthData = monthInfo[monthIndex]
- // Calculate the offset
- let offSet: Int
- var numberOfDaysToAddToOffset: Int = 0
- switch monthData.sectionIndexMaps[indexPath.section]! {
- case 0:
- offSet = monthData.inDates
- default:
- offSet = 0
- let currentSectionIndexMap = monthData.sectionIndexMaps[indexPath.section]!
- numberOfDaysToAddToOffset = monthData.sections[0..= offSet && indexPath.item + numberOfDaysToAddToOffset < monthData.numberOfDaysInMonth + offSet {
- // This is a month date
- dayIndex = monthData.startDayIndex + indexPath.item - offSet + numberOfDaysToAddToOffset
- date = calendar.date(byAdding: .day, value: dayIndex, to: startOfMonthCache)
- } else if indexPath.item < offSet {
- // This is a preDate
- dayIndex = indexPath.item - offSet + monthData.startDayIndex
- date = calendar.date(byAdding: .day, value: dayIndex, to: startOfMonthCache)
- if date! < startOfMonthCache {
- dateOwner = .previousMonthOutsideBoundary
- } else {
- dateOwner = .previousMonthWithinBoundary
- }
- } else {
- // This is a postDate
- dayIndex = monthData.startDayIndex - offSet + indexPath.item + numberOfDaysToAddToOffset
- date = calendar.date(byAdding: .day, value: dayIndex, to: startOfMonthCache)
- if date! > endOfMonthCache {
- dateOwner = .followingMonthOutsideBoundary
- } else {
- dateOwner = .followingMonthWithinBoundary
- }
- }
- guard let validDate = date else { return nil }
- return (validDate, dateOwner)
- }
-
- func datesAtCurrentOffset(_ offset: CGPoint? = nil) -> DateSegmentInfo {
-
- let rect: CGRect?
- if let offset = offset {
- rect = CGRect(x: offset.x + 1, y: offset.y + 1, width: frame.width - 2, height: frame.height - 2)
- } else {
- rect = nil
- }
-
- let emptySegment = DateSegmentInfo(indates: [], monthDates: [], outdates: [])
-
- guard calendarLayoutIsLoaded else { return emptySegment }
-
- let cellAttributes = calendarViewLayout.elementsAtRect(excludeHeaders: true, from: rect)
- let indexPaths: [IndexPath] = cellAttributes.map { $0.indexPath }.sorted()
- return dateSegmentInfoFrom(visible: indexPaths)
- }
-}
diff --git a/Sources/JTAppleCalendar/JTACMonthReusableView.swift b/Sources/JTAppleCalendar/JTACMonthReusableView.swift
deleted file mode 100644
index 92254ccc..00000000
--- a/Sources/JTAppleCalendar/JTACMonthReusableView.swift
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// JTACMonthReusableView.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-import Foundation
-import UIKit
-
-/// The header view class of the calendar
-@available(*, unavailable, renamed: "JTACMonthReusableView")
-open class JTAppleCollectionReusableView: UICollectionReusableView {}
-open class JTACMonthReusableView: UICollectionReusableView {
- /// Initializes and returns a newly allocated view object with the specified frame rectangle.
- public override init(frame: CGRect) {
- super.init(frame: frame)
- }
-
- /// Returns an object initialized from data in a given unarchiver.
- /// self, initialized using the data in decoder.
- required public init?(coder aDecoder: NSCoder) {
- super.init(coder: aDecoder)
- }
-}
diff --git a/Sources/JTAppleCalendar/JTACMonthView.swift b/Sources/JTAppleCalendar/JTACMonthView.swift
deleted file mode 100644
index 7b1ab1a6..00000000
--- a/Sources/JTAppleCalendar/JTACMonthView.swift
+++ /dev/null
@@ -1,229 +0,0 @@
-//
-// JTACMonthView.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-import Foundation
-import UIKit
-
-let maxNumberOfDaysInWeek = 7 // Should not be changed
-let maxNumberOfRowsPerMonth = 6 // Should not be changed
-let developerErrorMessage = "There was an error in this code section. Please contact the developer on GitHub"
-let decorationViewID = "Are you ready for the life after this one?"
-let errorDelta: CGFloat = 0.0000001
-
-
-/// An instance of JTAppleCalendarMonthView (or simply, a calendar view) is a
-/// means for displaying and interacting with a gridstyle layout of date-cells
-@available(*, unavailable, renamed: "JTACMonthView")
-open class JTAppleCalendarView: UICollectionView {}
-open class JTACMonthView: UICollectionView {
-
- /// Configures the size of your date cells
- @IBInspectable open var cellSize: CGFloat = 0 {
- didSet {
- if oldValue == cellSize { return }
- calendarViewLayout.invalidateLayout()
- }
- }
-
- /// Stores the first and last selected date cel
- open var selectedCells: (first: (date: Date, indexPath: IndexPath)?, last: (date: Date, indexPath: IndexPath)?)
-
- /// The scroll direction of the sections in JTAppleCalendar.
- open var scrollDirection: UICollectionView.ScrollDirection = .horizontal
-
- /// The configuration parameters setup by the developer in the confogureCalendar function
- open var cachedConfiguration: ConfigurationParameters? { return _cachedConfiguration }
-
- /// Enables/Disables the stretching of date cells. When enabled cells will stretch to fit the width of a month in case of a <= 5 row month.
- open var allowsDateCellStretching = true
-
- /// Alerts the calendar that range selection will be checked. If you are
- /// not using rangeSelection and you enable this,
- /// then whenever you click on a datecell, you may notice a very fast
- /// refreshing of the date-cells both left and right of the cell you
- /// just selected.
- open var allowsRangedSelection: Bool = false
-
- open var rangeSelectionMode: RangeSelectionMode = .segmented
-
- /// The object that acts as the delegate of the calendar view.
- weak open var calendarDelegate: JTACMonthViewDelegate? {
- didSet { lastMonthSize = sizesForMonthSection() }
- }
-
- /// The object that acts as the data source of the calendar view.
- weak open var calendarDataSource: JTACMonthViewDataSource? {
- didSet { setupMonthInfoAndMap() } // Refetch the data source for a data source change
- }
-
- var triggerScrollToDateDelegate: Bool? = true
- var isScrollInProgress = false
- var isReloadDataInProgress = false
-
- // Keeps track of scroll target location. If isScrolling, and user taps while scrolling
- var endScrollTargetLocation: CGFloat = 0
- var lastMovedScrollDirection: CGFloat = 0
-
- var generalDelayedExecutionClosure: [(() -> Void)] = []
- var scrollDelayedExecutionClosure: [(() -> Void)] = []
-
- let dateGenerator = JTAppleDateConfigGenerator.shared
-
- /// Implemented by subclasses to initialize a new object (the receiver) immediately after memory for it has been allocated.
- public init() {
- super.init(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout())
- setupNewLayout(from: collectionViewLayout as! JTACMonthLayoutProtocol)
- }
-
- /// Initializes and returns a newly allocated collection view object with the specified frame and layout.
- @available(*, unavailable, message: "Please use JTAppleCalendarMonthView() instead. It manages its own layout.")
- public override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) {
- super.init(frame: frame, collectionViewLayout: UICollectionViewFlowLayout())
- setupNewLayout(from: collectionViewLayout as! JTACMonthLayoutProtocol)
- }
-
- /// Initializes using decoder object
- required public init?(coder aDecoder: NSCoder) {
- super.init(coder: aDecoder)
- setupNewLayout(from: collectionViewLayout as! JTACMonthLayoutProtocol)
- }
-
- // Configuration parameters from the dataSource
- var _cachedConfiguration: ConfigurationParameters?
- // Set the start of the month
- var startOfMonthCache: Date!
- // Set the end of month
- var endOfMonthCache: Date!
- var selectedCellData: [IndexPath:SelectedCellData] = [:]
- var pathsToReload: Set = [] //Paths to reload because of prefetched cells
-
- var anchorDate: Date?
-
- var requestedContentOffset: CGPoint {
- var retval = CGPoint(x: -contentInset.left, y: -contentInset.top)
- guard let date = anchorDate else { return retval }
-
- // reset the initial scroll date once used.
- anchorDate = nil
-
- // Ensure date is within valid boundary
- let components = calendar.dateComponents([.year, .month, .day], from: date)
- let firstDayOfDate = calendar.date(from: components)!
- if !((firstDayOfDate >= startOfMonthCache!) && (firstDayOfDate <= endOfMonthCache!)) { return retval }
-
- // Get valid indexPath of date to scroll to
- let retrievedPathsFromDates = pathsFromDates([date])
- if retrievedPathsFromDates.isEmpty { return retval }
- let sectionIndexPath = pathsFromDates([date])[0]
-
-
- if calendarViewLayout.thereAreHeaders && scrollDirection == .vertical {
- let indexPath = IndexPath(item: 0, section: sectionIndexPath.section)
- guard let attributes = calendarViewLayout.layoutAttributesForSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, at: indexPath) else { return retval }
-
- let maxYCalendarOffset = max(0, self.contentSize.height - self.frame.size.height)
- retval = CGPoint(x: attributes.frame.origin.x,y: min(maxYCalendarOffset, attributes.frame.origin.y))
- // if self.scrollDirection == .horizontal { topOfHeader.x += extraAddedOffset} else { topOfHeader.y += extraAddedOffset }
-
- } else {
- switch scrollingMode {
- case .stopAtEach, .stopAtEachSection, .stopAtEachCalendarFrame:
- if scrollDirection == .horizontal || (scrollDirection == .vertical && !calendarViewLayout.thereAreHeaders) {
- retval = self.targetPointForItemAt(indexPath: sectionIndexPath) ?? retval
- }
- default:
- break
- }
- }
- return retval
- }
-
- var _sectionInset: UIEdgeInsets = .zero
- open var sectionInset: UIEdgeInsets {
- set {
- _sectionInset.top = newValue.top < 0 ? 0 : newValue.top
- _sectionInset.bottom = newValue.bottom < 0 ? 0 : newValue.bottom
- _sectionInset.left = newValue.left < 0 ? 0 : newValue.left
- _sectionInset.right = newValue.right < 0 ? 0 : newValue.right
- }
- get { return _sectionInset }
- }
-
- var _minimumInteritemSpacing: CGFloat = 0
- open var minimumInteritemSpacing: CGFloat {
- set { _minimumInteritemSpacing = newValue < 0 ? 0 : newValue }
- get { return _minimumInteritemSpacing }
- }
-
- var _minimumLineSpacing: CGFloat = 0
- open var minimumLineSpacing: CGFloat {
- set { _minimumLineSpacing = newValue < 0 ? 0 : newValue }
- get { return _minimumLineSpacing }
- }
-
- lazy var theData: CalendarData = {
- return self.setupMonthInfoDataForStartAndEndDate()
- }()
-
- var lastMonthSize: [AnyHashable:CGFloat] = [:]
-
- var monthMap: [Int: Int] {
- get { return theData.sectionToMonthMap }
- set { theData.sectionToMonthMap = newValue }
- }
-
- var decelerationRateMatchingScrollingMode: CGFloat {
- switch scrollingMode {
- case .stopAtEachCalendarFrame: return UIScrollView.DecelerationRate.fast.rawValue
- case .stopAtEach, .stopAtEachSection: return UIScrollView.DecelerationRate.fast.rawValue
- case .nonStopToSection, .nonStopToCell, .nonStopTo, .none: return UIScrollView.DecelerationRate.normal.rawValue
- }
- }
-
- /// Configure the scrolling behavior
- open var scrollingMode: ScrollingMode = .stopAtEachCalendarFrame {
- didSet {
- decelerationRate = UIScrollView.DecelerationRate(rawValue: decelerationRateMatchingScrollingMode)
- #if os(iOS)
- switch scrollingMode {
- case .stopAtEachCalendarFrame:
- isPagingEnabled = true
- default:
- isPagingEnabled = false
- }
- #endif
- }
- }
-}
-
-extension JTACMonthView {
- /// A semantic description of the view’s contents, used to determine whether the view should be flipped when switching between left-to-right and right-to-left layouts.
- open override var semanticContentAttribute: UISemanticContentAttribute {
- didSet {
- var superviewIsRTL = false
- if let validSuperView = superview?.effectiveUserInterfaceLayoutDirection { superviewIsRTL = validSuperView == .rightToLeft && semanticContentAttribute == .unspecified }
- transform.a = semanticContentAttribute == .forceRightToLeft || superviewIsRTL ? -1: 1
- }
- }
-}
diff --git a/Sources/JTAppleCalendar/JTACMonthViewProtocols.swift b/Sources/JTAppleCalendar/JTACMonthViewProtocols.swift
deleted file mode 100644
index 00718dea..00000000
--- a/Sources/JTAppleCalendar/JTACMonthViewProtocols.swift
+++ /dev/null
@@ -1,186 +0,0 @@
-//
-// JTACMonthViewProtocols.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-import Foundation
-import UIKit
-
-/// The JTAppleCalendarMonthViewDataSource protocol is adopted by an
-/// object that mediates the application’s data model for a
-/// the JTAppleCalendarMonthViewDataSource object. data source provides the
-/// the calendar-view object with the information it needs to construct and
-/// then modify it self
-@available(*, unavailable, renamed: "JTACMonthViewDataSource")
-public protocol JTAppleCalendarViewDataSource: AnyObject {}
-public protocol JTACMonthViewDataSource: AnyObject {
- /// Asks the data source to return the start and end boundary dates
- /// as well as the calendar to use. You should properly configure
- /// your calendar at this point.
- /// - Parameters:
- /// - calendar: The JTAppleCalendar view requesting this information.
- /// - returns:
- /// - ConfigurationParameters instance:
- func configureCalendar(_ calendar: JTACMonthView) -> ConfigurationParameters
-}
-
-/// The delegate of a JTAppleCalendarMonthView object must adopt the
-/// JTAppleCalendarMonthViewDelegate protocol Optional methods of the protocol
-/// allow the delegate to manage selections, and configure the cells
-@available(*, unavailable, renamed: "JTACMonthViewDelegate")
-public protocol JTAppleCalendarViewDelegate: AnyObject {}
-public protocol JTACMonthViewDelegate: AnyObject {
- /// Asks the delegate if selecting the date-cell with a specified date is
- /// allowed
- /// - Parameters:
- /// - calendar: The JTAppleCalendar view requesting this information.
- /// - date: The date attached to the date-cell.
- /// - cell: The date-cell view. This can be customized at this point.
- /// - cellState: The month the date-cell belongs to.
- /// - returns: A Bool value indicating if the operation can be done.
- func calendar(_ calendar: JTACMonthView, shouldSelectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) -> Bool
-
- /// Asks the delegate if de-selecting the
- /// date-cell with a specified date is allowed
- /// - Parameters:
- /// - calendar: The JTAppleCalendar view requesting this information.
- /// - date: The date attached to the date-cell.
- /// - cell: The date-cell view. This can be customized at this point.
- /// - cellState: The month the date-cell belongs to.
- /// - returns: A Bool value indicating if the operation can be done.
- func calendar(_ calendar: JTACMonthView, shouldDeselectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) -> Bool
-
- /// Tells the delegate that a date-cell with a specified date was selected
- /// - Parameters:
- /// - calendar: The JTAppleCalendar view giving this information.
- /// - date: The date attached to the date-cell.
- /// - cell: The date-cell view. This can be customized at this point.
- /// This may be nil if the selected cell is off the screen
- /// - cellState: The month the date-cell belongs to.
- func calendar(_ calendar: JTACMonthView, didSelectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath)
-
- /// Tells the delegate that a date-cell
- /// with a specified date was de-selected
- /// - Parameters:
- /// - calendar: The JTAppleCalendar view giving this information.
- /// - date: The date attached to the date-cell.
- /// - cell: The date-cell view. This can be customized at this point.
- /// This may be nil if the selected cell is off the screen
- /// - cellState: The month the date-cell belongs to.
- func calendar(_ calendar: JTACMonthView, didDeselectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath)
-
- /// Tells the delegate that the item at the specified index path was highlighted.
- /// - Parameters:
- /// - calendar: The JTAppleCalendar view giving this information.
- /// - date: The date attached to the date-cell.
- /// - cellState: The month the date-cell belongs to.
- func calendar(_ calendar: JTACMonthView, didHighlightDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath)
-
- /// Tells the delegate that the item at the specified index path was un-highlighted.
- /// - Parameters:
- /// - calendar: The JTAppleCalendar view giving this information.
- /// - date: The date attached to the date-cell.
- /// - cellState: The month the date-cell belongs to.
- func calendar(_ calendar: JTACMonthView, didUnhighlightDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath)
-
- /// Tells the delegate that the JTAppleCalendar view
- /// scrolled to a segment beginning and ending with a particular date
- /// - Parameters:
- /// - calendar: The JTAppleCalendar view giving this information.
- /// - startDate: The date at the start of the segment.
- /// - endDate: The date at the end of the segment.
- func calendar(_ calendar: JTACMonthView, didScrollToDateSegmentWith visibleDates: DateSegmentInfo)
-
- /// Tells the delegate that the JTAppleCalendar view
- /// will scroll to a segment beginning and ending with a particular date
- /// - Parameters:
- /// - calendar: The JTAppleCalendar view giving this information.
- /// - startDate: The date at the start of the segment.
- /// - endDate: The date at the end of the segment.
- func calendar(_ calendar: JTACMonthView, willScrollToDateSegmentWith visibleDates: DateSegmentInfo)
-
- /// Tells the delegate that the JTAppleCalendar is about to display
- /// a date-cell. This is the point of customization for your date cells
- /// - Parameters:
- /// - calendar: The JTAppleCalendar view giving this information.
- /// - date: The date attached to the cell.
- /// - cellState: The month the date-cell belongs to.
- /// - indexPath: use this value when dequeing cells
- func calendar(_ calendar: JTACMonthView, cellForItemAt date: Date, cellState: CellState, indexPath: IndexPath) -> JTACDayCell
-
- /// Tells the delegate that the JTAppleCalendar is about to
- /// display a header. This is the point of customization for your headers
- /// - Parameters:
- /// - calendar: The JTAppleCalendar view giving this information.
- /// - date: The date attached to the header.
- /// - indexPath: use this value when dequeing cells
- func calendar(_ calendar: JTACMonthView, headerViewForDateRange range: (start: Date, end: Date), at indexPath: IndexPath) -> JTACMonthReusableView
-
- /// Informs the delegate that the user just lifted their finger from swiping the calendar
- func scrollDidEndDecelerating(for calendar: JTACMonthView)
-
- /// Tells the delegate that a scroll occured
- func calendarDidScroll(_ calendar: JTACMonthView)
-
- /// Called to retrieve the size to be used for the month headers
- func calendarSizeForMonths(_ calendar: JTACMonthView?) -> MonthSize?
-
- /// Implement the function to configure calendar cells. The code that will go in here is the same
- /// that you will code for your cellForItem function. This function is only called to address
- /// inconsistencies in the visual appearance as stated by Apple: https://developer.apple.com/documentation/uikit/uicollectionview/1771771-prefetchingenabled
- /// a date-cell. This is the point of customization for your date cells
- /// - Parameters:
- /// - calendar: The JTAppleCalendar view giving this information.
- /// - cell: The cell
- /// - date: date attached to the cell
- /// - cellState: The month the date-cell belongs to.
- /// - indexPath: use this value when dequeing cells
- func calendar(_ calendar: JTACMonthView, willDisplay cell: JTACDayCell, forItemAt date: Date, cellState: CellState, indexPath: IndexPath)
-
- /// Called to retrieve the size to be used for decoration views
- func sizeOfDecorationView(indexPath: IndexPath) -> CGRect
-
- /// Called in case of tvOS
- func indexPathForPreferredFocusedView(in: UICollectionView) -> IndexPath?
-}
-
-/// Default delegate functions
-public extension JTACMonthViewDelegate {
- func calendar(_ calendar: JTACMonthView, shouldSelectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) -> Bool { return true }
- func calendar(_ calendar: JTACMonthView, shouldDeselectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) -> Bool { return true }
- func calendar(_ calendar: JTACMonthView, didSelectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) {}
- func calendar(_ calendar: JTACMonthView, didDeselectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) {}
- func calendar(_ calendar: JTACMonthView, didHighlightDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) {}
- func calendar(_ calendar: JTACMonthView, didUnhighlightDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) {}
- func calendar(_ calendar: JTACMonthView, willScrollToDateSegmentWith visibleDates: DateSegmentInfo) {}
- func calendar(_ calendar: JTACMonthView, didScrollToDateSegmentWith visibleDates: DateSegmentInfo) {}
- func calendar(_ calendar: JTACMonthView, headerViewForDateRange range: (start: Date, end: Date), at indexPath: IndexPath) -> JTACMonthReusableView {
- assert(false, "You have implemted a header size function, but forgot to implement the `headerViewForDateRange` function")
- return JTACMonthReusableView()
- }
- func calendarDidScroll(_ calendar: JTACMonthView) {}
- func calendarSizeForMonths(_ calendar: JTACMonthView?) -> MonthSize? { return nil }
- func sizeOfDecorationView(indexPath: IndexPath) -> CGRect { return .zero }
- func scrollDidEndDecelerating(for calendar: JTACMonthView) {}
- func indexPathForPreferredFocusedView(in: UICollectionView) -> IndexPath? { return nil }
-
-}
diff --git a/Sources/JTAppleCalendar/JTACScrollViewDelegates.swift b/Sources/JTAppleCalendar/JTACScrollViewDelegates.swift
deleted file mode 100644
index e044790f..00000000
--- a/Sources/JTAppleCalendar/JTACScrollViewDelegates.swift
+++ /dev/null
@@ -1,277 +0,0 @@
-//
-// JTACScrollViewDelegates.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-import UIKit
-
-extension JTACMonthView: UIScrollViewDelegate {
- /// Inform the scrollViewDidEndDecelerating
- /// function that scrolling just occurred
- public func scrollViewDidScrollToTop(_ scrollView: UIScrollView) {
- scrollViewDidEndDecelerating(self)
- }
-
- /// Tells the delegate when the user finishes scrolling the content.
- open func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer) {
- guard let theCurrentSection = currentSection() else { return }
-
- let maxContentOffset: CGFloat
- var theCurrentContentOffset: CGFloat = 0,
- theTargetContentOffset: CGFloat = 0,
- directionVelocity: CGFloat = 0
- let calendarLayout = calendarViewLayout
- if scrollDirection == .horizontal {
- theCurrentContentOffset = scrollView.contentOffset.x
- theTargetContentOffset = targetContentOffset.pointee.x
- directionVelocity = velocity.x
- maxContentOffset = scrollView.contentSize.width - scrollView.frame.width
- } else {
- theCurrentContentOffset = scrollView.contentOffset.y
- theTargetContentOffset = targetContentOffset.pointee.y
- directionVelocity = velocity.y
- maxContentOffset = scrollView.contentSize.height - scrollView.frame.height
- }
-
- let gestureTranslation = self.panGestureRecognizer.translation(in: self)
- let translation = self.scrollDirection == .horizontal ? gestureTranslation.x : gestureTranslation.y
-
-
-
- let setTargetContentOffset = {(finalOffset: CGFloat) -> Void in
- if self.scrollDirection == .horizontal {
- targetContentOffset.pointee.x = finalOffset
- } else {
- targetContentOffset.pointee.y = finalOffset
- }
- self.endScrollTargetLocation = finalOffset
- }
-
- if directionVelocity == 0.0 {
- decelerationRate = .fast
- }
-
- if theCurrentContentOffset >= maxContentOffset { setTargetContentOffset(maxContentOffset) ; return }
- if theCurrentContentOffset <= 0 { setTargetContentOffset(0); return }
-
- switch scrollingMode {
- case .stopAtEachCalendarFrame:
- let interval = scrollDirection == .horizontal ? scrollView.frame.width : scrollView.frame.height
- let offset = scrollDecision(currentScrollDirectionValue: translation,
- previousScrollDirectionValue: lastMovedScrollDirection,
- forward: { () -> CGFloat in return ceil(theCurrentContentOffset / interval) * interval },
- backward: { () -> CGFloat in return floor(theCurrentContentOffset / interval) * interval})
- setTargetContentOffset(offset)
-
- case let .stopAtEach(customInterval: interval):
- let offset = scrollDecision(currentScrollDirectionValue: translation,
- previousScrollDirectionValue: lastMovedScrollDirection,
- forward: { return ceil(theCurrentContentOffset / interval) * interval },
- backward: { return floor(theCurrentContentOffset / interval) * interval})
- setTargetContentOffset(offset)
- case .stopAtEachSection:
- let section = scrollDecision(currentScrollDirectionValue: translation,
- previousScrollDirectionValue: lastMovedScrollDirection,
- forward: { return theCurrentSection},
- backward: { return theCurrentSection - 1},
- fixed: { return theCurrentSection})
-
- guard section >= 0, section < calendarLayout.endOfSectionOffsets.count else {setTargetContentOffset(0); return}
- let endOfCurrentSectionOffset = calendarLayout.endOfSectionOffsets[theCurrentSection]
- let endOfPreviousSectionOffset = calendarLayout.endOfSectionOffsets[theCurrentSection - 1 < 0 ? 0 : theCurrentSection - 1]
- let midPoint = (endOfCurrentSectionOffset + endOfPreviousSectionOffset) / 2
- let maxSnap = calendarLayout.endOfSectionOffsets[section]
-
- let userPercentage: CGFloat = 20
- let modifiedPercentage = CGFloat((100 - userPercentage) / 100.0)
-
- let snapForward = midPoint - ((maxSnap - midPoint) * modifiedPercentage)
-
- scrollDecision(currentScrollDirectionValue: translation,
- previousScrollDirectionValue: lastMovedScrollDirection,
- forward: {
- if theCurrentContentOffset >= snapForward || directionVelocity > 0 {
- setTargetContentOffset(endOfCurrentSectionOffset)
- } else {
- setTargetContentOffset(endOfPreviousSectionOffset)
- }
- },
- backward: {
- if theCurrentContentOffset <= snapForward || directionVelocity < 0 {
- setTargetContentOffset(endOfPreviousSectionOffset)
- } else {
- setTargetContentOffset(endOfCurrentSectionOffset)
- }
- })
- case let .nonStopToCell(withResistance: resistance), let .nonStopToSection(withResistance: resistance):
-
- let (recalculatedOffset, elementProperties) = rectAfterApplying(resistance: resistance,
- targetContentOffset: theTargetContentOffset,
- currentContentOffset: theCurrentContentOffset,
- currentScrollDirectionValue: translation,
- previousScrollDirectionValue: lastMovedScrollDirection)
-
- guard let validElementProperties = elementProperties else { setTargetContentOffset(recalculatedOffset); return }
-
- switch scrollingMode {
- case .nonStopToCell:
- let midPoint = scrollDirection == .horizontal ? (validElementProperties.xOffset + (validElementProperties.xOffset + validElementProperties.width)) / 2 : (validElementProperties.yOffset + ( validElementProperties.yOffset + validElementProperties.height)) / 2
- let calculatedOffSet: CGFloat
- if recalculatedOffset > midPoint || theTargetContentOffset >= maxContentOffset {
- calculatedOffSet = self.scrollDirection == .horizontal ? validElementProperties.xOffset + validElementProperties.width : validElementProperties.yOffset + validElementProperties.height
- } else {
- calculatedOffSet = self.scrollDirection == .horizontal ? validElementProperties.xOffset : validElementProperties.yOffset
- }
- setTargetContentOffset(calculatedOffSet)
- case .nonStopToSection:
- let stopSection = scrollDecision(currentScrollDirectionValue: translation,
- previousScrollDirectionValue: lastMovedScrollDirection,
- forward: { validElementProperties.section },
- backward: {validElementProperties.section - 1})
-
- let calculatedOffSet = (stopSection < 0 || stopSection > calendarLayout.endOfSectionOffsets.count - 1) ? 0 : calendarLayout.endOfSectionOffsets[stopSection]
- setTargetContentOffset(calculatedOffSet)
- default: return
- }
-
- case let .nonStopTo(interval, resistance):
- let diffResist = diffResistance(targetOffset: theTargetContentOffset, currentOffset: theCurrentContentOffset, resistance: resistance)
- let recalculatedOffsetAfterResistance = scrollDecision(currentScrollDirectionValue: translation,
- previousScrollDirectionValue: lastMovedScrollDirection,
- forward: { theTargetContentOffset - diffResist },
- backward: { theTargetContentOffset + diffResist })
-
- let offset = scrollDecision(currentScrollDirectionValue: translation,
- previousScrollDirectionValue: lastMovedScrollDirection,
- forward: { ceil(recalculatedOffsetAfterResistance / interval) * interval },
- backward: { floor(recalculatedOffsetAfterResistance / interval) * interval })
-
- setTargetContentOffset(offset)
- case .none: break
- }
-
- let futureScrollPoint = CGPoint(x: targetContentOffset.pointee.x, y: targetContentOffset.pointee.y)
- let dateSegmentInfo = datesAtCurrentOffset(futureScrollPoint)
- calendarDelegate?.calendar(self, willScrollToDateSegmentWith: dateSegmentInfo)
-
- self.lastMovedScrollDirection = translation
-
- DispatchQueue.main.asyncAfter(deadline: .now() + 0.7) {
- self.decelerationRate = UIScrollView.DecelerationRate(rawValue: self.decelerationRateMatchingScrollingMode)
- }
- }
-
- public func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
- if decelerate {
- DispatchQueue.main.async {
- self.calendarDelegate?.scrollDidEndDecelerating(for: self)
- }
- }
- }
-
- /// Tells the delegate when a scrolling
- /// animation in the scroll view concludes.
- public func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView) {
- isScrollInProgress = false
- if
- let shouldTrigger = triggerScrollToDateDelegate,
- shouldTrigger == true {
- scrollViewDidEndDecelerating(scrollView)
- triggerScrollToDateDelegate = nil
- }
-
- DispatchQueue.main.async { // https://github.com/patchthecode/JTAppleCalendar/issues/778
- self.executeDelayedTasks(.scroll)
- }
- }
-
- /// Tells the delegate that the scroll view has
- /// ended decelerating the scrolling movement.
- open func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
- visibleDates {[unowned self] dates in
- self.calendarDelegate?.calendar(self, didScrollToDateSegmentWith: dates)
- }
- }
-
- /// Tells the delegate that a scroll occured
- public func scrollViewDidScroll(_ scrollView: UIScrollView) {
- calendarDelegate?.calendarDidScroll(self)
- }
-
- func rectAfterApplying(resistance: CGFloat,
- targetContentOffset: CGFloat,
- currentContentOffset: CGFloat,
- currentScrollDirectionValue: CGFloat,
- previousScrollDirectionValue: CGFloat) -> (recalculatedOffset: CGFloat, elementProperty: (item: Int, section: Int, xOffset: CGFloat, yOffset: CGFloat, width: CGFloat, height: CGFloat)?) {
-
- let diffResist = diffResistance(targetOffset: targetContentOffset, currentOffset: currentContentOffset, resistance: resistance)
- let recalcOffsetAfterResistanceApplied = scrollDecision(currentScrollDirectionValue: currentScrollDirectionValue,
- previousScrollDirectionValue: previousScrollDirectionValue,
- forward: { () -> CGFloat in return targetContentOffset - diffResist },
- backward: { () -> CGFloat in return targetContentOffset + diffResist })
-
- let element: UICollectionViewLayoutAttributes?
- let rect: CGRect
- if scrollDirection == .horizontal {
- rect = CGRect(x: recalcOffsetAfterResistanceApplied + 1, y: contentOffset.y + 1, width: 10, height: frame.height - 2)
- element = calendarViewLayout.elementsAtRect(excludeHeaders: true, from: rect).sorted { $0.indexPath < $1.indexPath }.first
- } else {
- rect = CGRect(x: contentOffset.x + 1, y: recalcOffsetAfterResistanceApplied + 1, width: frame.width - 2, height: 10)
- element = calendarViewLayout.elementsAtRect(from: rect).sorted { $0.indexPath < $1.indexPath }.first
- }
-
- guard let validElement = element else { return (recalcOffsetAfterResistanceApplied, nil) }
- let elementProperties: (item: Int, section: Int, xOffset: CGFloat, yOffset: CGFloat, width: CGFloat, height: CGFloat)?
-
- if validElement.representedElementKind == UICollectionView.elementKindSectionHeader {
- elementProperties = calendarViewLayout.headerCache[validElement.indexPath.section]
- } else {
- elementProperties = calendarViewLayout.cachedValue(for: validElement.indexPath.item, section: validElement.indexPath.section)
- }
-
- return (recalcOffsetAfterResistanceApplied, elementProperties)
- }
-
- func diffResistance(targetOffset: CGFloat, currentOffset: CGFloat, resistance: CGFloat) -> CGFloat {
- let difference = abs(targetOffset - currentOffset)
- return difference * resistance
- }
-
- func scrollDecision(currentScrollDirectionValue: CGFloat,
- previousScrollDirectionValue: CGFloat,
- forward: ()->T,
- backward: ()->T,
- fixed: (()->T)? = nil) -> T {
- if currentScrollDirectionValue < 0 {
- return forward()
- } else if currentScrollDirectionValue > 0 {
- return backward()
- } else if previousScrollDirectionValue < 0 {
- return forward()
- } else if previousScrollDirectionValue > 0 {
- return backward()
- } else {
- guard let fixed = fixed else { return forward() }
- return fixed()
- }
- }
-}
diff --git a/Sources/JTAppleCalendar/JTACVariables.swift b/Sources/JTAppleCalendar/JTACVariables.swift
deleted file mode 100644
index 2ecc4683..00000000
--- a/Sources/JTAppleCalendar/JTACVariables.swift
+++ /dev/null
@@ -1,124 +0,0 @@
-//
-// JTACVariables.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-import Foundation
-import UIKit
-
-// Calculated Variables
-extension JTACMonthView {
- /// Workaround for Xcode bug that prevents you from connecting the delegate in the storyboard.
- /// Remove this extra property once Xcode gets fixed.
- @IBOutlet public var ibCalendarDelegate: AnyObject? {
- get { return calendarDelegate as AnyObject? }
- set {
- if (newValue != nil) {
- assert(newValue as? JTACMonthViewDelegate != nil, "Error, your delegate is not of type JTACMonthViewDelegate.")
- }
- calendarDelegate = newValue as? JTACMonthViewDelegate
- }
- }
-
- /// Workaround for Xcode bug that prevents you from connecting the delegate in the storyboard.
- /// Remove this extra property once Xcode gets fixed.
- @IBOutlet public var ibCalendarDataSource: AnyObject? {
- get { return calendarDataSource as AnyObject? }
- set {
- if (newValue != nil) {
- assert(newValue as? JTACMonthViewDataSource != nil, "Error, your dataSource is not of type JTACMonthViewDataSource.")
- }
- calendarDataSource = newValue as? JTACMonthViewDataSource
- }
- }
-
- @available(*, unavailable)
- /// Will not be used by subclasses
- open override var delegate: UICollectionViewDelegate? {
- get { return super.delegate }
- set { /* Do nothing */ }
- }
-
- @available(*, unavailable)
- /// Will not be used by subclasses
- open override var dataSource: UICollectionViewDataSource? {
- get { return super.dataSource }
- set {/* Do nothing */ }
- }
-
- /// Returns all selected dates
- public var selectedDates: [Date] {
- return selectedDatesSet.sorted()
- }
-
- var selectedDatesSet: Set {
- return Set(selectedCellData.values.map { $0.date })
- }
-
- var monthInfo: [Month] {
- get { return theData.months }
- set { theData.months = newValue }
- }
-
- var numberOfMonths: Int {
- return monthInfo.count
- }
-
- var totalDays: Int {
- return theData.totalDays
- }
-
- var calendarViewLayout: JTACMonthLayout {
- guard let layout = collectionViewLayout as? JTACMonthLayout else {
- developerError(string: "Calendar layout is not of type JTAppleCalendarMonthLayout.")
- return JTACMonthLayout(withDelegate: self)
- }
- return layout
- }
-
- var functionIsUnsafeSafeToRun: Bool {
- return !calendarLayoutIsLoaded || isScrollInProgress || isReloadDataInProgress
- }
-
- var calendarLayoutIsLoaded: Bool { return calendarViewLayout.isCalendarLayoutLoaded }
- var startDateCache: Date {
- guard let date = _cachedConfiguration?.startDate else {
- assert(false, "Attemped to access startDate when Datasource/delegate is not set yet. Returning todays's date")
- return Date()
- }
- return date
- }
- var endDateCache: Date {
- guard let date = _cachedConfiguration?.endDate else {
- assert(false, "Attemped to access endDate when Datasource/delegate is not set yet. Returning todays's date")
- return Date()
- }
- return date
- }
- var calendar: Calendar {
- guard let calendar = _cachedConfiguration?.calendar else {
- assert(false, "Attemped to access calendar when Datasource/delegate is not set yet. Returning default value")
- return Calendar.current
- }
- return calendar
- }
-}
diff --git a/Sources/JTAppleCalendar/JTACYearView.swift b/Sources/JTAppleCalendar/JTACYearView.swift
deleted file mode 100644
index 1181e620..00000000
--- a/Sources/JTAppleCalendar/JTACYearView.swift
+++ /dev/null
@@ -1,75 +0,0 @@
-//
-// JTAppleCalendarYearView.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-import Foundation
-import UIKit
-
-open class JTACYearView: UICollectionView {
- var configurationParameters = ConfigurationParameters(startDate: Date(), endDate: Date())
- var monthData: [Any] = []
-
-
- /// The object that acts as the delegate of the calendar year view.
- weak open var calendarDelegate: JTACYearViewDelegate?
- weak open var calendarDataSource: JTACYearViewDataSource? {
- didSet { setupYearViewCalendar() }
- }
-
- /// Workaround for Xcode bug that prevents you from connecting the delegate in the storyboard.
- /// Remove this extra property once Xcode gets fixed.
- @IBOutlet public var ibCalendarDelegate: AnyObject? {
- get { return calendarDelegate }
- set { calendarDelegate = newValue as? JTACYearViewDelegate }
- }
-
- /// Workaround for Xcode bug that prevents you from connecting the delegate in the storyboard.
- /// Remove this extra property once Xcode gets fixed.
- @IBOutlet public var ibCalendarDataSource: AnyObject? {
- get { return calendarDataSource }
- set { calendarDataSource = newValue as? JTACYearViewDataSource }
- }
-
- open func dataSourcefrom(configurationParameters: ConfigurationParameters) -> [Any] {
- return JTAppleDateConfigGenerator.shared.setupMonthInfoDataForStartAndEndDate(configurationParameters).months
- }
-
- func setupYearViewCalendar() {
- guard let validConfig = calendarDataSource?.configureCalendar(self) else {
- print("Invalid datasource")
- return;
- }
-
- configurationParameters = validConfig.configurationParameters
- monthData = validConfig.months
- dataSource = self
- delegate = self
- }
-
-}
-
-extension JTACYearView: JTACCellMonthViewDelegate {
- public func monthView(_ monthView: JTACCellMonthView, drawingFor segmentRect: CGRect, with date: Date, dateOwner: DateOwner, monthIndex: Int) {
- calendarDelegate?.calendar(self, monthView: monthView, drawingFor: segmentRect, with: date, dateOwner: dateOwner, monthIndex: monthIndex)
- }
-}
diff --git a/Sources/JTAppleCalendar/JTACYearViewProtocols.swift b/Sources/JTAppleCalendar/JTACYearViewProtocols.swift
deleted file mode 100644
index 15a41b9a..00000000
--- a/Sources/JTAppleCalendar/JTACYearViewProtocols.swift
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// JTACYearViewProtocols.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-import Foundation
-import UIKit
-
-public protocol JTACYearViewDelegate: AnyObject {
- func calendar(_ calendar: JTACYearView, cellFor item: Any, at date: Date, indexPath: IndexPath) -> JTACMonthCell
- func calendar(_ calendar: JTACYearView,
- monthView: JTACCellMonthView,
- drawingFor segmentRect: CGRect,
- with date: Date,
- dateOwner: DateOwner,
- monthIndex index: Int)
- func calendar(_ calendar: JTACYearView, sizeFor item: Any) -> CGSize
-}
-
-extension JTACYearViewDelegate {
- func calendar(_ calendar: JTACYearView,
- monthView: JTACCellMonthView,
- drawingFor segmentRect: CGRect,
- with date: Date,
- dateOwner: DateOwner,
- monthIndex index: Int){}
- func calendar(_ calendar: JTACYearView, sizeFor item: Any) -> CGSize { return .zero }
-}
-
-public protocol JTACYearViewDataSource: AnyObject {
- func configureCalendar(_ calendar: JTACYearView) -> (configurationParameters: ConfigurationParameters, months: [Any])
-}
-
diff --git a/Sources/JTAppleCalendar/JTAppleCalendar.h b/Sources/JTAppleCalendar/JTAppleCalendar.h
deleted file mode 100644
index 8f1acc15..00000000
--- a/Sources/JTAppleCalendar/JTAppleCalendar.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// JTACMonthView.swift
-//
-// Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#import
-
-//! Project version number for JTAppleCalendar.
-FOUNDATION_EXPORT double JTAppleCalendarVersionNumber;
-
-//! Project version string for JTAppleCalendar.
-FOUNDATION_EXPORT const unsigned char JTAppleCalendarVersionString[];
-
-// In this header, you should import all the public headers of your framework using statements like #import
-
-
diff --git a/Sources/JTAppleCalendar/PrivacyInfo.xcprivacy b/Sources/JTAppleCalendar/PrivacyInfo.xcprivacy
deleted file mode 100644
index 987771fa..00000000
--- a/Sources/JTAppleCalendar/PrivacyInfo.xcprivacy
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
- NSPrivacyTrackingDomains
-
- NSPrivacyCollectedDataTypes
-
- NSPrivacyAccessedAPITypes
-
- NSPrivacyTracking
-
-
-
diff --git a/Tests/JTAppleCalendarTests/JTAppleCalendarTests.swift b/Tests/JTAppleCalendarTests/JTAppleCalendarTests.swift
deleted file mode 100644
index f1b8d77c..00000000
--- a/Tests/JTAppleCalendarTests/JTAppleCalendarTests.swift
+++ /dev/null
@@ -1,15 +0,0 @@
-import XCTest
-@testable import JTAppleCalendar
-
-final class JTAppleCalendarTests: XCTestCase {
- func testExample() {
- // This is an example of a functional test case.
- // Use XCTAssert and related functions to verify your tests produce the correct
- // results.
-// XCTAssertEqual(JTAppleCalendar().text, "Hello, World!")
- }
-
- static var allTests = [
- ("testExample", testExample),
- ]
-}
diff --git a/Tests/JTAppleCalendarTests/XCTestManifests.swift b/Tests/JTAppleCalendarTests/XCTestManifests.swift
deleted file mode 100644
index 6723652e..00000000
--- a/Tests/JTAppleCalendarTests/XCTestManifests.swift
+++ /dev/null
@@ -1,9 +0,0 @@
-import XCTest
-
-#if !canImport(ObjectiveC)
-public func allTests() -> [XCTestCaseEntry] {
- return [
- testCase(JTAppleCalendarTests.allTests),
- ]
-}
-#endif
diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift
deleted file mode 100644
index 2126e573..00000000
--- a/Tests/LinuxMain.swift
+++ /dev/null
@@ -1,7 +0,0 @@
-import XCTest
-
-import JTAppleCalendarTests
-
-var tests = [XCTestCaseEntry]()
-tests += JTAppleCalendarTests.allTests()
-XCTMain(tests)
diff --git a/Tutorial.md b/Tutorial.md
new file mode 100644
index 00000000..a76b6754
--- /dev/null
+++ b/Tutorial.md
@@ -0,0 +1,258 @@
+---
+layout: recipe
+title: Tutorial
+---
+
+
+###Quick tutorial - How to setup the calendar
+**Note**: If at any point in this tutorial, you believe that you have already grasped the concept, then you can drop out at any time 👍
+
+________________
+
+JTAppleCalendar is similar to setting up a UITableView with a custom cell.
+
+
+
+
+
+There are two parts: The `cell`, and the `calendarView`
+##### 1. The cell
+---
+Like a UITableView, the cell has 2 sub-parts.
+
+* First let's create a new xib file. I'll call mine *CellView.xib*. I will setup the bare minimum; a single `UILabel` to show the date. It will be centered with Autolayout constraints.
+
+> Do you need more views setup on your cell like: event-dots, animated selection view, custom images etc? No problem. Design the cell however you want. This repository has sample code which demonstrates how you can do this easily. Cells can also be created via classes instead of XIBs.
+
+
+
+
+
+
+* Second , create a custom class for the xib. The new class must be a subclass of `JTAppleDayCellView`. I called mine *CellView.swift*. Inside the class setup the following:
+
+```swift
+ import JTAppleCalendar
+ class CellView: JTAppleDayCellView {
+ @IBOutlet var dayLabel: UILabel!
+ }
+```
+
+* Finally head back to your *cellView.xib* file and make the outlet connections.
+- First, select the root-view for the cell
+- Second, click on the identity inspector
+- Third, change the name of the class to one you just created: *CellView*
+- Then connect your UILabel to your `dayLabel` outlet
+
+
+
+
+##### 2. The calendarView
+---
+* This step is easy. Go to your Storyboard and add a `UIView` to it.
+Then, using the same procedure like you did above for the `CellView.xib` diagram above, Set the subclass of this UIView to be `JTAppleCalendarView`. Then setup an outlet for it to your viewController. I called my outlet `calendarView`.
+
+```swift
+class ViewController: UIViewController {
+ @IBOutlet weak var calendarView: JTAppleCalendarView!
+.....
+.....
+```
+
+You can also setup your autolayout constrainst for the calendar view at this point.
+
+
+##### Whats next?
+Similar to UITableView protocols, your viewController has to conform to 2 protocols for it to work
+
+* JTAppleCalendarViewDataSource
+* JTAppleCalendarViewDelegate
+
+
+##### Setting up the DataSource
+The data-source method is manditory.
+Let's set this up now on your viewController. I have called my viewController simply `ViewController`.
+
+I prefer setting up my protocols on my controllers using extensions to keep my code neat, but you can put it where ever youre accustomed to.
+
+The data-source protocol has only one function which needs to return a value of type `ConfigurationParameters`. This value requires 7 sub-values.
+
+- Start boundary date: date calendar will start from
+- End boundary date: date calendar will end
+- The number of rows per month you want displayed
+- A Calendar() instance which you should configure to your desired time zone. Please configure this properly.
+- Generate in dates
+- Generate out dates
+- First day of week.
+
+Paste the following code in your project.
+
+```swift
+extension ViewController: JTAppleCalendarViewDataSource, JTAppleCalendarViewDelegate {
+ func configureCalendar(_ calendar: JTAppleCalendarView) -> ConfigurationParameters {
+ let formatter = DateFormatter()
+ formatter.dateFormat = "yyyy MM dd"
+
+ let startDate = formatter.date(from: "2016 02 01")! // You can use date generated from a formatter
+ let endDate = Date() // You can also use dates created from this function
+ let calendar = Calendar.current // Make sure you set this up to your time zone. We'll just use default here
+
+ let parameters = ConfigurationParameters(startDate: startDate,
+ endDate: endDate,
+ numberOfRows: 6,
+ calendar: calendar,
+ generateInDates: true,
+ generateOutDates: .tillEndOfGrid,
+ firstDayOfWeek: .sunday)
+ return parameters
+ }
+```
+
+The parameters should be self explainatory. The only ones that might be unfamiliar to you are: `in-dates` and `out-dates`. The following diagram will bring you up to speed.
+
+
+
+In-dates can be turned off/on. Out-dates can be generated either till the end of a row, till the end of the 6x7 grid, or off.
+
+
+
+Now that JTAppleCalendar knows its configuration properties, it is ready to start displaying dateCells. Let's setup up the delegate protocol method to allow us to see the beautiful date cells we have designed earlier.
+
+Add the following code to your extension.
+
+```swift
+ func calendar(_ calendar: JTAppleCalendarView, willDisplayCell cell: JTAppleDayCellView, date: Date, cellState: CellState) {
+ (cell as? CellView)?.setupCellBeforeDisplay(cellState, date: date)
+ }
+```
+
+The `setupCellBeforeDisplay:date:` function has not yet been created on your custom CellView class as yet, so let's head over to that class and implement it.
+
+> Note: the code from here on is yours. You do not have to call the function this name. You don't even have to put this code in your `cellView` class. This is just a tutorial. Put the code where makes sense for your project.
+
+Modify your code in the CellView class to reflect the following.
+
+```swift
+ import JTAppleCalendar
+
+ class CellView: JTAppleDayCellView {
+ @IBOutlet var dayLabel: UILabel!
+ var thisMonthColor = UIColor.black
+ var otherMonthColor = UIColor.gray
+
+
+ func setupCellBeforeDisplay(_ cellState: CellState, date: NSDate) {
+ // Setup Cell text
+ dayLabel.text = cellState.text
+
+ // Setup text color
+ configureTextColor(cellState)
+ }
+
+ func configureTextColor(_ cellState: CellState) {
+ if cellState.dateBelongsTo == .thisMonth {
+ dayLabel.textColor = thisMonthColor
+ } else {
+ dayLabel.textColor = otherMonthColor
+ }
+ }
+ }
+```
+
+Your cell now has the ability to display text and color based on which month it belons to. One final thing needs to be done. The Calender does not have its `delegate` and `datasource` setup. Head to your `ViewController` class, and add following code:
+
+
+```swift
+ @IBOutlet weak var calendarView: JTAppleCalendarView! // Don't forget to hook up the outlet to your calendarView on Storyboard
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ calendarView.dataSource = self
+ calendarView.delegate = self
+ calendarView.registerCellViewXib(file: "CellView") // Registering your cell is manditory
+ }
+```
+
+#### Completed! Where to go from here?
+---
+
+Well if you followed this tutorial exactly, then your calendar should look like this.
+
+
+
+
+Pretty unimpressive... :/
+Since I am not that great of a designer yet, I will copy what one of the users of this framework has done with this calendar control [here](https://github.com/patchthecode/JTAppleCalendar/issues/2). Click on that link and scroll down till you see the purple calendar. That's the one we'll attempt to make.
+
+#### Setting up the color
+___
+Let's cheat a bit. Paste this code anywhere in your project. I'll put it in the CellView.swift file.
+
+```swift
+// Paste the code outside of the CellView class
+class CellView: JTAppleDayCellView {
+...
+...
+}
+
+extension UIColor {
+ convenience init(colorWithHexValue value: Int, alpha:CGFloat = 1.0){
+ self.init(
+ red: CGFloat((value & 0xFF0000) >> 16) / 255.0,
+ green: CGFloat((value & 0x00FF00) >> 8) / 255.0,
+ blue: CGFloat(value & 0x0000FF) / 255.0,
+ alpha: alpha
+ )
+ }
+}
+```
+This code allows us to create UIColors from Hex codes.
+
+Head over to your CellView.xib and change the root cell view background color to: #3A284C on interface builder. This is a dark color, so head over to the CellView.swift file you created earlier and change this line
+
+```var normalDayColor = UIColor.black```
+
+to this line
+
+```var normalDayColor = UIColor(colorWithHexValue: 0xECEAED)```
+
+ to brighten it up a bit. And change this line
+
+ ```var weekendDayColor = UIColor.gray```
+
+ to this
+
+ ```var weekendDayColor = UIColor(colorWithHexValue: 0x574865)```.
+
+> Note: This is not the most efficient code. You do not want to be creating a new UIColor instance every time right? Cache this where necessary.
+
+Your calendar will now look like this:
+
+
+
+
+Lets get rid of the white spaces. By default, the calendar has a cell inset of 3,3. I may change this to 0,0 if enough of you complain. Head to your ViewController.swift file and add this line of code in your viewDidLoad()
+
+```swift
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ self.calendarView.dataSource = self
+ self.calendarView.delegate = self
+ calendarView.registerCellViewXib(file: "CellView") // Registering your cell is manditory
+
+ // Add this new line
+ calendarView.cellInset = CGPoint(x: 0, y: 0) // default is (3,3)
+ }
+
+```
+Your calendar will now look like this:
+
+
+
+
+Tutorial over.
+
+Create all the other views on your xib that you need. Event-dots view, customWhatEverView etc. After designing the views on your xib, go create the functionality for it just like you did in the example above; where you created a `UILabel` and added the functionality for it.
+
+If you're really out of ideas, using the same procedure above, why not try to create a background circular shaped SelectedView to appear when ever you tap on a date cell? You can also download the example project on Github and see the possibilities.
+
+Or [Head back to main screen](http://patchthecode.github.io/JTAppleCalendar/) to see other ways to configure your calendar.
\ No newline at end of file
diff --git a/_config.yml b/_config.yml
new file mode 100644
index 00000000..8f84b8ac
--- /dev/null
+++ b/_config.yml
@@ -0,0 +1,29 @@
+# Welcome to Jekyll!
+#
+# This config file is meant for settings that affect your whole blog, values
+# which you are expected to set up once and rarely edit after that. If you find
+# yourself editing these this file very often, consider using Jekyll's data files
+# feature for the data you need to update frequently.
+#
+# For technical reasons, this file is *NOT* reloaded automatically when you use
+# 'jekyll serve'. If you change this file, please restart the server process.
+
+# Site settings
+# These are used to personalize your new site. If you look in the HTML files,
+# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
+# You can create any custom variable you would like, and they will be accessible
+# in the templates via {{ site.myvariable }}.
+title: JTAppleCalendar
+email: patchTheCode@gmail.com
+description: > # this means to ignore newlines until "baseurl:"
+ Write an awesome description for your new site here. You can edit this
+ line in _config.yml. It will appear in your document head meta (for
+ Google search results) and in your feed.xml site description.
+baseurl: "" # the subpath of your site, e.g. /blog
+url: "http://example.com" # the base hostname & protocol for your site
+twitter_username: jekyllrb
+github_username: patchTheCode
+
+# Build settings
+markdown: kramdown
+theme: minima
diff --git a/_includes/default.html b/_includes/default.html
new file mode 100644
index 00000000..e8c51fa3
--- /dev/null
+++ b/_includes/default.html
@@ -0,0 +1,7 @@
+{% include head.html %}
+
+ {{ page.title }}
+
+ {{ content }}
+
+{% include foot.html %}
\ No newline at end of file
diff --git a/_includes/foot.html b/_includes/foot.html
new file mode 100644
index 00000000..691287b6
--- /dev/null
+++ b/_includes/foot.html
@@ -0,0 +1,2 @@
+