Posts

Post not yet marked as solved
3 Replies
0 Views
colorMultiply is not the way to go as it tints the cells and background. But I don't think there is a solution to this if one just wants to replace the dull gray.
Post not yet marked as solved
20 Replies
0 Views
I received feedback from Apple on this. I hope youi did as well.
Post marked as solved
12 Replies
0 Views
Check out the following website describing the differences between @EnvironmentObject and @ObservedObject.https://mecid.github.io/2019/06/12/understanding-property-wrappers-in-swiftui/
Post marked as solved
12 Replies
0 Views
You don't need to do this. Check out the SwiftUI tutorials again. You'll see the changes that they made.
Post not yet marked as solved
3 Replies
0 Views
The user of my apps has the ability to enter in reminders and notes, something much more extensive than a line of text.
Post not yet marked as solved
3 Replies
0 Views
The more I think of it, the more I think my idea is a bad one.
Post not yet marked as solved
3 Replies
0 Views
Is your SwiftUI view in a NavigationView?
Post not yet marked as solved
7 Replies
0 Views
Even though this works, it's not how this view controller would normally be shown. But it didn't work modally for several reasons. It worked once, but when I showed it a second time, I could not dismiss it, nor did the delegate fire the second time. But when I navigate out of the detail view and then back in, then it worked again.
Post not yet marked as solved
2 Replies
0 Views
The way they did it was to embed the view controller in a ZStack and then hide it with a bool. That's not how it would be done normally, but I have found when I looked into a EKEditEventViewController, that one can only dismiss is once and after the first dismissal, the delegate is not called.
Post not yet marked as solved
20 Replies
0 Views
I also filed a feedback request. I hope that everybody that needs to have pre-existing data synced, do so as well.
Post not yet marked as solved
1 Replies
0 Views
Navigation too. 🙂
Post not yet marked as solved
8 Replies
0 Views
When I comment out a navigation link, the issue is gone. Will dig more.
Post not yet marked as solved
7 Replies
0 Views
The trick is to embed it inside a ZStack and make it appear via an @Binding.import Foundation import SwiftUI import EventKitUI let eventStore = EKEventStore() struct EKEventWrapper: UIViewControllerRepresentable { @Binding var isShown: Bool typealias UIViewControllerType = EKEventEditViewController var theEvent = EKEvent.init(eventStore: eventStore) func makeUIViewController(context: UIViewControllerRepresentableContext<EKEventWrapper>) -> EKEventEditViewController { // func makeUIViewController(context: UIViewControllerRepresentableContext<EKEventWrapper>) -> EKEventWrapper.UIViewControllerType { theEvent.startDate = Date() theEvent.endDate = Date() theEvent.title = "The Main Event!" let calendar = EKCalendar.init(for: .event, eventStore: eventStore) theEvent.calendar = calendar let controller = EKEventEditViewController() controller.event = theEvent controller.eventStore = eventStore controller.editViewDelegate = context.coordinator return controller } func updateUIViewController(_ uiViewController: EKEventWrapper.UIViewControllerType, context: UIViewControllerRepresentableContext<EKEventWrapper>) { // } func makeCoordinator() -> EKEventWrapper.Coordinator { return Coordinator(isShown: $isShown, event: theEvent) } class Coordinator : NSObject, UINavigationControllerDelegate, EKEventEditViewDelegate { @Binding var isShown: Bool init(isShown: Binding<Bool>, event: EKEvent) { _isShown = isShown } func eventEditViewController(_ controller: EKEventEditViewController, didCompleteWith action: EKEventEditViewAction) { switch action { case .canceled: print("Canceled") isShown = false // controller.dismiss(animated: true, completion: nil) case .saved: print("Saved") do { try controller.eventStore.save(controller.event!, span: .thisEvent, commit: true) } catch { print("Problem saving event") } isShown = false // controller.dismiss(animated: true, completion: nil) case .deleted: print("Deleted") isShown = false // controller.dismiss(animated: true, completion: nil) @unknown default: print("I shouldn't be here") isShown = false // controller.dismiss(animated: true, completion: nil) } } } }
Post not yet marked as solved
12 Replies
0 Views
Sorry to have hijacked the thread, but I got some inspiration, and some examples off of the internet. The thing doesn't work when presented modally, but does work in a VStack with a binding.import Foundation import SwiftUI import EventKitUI let eventStore = EKEventStore() struct EKEventWrapper: UIViewControllerRepresentable { @Binding var isShown: Bool typealias UIViewControllerType = EKEventEditViewController var theEvent = EKEvent.init(eventStore: eventStore) func makeUIViewController(context: UIViewControllerRepresentableContext<EKEventWrapper>) -> EKEventEditViewController { // func makeUIViewController(context: UIViewControllerRepresentableContext<EKEventWrapper>) -> EKEventWrapper.UIViewControllerType { theEvent.startDate = Date() theEvent.endDate = Date() theEvent.title = "The Main Event!" let calendar = EKCalendar.init(for: .event, eventStore: eventStore) theEvent.calendar = calendar let controller = EKEventEditViewController() controller.event = theEvent controller.eventStore = eventStore controller.editViewDelegate = context.coordinator return controller } func updateUIViewController(_ uiViewController: EKEventWrapper.UIViewControllerType, context: UIViewControllerRepresentableContext<EKEventWrapper>) { // } func makeCoordinator() -> EKEventWrapper.Coordinator { return Coordinator(isShown: $isShown, event: theEvent) } class Coordinator : NSObject, UINavigationControllerDelegate, EKEventEditViewDelegate { @Binding var isShown: Bool init(isShown: Binding<Bool>, event: EKEvent) { _isShown = isShown } func eventEditViewController(_ controller: EKEventEditViewController, didCompleteWith action: EKEventEditViewAction) { switch action { case .canceled: print("Canceled") isShown = false // controller.dismiss(animated: true, completion: nil) case .saved: print("Saved") do { try controller.eventStore.save(controller.event!, span: .thisEvent, commit: true) } catch { print("Problem saving event") } isShown = false // controller.dismiss(animated: true, completion: nil) case .deleted: print("Deleted") isShown = false // controller.dismiss(animated: true, completion: nil) @unknown default: print("I shouldn't be here") isShown = false // controller.dismiss(animated: true, completion: nil) } } } }