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: MonthModelThe model that contains all the month data.font: FontFont of the whole viewlinePadding: CGFloatPadding between each week in the monthtitleSize: DoubleThe size of the current month and yearselectedYear: IntThe currently selected yearselectedDay: IntThe currently selected dayshowMonthTitle: StringA boolean value that
name: StringName of the monthnumber: IntNumber of the monthdays: [DayModel]Array ofDayModels for the days of the month
