Closed peterpoliwoda closed 4 weeks ago
OK, correction. a .decorator(...)
function will overwrite the events on the CalendarView which was my initial thinking of just adding a decorator after a decorator and that's it. This may actually be a better solution speed-wise, but I realised you have added a customView
initiator for the decorator also, so in that case, I got what I needed. I can just use a decorator with a custom HStack and it shows me two circles like I wanted to 😎. I just need to figure out how to do this right with what I want to do.
Here's some code if anybody's looking for a solution for this:
//
// ContentView.swift
// Swift CalendarView Package Tests
//
// Created by Piotr Poliwoda on 21/08/2024.
//
import SwiftUI
import CalendarView
struct ContentView: View {
let eveningEntriesThisMonth: Set<DateComponents> = [
DateComponents(month: 8, day: 1),
DateComponents(month: 8, day: 2),
DateComponents(month: 8, day: 3),
DateComponents(month: 8, day: 6),
DateComponents(month: 8, day: 8),
DateComponents(month: 8, day: 14),
DateComponents(month: 8, day: 15),
DateComponents(month: 8, day: 16),
]
var body: some View {
ScrollView {
CalendarView()
.decorating(eveningEntriesThisMonth, customView: {
HStack {
Circle().frame(width: 5)
.foregroundColor(.cyan)
Circle().frame(width: 5)
.foregroundColor(.indigo)
}
})
}
.padding()
}
}
#Preview {
ContentView()
}
Thanks for building and sharing this! It really helps!
Hi @AllanJuenemann I'm looking to show a calendar view with two dots in my current project (and potentially more in a different one, 3-4 dots to keep it clean) as they will only represent a coloured dot it should be pretty clean to see. Would it be possible to add this into your code?