Can I use View Controller (CalendarKit) in SwiftUI application?
Lol I don't know why it didn't work before, but if you are looking for something like this
struct CustomController: UIViewControllerRepresentable {
func updateUIViewController(_ uiViewController: UIViewController, context: Context){
}
func makeUIViewController(context: Context) -> UIViewController {
let dayViewController = CustomCalendarExampleController()
return dayViewController
}
}
CalendarKit SwiftUI Events
Looks like you're using CalendarKit
with SwiftUI.As of right now, SwiftUI is not supported out-of-the box.
Moreover, this API's purpose is to provide animations / gesture handling for the user, it doesn't actually creates events in the datasource.
dayView.updateStyle(style)
var testingEvents: [Event] = [Event]()
var event = Event()
event.startDate = Date()
event.endDate = Date()
event.isAllDay = true
event.text = "Testing Event"
dayView.create(event: event)
In order to solve your issue, I suggest making the following changes:
- Implement
DayViewDataSource
and any other CalendarKit interaction in the domain of UIKit. - Bridge your custom subclass of
DayViewController
to SwiftUI and use that subclass in the SwiftUI domain (similar to the way you've provided in your code snippet)
Related Topics
How to Segue Values When My Viewcontroller Is Embedded in an Uinavigationcontroller
Deep Copy of Cmimagebuffer or Cvimagebuffer
Why Does Somestruct() Is Anyobject Return True
Concatenate Literal with Optional String
How to Handle Parameter Validation Swift
Swiftui - Make Toolbar's Navigationlink Use Detail View
Swift For-In Loop with Enumerate on Custom Array2D Class
Why Do Two Distinct Array Literals Equal Each Other in Swift
How to Incorporate Swift Package Manager to an Existing Xcode Project
Swift 5, How to Execute Code After Fetching All Childadded from Firebase
Play Segment of Avaudiopcmbuffer
Get Compiler Error in Swift Indexof()
Overlapping Accesses to 'Urlcomponents', But Modification Requires Exclusive Access
Rectangle Progress Bar Swiftui
Swiftui Behavior of .Frame(Height: Nil)
Replace Exactly One Pixel in an Image and Put It in Another Image via Swift