Heatmap style calendar made in SwiftUI.
-
Use "Swift Package Manager":
File -> Swift Packages -> Add Package Dependency
-
Paste URL:
https://github.com/s-n-1-0/MMHeatmap.git
Displays a calendar from "start" to "end".
//"import MMHeatmap" is required
let calendar = Calendar(identifier: .gregorian)
let start = calendar.date(from: DateComponents(year:2021,month: 12,day: 20))!
let end = calendar.date(from: DateComponents(year:2022,month: 4,day: 3))! // or nil = now
let data = [
MMHeatmapData(year: 2022, month: 3, day: 10, value: 5),
MMHeatmapData(year: 2022, month: 4, day:1, value: 10)
]
//view
HStack{
MMHeatmapView(start: start,end:end, data: data, style: MMHeatmapStyle(baseCellColor: UIColor.systemIndigo,isScroll: true))
Spacer()
}
*The variable "style:" is optional.
Calendar cell data.
Please not duplicate dates in MMHeatmapViewData.
public init(date _date:Date,value:Int)
public init(year:Int,month:Int,day:Int,value:Int)
Specifies the color strength of the cell.
Specify a value greater than or equal to 0.
*If you want to set Color.clear, use "nil".
Variable | Description | |
---|---|---|
baseCellColor | Maximum color | |
minCellColor | Color when value is 0 | |
week | Notation of the day of the week | |
dateMMFormat | Months format Example: 4 "M" = 4 "MM" = 04 "MMM" = en: Apr , ja: 4月 |
|
clippedWithEndDate | true : If you want to display cells up to end parameter. false : if you want to display cells until the end of the month in the last month. |
|
isScroll | scrolling. *Disabled for iOS13 |
Read this. #2
Please PR or Issues if you have any questions.