CalendarView
Calendars made simple (SwiftUI)
Install / Use
/learn @Mijick/CalendarViewREADME
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
MCalendarViewconstructor 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 -->⏳ Installation
Swift Package Manager
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.
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 for your project
pod init
- Add CocoaPods dependency into your
Podfile
pod 'MijickCalendarView'
- Install dependency and generate
.xcworkspacefile
pod install
- Use new XCode project file
.xcworkspace<br>
Usage
1. Call initialiser
To declare a CalendarView, call the constructor:
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:
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 for more details).
<br>Try our demo
See for yourself how does it work by cloning project we created
License
CalendarView is released under the MIT license. See LICENSE for details.
<br><br>
Our other open source SwiftUI libraries
Popups - The most powerful popup library that allows you to present any popup <br> NavigationView - Easier and cleaner way of navigating through your app <br> GridView - Lay out your data with no effort <br> Camera - The most powerful CameraController. Designed for SwiftUI <br> Timer - Modern API for Timer
Related Skills
node-connect
347.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
