You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+34
Original file line number
Diff line number
Diff line change
@@ -10,3 +10,37 @@
10
10
A native SwiftUI calendar component.
11
11
12
12
<imgwidth="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