Skip to content

Instantly share code, notes, and snippets.

@10Macit
Created October 25, 2023 21:49
Show Gist options
  • Save 10Macit/317d4ffc96a0a41aeb4c8fddee8afdb4 to your computer and use it in GitHub Desktop.
Save 10Macit/317d4ffc96a0a41aeb4c8fddee8afdb4 to your computer and use it in GitHub Desktop.
CalendarView
struct MyContentView: View {
@StateObject var viewModel = EventStore()
var body: some View {
MyCalendarViewRepresentable(calendarView: viewModel.calendarView)
}
}
struct MyCalendarViewRepresentable: UIViewRepresentable {
typealias UIViewType = UICalendarView
var calendarView: UICalendarView
func makeUIView(context: Context) -> UICalendarView {
calendarView
}
func updateUIView(_ uiView: UICalendarView, context: Context) {
}
}
class EventStore: NSObject, ObservableObject {
@Published var calendarView = UICalendarView()
override init() {
super.init()
calendarView.delegate = self
}
}
extension EventStore: UICalendarViewDelegate {
//delegates
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment