[
  {
    "path": ".gitignore",
    "content": ".DS_Store\n/.build\n/Packages\n/*.xcodeproj\nxcuserdata/\n"
  },
  {
    "path": ".swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": ".swiftpm/xcode/xcshareddata/xcschemes/JBCalendarDatePicker.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1230\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"JBCalendarDatePicker_JBCalendarDatePicker\"\n               BuildableName = \"JBCalendarDatePicker_JBCalendarDatePicker\"\n               BlueprintName = \"JBCalendarDatePicker_JBCalendarDatePicker\"\n               ReferencedContainer = \"container:\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"JBCalendarDatePicker\"\n               BuildableName = \"JBCalendarDatePicker\"\n               BlueprintName = \"JBCalendarDatePicker\"\n               ReferencedContainer = \"container:\">\n            </BuildableReference>\n         </BuildActionEntry>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"NO\"\n            buildForArchiving = \"NO\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"JBCalendarDatePickerTests\"\n               BuildableName = \"JBCalendarDatePickerTests\"\n               BlueprintName = \"JBCalendarDatePickerTests\"\n               ReferencedContainer = \"container:\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\">\n      <Testables>\n         <TestableReference\n            skipped = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"JBCalendarDatePickerTests\"\n               BuildableName = \"JBCalendarDatePickerTests\"\n               BlueprintName = \"JBCalendarDatePickerTests\"\n               ReferencedContainer = \"container:\">\n            </BuildableReference>\n         </TestableReference>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"JBCalendarDatePicker_JBCalendarDatePicker\"\n            BuildableName = \"JBCalendarDatePicker_JBCalendarDatePicker\"\n            BlueprintName = \"JBCalendarDatePicker_JBCalendarDatePicker\"\n            ReferencedContainer = \"container:\">\n         </BuildableReference>\n      </MacroExpansion>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "JBCalendarDatePicker.podspec",
    "content": "Pod::Spec.new do |s|\n\n# 1\ns.platform = :ios\ns.ios.deployment_target = '13.0'\ns.name = \"JBCalendarDatePicker\"\ns.summary = \"A replacement for UIDatePicker made for Catalyst.\"\ns.requires_arc = true\n\n# 2\ns.version = \"0.2.3\"\n\n# 3\ns.license = { :type => \"MIT\", :file => \"LICENSE\" }\n\n# 4 - Replace with your name and e-mail address\ns.author = { \"Josh Birnholz\" => \"josh@birnholz.com\" }\n\n# 5 - Replace this URL with your own GitHub page's URL (from the address bar)\ns.homepage = \"https://github.com/joshbirnholz/JBCalendarDatePicker\"\n\n# 6 - Replace this URL with your own Git URL from \"Quick Setup\"\ns.source = { :git => \"https://github.com/joshbirnholz/JBCalendarDatePicker.git\",\n             :tag => \"#{s.version}\" }\n\n# 7\ns.framework = \"UIKit\"\n\n# 8\ns.source_files = \"JBCalendarDatePicker/**/*.{swift}\"\n\n# 9\ns.resources = \"JBCalendarDatePicker/**/*.{xib}\"\n\n# 10\ns.swift_version = \"5\"\n\nend\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2019 Joshua Birnholz\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE."
  },
  {
    "path": "Package.swift",
    "content": "// swift-tools-version:5.3\n// The swift-tools-version declares the minimum version of Swift required to build this package.\n\nimport PackageDescription\n\nlet package = Package(\n    name: \"JBCalendarDatePicker\",\n    platforms: [\n        .iOS(.v13),\n    ],\n    products: [\n        // Products define the executables and libraries a package produces, and make them visible to other packages.\n        .library(\n            name: \"JBCalendarDatePicker\",\n            targets: [\"JBCalendarDatePicker\"]),\n    ],\n    dependencies: [\n        // Dependencies declare other packages that this package depends on.\n        // .package(url: /* package url */, from: \"1.0.0\"),\n    ],\n    targets: [\n        // Targets are the basic building blocks of a package. A target can define a module or a test suite.\n        // Targets can depend on other targets in this package, and on products in packages this package depends on.\n        .target(\n            name: \"JBCalendarDatePicker\",\n            dependencies: [],\n            path: \"Sources\",\n            exclude: [\"Info.plist\"],\n            resources: [\n                .process(\"JBCalendarDatePicker/JBDatePickerViewController.xib\"),\n                .process(\"JBCalendarDatePicker/JBCalendarViewController.xib\"),\n                .process(\"JBCalendarDatePicker/JBCalendarDateCell.xib\"),\n            ]\n        ),\n        .testTarget(\n            name: \"JBCalendarDatePickerTests\",\n            dependencies: [\"JBCalendarDatePicker\"],\n            path: \"Tests\"\n        ),\n    ],\n    swiftLanguageVersions: [.v5]\n)\n"
  },
  {
    "path": "README.md",
    "content": "\n# JBCalendarDatePicker\nA replacement for UIDatePicker made for Catalyst.\n\nThis is still a work in progress, there are bugs, and although it's written to work with different calendar systems and locales, it's not guaranteed to work correctly with everything!\n\n![JBCalendarDatePicker](https://i.imgur.com/XusV7dx.gif)\n\n## Installation\n\nTo install as SPM, Go to:\n`Xcode -> File -> Swift Packages -> Add Package Dependency`\n\nThen enter this URL:\n`https://github.com/mohitnandwani/JBCalendarDatePicker.git`\n\nTo install, add the source to the top of your podfile:\n\n`source 'https://github.com/joshbirnholz/JBPodSpecs.git'`\n\nThen add this pod to your targets:\n\n`pod 'JBCalendarDatePicker'`\n\n## Use\n\nThere are two classes you can use: `JBDatePickerViewController` and `JBCalendarViewController`.\n\nThey are both similar to `UIDatePicker`, and their `date`, `minimumDate`, `maximumDate`, `calendar`, and `locale` properties can be configured in the same way. Configure them before presenting either of the view controllers.\n\n`JBDatePickerViewController` also has a `datePickerMode` property, although `UIDatePicker.Mode.countDownTimer` is not supported.\n\n### JBDatePickerViewController\n\n![JBDatePickerViewController](https://i.imgur.com/OtPr5V7.png)\n\n`JBDatePickerViewController` displays labels showing its represented date and allows the user to use the keyboard to enter a date. When the user clicks on the date portion, the view controller presents its own `JBCalendarViewController`. You can allow the user to select a date, time, or both, by setting the `datePickerMode` property.\n\n```Swift\nimport JBCalendarDatePicker\n\nclass ViewController: UIViewController {\n\n\tvar datePicker: JBDatePickerViewController!\n\t\n\toverride func viewDidLoad() {\n\t\tsuper.viewDidLoad()\n\t\t\n\t\tlet datePicker = JBDatePickerViewController()\n\t\tview.addSubview(datePicker.view)\n\t\taddChild(datePicker)\n\t\tdatePicker.didMove(toParent: self)\n\t\tself.datePicker = datePicker\n\n\t\t// Configure the datePicker's properties\n\t}\n}\n```\n\nOr use it from a storyboard. Drag a Container View onto your storyboard. Change the view controller's class to `JBDatePickerViewController`. Give the embed segue an identifier, and then capture a reference to it:\n\n```Swift\noverride func prepare(for segue: UIStoryboardSegue, sender: Any?) {\n\tif segue.identifier == \"Embed Date Picker\", let destination = segue.destination as? JBDatePickerViewController {\n\t\tself.datePicker = destination\n\t\t\n\t\t// Configure the datePicker's properties\n\t}\n}\n```\n\n### JBCalendarViewController\n\n![JBCalendarViewController](https://i.imgur.com/NV48jUk.png)\n\n`JBCalendarViewController` is just the calendar, without the labels.\n\nThe view controller tries to present itself as a popover automatically, so be sure to set the `popoverPresentationController`'s `barButtonItem` property or the `sourceView` and `sourceRect` properties.\n\n```Swift\n@IBOutlet func buttonPressed(_ sender: UIBarButtonItem) {\n\tlet calendarPicker = JBCalendarViewController()\n\tcalendarPicker.popoverPresentationController?.barButtonItem = sender\n\t\n\t// Configure the calendar's properties\n\t\n\tpresent(calendarPicker, animated: true, completion: nil)\n}\n```\nThere is also a `JBCalendarViewControllerDelegate` protocol.\n\n```Swift\npublic protocol JBCalendarViewControllerDelegate: class {\n\tfunc calendarViewControllerDateChanged(_ calendarViewController: JBCalendarViewController)\n\tfunc calendarViewControllerWillDismiss(_ calendarViewController: JBCalendarViewController)\n\tfunc calendarViewControllerDidDismiss(_ calendarViewController: JBCalendarViewController)\n}\n```\n"
  },
  {
    "path": "Sources/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>$(DEVELOPMENT_LANGUAGE)</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>$(MARKETING_VERSION)</string>\n\t<key>CFBundleVersion</key>\n\t<string>$(CURRENT_PROJECT_VERSION)</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Sources/JBCalendarDatePicker/CalendarDatePickerViewController.h",
    "content": "//\n//  CalendarDatePickerViewController.h\n//  CalendarDatePickerViewController\n//\n//  Created by Josh Birnholz on 28/10/2019.\n//  Copyright © 2019 Josh Birnholz. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\n//! Project version number for CalendarDatePickerViewController.\nFOUNDATION_EXPORT double CalendarDatePickerViewControllerVersionNumber;\n\n//! Project version string for CalendarDatePickerViewController.\nFOUNDATION_EXPORT const unsigned char CalendarDatePickerViewControllerVersionString[];\n\n// In this header, you should import all the public headers of your framework using statements like #import <CalendarDatePickerViewController/PublicHeader.h>\n\n\n"
  },
  {
    "path": "Sources/JBCalendarDatePicker/DateInputView.swift",
    "content": "//\n//  DateInputView.swift\n//  CalendarDatePickerViewController\n//\n//  Created by Josh Birnholz on 10/29/19.\n//  Copyright © 2019 Josh Birnholz. All rights reserved.\n//\n\n#if canImport(UIKit)\nimport UIKit\n\nprotocol DateInputViewDelegate: UIResponder, UIKeyInput {\n\t\n}\n\nclass DateInputView: UIView, UIKeyInput {\n\t\n\tweak var delegate: DateInputViewDelegate?\n\t\n\toverride func becomeFirstResponder() -> Bool {\n\t\tprint(type(of: self), #function)\n\t\tlet value = super.becomeFirstResponder()\n\t\tprint(type(of: self), \"is first responder: \\(self.isFirstResponder)\")\n\t\treturn value\n\t}\n\t\n\toverride func resignFirstResponder() -> Bool {\n\t\tprint(type(of: self), #function)\n\t\treturn delegate?.resignFirstResponder() ?? super.resignFirstResponder()\n\t}\n\t\n\toverride var canBecomeFirstResponder: Bool {\n\t\treturn true\n\t}\n\t\n\t// MARK: UIKeyInput\n\t\n\tvar hasText: Bool {\n\t\treturn delegate?.hasText ?? false\n\t}\n\t\n\tfunc insertText(_ text: String) {\n\t\tdelegate?.insertText(text)\n\t}\n\t\n\tfunc deleteBackward() {\n\t\tdelegate?.deleteBackward()\n\t}\n\t\n\t// MARK: UITextInputTraits\n\t\n\t// this doesn't seem to work for some reason.\n\tprivate var keyboardType: UIKeyboardType {\n\t\treturn .numberPad\n\t}\n\n}\n#endif\n"
  },
  {
    "path": "Sources/JBCalendarDatePicker/Day.swift",
    "content": "//\n//  Day.swift\n//  CalendarDatePickerViewController\n//\n//  Created by Josh Birnholz on 28/10/2019.\n//  Copyright © 2019 Josh Birnholz. All rights reserved.\n//\n\nimport Foundation\n\nstruct Day: Equatable, Hashable {\n\tvar calendar: Calendar\n\tvar day: Int\n\tvar month: Int\n\tvar year: Int\n\t\n\tvar date: Date {\n\t\tDateComponents(calendar: calendar, year: year, month: month, day: day).date!\n\t}\n\t\n\tvar isToday: Bool {\n\t\tlet todayComponents = calendar.dateComponents([.year, .month, .day], from: Date())\n\t\tvar components = DateComponents(calendar: calendar, year: year, month: month, day: day)\n\t\tlet date = calendar.date(from: components)!\n\t\tcomponents = calendar.dateComponents([.year, .month, .day], from: date)\n\t\treturn todayComponents.day == components.day && todayComponents.month == components.month && todayComponents.year == components.year\n\t}\n\t\n\tstatic func == (lhs: Day, rhs: Day) -> Bool {\n\t\tif lhs.day == rhs.day && lhs.month == rhs.month && lhs.year == rhs.year {\n\t\t\treturn true\n\t\t}\n\t\treturn lhs.date == rhs.date\n\t}\n}\n"
  },
  {
    "path": "Sources/JBCalendarDatePicker/JBCalendarDateCell.swift",
    "content": "//\n//  CalendarDateCollectionViewCell.swift\n//  CalendarDatePickerViewController\n//\n//  Created by Josh Birnholz on 28/10/2019.\n//  Copyright © 2019 Josh Birnholz. All rights reserved.\n//\n\n#if canImport(UIKit)\nimport UIKit\n\nclass JBCalendarDateCell: UICollectionViewCell {\n\t@IBOutlet weak var label: UILabel!\n}\n#endif\n"
  },
  {
    "path": "Sources/JBCalendarDatePicker/JBCalendarDateCell.xib",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.XIB\" version=\"3.0\" toolsVersion=\"15400\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" useTraitCollections=\"YES\" useSafeAreas=\"YES\" colorMatched=\"YES\">\n    <device id=\"retina6_1\" orientation=\"portrait\" appearance=\"light\"/>\n    <dependencies>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"15404\"/>\n        <capability name=\"Safe area layout guides\" minToolsVersion=\"9.0\"/>\n        <capability name=\"documents saved in the Xcode 8 format\" minToolsVersion=\"8.0\"/>\n    </dependencies>\n    <objects>\n        <placeholder placeholderIdentifier=\"IBFilesOwner\" id=\"-1\" userLabel=\"File's Owner\" customClass=\"JBCalendarDateCell\" customModule=\"CalendarDatePickerViewController\" customModuleProvider=\"target\"/>\n        <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"-2\" customClass=\"UIResponder\"/>\n        <view contentMode=\"scaleToFill\" id=\"iN0-l3-epB\" customClass=\"JBCalendarDateCell\" customModule=\"JBCalendarDatePicker\">\n            <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"414\" height=\"896\"/>\n            <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n            <subviews>\n                <label opaque=\"NO\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"31\" textAlignment=\"right\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"Ucl-T0-oTc\">\n                    <rect key=\"frame\" x=\"4\" y=\"48\" width=\"406\" height=\"810\"/>\n                    <fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"13\"/>\n                    <nil key=\"textColor\"/>\n                    <nil key=\"highlightedColor\"/>\n                </label>\n            </subviews>\n            <color key=\"backgroundColor\" red=\"1\" green=\"1\" blue=\"1\" alpha=\"1\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>\n            <constraints>\n                <constraint firstItem=\"Ucl-T0-oTc\" firstAttribute=\"leading\" secondItem=\"vUN-kp-3ea\" secondAttribute=\"leading\" constant=\"4\" id=\"Gb8-nW-Kyz\"/>\n                <constraint firstItem=\"vUN-kp-3ea\" firstAttribute=\"trailing\" secondItem=\"Ucl-T0-oTc\" secondAttribute=\"trailing\" constant=\"4\" id=\"aSb-bC-zIs\"/>\n                <constraint firstItem=\"vUN-kp-3ea\" firstAttribute=\"bottom\" secondItem=\"Ucl-T0-oTc\" secondAttribute=\"bottom\" constant=\"4\" id=\"gmd-5m-i2m\"/>\n                <constraint firstItem=\"Ucl-T0-oTc\" firstAttribute=\"top\" secondItem=\"vUN-kp-3ea\" secondAttribute=\"top\" constant=\"4\" id=\"xd2-do-aau\"/>\n            </constraints>\n            <freeformSimulatedSizeMetrics key=\"simulatedDestinationMetrics\"/>\n            <viewLayoutGuide key=\"safeArea\" id=\"vUN-kp-3ea\"/>\n            <connections>\n                <outlet property=\"label\" destination=\"Ucl-T0-oTc\" id=\"iXA-dA-E4K\"/>\n            </connections>\n            <point key=\"canvasLocation\" x=\"139\" y=\"118\"/>\n        </view>\n    </objects>\n</document>\n"
  },
  {
    "path": "Sources/JBCalendarDatePicker/JBCalendarDatePicker.h",
    "content": "//\n//  JBDatePicker.h\n//  JBDatePicker\n//\n//  Created by Josh Birnholz on 10/30/19.\n//  Copyright © 2019 Josh Birnholz. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\n//! Project version number for JBDatePicker.\nFOUNDATION_EXPORT double JBDatePickerVersionNumber;\n\n//! Project version string for JBDatePicker.\nFOUNDATION_EXPORT const unsigned char JBDatePickerVersionString[];\n\n// In this header, you should import all the public headers of your framework using statements like #import <JBDatePicker/PublicHeader.h>\n\n\n"
  },
  {
    "path": "Sources/JBCalendarDatePicker/JBCalendarViewController.swift",
    "content": "//\n//  CalendarDatePickerViewController.swift\n//  Calendar Picker\n//\n//  Created by Josh Birnholz on 10/27/19.\n//  Copyright © 2019 Josh Birnholz. All rights reserved.\n//\n\n#if canImport(UIKit)\nimport UIKit\n\n@objc public protocol JBCalendarViewControllerDelegate: class {\n\tfunc calendarViewControllerDateChanged(_ calendarViewController: JBCalendarViewController)\n\tfunc calendarViewControllerWillDismiss(_ calendarViewController: JBCalendarViewController)\n\tfunc calendarViewControllerDidDismiss(_ calendarViewController: JBCalendarViewController)\n}\n\npublic class JBCalendarViewController: UIViewController, JBDatePicker {\n\t\n\t@objc public weak var delegate: JBCalendarViewControllerDelegate?\n\n\t@IBOutlet private weak var monthLabel: UILabel!\n\t@IBOutlet private weak var collectionView: UICollectionView!\n\t\n\t@IBOutlet private var weekSymbolLabels: [UILabel]!\n\t\n\t/// This property always returns `UIDatePicker.Mode.date`. Setting this property to a new value does nothing. It is not possible to change the date picker mode of the calendar interface.\n\t@objc public var datePickerMode: UIDatePicker.Mode {\n\t\tget {\n\t\t\treturn .date\n\t\t}\n\t\tset {\n\t\t\t\n\t\t}\n\t}\n\t\n\t@objc public var calendar: Calendar! = Calendar.current {\n\t\tdidSet {\n\t\t\tif calendar == nil {\n\t\t\t\tcalendar = .current\n\t\t\t}\n\t\t\tupdateWeekLabels()\n\t\t}\n\t}\n\t\n\t@objc public var locale: Locale? = .current {\n\t\tdidSet {\n\t\t\tcalendar.locale = locale\n\t\t}\n\t}\n\t\n\t@objc public var date: Date = Date() {\n\t\tdidSet {\n\t\t\tswitch (minimumDate, maximumDate) {\n\t\t\tcase(let minimumDate?, let maximumDate?) where minimumDate < maximumDate :\n\t\t\t\tdate = min(max(date, minimumDate), maximumDate)\n\t\t\tcase (let minimumDate?, nil):\n\t\t\t\tdate = max(date, minimumDate)\n\t\t\tcase (nil, let maximumDate?):\n\t\t\t\tdate = min(date, maximumDate)\n\t\t\tdefault:\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t\n\t\t\tif current != nil {\n\t\t\t\tlet components = calendar.dateComponents([.month, .year], from: date)\n\t\t\t\t\n\t\t\t\tif  components.month! != current.month || components.year! != current.year {\n\t\t\t\t\t(current.month, current.year) = (components.month!, components.year!)\n\t\t\t\t} else {\n\t\t\t\t\tcollectionView?.reloadData()\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tdelegate?.calendarViewControllerDateChanged(self)\n\t\t}\n\t}\n\t\n\t@objc public var minimumDate: Date? {\n\t\tdidSet {\n\t\t\tcollectionView?.reloadData()\n\t\t}\n\t}\n\t@objc public var maximumDate: Date? {\n\t\tdidSet {\n\t\t\tcollectionView?.reloadData()\n\t\t}\n\t}\n\t\n\tprivate var usableMinimumDate: Date? {\n\t\tif let minimumDate = minimumDate {\n\t\t\tif let maximumDate = maximumDate {\n\t\t\t\tif minimumDate < maximumDate {\n\t\t\t\t\treturn minimumDate\n\t\t\t\t} else {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn minimumDate\n\t\t}\n\t\t\n\t\treturn nil\n\t}\n\t\n\tprivate var usableMaximumDate: Date? {\n\t\tif let maximumDate = maximumDate {\n\t\t\tif let minimumDate = minimumDate {\n\t\t\t\tif minimumDate < maximumDate {\n\t\t\t\t\treturn maximumDate\n\t\t\t\t} else {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn maximumDate\n\t\t}\n\t\t\n\t\treturn nil\n\t}\n\t\n\tprivate var selectedDay: Day {\n\t\tlet components = calendar.dateComponents([.day, .month, .year], from: date)\n\t\treturn Day(calendar: calendar, day: components.day!, month: components.month!, year: components.year!)\n\t}\n\t\n\tprivate struct Current {\n\t\tvar month: Int {\n\t\t\tdidSet {\n\t\t\t\tlet firstOfMonth = DateComponents(calendar: calendar, year: year, month: month, day: 1).date!\n\t\t\t\tlet range = calendar.range(of: .month, in: .year, for: firstOfMonth)!\n\t\t\t\tif month > range.last! {\n\t\t\t\t\tmonth = range.first!\n\t\t\t\t\tyear += 1\n\t\t\t\t} else if month < range.first! {\n\t\t\t\t\tmonth = range.last!\n\t\t\t\t\tyear -= 1\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tvar year: Int\n\t\t\n\t\tprivate let calendar: Calendar\n\n\t\tinit(calendar: Calendar, month: Int, year: Int) {\n\t\t\tself.calendar = calendar\n\t\t\tself.month = month\n\t\t\tself.year = year\n\t\t}\n\t\t\n\t\t\n\t}\n\t\n\tprivate var current: Current! {\n\t\tdidSet {\n\t\t\tupdateMonthLabel()\n\t\t\tupdateDays()\n\t\t\tcollectionView.reloadData()\n\t\t}\n\t}\n\t\n\tprivate var days: [Day] = []\n\t\n\tpublic required init?(coder: NSCoder) {\n\t\tsuper.init(nibName: \"JBCalendarViewController\", bundle: Bundle(for: Self.self))\n\t\tcommonInit()\n\t}\n\t\n\tpublic override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {\n\t\tsuper.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)\n\t\tcommonInit()\n\t}\n\t\n\tpublic init() {\n\t\tsuper.init(nibName: \"JBCalendarViewController\", bundle: Bundle(for: Self.self))\n\t\tcommonInit()\n\t}\n\t\n\tprivate func commonInit() {\n\t\tmodalPresentationStyle = .popover\n\t\tpopoverPresentationController?.delegate = self\n\t\tpreferredContentSize = CGSize(width: 200, height: 210)\n\t}\n\t\n\toverride public func viewDidLoad() {\n        super.viewDidLoad()\n\t\t\n\t\tcalendar.locale = self.locale\n\t\t\n\t\tcollectionView.delegate = self\n\t\tcollectionView.dataSource = self\n\t\tcollectionView.register(UINib(nibName: \"JBCalendarDateCell\", bundle: Bundle(for: Self.self)), forCellWithReuseIdentifier: \"DateCell\")\n\t\t\n\t\t#if targetEnvironment(macCatalyst)\n\t\tview.tintColor = .systemAccent\n\t\t#endif\n\t\t\n\t\tlet selectedComponents = calendar.dateComponents([.year, .month], from: date)\n\t\tcurrent = Current(calendar: calendar, month: selectedComponents.month!, year: selectedComponents.year!)\n\t\t\n\t\tlet pan = UIPanGestureRecognizer(target: self, action: #selector(didPan(toSelectCells:)))\n\t\tcollectionView.addGestureRecognizer(pan)\n\t\t\n\t\tlet prevLong = UILongPressGestureRecognizer(target: self, action: #selector(previousMonthButtonTouchDown(_:)))\n\t\tprevLong.minimumPressDuration = 0\n    \n\t}\n\t\n\tprivate func updateWeekLabels() {\n\t\tvar symbols = calendar.veryShortStandaloneWeekdaySymbols\n\t\tif (calendar.locale ?? .current).languageCode == \"en\" {\n\t\t\tsymbols = calendar.shortStandaloneWeekdaySymbols.map { String($0.prefix(2)) }\n\t\t}\n\t\tguard isViewLoaded else { return }\n\t\tfor (index, symbol) in symbols.enumerated() {\n\t\t\tweekSymbolLabels[index].text = symbol\n\t\t}\n\t}\n\t\n\tprivate func updateDays() {\n\t\tlet components = DateComponents(calendar: calendar, year: current.year, month: current.month)\n\t\tlet date = components.date!\n\t\t\n\t\tlet range = calendar.range(of: .day, in: .month, for: date)!\n\t\t\n\t\tdays = range.map { Day(calendar: calendar, day: $0, month: current.month, year: current.year) }\n\t\t\n\t\tlet startDate = calendar.dateInterval(of: .month, for: date)!.start\n\t\tlet weekday = calendar.component(.weekday, from: startDate)\n\t\t\n\t\tlet firstDay = days.first!\n\t\tfor i in 0 ..< weekday-1 {\n\t\t\tvar day = firstDay\n\t\t\tday.day -= i+1\n\t\t\tdays.insert(day, at: 0)\n\t\t}\n\t\t\n\t\tlet lastDay = days.last!\n\t\tlet count = calendar.weekdaySymbols.count * 6\n\t\tfor i in 0 ..< (count-days.count) {\n\t\t\tvar day = lastDay\n\t\t\tday.day += i+1\n\t\t\tdays.append(day)\n\t\t}\n\t}\n\t\n\tprivate func updateMonthLabel() {\n\t\tguard isViewLoaded else { return }\n\t\t\n\t\tlet formatter = DateFormatter()\n\t\tformatter.locale = calendar.locale\n\t\tformatter.setLocalizedDateFormatFromTemplate(\"MMM yyyy\")\n\t\tlet components = DateComponents(calendar: calendar, year: current.year, month: current.month)\n\t\tmonthLabel.text = formatter.string(from: components.date!)\n\t}\n\t\n\t@IBAction private func previousMonthButtonTouchUp(_ sender: Any) {\n\t\ttimer?.invalidate()\n\t\ttimer = nil\n\t}\n\t\n\t@IBAction private func selectedDayButtonPressed(_ sender: Any) {\n\t\tlet components = calendar.dateComponents([.month, .year], from: date)\n\t\tlet month = components.month!\n\t\tlet year = components.year!\n\t\tcurrent = Current(calendar: calendar, month: month, year: year)\n\t}\n\t\n\t@IBAction private func nextMonthButtonTouchUp(_ sender: Any) {\n\t\ttimer?.invalidate()\n\t\ttimer = nil\n\t}\n\t\n\t@IBAction private func previousMonthButtonTouchDown(_ sender: Any) {\n\t\tstartRepeatingTimer { [weak self] in\n\t\t\tself?.current.month -= 1\n\t\t}\n\t}\n\t\n\tprivate var timer: Timer?\n\tprivate func startRepeatingTimer(_ action: @escaping () -> Void) {\n\t\taction()\n\t\t\n\t\ttimer = Timer(fire: Date().addingTimeInterval(0.5), interval: 0.25, repeats: true) { timer in\n\t\t\taction()\n\t\t}\n\t\tRunLoop.main.add(timer!, forMode: .common)\n\t\t\n\t\tDispatchQueue.main.asyncAfter(deadline: .now() + 4) {\n\t\t\tif let timer = self.timer {\n\t\t\t\ttimer.invalidate()\n\t\t\t\tself.timer = Timer(timeInterval: 0.075, repeats: true, block: { timer in\n\t\t\t\t\taction()\n\t\t\t\t})\n\t\t\t\tRunLoop.main.add(self.timer!, forMode: .common)\n\t\t\t}\n\t\t}\n\t}\n\t\n\t@IBAction private func nextMonthButtonTouchDown(_ sender: Any) {\n\t\tstartRepeatingTimer { [weak self] in\n\t\t\tself?.current.month += 1\n\t\t}\n\t}\n\t\t\n\tprivate var lastPanChangeDate: Date = Date()\n\t@objc private func didPan(toSelectCells panGesture: UIPanGestureRecognizer) {\n\t\tif panGesture.state == .began {\n\t\t\tcollectionView.isUserInteractionEnabled = false\n\t\t} else if panGesture.state == .changed, let indexPath = collectionView.indexPathForItem(at: panGesture.location(in: collectionView)) {\n\t\t\tlet day = days[indexPath.row]\n\t\t\tlet date = DateComponents(calendar: calendar, year: current.year, month: current.month, day: day.day).date!\n\t\t\tlet month = calendar.component(.month, from: date)\n\t\t\t\n\t\t\tif month == current.month || -lastPanChangeDate.timeIntervalSinceNow > 0.8 {\n\t\t\t\tself.collectionView.selectItem(at: indexPath, animated: false, scrollPosition: [])\n\t\t\t\tself.collectionView(collectionView, didSelectItemAt: indexPath)\n\t\t\t\t\n\t\t\t\tlastPanChangeDate = Date()\n\t\t\t}\n\t\t} else if panGesture.state == .ended {\n\t\t\tcollectionView.isUserInteractionEnabled = true\n\t\t}\n\t}\n\t\n}\n\nextension JBCalendarViewController: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {\n\tpublic func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {\n\t\treturn days.count\n\t}\n\t\n\tpublic func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {\n\t\t\tlet cell = collectionView.dequeueReusableCell(withReuseIdentifier: \"DateCell\", for: indexPath) as! JBCalendarDateCell\n\t\tlet day = days[indexPath.row]\n\t\t\n\t\tlet date = DateComponents(calendar: calendar, year: current.year, month: current.month, day: day.day).date!\n\t\tlet components = calendar.dateComponents([.day, .month], from: date)\n\t\t\t\n\t\tcell.label.text = String(components.day!)\n\t\tcell.layer.cornerRadius = 4\n\t\tcell.layer.masksToBounds = true\n\t\t\n\t\tlet isSelected = day == selectedDay\n\t\t\n\t\tlet highlightedBackgroundColor: UIColor = day.isToday ? view.tintColor : .systemFill\n\t\tcell.backgroundColor = isSelected ? highlightedBackgroundColor : nil\n\t\t\n\t\tif day.isToday {\n\t\t\tif isSelected {\n\t\t\t\tcell.label.textColor = .lightLabel\n\t\t\t} else {\n\t\t\t\tcell.label.textColor = self.view.tintColor\n\t\t\t}\n\t\t} else if let minimumDate = usableMinimumDate, date < minimumDate {\n\t\t\tcell.label.textColor = .quaternaryLabel\n\t\t} else if let maximumDate = usableMaximumDate, date > maximumDate {\n\t\t\tcell.label.textColor = .quaternaryLabel\n\t\t} else if components.month == current.month {\n\t\t\tcell.label.textColor = .label\n\t\t} else {\n\t\t\tcell.label.textColor = .tertiaryLabel\n\t\t}\n\t\t\n\t\treturn cell\n\t}\n\t\n\tpublic func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {\n\t\t\n\t\tlet numberOfItems = collectionView.numberOfItems(inSection: 0)\n\t\t\n\t\tlet spacing = (collectionViewLayout as! UICollectionViewFlowLayout).minimumInteritemSpacing * CGFloat(numberOfItems-1)\n\t\tlet width = (self.collectionView.frame.width - spacing) / CGFloat(calendar.weekdaySymbols.count)\n\t\tlet height = (self.collectionView.frame.height - spacing) / CGFloat(6)\n\t\t\n\t\treturn CGSize(width: width, height: height)\n\t}\n\t\n\tpublic func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {\n\t\tlet day = days[indexPath.row]\n\t\t\n\t\tvar components = calendar.dateComponents([.timeZone, .year, .month, .day, .hour, .minute, .second, .nanosecond], from: self.date)\n\t\tcomponents.day = day.day\n\t\tcomponents.month = day.month\n\t\tcomponents.year = day.year\n\t\tlet newDate = calendar.date(from: components)!\n\t\t\n\t\tif let minimumDate = usableMinimumDate, newDate < minimumDate {\n\t\t\treturn\n\t\t} else if let maximumDate = usableMaximumDate, newDate > maximumDate {\n\t\t\treturn\n\t\t}\n\t\t\n\t\tcollectionView.reloadData()\n\t\t\n\t\tself.date = newDate\n\t}\n\t\n\tpublic func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) {\n\t\tcollectionView.reloadData()\n\t}\n\t\n}\n\nextension JBCalendarViewController: UIPopoverPresentationControllerDelegate {\n\tpublic func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle {\n\t\treturn .none\n\t}\n\t\n\tpublic func presentationControllerWillDismiss(_ presentationController: UIPresentationController) {\n\t\tdelegate?.calendarViewControllerWillDismiss(self)\n\t\tprint(\"final date:\", date)\n\t}\n\t\n\tpublic func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {\n\t\tdelegate?.calendarViewControllerDidDismiss(self)\n\t}\n}\n#endif\n"
  },
  {
    "path": "Sources/JBCalendarDatePicker/JBCalendarViewController.xib",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.XIB\" version=\"3.0\" toolsVersion=\"15400\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" useTraitCollections=\"YES\" useSafeAreas=\"YES\" colorMatched=\"YES\">\n    <device id=\"retina6_1\" orientation=\"portrait\" appearance=\"light\"/>\n    <dependencies>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"15404\"/>\n        <capability name=\"Safe area layout guides\" minToolsVersion=\"9.0\"/>\n        <capability name=\"documents saved in the Xcode 8 format\" minToolsVersion=\"8.0\"/>\n    </dependencies>\n    <objects>\n        <placeholder placeholderIdentifier=\"IBFilesOwner\" id=\"-1\" userLabel=\"File's Owner\" customClass=\"JBCalendarViewController\" customModule=\"JBCalendarDatePicker\">\n            <connections>\n                <outlet property=\"collectionView\" destination=\"SJT-dF-4Dv\" id=\"Fgp-sQ-slW\"/>\n                <outlet property=\"monthLabel\" destination=\"XsS-gG-JOn\" id=\"t3u-EQ-qBq\"/>\n                <outlet property=\"view\" destination=\"iN0-l3-epB\" id=\"H4Q-QN-OzQ\"/>\n                <outletCollection property=\"weekSymbolLabels\" destination=\"NzH-cg-g4f\" collectionClass=\"NSMutableArray\" id=\"PvR-50-ZTa\"/>\n                <outletCollection property=\"weekSymbolLabels\" destination=\"Jh7-Xy-ne4\" collectionClass=\"NSMutableArray\" id=\"Adw-v9-yyb\"/>\n                <outletCollection property=\"weekSymbolLabels\" destination=\"GHT-nG-QP9\" collectionClass=\"NSMutableArray\" id=\"WCv-rU-ebN\"/>\n                <outletCollection property=\"weekSymbolLabels\" destination=\"BZX-9S-jZP\" collectionClass=\"NSMutableArray\" id=\"aFo-et-a8d\"/>\n                <outletCollection property=\"weekSymbolLabels\" destination=\"nN9-YF-bv0\" collectionClass=\"NSMutableArray\" id=\"kyZ-tY-HYN\"/>\n                <outletCollection property=\"weekSymbolLabels\" destination=\"Ecz-Oh-w0S\" collectionClass=\"NSMutableArray\" id=\"sEL-kp-Kwx\"/>\n                <outletCollection property=\"weekSymbolLabels\" destination=\"ju0-r4-MOj\" collectionClass=\"NSMutableArray\" id=\"zrb-Xp-dvd\"/>\n            </connections>\n        </placeholder>\n        <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"-2\" customClass=\"UIResponder\"/>\n        <view contentMode=\"scaleToFill\" id=\"iN0-l3-epB\">\n            <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"200\" height=\"220\"/>\n            <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n            <subviews>\n                <stackView opaque=\"NO\" contentMode=\"scaleToFill\" axis=\"vertical\" spacing=\"1\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"9zH-yi-fyW\">\n                    <rect key=\"frame\" x=\"8\" y=\"52\" width=\"184\" height=\"160\"/>\n                    <subviews>\n                        <stackView opaque=\"NO\" contentMode=\"scaleToFill\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"P47-Dg-Btf\">\n                            <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"184\" height=\"28\"/>\n                            <subviews>\n                                <label opaque=\"NO\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"249\" verticalHuggingPriority=\"251\" text=\"Oct 2019\" textAlignment=\"natural\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"XsS-gG-JOn\">\n                                    <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"116\" height=\"28\"/>\n                                    <fontDescription key=\"fontDescription\" type=\"boldSystem\" pointSize=\"18\"/>\n                                    <nil key=\"textColor\"/>\n                                    <nil key=\"highlightedColor\"/>\n                                </label>\n                                <stackView opaque=\"NO\" contentMode=\"scaleToFill\" spacing=\"-11\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"L4a-pK-Onm\">\n                                    <rect key=\"frame\" x=\"116\" y=\"0.0\" width=\"68\" height=\"28\"/>\n                                    <subviews>\n                                        <button opaque=\"NO\" contentMode=\"scaleToFill\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"5ZB-PE-x1r\">\n                                            <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"30\" height=\"28\"/>\n                                            <fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"13\"/>\n                                            <color key=\"tintColor\" systemColor=\"secondaryLabelColor\" red=\"0.23529411759999999\" green=\"0.23529411759999999\" blue=\"0.26274509800000001\" alpha=\"0.59999999999999998\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>\n                                            <state key=\"normal\" title=\"◀︎\"/>\n                                            <connections>\n                                                <action selector=\"previousMonthButtonTouchDown:\" destination=\"-1\" eventType=\"touchDown\" id=\"n3F-ID-pNe\"/>\n                                                <action selector=\"previousMonthButtonTouchUp:\" destination=\"-1\" eventType=\"touchUpOutside\" id=\"4Cm-wu-jUl\"/>\n                                                <action selector=\"previousMonthButtonTouchUp:\" destination=\"-1\" eventType=\"touchUpInside\" id=\"KIQ-1V-UtW\"/>\n                                            </connections>\n                                        </button>\n                                        <button opaque=\"NO\" contentMode=\"scaleToFill\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"PXw-Xa-rec\">\n                                            <rect key=\"frame\" x=\"19\" y=\"0.0\" width=\"30\" height=\"28\"/>\n                                            <fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"11\"/>\n                                            <color key=\"tintColor\" systemColor=\"secondaryLabelColor\" red=\"0.23529411759999999\" green=\"0.23529411759999999\" blue=\"0.26274509800000001\" alpha=\"0.59999999999999998\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>\n                                            <state key=\"normal\" title=\"●\"/>\n                                            <connections>\n                                                <action selector=\"selectedDayButtonPressed:\" destination=\"-1\" eventType=\"touchUpInside\" id=\"NeK-ty-u1o\"/>\n                                            </connections>\n                                        </button>\n                                        <button opaque=\"NO\" contentMode=\"scaleToFill\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"nba-2C-EMV\">\n                                            <rect key=\"frame\" x=\"38\" y=\"0.0\" width=\"30\" height=\"28\"/>\n                                            <fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"13\"/>\n                                            <color key=\"tintColor\" systemColor=\"secondaryLabelColor\" red=\"0.23529411759999999\" green=\"0.23529411759999999\" blue=\"0.26274509800000001\" alpha=\"0.59999999999999998\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>\n                                            <state key=\"normal\" title=\"▶︎\"/>\n                                            <connections>\n                                                <action selector=\"nextMonthButtonTouchDown:\" destination=\"-1\" eventType=\"touchDown\" id=\"zim-hz-d73\"/>\n                                                <action selector=\"nextMonthButtonTouchUp:\" destination=\"-1\" eventType=\"touchUpOutside\" id=\"Zcj-e5-rkA\"/>\n                                                <action selector=\"nextMonthButtonTouchUp:\" destination=\"-1\" eventType=\"touchUpInside\" id=\"g5l-xx-0Ew\"/>\n                                            </connections>\n                                        </button>\n                                    </subviews>\n                                </stackView>\n                            </subviews>\n                        </stackView>\n                        <stackView opaque=\"NO\" contentMode=\"scaleToFill\" distribution=\"fillEqually\" spacing=\"2\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"6sq-CK-ND2\">\n                            <rect key=\"frame\" x=\"0.0\" y=\"29\" width=\"184\" height=\"16\"/>\n                            <subviews>\n                                <label opaque=\"NO\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"Su\" textAlignment=\"center\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" minimumScaleFactor=\"0.10000000149011612\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"NzH-cg-g4f\">\n                                    <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"24.5\" height=\"16\"/>\n                                    <fontDescription key=\"fontDescription\" type=\"boldSystem\" pointSize=\"13\"/>\n                                    <color key=\"textColor\" systemColor=\"secondaryLabelColor\" red=\"0.23529411759999999\" green=\"0.23529411759999999\" blue=\"0.26274509800000001\" alpha=\"0.59999999999999998\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>\n                                    <nil key=\"highlightedColor\"/>\n                                </label>\n                                <label opaque=\"NO\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"Mo\" textAlignment=\"center\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" minimumScaleFactor=\"0.10000000149011612\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"Jh7-Xy-ne4\">\n                                    <rect key=\"frame\" x=\"26.5\" y=\"0.0\" width=\"24.5\" height=\"16\"/>\n                                    <fontDescription key=\"fontDescription\" type=\"boldSystem\" pointSize=\"13\"/>\n                                    <color key=\"textColor\" systemColor=\"secondaryLabelColor\" red=\"0.23529411759999999\" green=\"0.23529411759999999\" blue=\"0.26274509800000001\" alpha=\"0.59999999999999998\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>\n                                    <nil key=\"highlightedColor\"/>\n                                </label>\n                                <label opaque=\"NO\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"Tu\" textAlignment=\"center\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" minimumScaleFactor=\"0.10000000149011612\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"GHT-nG-QP9\">\n                                    <rect key=\"frame\" x=\"53\" y=\"0.0\" width=\"24.5\" height=\"16\"/>\n                                    <fontDescription key=\"fontDescription\" type=\"boldSystem\" pointSize=\"13\"/>\n                                    <color key=\"textColor\" systemColor=\"secondaryLabelColor\" red=\"0.23529411759999999\" green=\"0.23529411759999999\" blue=\"0.26274509800000001\" alpha=\"0.59999999999999998\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>\n                                    <nil key=\"highlightedColor\"/>\n                                </label>\n                                <label opaque=\"NO\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"We\" textAlignment=\"center\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" minimumScaleFactor=\"0.10000000149011612\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"BZX-9S-jZP\">\n                                    <rect key=\"frame\" x=\"79.5\" y=\"0.0\" width=\"25\" height=\"16\"/>\n                                    <fontDescription key=\"fontDescription\" type=\"boldSystem\" pointSize=\"13\"/>\n                                    <color key=\"textColor\" systemColor=\"secondaryLabelColor\" red=\"0.23529411759999999\" green=\"0.23529411759999999\" blue=\"0.26274509800000001\" alpha=\"0.59999999999999998\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>\n                                    <nil key=\"highlightedColor\"/>\n                                </label>\n                                <label opaque=\"NO\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"Th\" textAlignment=\"center\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" minimumScaleFactor=\"0.10000000149011612\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"nN9-YF-bv0\">\n                                    <rect key=\"frame\" x=\"106.5\" y=\"0.0\" width=\"24.5\" height=\"16\"/>\n                                    <fontDescription key=\"fontDescription\" type=\"boldSystem\" pointSize=\"13\"/>\n                                    <color key=\"textColor\" systemColor=\"secondaryLabelColor\" red=\"0.23529411759999999\" green=\"0.23529411759999999\" blue=\"0.26274509800000001\" alpha=\"0.59999999999999998\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>\n                                    <nil key=\"highlightedColor\"/>\n                                </label>\n                                <label opaque=\"NO\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"Fr\" textAlignment=\"center\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" minimumScaleFactor=\"0.10000000149011612\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"Ecz-Oh-w0S\">\n                                    <rect key=\"frame\" x=\"133\" y=\"0.0\" width=\"24.5\" height=\"16\"/>\n                                    <fontDescription key=\"fontDescription\" type=\"boldSystem\" pointSize=\"13\"/>\n                                    <color key=\"textColor\" systemColor=\"secondaryLabelColor\" red=\"0.23529411759999999\" green=\"0.23529411759999999\" blue=\"0.26274509800000001\" alpha=\"0.59999999999999998\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>\n                                    <nil key=\"highlightedColor\"/>\n                                </label>\n                                <label opaque=\"NO\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"Sa\" textAlignment=\"center\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" minimumScaleFactor=\"0.10000000149011612\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"ju0-r4-MOj\">\n                                    <rect key=\"frame\" x=\"159.5\" y=\"0.0\" width=\"24.5\" height=\"16\"/>\n                                    <fontDescription key=\"fontDescription\" type=\"boldSystem\" pointSize=\"13\"/>\n                                    <color key=\"textColor\" systemColor=\"secondaryLabelColor\" red=\"0.23529411759999999\" green=\"0.23529411759999999\" blue=\"0.26274509800000001\" alpha=\"0.59999999999999998\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>\n                                    <nil key=\"highlightedColor\"/>\n                                </label>\n                            </subviews>\n                        </stackView>\n                        <stackView opaque=\"NO\" contentMode=\"scaleToFill\" axis=\"vertical\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"eop-u5-hdg\">\n                            <rect key=\"frame\" x=\"0.0\" y=\"46\" width=\"184\" height=\"4.5\"/>\n                            <subviews>\n                                <view contentMode=\"scaleToFill\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"8vZ-od-Ehu\">\n                                    <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"184\" height=\"3\"/>\n                                    <color key=\"backgroundColor\" systemColor=\"systemBackgroundColor\" cocoaTouchSystemColor=\"whiteColor\"/>\n                                    <constraints>\n                                        <constraint firstAttribute=\"height\" constant=\"3\" id=\"duy-FI-4zu\"/>\n                                    </constraints>\n                                </view>\n                                <view contentMode=\"scaleToFill\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"5YM-lx-cg4\">\n                                    <rect key=\"frame\" x=\"0.0\" y=\"3\" width=\"184\" height=\"1.5\"/>\n                                    <color key=\"backgroundColor\" systemColor=\"quaternaryLabelColor\" red=\"0.23529411759999999\" green=\"0.23529411759999999\" blue=\"0.26274509800000001\" alpha=\"0.17999999999999999\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>\n                                    <constraints>\n                                        <constraint firstAttribute=\"height\" constant=\"1.3\" id=\"LYl-xp-ZRp\"/>\n                                    </constraints>\n                                </view>\n                            </subviews>\n                        </stackView>\n                        <collectionView clipsSubviews=\"YES\" multipleTouchEnabled=\"YES\" contentMode=\"scaleToFill\" dataMode=\"prototypes\" prefetchingEnabled=\"NO\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"SJT-dF-4Dv\">\n                            <rect key=\"frame\" x=\"0.0\" y=\"51.5\" width=\"184\" height=\"108.5\"/>\n                            <color key=\"backgroundColor\" systemColor=\"systemBackgroundColor\" cocoaTouchSystemColor=\"whiteColor\"/>\n                            <collectionViewFlowLayout key=\"collectionViewLayout\" minimumLineSpacing=\"0.0\" minimumInteritemSpacing=\"0.0\" id=\"JWd-Xu-Nj4\">\n                                <size key=\"itemSize\" width=\"26\" height=\"24\"/>\n                                <size key=\"headerReferenceSize\" width=\"0.0\" height=\"0.0\"/>\n                                <size key=\"footerReferenceSize\" width=\"0.0\" height=\"0.0\"/>\n                                <inset key=\"sectionInset\" minX=\"0.0\" minY=\"0.0\" maxX=\"0.0\" maxY=\"0.0\"/>\n                            </collectionViewFlowLayout>\n                            <cells/>\n                        </collectionView>\n                    </subviews>\n                </stackView>\n            </subviews>\n            <color key=\"backgroundColor\" systemColor=\"systemBackgroundColor\" cocoaTouchSystemColor=\"whiteColor\"/>\n            <constraints>\n                <constraint firstItem=\"9zH-yi-fyW\" firstAttribute=\"top\" secondItem=\"vUN-kp-3ea\" secondAttribute=\"top\" constant=\"8\" id=\"FoA-L7-RMt\"/>\n                <constraint firstItem=\"9zH-yi-fyW\" firstAttribute=\"leading\" secondItem=\"vUN-kp-3ea\" secondAttribute=\"leading\" constant=\"8\" id=\"QPv-6S-a73\"/>\n                <constraint firstItem=\"vUN-kp-3ea\" firstAttribute=\"bottom\" secondItem=\"9zH-yi-fyW\" secondAttribute=\"bottom\" constant=\"8\" id=\"Rbt-yF-kR7\"/>\n                <constraint firstItem=\"vUN-kp-3ea\" firstAttribute=\"trailing\" secondItem=\"9zH-yi-fyW\" secondAttribute=\"trailing\" constant=\"8\" id=\"dsb-tS-kE2\"/>\n            </constraints>\n            <nil key=\"simulatedTopBarMetrics\"/>\n            <freeformSimulatedSizeMetrics key=\"simulatedDestinationMetrics\"/>\n            <viewLayoutGuide key=\"safeArea\" id=\"vUN-kp-3ea\"/>\n            <point key=\"canvasLocation\" x=\"139\" y=\"130\"/>\n        </view>\n    </objects>\n</document>\n"
  },
  {
    "path": "Sources/JBCalendarDatePicker/JBDatePicker.swift",
    "content": "//\n//  JBDatePicker.swift\n//  CalendarDatePickerViewController\n//\n//  Created by Josh Birnholz on 10/29/19.\n//  Copyright © 2019 Josh Birnholz. All rights reserved.\n//\n\n#if canImport(UIKit)\nimport UIKit\n\n\npublic protocol JBDatePicker: UIResponder {\n\tvar date: Date { get set }\n\tvar calendar: Calendar! { get set }\n\tvar locale: Locale? { get set }\n\tvar minimumDate: Date? { get set }\n\tvar maximumDate: Date? { get set }\n\tvar datePickerMode: UIDatePicker.Mode { get set }\n}\n#endif\n"
  },
  {
    "path": "Sources/JBCalendarDatePicker/JBDatePickerViewController.swift",
    "content": "//\n//  JBDatePickerViewController.swift\n//  CalendarDatePickerViewController\n//\n//  Created by Josh Birnholz on 28/10/2019.\n//  Copyright © 2019 Josh Birnholz. All rights reserved.\n//\n\n#if canImport(UIKit)\nimport UIKit\n\npublic class JBDatePickerViewController: UIViewController, DateInputViewDelegate, JBDatePicker {\n\t\n\t// MARK: Public interface\n\t\n\tprivate var keyboardType: UIKeyboardType {\n\t\treturn .numberPad\n\t}\n\t\n\t/// Use this property to change the type of information displayed by the date picker. It determines whether the date picker allows selection of a date, a time, or both date and time. The default mode is `UIDatePicker.Mode.dateAndTime`. See `UIDatePicker.Mode` for a list of mode constants.\n\t///\n\t/// Setting this property to `UIDatePicker.Mode.countDownTimer` has no effect; this date picker does not support the countdown timer mode.\n\t@objc public var datePickerMode: UIDatePicker.Mode = .dateAndTime {\n\t\tdidSet {\n\t\t\tif datePickerMode == .countDownTimer {\n\t\t\t\tdatePickerMode = oldValue\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprivate var dateInputView: DateInputView! {\n\t\treturn (view as! DateInputView)\n\t}\n\t\n\tpublic var calendar: Calendar! = Calendar.current {\n\t\tdidSet {\n\t\t\tif calendar == nil {\n\t\t\t\tcalendar = .current\n\t\t\t}\n\t\t}\n\t}\n\t\n\t@objc public var locale: Locale? = .current {\n\t\tdidSet {\n\t\t\tcalendar.locale = locale\n\t\t}\n\t}\n\t\n\t@objc public var date: Date = Date() {\n\t\tdidSet {\n\t\t\tswitch (minimumDate, maximumDate) {\n\t\t\tcase(let minimumDate?, let maximumDate?) where minimumDate < maximumDate :\n\t\t\t\tdate = min(max(date, minimumDate), maximumDate)\n\t\t\tcase (let minimumDate?, nil):\n\t\t\t\tdate = max(date, minimumDate)\n\t\t\tcase (nil, let maximumDate?):\n\t\t\t\tdate = min(date, maximumDate)\n\t\t\tdefault:\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tupdateLabelText()\n\t\t\tsetTextInputString(\"\", updatingLabel: false)\n\t\t\tprint(\"date set to \\(date)\")\n\t\t\tisPM = (12...23).contains(calendar.component(.hour, from: date))\n\t\t\t\n\t\t\tpresentedCalendar?.delegate = nil\n\t\t\tpresentedCalendar?.date = date\n\t\t\tpresentedCalendar?.delegate = self\n\t\t}\n\t}\n\t\n\t@objc public var minimumDate: Date? {\n\t\tdidSet {\n\t\t\tupdateLabelText()\n\t\t}\n\t}\n\t@objc public var maximumDate: Date? {\n\t\tdidSet {\n\t\t\tupdateLabelText()\n\t\t}\n\t}\n\t\n\tprivate var usableMinimumDate: Date? {\n\t\tif let minimumDate = minimumDate {\n\t\t\tif let maximumDate = maximumDate {\n\t\t\t\tif minimumDate < maximumDate {\n\t\t\t\t\treturn minimumDate\n\t\t\t\t} else {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn minimumDate\n\t\t}\n\t\t\n\t\treturn nil\n\t}\n\t\n\tprivate var usableMaximumDate: Date? {\n\t\tif let maximumDate = maximumDate {\n\t\t\tif let minimumDate = minimumDate {\n\t\t\t\tif minimumDate < maximumDate {\n\t\t\t\t\treturn maximumDate\n\t\t\t\t} else {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn maximumDate\n\t\t}\n\t\t\n\t\treturn nil\n\t}\n\t\n\tfileprivate var _textInputString: String = \"\"\n\tfileprivate var textInputString: String { return _textInputString }\n\t\n\tfileprivate func setTextInputString(_ newValue: String, updatingLabel: Bool) {\n\t\t_textInputString = newValue\n\t\tif updatingLabel, let selectedDatePart = selectedDatePart {\n\t\t\tlabel(for: selectedDatePart).text = _textInputString\n\t\t}\n\t}\n\t\n\t// MARK: Init\n\t\n\tpublic required init?(coder: NSCoder) {\n\t\tsuper.init(nibName: \"JBDatePickerViewController\", bundle: Bundle(for: Self.self))\n\t\tcommonInit()\n\t}\n\t\n\tpublic override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {\n\t\tsuper.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)\n\t\tcommonInit()\n\t}\n\t\n\tpublic init() {\n\t\tsuper.init(nibName: \"JBDatePickerViewController\", bundle: Bundle(for: Self.self))\n\t\tcommonInit()\n\t}\n\t\n\tprivate func commonInit() {\n\t\t\n\t}\n\t\n\t@IBOutlet private var labels: [UILabel]!\n\t@IBOutlet private var slashLabels: [UILabel]!\n\t@IBOutlet private weak var fullStackView: UIStackView!\n\t@IBOutlet private weak var datePartsStackView: UIStackView!\n\t@IBOutlet private weak var timePartsStackView: UIStackView!\n\t\n\toverride public func viewDidLoad() {\n        super.viewDidLoad()\n\t\tcalendar.locale = locale ?? .current\n\t\t\n\t\tview.backgroundColor = .clear\n\t\tdateInputView.delegate = self\n\t\t\n\t\t#if targetEnvironment(macCatalyst)\n\t\tview.tintColor = .systemAccent\n\t\t#endif\n\t\t\n\t\tisPM = (12...23).contains(calendar.component(.hour, from: date))\n\t\t\n\t\tdatePartsStackView.isHidden = datePickerMode == .time\n\t\ttimePartsStackView.isHidden = datePickerMode == .date\n\t\t\n\t\tsetupTextFields()\n\t\t\n\t\tupdateLabelText()\n\t\t\n\t}\n\t\n\toverride public var canBecomeFirstResponder: Bool {\n\t\treturn dateInputView.canBecomeFirstResponder\n\t}\n\t\n\toverride public func becomeFirstResponder() -> Bool {\n\t\tprint(type(of: self), #function)\n\t\tif selectedDatePart == nil {\n\t\t\tselectedDatePart = dateParts.first\n\t\t}\n\t\treturn dateInputView.becomeFirstResponder()\n\t}\n\t\n\toverride public func resignFirstResponder() -> Bool {\n\t\tprint(type(of: self), #function)\n\t\tselectedDatePart = nil\n\t\t\n//\t\tif let presented = presentedCalendar {\n//\t\t\tdismiss(animated: true, completion: nil)\n//\t\t}\n\t\t\n\t\treturn super.resignFirstResponder()\n\t}\n\t\n\t@objc private func tapGestureRecognized(_ sender: UITapGestureRecognizer) {\n\t\tguard let label = sender.view as? UILabel, let datePart = self.datePart(for: label) else { return }\n\t\tselectedDatePart = datePart\n\t\t_ = dateInputView.becomeFirstResponder()\n\t}\n\t\n\tprivate var isPM = false\n\t\n\tprivate enum DatePart: String, CaseIterable {\n\t\tcase day = \"dd\"\n\t\tcase month = \"MM\"\n\t\tcase year = \"yyyy\"\n\t\tcase hour12 = \"h\"\n\t\tcase hour24 = \"HH\"\n\t\tcase minute = \"mm\"\n\t\tcase amPM = \"a\"\n\t\t\n\t\tfunc set(value: Int, of components: inout DateComponents, using calendar: Calendar, isPM: Bool) {\n\t\t\tswitch self {\n\t\t\tcase .day:\n\t\t\t\tcomponents.setValue(value, for: .day)\n\t\t\tcase .month:\n\t\t\t\t// TODO: Set day to last day of month when the date range for the new month doesn't include the old day.\n\t\t\t\tcomponents.setValue(value, for: .month)\n\t\t\tcase .year:\n\t\t\t\tcomponents.setValue(value, for: .year)\n\t\t\tcase .hour12:\n\t\t\t\tvar value = value\n\t\t\t\t\n\t\t\t\tif value == 12 && !isPM {\n\t\t\t\t\tvalue = 0\n\t\t\t\t} else if (1...11).contains(value) && isPM {\n\t\t\t\t\tvalue += 12\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tcomponents.setValue(value, for: .hour)\n\t\t\tcase .hour24:\n\t\t\t\tcomponents.setValue(value, for: .hour)\n\t\t\tcase .minute:\n\t\t\t\tcomponents.setValue(value, for: .minute)\n\t\t\tcase .amPM:\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t\n\t\tfunc maxComponentLength(using calendar: Calendar) -> Int {\n\t\t\tif self == .amPM {\n\t\t\t\treturn max(calendar.amSymbol.count, calendar.pmSymbol.count)\n\t\t\t} else if self == .hour12 {\n\t\t\t\treturn 2\n\t\t\t}\n\t\t\t\n\t\t\treturn rawValue.count\n\t\t}\n\t}\n\t\n\tprivate var presentedCalendar: JBCalendarViewController? {\n\t\treturn presentedViewController as? JBCalendarViewController\n\t}\n\t\n\tprivate var selectedDatePart: DatePart? {\n\t\tdidSet {\n\t\t\tfor datePart in visibleDateParts {\n\t\t\t\tlet label = self.label(for: datePart)\n\t\t\t\tlet isSelected = selectedDatePart == datePart\n\t\t\t\tlabel.backgroundColor = isSelected ? view.tintColor : nil\n\t\t\t\tlabel.textColor = isSelected ? .lightLabel : .label\n\t\t\t}\n\t\t\t\n\t\t\tself.setTextInputString(\"\", updatingLabel: false)\n\t\t\t\n\t\t\tguard let selectedDatePart = selectedDatePart else {\n//\t\t\t\tpresentedCalendar?.dismiss(animated: true, completion: nil)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t\n\t\t\tif selectedDatePart == .day || selectedDatePart == .month || selectedDatePart == .year && presentedCalendar == nil {\n\t\t\t\tlet calendarVC = JBCalendarViewController()\n\t\t\t\tcalendarVC.date = date\n\t\t\t\tcalendarVC.calendar = calendar\n\t\t\t\tcalendarVC.locale = locale\n\t\t\t\tcalendarVC.minimumDate = minimumDate\n\t\t\t\tcalendarVC.maximumDate = maximumDate\n\t\t\t\tcalendarVC.popoverPresentationController?.sourceView = datePartsStackView\n\t\t\t\tcalendarVC.popoverPresentationController?.sourceRect = datePartsStackView.frame\n//\t\t\t\tcalendarVC.popoverPresentationController?.sourceRect = dayLabel.frame\n\t\t\t\tcalendarVC.popoverPresentationController?.permittedArrowDirections = [.up]\n\t\t\t\tcalendarVC.popoverPresentationController?.passthroughViews = [fullStackView]\n\t\t\t\tcalendarVC.delegate = self\n\t\t\t\tself.present(calendarVC, animated: true, completion: nil)\n\t\t\t} else {\n//\t\t\t\tpresentedCalendar?.dismiss(animated: true, completion: nil)\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprivate var dateParts: [DatePart]! {\n\t\tdidSet {\n\t\t\tamPMLabel.isHidden = !dateParts.contains(.hour12)\n\t\t}\n\t}\n\t\n\tprivate var yearLabel: UILabel {\n\t\tlet index = dateParts.firstIndex(of: .year)!\n\t\treturn labels[index]\n\t}\n\t\n\tprivate var monthLabel: UILabel {\n\t\tlet index = dateParts.firstIndex(of: .month)!\n\t\treturn labels[index]\n\t}\n\t\n\tprivate var dayLabel: UILabel {\n\t\tlet index = dateParts.firstIndex(of: .day)!\n\t\treturn labels[index]\n\t}\n\t\n\t@IBOutlet private weak var hourLabel: UILabel!\n\t@IBOutlet private weak var minuteLabel: UILabel!\n\t@IBOutlet private weak var amPMLabel: UILabel!\n\t\n\tprivate func setupTextFields() {\n\t\tvar allLabels = labels ?? []\n\t\tallLabels.append(hourLabel)\n\t\tallLabels.append(minuteLabel)\n\t\tallLabels.append(amPMLabel)\n\t\tfor label in allLabels {\n\t\t\tlabel.font = UIFont.monospacedDigitSystemFont(ofSize: label.font!.pointSize, weight: .regular)\n\t\t\tlabel.sizeToFit()\n\t\t\tNSLayoutConstraint(item: label, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .width, multiplier: 1, constant: label.frame.size.width).isActive = true\n\t\t\t\n\t\t\tlabel.layer.masksToBounds = true\n\t\t\tlabel.layer.cornerRadius = 4\n\t\t\tlabel.backgroundColor = .clear\n\t\t\tlabel.textColor = .label\n\t\t\t\n\t\t\tlet gesture = UITapGestureRecognizer(target: self, action: #selector(tapGestureRecognized(_:)))\n\t\t\tlabel.addGestureRecognizer(gesture)\n\t\t\tlabel.isUserInteractionEnabled = true\n\t\t}\n\t\t\n\t\tlet template = dateTemplate\n\t\tlet dateFormat = DateFormatter.dateFormat(fromTemplate: template, options: 0, locale: locale ?? .current)!\n\t\tlet components = dateFormat.split(maxSplits: .max, omittingEmptySubsequences: true, whereSeparator: { character -> Bool in\n\t\t\t!template.contains(character.lowercased())\n\t\t})\n\t\tdateParts = components.compactMap { DatePart(rawValue: String($0)) }\n\t}\n\t\n\tprivate let dateTemplate: String = \"MMddyyyyhmma\"\n\t\n\tprivate let formatter = DateFormatter()\n\t\n\tprivate var visibleDateParts: [DatePart] {\n\t\tlet allowedDateParts: Set<DatePart> = {\n\t\t\tswitch datePickerMode {\n\t\t\tcase .time:\n\t\t\t\tif dateParts.contains(.hour12) {\n\t\t\t\t\treturn [.hour12, .minute, .amPM]\n\t\t\t\t} else {\n\t\t\t\t\treturn [.hour24, .minute]\n\t\t\t\t}\n\t\t\tcase .date:\n\t\t\t\treturn [.year, .month, .day]\n\t\t\tdefault:\n\t\t\t\tvar returnValue: Set<DatePart> = [.year, .month, .day]\n\t\t\t\tif dateParts.contains(.hour12) {\n\t\t\t\t\treturnValue.insert(.hour12)\n\t\t\t\t\treturnValue.insert(.minute)\n\t\t\t\t\treturnValue.insert(.amPM)\n\t\t\t\t} else {\n\t\t\t\t\treturnValue.insert(.hour24)\n\t\t\t\t\treturnValue.insert(.minute)\n\t\t\t\t}\n\t\t\t\treturn returnValue\n\t\t\t}\n\t\t}()\n\t\t\n\t\treturn dateParts.filter { allowedDateParts.contains($0) }\n\t}\n\t\n//\tprivate var labelsAndDateParts: [(UILabel, DatePart)] {\n//\t\treturn visibleDateParts.map { (self.label(for: $0), $0) }\n//\t}\n\t\n\tprivate func label(for datePart: DatePart) -> UILabel {\n\t\tswitch datePart {\n\t\tcase .day: return dayLabel\n\t\tcase .month: return monthLabel\n\t\tcase .year: return yearLabel\n\t\tcase .hour12: return hourLabel\n\t\tcase .hour24: return hourLabel\n\t\tcase .minute: return minuteLabel\n\t\tcase .amPM: return amPMLabel\n\t\t}\n\t}\n\t\n\tprivate func datePart(for label: UILabel) -> DatePart? {\n\t\tswitch label {\n\t\tcase yearLabel: return .year\n\t\tcase monthLabel: return .month\n\t\tcase dayLabel: return .day\n\t\tcase hourLabel:\n\t\t\tif dateParts.contains(.hour12) {\n\t\t\t\treturn .hour12\n\t\t\t}\n\t\t\treturn .hour24\n\t\tcase minuteLabel: return .minute\n\t\tcase amPMLabel: return .amPM\n\t\tdefault: return nil\n\t\t}\n\t}\n\t\n\tprivate func updateLabelText() {\n\t\tfor datePart in visibleDateParts {\n\t\t\tformatter.dateFormat = datePart.rawValue\n\t\t\tlabel(for: datePart).text = String(formatter.string(from: date).prefix(datePart.maxComponentLength(using: calendar)))\n\t\t}\n\t\t\n\t\tformatter.dateFormat = \"a\"\n\t\tamPMLabel.text = formatter.string(from: date)\n\t}\n\t\n\tprivate var finalizeEditTimer: Timer? {\n\t\tdidSet {\n\t\t\toldValue?.invalidate()\n\t\t}\n\t}\n\n}\n\nextension JBDatePickerViewController: UIKeyInput {\n\tpublic var hasText: Bool {\n\t\treturn !textInputString.isEmpty\n\t}\n\t\n\tfileprivate func selectNextDatePart() {\n\t\tguard let selectedDatePart = selectedDatePart else { return }\n\t\tif let index = visibleDateParts.lastIndex(of: selectedDatePart), visibleDateParts.indices.contains(index+1) {\n\t\t\tself.selectedDatePart = visibleDateParts[index+1]\n\t\t} else {\n\t\t\tself.selectedDatePart = visibleDateParts.first\n\t\t}\n\t}\n\t\n\tpublic func insertText(_ text: String) {\n\t\tguard let selectedDatePart = selectedDatePart else { return }\n\t\t\n\t\tif text == \"\\t\" {\n\t\t\tfinalize(datePart: selectedDatePart)\n\t\t\t\n\t\t\tselectNextDatePart()\n\t\t\t\n\t\t\treturn\n\t\t}\n\t\t\n\t\tif selectedDatePart == .amPM {\n\t\t\tsetTextInputString(text, updatingLabel: true)\n\t\t\tfinalize(datePart: selectedDatePart)\n\t\t\treturn\n\t\t}\n\t\t\n\t\tguard let proposedValue = Int(textInputString + text) else { return }\n\t\t\n\t\tlet validValues: [Int] = {\n\t\t\tswitch selectedDatePart {\n\t\t\tcase .day:\n\t\t\t\treturn calendar.range(of: .day, in: .month, for: date).map(Array.init) ?? []\n\t\t\tcase .month:\n\t\t\t\treturn calendar.range(of: .month, in: .year, for: date).map(Array.init) ?? []\n\t\t\tcase .year:\n\t\t\t\treturn Array(1...9999)\n\t\t\tcase .hour12:\n\t\t\t\treturn Array(1...12)\n\t\t\tcase .hour24:\n\t\t\t\treturn Array(0...23)\n\t\t\tcase .minute:\n\t\t\t\treturn Array(0...59)\n\t\t\tcase .amPM:\n\t\t\t\treturn []\n\t\t\t}\n\t\t}()\n\t\t\n\t\tlet valueIsValid: Bool = {\n\t\t\treturn validValues.contains(proposedValue)\n\t\t}()\n\t\t\n\t\tguard valueIsValid else { return }\n\t\t\n\t\tsetTextInputString(String(proposedValue), updatingLabel: true)\n\t\t\n\t\tif textInputString.count >= selectedDatePart.maxComponentLength(using: calendar) {\n\t\t\tfinalize(datePart: selectedDatePart)\n\t\t} else {\n\t\t\tstartFinalizeTimer(datePart: selectedDatePart)\n\t\t}\n\t\t\n\t}\n\t\n\tpublic func deleteBackward() {\n\t\t\n\t\tguard !textInputString.isEmpty else { return }\n\t\tvar input = textInputString\n\t\tinput.removeLast()\n\t\tsetTextInputString(input, updatingLabel: true)\n\t\t\n\t\tif let selectedDatePart = selectedDatePart, !textInputString.isEmpty {\n\t\t\tstartFinalizeTimer(datePart: selectedDatePart)\n\t\t}\n\t}\n\t\n\tprivate func startFinalizeTimer(datePart: DatePart) {\n\t\tfinalizeEditTimer = Timer(timeInterval: 1, repeats: false) { timer in\n\t\t\tself.finalize(datePart: datePart)\n\t\t}\n\t\tRunLoop.main.add(finalizeEditTimer!, forMode: .common)\n\t}\n\t\n\tprivate func finalize(datePart: DatePart) {\n\t\tvar components = calendar.dateComponents([.timeZone, .year, .month, .day, .hour, .minute, .second, .nanosecond], from: date)\n\t\tif let value = Int(textInputString) {\n\t\t\tdatePart.set(value: value, of: &components, using: calendar, isPM: isPM)\n\t\t\tif let date = calendar.date(from: components) {\n\t\t\t\tself.date = date\n\t\t\t} else {\n\t\t\t\tupdateLabelText()\n\t\t\t}\n\t\t} else if datePart == .amPM && !textInputString.isEmpty {\n\t\t\tif calendar.amSymbol.lowercased().hasPrefix(textInputString.lowercased()) && isPM {\n\t\t\t\tisPM = false\n\t\t\t\tprint(\"setting to am\")\n\t\t\t\tcomponents.hour! -= 12\n\t\t\t} else if calendar.pmSymbol.lowercased().hasPrefix(textInputString.lowercased()) && !isPM {\n\t\t\t\tisPM = true\n\t\t\t\tprint(\"setting to pm\")\n\t\t\t\tcomponents.hour! += 12\n\t\t\t}\n\t\t\tif let date = calendar.date(from: components) {\n\t\t\t\tself.date = date\n\t\t\t} else {\n\t\t\t\tupdateLabelText()\n\t\t\t}\n\t\t}\n\t\tsetTextInputString(\"\", updatingLabel: false)\n\t\tfinalizeEditTimer?.invalidate()\n\t}\n\n}\n\nextension JBDatePickerViewController: JBCalendarViewControllerDelegate {\n\tpublic func calendarViewControllerDateChanged(_ calendarViewController: JBCalendarViewController) {\n\t\tself.date = calendarViewController.date\n\t}\n\t\n\tpublic func calendarViewControllerWillDismiss(_ calendarViewController: JBCalendarViewController) {\n\t\t_ = dateInputView.resignFirstResponder()\n\t}\n\t\n\tpublic func calendarViewControllerDidDismiss(_ calendarViewController: JBCalendarViewController) {\n\t\t\n\t}\n}\n\n#endif\n"
  },
  {
    "path": "Sources/JBCalendarDatePicker/JBDatePickerViewController.xib",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.XIB\" version=\"3.0\" toolsVersion=\"15400\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" useTraitCollections=\"YES\" useSafeAreas=\"YES\" colorMatched=\"YES\">\n    <device id=\"retina6_1\" orientation=\"portrait\" appearance=\"light\"/>\n    <dependencies>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"15404\"/>\n        <capability name=\"Safe area layout guides\" minToolsVersion=\"9.0\"/>\n        <capability name=\"documents saved in the Xcode 8 format\" minToolsVersion=\"8.0\"/>\n    </dependencies>\n    <objects>\n        <placeholder placeholderIdentifier=\"IBFilesOwner\" id=\"-1\" userLabel=\"File's Owner\" customClass=\"JBDatePickerViewController\" customModule=\"JBCalendarDatePicker\">\n            <connections>\n                <outlet property=\"amPMLabel\" destination=\"Yb6-cX-Iup\" id=\"hi9-tq-aBn\"/>\n                <outlet property=\"datePartsStackView\" destination=\"1tw-Dr-MZK\" id=\"TQ1-js-BQA\"/>\n                <outlet property=\"fullStackView\" destination=\"1DW-sK-Kuh\" id=\"swT-4n-yPM\"/>\n                <outlet property=\"hourLabel\" destination=\"wWz-nR-eEw\" id=\"tlX-VS-R54\"/>\n                <outlet property=\"minuteLabel\" destination=\"xBH-eh-Kkk\" id=\"ZMz-FT-Biw\"/>\n                <outlet property=\"timePartsStackView\" destination=\"sGC-mG-oKf\" id=\"WOe-CT-8FY\"/>\n                <outlet property=\"view\" destination=\"i5M-Pr-FkT\" id=\"sfx-zR-JGt\"/>\n                <outletCollection property=\"labels\" destination=\"e10-lT-IGg\" collectionClass=\"NSMutableArray\" id=\"Len-tI-HR5\"/>\n                <outletCollection property=\"slashLabels\" destination=\"mth-vw-Bki\" collectionClass=\"NSMutableArray\" id=\"A1H-gr-R5g\"/>\n                <outletCollection property=\"labels\" destination=\"CZQ-vO-Hfs\" collectionClass=\"NSMutableArray\" id=\"ZTh-Hs-4aQ\"/>\n                <outletCollection property=\"slashLabels\" destination=\"4Ms-VI-PZa\" collectionClass=\"NSMutableArray\" id=\"v71-6n-ufG\"/>\n                <outletCollection property=\"labels\" destination=\"hgy-52-e1p\" collectionClass=\"NSMutableArray\" id=\"qR2-7b-5tk\"/>\n                <outletCollection property=\"slashLabels\" destination=\"LWa-FT-OeY\" collectionClass=\"NSMutableArray\" id=\"XKk-Po-Qvl\"/>\n            </connections>\n        </placeholder>\n        <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"-2\" customClass=\"UIResponder\"/>\n        <view clearsContextBeforeDrawing=\"NO\" contentMode=\"scaleToFill\" id=\"i5M-Pr-FkT\" customClass=\"DateInputView\" customModule=\"JBCalendarDatePicker\">\n            <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"439\" height=\"104\"/>\n            <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n            <subviews>\n                <stackView opaque=\"NO\" contentMode=\"scaleToFill\" spacing=\"14\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"1DW-sK-Kuh\">\n                    <rect key=\"frame\" x=\"0.0\" y=\"47\" width=\"178.5\" height=\"20.5\"/>\n                    <subviews>\n                        <stackView opaque=\"NO\" contentMode=\"scaleToFill\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"1tw-Dr-MZK\">\n                            <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"88\" height=\"20.5\"/>\n                            <subviews>\n                                <label opaque=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"10\" textAlignment=\"right\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"e10-lT-IGg\">\n                                    <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"18\" height=\"20.5\"/>\n                                    <fontDescription key=\"fontDescription\" style=\"UICTFontTextStyleBody\"/>\n                                    <nil key=\"textColor\"/>\n                                    <nil key=\"highlightedColor\"/>\n                                </label>\n                                <label opaque=\"NO\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"/\" textAlignment=\"natural\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"mth-vw-Bki\">\n                                    <rect key=\"frame\" x=\"18\" y=\"0.0\" width=\"5.5\" height=\"20.5\"/>\n                                    <fontDescription key=\"fontDescription\" style=\"UICTFontTextStyleBody\"/>\n                                    <nil key=\"textColor\"/>\n                                    <nil key=\"highlightedColor\"/>\n                                </label>\n                                <label opaque=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"29\" textAlignment=\"right\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"CZQ-vO-Hfs\">\n                                    <rect key=\"frame\" x=\"23.5\" y=\"0.0\" width=\"20.5\" height=\"20.5\"/>\n                                    <fontDescription key=\"fontDescription\" style=\"UICTFontTextStyleBody\"/>\n                                    <nil key=\"textColor\"/>\n                                    <nil key=\"highlightedColor\"/>\n                                </label>\n                                <label opaque=\"NO\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"/\" textAlignment=\"natural\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"4Ms-VI-PZa\">\n                                    <rect key=\"frame\" x=\"44\" y=\"0.0\" width=\"5.5\" height=\"20.5\"/>\n                                    <fontDescription key=\"fontDescription\" style=\"UICTFontTextStyleBody\"/>\n                                    <nil key=\"textColor\"/>\n                                    <nil key=\"highlightedColor\"/>\n                                </label>\n                                <label opaque=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"2019\" textAlignment=\"right\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"hgy-52-e1p\">\n                                    <rect key=\"frame\" x=\"49.5\" y=\"0.0\" width=\"38.5\" height=\"20.5\"/>\n                                    <fontDescription key=\"fontDescription\" style=\"UICTFontTextStyleBody\"/>\n                                    <nil key=\"textColor\"/>\n                                    <nil key=\"highlightedColor\"/>\n                                </label>\n                            </subviews>\n                        </stackView>\n                        <stackView opaque=\"NO\" contentMode=\"scaleToFill\" spacing=\"4\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"sGC-mG-oKf\">\n                            <rect key=\"frame\" x=\"102\" y=\"0.0\" width=\"76.5\" height=\"20.5\"/>\n                            <subviews>\n                                <stackView opaque=\"NO\" contentMode=\"scaleToFill\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"KKl-98-e11\">\n                                    <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"46.5\" height=\"20.5\"/>\n                                    <subviews>\n                                        <label opaque=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"23\" textAlignment=\"right\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"wWz-nR-eEw\">\n                                            <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"20.5\" height=\"20.5\"/>\n                                            <fontDescription key=\"fontDescription\" style=\"UICTFontTextStyleBody\"/>\n                                            <nil key=\"textColor\"/>\n                                            <nil key=\"highlightedColor\"/>\n                                        </label>\n                                        <label opaque=\"NO\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\":\" textAlignment=\"natural\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"LWa-FT-OeY\">\n                                            <rect key=\"frame\" x=\"20.5\" y=\"0.0\" width=\"5\" height=\"20.5\"/>\n                                            <fontDescription key=\"fontDescription\" style=\"UICTFontTextStyleBody\"/>\n                                            <nil key=\"textColor\"/>\n                                            <nil key=\"highlightedColor\"/>\n                                        </label>\n                                        <label opaque=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"59\" textAlignment=\"right\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"xBH-eh-Kkk\">\n                                            <rect key=\"frame\" x=\"25.5\" y=\"0.0\" width=\"21\" height=\"20.5\"/>\n                                            <fontDescription key=\"fontDescription\" style=\"UICTFontTextStyleBody\"/>\n                                            <nil key=\"textColor\"/>\n                                            <nil key=\"highlightedColor\"/>\n                                        </label>\n                                    </subviews>\n                                </stackView>\n                                <label opaque=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"AM\" textAlignment=\"right\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" adjustsFontSizeToFit=\"NO\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"Yb6-cX-Iup\">\n                                    <rect key=\"frame\" x=\"50.5\" y=\"0.0\" width=\"26\" height=\"20.5\"/>\n                                    <fontDescription key=\"fontDescription\" style=\"UICTFontTextStyleBody\"/>\n                                    <nil key=\"textColor\"/>\n                                    <nil key=\"highlightedColor\"/>\n                                </label>\n                            </subviews>\n                        </stackView>\n                    </subviews>\n                </stackView>\n            </subviews>\n            <color key=\"backgroundColor\" red=\"1\" green=\"1\" blue=\"1\" alpha=\"1\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>\n            <constraints>\n                <constraint firstItem=\"1DW-sK-Kuh\" firstAttribute=\"leading\" secondItem=\"fnl-2z-Ty3\" secondAttribute=\"leading\" id=\"KES-GK-c0X\"/>\n                <constraint firstItem=\"1DW-sK-Kuh\" firstAttribute=\"centerY\" secondItem=\"fnl-2z-Ty3\" secondAttribute=\"centerY\" id=\"kl5-dU-SqA\"/>\n            </constraints>\n            <nil key=\"simulatedTopBarMetrics\"/>\n            <nil key=\"simulatedBottomBarMetrics\"/>\n            <freeformSimulatedSizeMetrics key=\"simulatedDestinationMetrics\"/>\n            <viewLayoutGuide key=\"safeArea\" id=\"fnl-2z-Ty3\"/>\n            <point key=\"canvasLocation\" x=\"155.79710144927537\" y=\"-128.57142857142856\"/>\n        </view>\n    </objects>\n</document>\n"
  },
  {
    "path": "Sources/JBCalendarDatePicker/UIColor+SystemAccent.swift",
    "content": "//\n//  UIColor+SystemAccent.swift\n//  CalendarDatePickerViewController\n//\n//  Created by Josh Birnholz on 28/10/2019.\n//  Copyright © 2019 Josh Birnholz. All rights reserved.\n//\n\n#if canImport(UIKit)\nimport UIKit\n\nextension UIColor {\n\t\n\t#if targetEnvironment(macCatalyst)\n\tstatic var systemAccent: UIColor {\n\t\tlet hasAccentSet = UserDefaults.standard.object(forKey: \"AppleAccentColor\") != nil\n\t\tlet systemAccentColor = UserDefaults.standard.integer(forKey: \"AppleAccentColor\")\n\t\tvar returnColor: UIColor = UIColor { traitCollection in\n\t\t\t\ttraitCollection.userInterfaceStyle == .dark ? #colorLiteral(red: 0.008315349929, green: 0.3450804651, blue: 0.817365706, alpha: 1) : #colorLiteral(red: 0.01329958253, green: 0.3846624196, blue: 0.8779004216, alpha: 1)\n\t\t}\n\t\tif hasAccentSet {\n\t\t\tswitch systemAccentColor {\n\t\t\t\tcase -1:\n\t\t\t\t\treturnColor = UIColor { traitCollection in\n\t\t\t\t\t\t\ttraitCollection.userInterfaceStyle == .dark ? #colorLiteral(red: 0.4039281607, green: 0.403850317, blue: 0.4124818146, alpha: 1) : #colorLiteral(red: 0.5019147992, green: 0.5019902587, blue: 0.5018982291, alpha: 1)\n\t\t\t\t\t}\n\t\t\t\tcase 0:\n\t\t\t\t\treturnColor = UIColor { traitCollection in\n\t\t\t\t\t\t\ttraitCollection.userInterfaceStyle == .dark ? #colorLiteral(red: 0.82002002, green: 0.2045214176, blue: 0.2204136252, alpha: 1) : #colorLiteral(red: 0.7370213866, green: 0.1443678439, blue: 0.1633504629, alpha: 1)\n\t\t\t\t\t}\n\t\t\t\tcase 1:\n\t\t\t\t\treturnColor = UIColor { traitCollection in\n\t\t\t\t\t\t\ttraitCollection.userInterfaceStyle == .dark ? #colorLiteral(red: 0.7512640357, green: 0.3605512679, blue: 0.01273573376, alpha: 1) : #colorLiteral(red: 0.8462041616, green: 0.4178547263, blue: 0.05405366421, alpha: 1)\n\t\t\t\t\t}\n\t\t\t\tcase 2:\n\t\t\t\t\treturnColor = UIColor { traitCollection in\n\t\t\t\t\t\t\ttraitCollection.userInterfaceStyle == .dark ? #colorLiteral(red: 0.8009095192, green: 0.5611655712, blue: 0.05494389683, alpha: 1) : #colorLiteral(red: 0.8690621257, green: 0.6199508309, blue: 0.07889743894, alpha: 1)\n\t\t\t\t\t}\n\t\t\t\tcase 3:\n\t\t\t\t\treturnColor = UIColor { traitCollection in\n\t\t\t\t\t\t\ttraitCollection.userInterfaceStyle == .dark ? #colorLiteral(red: 0.2549478412, green: 0.5663680434, blue: 0.1645001471, alpha: 1) : #colorLiteral(red: 0.3048421741, green: 0.6298194528, blue: 0.1963118315, alpha: 1)\n\t\t\t\t\t}\n\t\t\t\tcase 5:\n\t\t\t\t\treturnColor = UIColor { traitCollection in\n\t\t\t\t\t\ttraitCollection.userInterfaceStyle == .dark ? #colorLiteral(red: 0.500952661, green: 0.1951716244, blue: 0.5008149147, alpha: 1) : #colorLiteral(red: 0.4900261164, green: 0.1631549001, blue: 0.4976372719, alpha: 1)\n\t\t\t\t}\n\t\t\t\tcase 6:\n\t\t\t\t\treturnColor = UIColor { traitCollection in\n\t\t\t\t\t\t\ttraitCollection.userInterfaceStyle == .dark ? #colorLiteral(red: 0.7823504806, green: 0.1956582665, blue: 0.4722630978, alpha: 1) : #colorLiteral(red: 0.8491325974, green: 0.2301979959, blue: 0.5240355134, alpha: 1)\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn returnColor\n\t}\n\t#endif\n\n\tstatic let lightLabel = UIColor { traitCollection in\n\t\tif traitCollection.userInterfaceStyle == .dark {\n\t\t\treturn .label\n\t\t} else {\n\t\t\treturn .systemBackground\n\t\t}\n\t}\n}\n\n#endif\n"
  },
  {
    "path": "Tests/JBCalendarDatePickerTests/JBCalendarDatePickerTests.swift",
    "content": "import XCTest\n@testable import JBCalendarDatePicker\n\nfinal class JBCalendarDatePickerTests: XCTestCase {\n    func testExample() {\n        // This is an example of a functional test case.\n        // Use XCTAssert and related functions to verify your tests produce the correct\n        // results.\n        \n    }\n\n    static var allTests = [\n        (\"testExample\", testExample),\n    ]\n}\n"
  },
  {
    "path": "Tests/JBCalendarDatePickerTests/XCTestManifests.swift",
    "content": "import XCTest\n\n#if !canImport(ObjectiveC)\npublic func allTests() -> [XCTestCaseEntry] {\n    return [\n        testCase(JBCalendarDatePickerTests.allTests),\n    ]\n}\n#endif\n"
  }
]