Skip to content

Commit 531a3ce

Browse files
author
William Vabrinskas
committed
updated readme
1 parent 22df2f8 commit 531a3ce

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

README.md

+34
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,37 @@
1010
A native SwiftUI calendar component.
1111

1212
<img width="300" src="images/example.png">
13+
14+
# Usage
15+
This package contains a SwiftUI view that will generate the above view. It's very simple to do.
16+
17+
Create a `MonthView` and `MonthViewModel`. In the example below we are using the `.mock()` initializer to create a mock view model for the `MonthView`.
18+
```
19+
var body: some View {
20+
let vm = MonthViewModel.mock()
21+
22+
MonthView(viewModel: vm) { day in
23+
print("Day: \(day) selected")
24+
}
25+
}
26+
```
27+
28+
The call back method is triggered when a day is tapped in the view. This returns the day as a number.
29+
30+
## MonthViewModel
31+
32+
### Initializer parameters:
33+
- `model: MonthModel` The model that contains all the month data.
34+
- `font: Font` Font of the whole view
35+
- `linePadding: CGFloat` Padding between each week in the month
36+
- `titleSize: Double` The size of the current month and year
37+
- `selectedYear: Int` The currently selected year
38+
- `selectedDay: Int` The currently selected day
39+
- `showMonthTitle: String` A boolean value that
40+
41+
## MonthModel
42+
43+
### Initializer parameters:
44+
- `name: String` Name of the month
45+
- `number: Int` Number of the month
46+
- `days: [DayModel]` Array of `DayModel`s for the days of the month

0 commit comments

Comments
 (0)