{"id":20878869,"url":"https://github.com/codeandtheory/ycalendarpicker-ios","last_synced_at":"2025-12-11T22:52:37.658Z","repository":{"id":88687563,"uuid":"605074326","full_name":"codeandtheory/ycalendarpicker-ios","owner":"codeandtheory","description":"An easy-to-use and highly customizable month calendar.","archived":false,"fork":false,"pushed_at":"2023-12-12T06:42:12.000Z","size":279,"stargazers_count":12,"open_issues_count":2,"forks_count":1,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-11-17T11:23:16.602Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codeandtheory.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-02-22T11:45:00.000Z","updated_at":"2023-09-29T07:41:02.000Z","dependencies_parsed_at":"2023-10-03T05:28:45.767Z","dependency_job_id":null,"html_url":"https://github.com/codeandtheory/ycalendarpicker-ios","commit_stats":null,"previous_names":["codeandtheory/ycalendarpicker-ios","yml-org/ycalendarpicker-ios"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/codeandtheory/ycalendarpicker-ios","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeandtheory%2Fycalendarpicker-ios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeandtheory%2Fycalendarpicker-ios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeandtheory%2Fycalendarpicker-ios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeandtheory%2Fycalendarpicker-ios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codeandtheory","download_url":"https://codeload.github.com/codeandtheory/ycalendarpicker-ios/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeandtheory%2Fycalendarpicker-ios/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27672062,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-11T02:00:11.302Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T07:14:27.370Z","updated_at":"2025-12-11T22:52:37.632Z","avatar_url":"https://github.com/codeandtheory.png","language":"Swift","readme":"![Y—Calendar Picker](https://user-images.githubusercontent.com/1037520/220841655-8784e89b-1836-4fc5-8bc9-40c758b6d6f5.jpeg)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fyml-org%2Fycalendarpicker-ios%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/yml-org/ycalendarpicker-ios) [![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fyml-org%2Fycalendarpicker-ios%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/yml-org/ycalendarpicker-ios)  \n_An easy-to-use and highly customizable month calendar._\n\nThis frameworks provides a month calendar picker with both UIKit and SwiftUI variants.\n\n![Calendar Picker demo animation](https://user-images.githubusercontent.com/1037520/220844728-b6bcf4bd-74a0-4618-b34d-7a1176b96876.gif)\n\nLicensing\n----------\nY—CalendarPicker is licensed under the [Apache 2.0 license](LICENSE).\n\nDocumentation\n----------\n\nDocumentation is automatically generated from source code comments and rendered as a static website hosted via GitHub Pages at: https://yml-org.github.io/ycalendarpicker-ios/\n\nUsage\n----------\n\n### `CalendarPicker` (UIKit)\n`CalendarPicker` is a subclass of `UIControl` with an api similar to `UIDatePicker`.\n\n### `CalendarView` (SwiftUI)\n`CalendarView` is a struct that conforms to the SwiftUI `View` protocol.\n\n### Initializers\n\nBoth `CalendarPicker` and `CalendarView` can be initialized with the same five parameters (`CalendarPicker` uses `CalendarView` internally):\n\n```swift\ninit(\n    firstWeekday: Int? = nil, \n    appearance: Appearance = .default, \n    minimumDate: Date? = nil, \n    maximumDate: Date? = nil, \n    startDate: Date? = nil,\n    locale: Locale? = nil\n)\n```\nThe standard initializer lets you specify the first day of the week, appearance, optional minimum and maximum dates, start date of the calendar and the locale, although it provides sensible defaults for all of these.\n\n`CalendarPicker` has an additional initializer:\n\n```swift\ninit?(coder: NSCoder)\n```\nFor use in Interface Builder or Storyboards (although we recommend that you build your UI in code). \n\nA calendar picker created this way begins with the default appearance, but you can customize it at runtime by updating its `appearance` property.\n\n### Customization\n\n`CalendarPicker` and `CalendarView` both have an `appearance` property of type `Appearance`.\n\n`Appearance` lets you customize the picker's appearance. You have full control over the colors, typographies, and images used. The default appearance is dark mode compatible and WCAG 2.0 AA compliant for color contrast.\n\n```swift\n/// Appearance for CalendarPicker that contains typography and color properties\npublic struct Appearance {\n    /// Appearance for days within current month\n    public var normalDayAppearance: Day\n    /// Appearance for days outside current month\n    public var grayedDayAppearance: Day\n    /// Appearance for today\n    public var todayAppearance: Day\n    /// Appearance for selected day\n    public var selectedDayAppearance: Day\n    /// Appearance for disabled day\n    public var disabledDayAppearance: Day\n    /// Appearance for booked day\n    public var bookedDayAppearance: Day\n    /// Foreground color and typography for weekdays\n    public var weekdayStyle: (textColor: UIColor, typography: Typography)\n    /// Image for previous month button\n    ///\n    /// Images with template rendering mode will be tinted to `monthForegroundColor`.\n    public var previousImage: UIImage?\n    /// Image for next month button\n    ///\n    /// Images with template rendering mode will be tinted to `monthForegroundColor`.\n    public var nextImage: UIImage?\n    /// Foreground color and typography for month (and year)\n    public var monthStyle: (textColor: UIColor, typography: Typography)\n    /// Background color for calendar view\n    public var backgroundColor: UIColor\n}\n```\n\nThe calendar has six different appearances for drawing individual days:\n\n1. **normal**: for unselected dates within the current month\n2. **grayed**: for unselected dates that fall before or after the current month (because we always show 6 rows or 42 days)\n3. **today**: for today's date when unselected\n4. **selected**: for the currently selected date (if any)\n5. **booked**: for any dates that are already booked. These days are not selectable.\n6. **disabled**: for any dates before `minimumDate` or after `maximumDate`. These days are not selectable.\n\nThe appearance of each of these types of days can be customized using the `Day` structure.\n```swift\n/// Appearance for Date\npublic struct Day {\n    /// Typography for day view\n    public var typography: Typography\n    /// Foreground color for day view\n    public var foregroundColor: UIColor\n    /// Background color for day view\n    public var backgroundColor: UIColor\n    /// Border color for day view\n    public var borderColor: UIColor\n    /// Border width for day view\n    public var borderWidth: CGFloat\n    /// Hides day view (if true)\n    public var isHidden: Bool\n}\n```\n\n### Usage (UIKit)\n\n1. **How to import?**\n    \n    ```swift\n    import YCalendarPicker\n    ```\n    \n2. **Create a calendar picker**\n    \n    ```swift\n    // Create calendar picker with default values\n    let calendarPicker = CalendarPicker()\n    \n    // add calendar picker to any view\n    view.addSubview(calendarPicker)\n    ```    \n\n3. **Customize and then update appearance**\n\n    ```swift\n    // Create a calendar picker with the weekday text color set to green\n    var calendarPicker = CalendarPicker(\n        appearance: CalendarPicker.Appearance(weekdayStyle: (textColor: .green, typography: .weekday)\n    )\n\n    // Change the weekday text color to red\n    calendarPicker.appearance.weekdayStyle.textColor = .red\n    ```\n\n4. **Update Calendar properties**\n    \n    ```swift\n    // set minimum date to yesterday and maximum date to tomorrow\n    calendarPicker.minimumDate = Date().previousDate()\n    calendarPicker.maximumDate = Date().nextDate()\n    \n    // select today's date\n    calendarPicker.date = Date()\n    ```\n    \n5. **Receive change notifications**\n    \n    To be notified when the date changes, simply use the target-action mechanism exactly as you would for `UIDatePicker`.\n    \n    ```swift\n    // Add target with action\n    calendarPicker.addTarget(self, action: #selector(onDateChange), for: .valueChanged)\n    ```\n    \n    If you wish to know when the user has switched months (via the previous and next buttons), you can use the picker's `delegate` property and conform to the `CalendarPickerDelegate` protocol.\n    \n    ```swift\n    // Create calendar picker\n    let calendarPicker = CalendarPicker()\n    \n    // set the delegate to be notified when the month changes\n    calendarPicker.delegate = self\n    ```    \n\n    ```swift\n    // This will notify when the user presses the next/previous buttons\n    extension DemoViewController: CalendarPickerDelegate {\n        func calendarPicker(_ calendarPicker: CalendarPicker, didChangeMonthTo date: Date) {\n            print(\"New month: \\(date)\")\n        }\n    }\n    ```\n    \n### Usage (SwiftUI)\n    \nOur calendar picker also supports Swift UI!\n    \n1. **How to import?**\n    \n    ```swift\n    import YCalendarPicker\n    ```\n    \n2. **Create a calendar view**\n    `CalendarView` conforms to SwiftUI's `View` protocol so we can directly integrate `CalendarView` with any SwiftUI view.\n    ```swift\n    var body: some View {\n        CalendarView()\n    }\n    ```\n    \n3. **Customize and then update appearance**\n\n    ```swift\n    struct CustomCalendar {\n        @State var calendar: CalendarView = {\n            // Create a calendar picker with the weekday text color set to green\n            var calendar = CalendarView()\n            calendar.appearance.weekdayStyle.textColor = .green\n            return calendar\n        }()\n    }\n\n    extension CustomCalendar: View {\n        public var body: some View {\n            VStack {\n                calendar\n                Button(\"Go Red\") {\n                    // Change the weekday text color to red\n                    calendar.appearance.weekdayStyle.textColor = .red\n                }\n            }\n        }\n    }\n    ```\n    \n4. **Update Calendar properties**\n\n    ```swift\n    struct CustomCalendar {\n        @State var calendar = CalendarView()\n    }\n\n    extension CustomCalendar: View {\n        var body: some View {\n            VStack {\n                calendar\n                Button(\"Set Min/Max\") {\n                    // set minimum date to yesterday and maximum date to tomorrow\n                    calendar.minimumDate = Date().previousDate()\n                    calendar.maximumDate = Date().nextDate()\n                }\n                Button(\"Select Today\") {\n                    // select today's date\n                    calendar.date = Date()\n                }\n            }\n        }\n    }\n    ```\n\n5. **Receive change notifications**\n    To be notified when the user selects a date or changes the month, you can use the `delegate` property and conform to the `CalendarViewDelegate` protocol.\n\n    ```swift\n    extension DemoView: CalendarViewDelegate {\n        // Date was selected\n        func calendarViewDidSelectDate(_ date: Date?) {\n            if let date {\n                print(\"Selected: \\(date)\")\n            } else {\n                print(\"Selection cleared\")\n            }\n        }\n        \n        // Month was changed\n        func calendarViewDidChangeMonth(to date: Date) {\n            print(\"New month: \\(date)\")\n        }\n    }\n    ```\n\nDependencies\n----------\n\nY—CalendarPicker depends upon our [Y—CoreUI](https://github.com/yml-org/ycoreui) and [Y—MatterType](https://github.com/yml-org/ymattertype) frameworks (both also open source and Apache 2.0 licensed).\n\nInstallation\n----------\n\nYou can add Y—CalendarPicker to an Xcode project by adding it as a package dependency.\n\n1. From the **File** menu, select **Add Packages...**\n2. Enter \"[https://github.com/yml-org/ycalendarpicker-ios](https://github.com/yml-org/ycalendarpicker-ios)\" into the package repository URL text field\n3. Click **Add Package**\n\nContributing to Y—CalendarPicker\n----------\n\n### Requirements\n\n#### SwiftLint (linter)\n```\nbrew install swiftlint\n```\n\n#### Jazzy (documentation)\n```\nsudo gem install jazzy\n```\n\n### Setup\n\nClone the repo and open `Package.swift` in Xcode.\n\n### Versioning strategy\n\nWe utilize [semantic versioning](https://semver.org).\n\n```\n{major}.{minor}.{patch}\n```\n\ne.g.\n\n```\n1.0.5\n```\n\n### Branching strategy\n\nWe utilize a simplified branching strategy for our frameworks.\n\n* main (and development) branch is `main`\n* both feature (and bugfix) branches branch off of `main`\n* feature (and bugfix) branches are merged back into `main` as they are completed and approved.\n* `main` gets tagged with an updated version # for each release\n \n### Branch naming conventions:\n\n```\nfeature/{ticket-number}-{short-description}\nbugfix/{ticket-number}-{short-description}\n```\ne.g.\n```\nfeature/CM-44-button\nbugfix/CM-236-textview-color\n```\n\n### Pull Requests\n\nPrior to submitting a pull request you should:\n\n1. Compile and ensure there are no warnings and no errors.\n2. Run all unit tests and confirm that everything passes.\n3. Check unit test coverage and confirm that all new / modified code is fully covered.\n4. Run `swiftlint` from the command line and confirm that there are no violations.\n5. Run `jazzy` from the command line and confirm that you have 100% documentation coverage.\n6. Consider using `git rebase -i HEAD~{commit-count}` to squash your last {commit-count} commits together into functional chunks.\n7. If HEAD of the parent branch (typically `main`) has been updated since you created your branch, use `git rebase main` to rebase your branch.\n    * _Never_ merge the parent branch into your branch.\n    * _Always_ rebase your branch off of the parent branch.\n\nWhen submitting a pull request:\n\n* Use the [provided pull request template](.github/pull_request_template.md) and populate the Introduction, Purpose, and Scope fields at a minimum.\n* If you're submitting before and after screenshots, movies, or GIF's, enter them in a two-column table so that they can be viewed side-by-side.\n\nWhen merging a pull request:\n\n* Make sure the branch is rebased (not merged) off of the latest HEAD from the parent branch. This keeps our git history easy to read and understand.\n* Make sure the branch is deleted upon merge (should be automatic).\n\n### Releasing new versions\n* Tag the corresponding commit with the new version (e.g. `1.0.5`)\n* Push the local tag to remote\n\nGenerating Documentation (via Jazzy)\n----------\n\nYou can generate your own local set of documentation directly from the source code using the following command from Terminal:\n```\njazzy\n```\nThis generates a set of documentation under `/docs`. The default configuration is set in the default config file `.jazzy.yaml` file.\n\nTo view additional documentation options type:\n```\njazzy --help\n```\nA GitHub Action automatically runs each time a commit is pushed to `main` that runs Jazzy to generate the documentation for our GitHub page at: https://yml-org.github.io/ycalendarpicker-ios/\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeandtheory%2Fycalendarpicker-ios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeandtheory%2Fycalendarpicker-ios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeandtheory%2Fycalendarpicker-ios/lists"}