Sunday, March 24, 2024
HomeiOS Developmentios - Edit button not exhibiting up on edit occasion view utilizing...

ios – Edit button not exhibiting up on edit occasion view utilizing EKEventViewController


I’m engaged on a SwiftUI app and have created a bridge/coordinator to open an occasion particulars view. This view often has “Edit” button to permit enhancing the occasion, however I’m not seeing it once I run the code beneath in iOS 17. It really works in iOS 16.

Code:

import SwiftUI
import EventKitUI

struct EKView: UIViewControllerRepresentable {
    func makeCoordinator() -> Coordinator {
        return Coordinator(self)
    }

    @Atmosphere(.presentationMode) var presentationMode
    var existingEvent: EKEvent

    func makeUIViewController(context: UIViewControllerRepresentableContext<EKView>) -> EKEventViewController {
        let eventViewController = EKEventViewController()
        eventViewController.delegate = context.coordinator
        eventViewController.occasion = existingEvent
        eventViewController.allowsCalendarPreview = true
        eventViewController.allowsEditing = true
        return eventViewController
    }

    func updateUIViewController(_ uiViewController: EKEventViewController, context: UIViewControllerRepresentableContext<EKView>) {

    }

    class Coordinator: NSObject, EKEventViewDelegate {
        let guardian: EKView

        init(_ guardian: EKView) {
            self.guardian = guardian
        }

        func eventViewController(_ controller: EKEventViewController, didCompleteWith motion: EKEventViewAction) {
            if motion == .deleted {

            }
            
            if motion == .carried out {

            }

            guardian.presentationMode.wrappedValue.dismiss()
        }
    }
}

Anybody right here tried opening present occasion utilizing “EKEventViewController” on iOS 17. Does edit button be just right for you? Or how do I make edit button seen to edit/delete the occasion?



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments