MooCal
MooCal, a lightweight SwiftUI calendar library designed to simplify the creation and customization of calendars in your SwiftUI applications. Whether you're building a productivity app, an event planner, or any application that requires calendar functionality, Moocal is your go-to solution.
Install / Use
/learn @mazefest/MooCalREADME
Requirements
| Platforms | Minimum Swift Version | |--------------|-----------------------| | iOS 16+ | 5.9 |
Getting Started
Swift Package Manager
- in XCode go to
File->Add Package Dependencies...
- In the searchbar paste the github url
https://github.com/mazefest/MooCaland selectAdd Package.
Now you can import MooCal and use the library where ever you like.
Integration
1. Import MooCal
Import MooCal inside of the desired file you are wanting to implement MooCal's features.
import MooCal
2. Setup View
In the view you are wanting to add the scrollable calendar, create a ScrollableCalendarViewViewModel and store it as a variable.
struct ContentView: View {
var viewModel: ScrollableCalendarViewViewModel
init() {
self.viewModel = ScrollableCalendarViewViewModel()
}
var body: some View {
}
}
Next you will need to initialize the ScrollableCalendarView inside of the var body, it takes in two parameters.
ScrollableCalendarView(viewModel: ScrollableCalendarViewViewModel, calendarDayView: CalendarDayView)
viewModel- [ScrollableCalendarViewViewModel] The viewModel we just made abovecalendaryDayView- [CalendarDayView] This determines the view of each individual day inside the calendar
3. Select Calendar Style
In this documentation we are going ot continue on with the Custom calendar day view implementation, but if you are interested in the other offering, checkout the our premade calendar day view implementations below by linking to our wiki.
4. Implementing Calendar Style (Custom Implementation)
When choosing to use the custom implementation your code will look like the following. The Custom implementation provides a completion handler where you will return the CalendarDay of the view you need to draw, which gives you all you need to create your custom calendar day view, and then you will have to return the View.
var body: some View {
ScrollableCalendarView(
viewModel: viewModel,
calendarDayView: .custom( // <--- HERE
{ calendarDay in
// Your custom view implementation here
}
)
)
}
Now you will need to provide your custom view to the completion handle. The CalendarDay is going to be vital for doing so. I recommend creating a function that takes in a CalendarDay parameter and returns a view. Forexample:
private func customCalendarDayView(_ calendarDay: CalendarDay) -> some View {
ZStack {
RoundedRectangle(cornerRadius: 10.0)
.foregroundStyle(Color.gray.opacity(0.13))
Text(calendarDay.descriptor) // The day number. ex: 11
.bold()
}
.aspectRatio(contentMode: .fit)
}
This function will return a rounded rectangle with the numbered day of month centered on top of it.
Next you will need to put this function inside the compltion handler.
var body: some View {
ScrollableCalendarView(
viewModel: viewModel,
calendarDayView: .custom(
{ calendarDay in
customCalendarDayView(calendarDay) // <-- HERE
}
)
)
}
This will be the result of the above code.
<img src="ReadMeResources/Gif_CustomCalendar_Scroll.gif" width="200" alt="">Further Customization
If you want to have full control on the stlying of your calendar, checkout the below ways to style the calendar to your liking.
<img src="ReadMeResources/labeledCustomizableViews.png" width="300" alt="">Further Implementation
If you want to add more functionality to your calendar, make sure to take a look at our Wiki, there is a lot more functionality you can add very easily.
Test App
For full examples of implementing a full calendar app, see the test app below.
Related Skills
clearshot
Structured screenshot analysis for UI implementation and critique. Analyzes every UI screenshot with a 5×5 spatial grid, full element inventory, and design system extraction — facts and taste together, every time. Escalates to full implementation blueprint when building. Trigger on any digital interface image file (png, jpg, gif, webp — websites, apps, dashboards, mockups, wireframes) or commands like 'analyse this screenshot,' 'rebuild this,' 'match this design,' 'clone this.' Skip for non-UI images (photos, memes, charts) unless the user explicitly wants to build a UI from them. Does NOT trigger on HTML source code, CSS, SVGs, or any code pasted as text.
openpencil
2.2kThe world's first open-source AI-native vector design tool and the first to feature concurrent Agent Teams. Design-as-Code. Turn prompts into UI directly on the live canvas. A modern alternative to Pencil.
HappyColorBlend
HappyColorBlendVibe Project Guidelines Project Overview HappyColorBlendVibe is a Figma plugin for color palette generation with advanced tint/shade blending capabilities. It allows designers to
ui-ux-pro-max-skill
62.4kAn AI SKILL that provide design intelligence for building professional UI/UX multiple platforms
