A native SwiftUI calendar component.
This package contains a SwiftUI view that will generate the above view. It's very simple to do.
Create a MonthView
and MonthViewModel
. In the example below we are using the .mock()
initializer to create a mock view model for the MonthView
.
var body: some View {
let vm = MonthViewModel.mock()
MonthView(viewModel: vm) { day in
print("Day: \(day) selected")
}
}
The call back method is triggered when a day is tapped in the view. This returns the day as a number.
model: MonthModel
The model that contains all the month data.font: Font
Font of the whole viewlinePadding: CGFloat
Padding between each week in the monthtitleSize: Double
The size of the current month and yearselectedYear: Int
The currently selected yearselectedDay: Int
The currently selected dayshowMonthTitle: String
A boolean value that
name: String
Name of the monthnumber: Int
Number of the monthdays: [DayModel]
Array ofDayModel
s for the days of the month