Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mijick/calendarview
Calendars made simple (SwiftUI)
https://github.com/mijick/calendarview
calendar calendar-component calendar-view cocoapods ios-sdk ios-swift swift swift-calendar swift-library swift-package-manager swift5 swiftui swiftui-components swiftui-example swiftui-extensions swiftui-framework
Last synced: 4 days ago
JSON representation
Calendars made simple (SwiftUI)
- Host: GitHub
- URL: https://github.com/mijick/calendarview
- Owner: Mijick
- License: mit
- Created: 2023-10-08T07:52:25.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-30T18:57:14.000Z (6 months ago)
- Last Synced: 2025-01-22T09:01:36.533Z (11 days ago)
- Topics: calendar, calendar-component, calendar-view, cocoapods, ios-sdk, ios-swift, swift, swift-calendar, swift-library, swift-package-manager, swift5, swiftui, swiftui-components, swiftui-example, swiftui-extensions, swiftui-framework
- Language: Swift
- Homepage:
- Size: 57.6 KB
- Stars: 333
- Watchers: 4
- Forks: 25
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
Calendar View
Create fully customisable calendar in no time. Keep your code clean
Try demo we prepared
|
Roadmap
|
Propose a new feature
CalendarView is a free and open-source library designed for SwiftUI that makes the process of creating calendars easier and much cleaner.
* **Improves code quality.** Create a calendar using `MCalendarView` constructor and pass the selected date / range to it. Simple as never!
* **Customize calendar in no time.** We know how important customisation is; that's why we give you the opportunity to design your calendar in any way you like.
* **Designed for SwiftUI.** While developing the library, we have used the power of SwiftUI to give you powerful tool to speed up your implementation process.
# Getting Started
### ✋ Requirements| **Platforms** | **Minimum Swift Version** |
|:----------|:----------|
| iOS 14+ | 5.0 |
| iPadOS 14+ | 5.0 |
| macOS 11+ | 5.0 |
| watchOS 7+ | 5.0 |### ⏳ Installation
#### [Swift Package Manager][spm]
Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the Swift compiler.Once you have your Swift package set up, adding CalendarView as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.
```Swift
dependencies: [
.package(url: "https://github.com/Mijick/CalendarView.git", branch(“main”))
]
```#### [Cocoapods][cocoapods]
Cocoapods is a dependency manager for Swift and Objective-C Cocoa projects that helps to scale them elegantly.Installation steps:
- Install CocoaPods 1.10.0 (or later)
- [Generate CocoaPods][generate_cocoapods] for your project
```Swift
pod init
```
- Add CocoaPods dependency into your `Podfile`
```Swift
pod 'MijickCalendarView'
```
- Install dependency and generate `.xcworkspace` file
```Swift
pod install
```
- Use new XCode project file `.xcworkspace`# Usage
### 1. Call initialiser
To declare a CalendarView, call the constructor:```Swift
struct ContentView: View {
@State private var selectedDate: Date? = nil
@State private var selectedRange: MDateRange? = .init()var body: some View {
MCalendarView(selectedDate: $selectedDate, selectedRange: $selectedRange)
}
}
```### 2. Customise Calendar
Your MCalendarView can be customised by calling `configBuilder` inside the initialiser:```Swift
struct ContentView: View {
@State private var selectedDate: Date? = nil
@State private var selectedRange: MDateRange? = .init()var body: some View {
MCalendarView(selectedDate: nil, selectedRange: $selectedRange) {
$0
(...)
.dayView(NewDayView.init)
.firstWeekday(.wednesday)
.monthLabelToDaysDistance(12)
.weekdaysView(NewWeekdaysView.init)
(...)
}
}
}
```### 3. Customizing WeekdaysView / WeekdayLabel / MonthLabel / DayView
Each calendar element can be easily customised by creating your own view by inheriting the protocol (check [Demo Project][Demo] for more details).
# Try our demo
See for yourself how does it work by cloning [project][Demo] we created# License
CalendarView is released under the MIT license. See [LICENSE][License] for details.
# Our other open source SwiftUI libraries
[PopupView] - The most powerful popup library that allows you to present any popup
[NavigationView] - Easier and cleaner way of navigating through your app
[GridView] - Lay out your data with no effort
[CameraView] - The most powerful CameraController. Designed for SwiftUI
[Timer] - Modern API for Timer[MIT]: https://en.wikipedia.org/wiki/MIT_License
[SPM]: https://www.swift.org/package-manager[Demo]: https://github.com/Mijick/CalendarView-Demo
[License]: https://github.com/Mijick/CalendarView/blob/main/LICENSE[spm]: https://www.swift.org/package-manager/
[cocoapods]: https://cocoapods.org/
[generate_cocoapods]: https://github.com/square/cocoapods-generate[PopupView]: https://github.com/Mijick/PopupView
[NavigationView]: https://github.com/Mijick/NavigationView
[CameraView]: https://github.com/Mijick/CameraView
[GridView]: https://github.com/Mijick/GridView
[Timer]: https://github.com/Mijick/Timer