Request Reminders Access

So I'm looking to add a button to my app that would create and fill a reminder in the user's Reminders app, but I've found that I first need to request access to the user's Reminders app data. I've also found the way to do that has been changed with iOS 17 as explained here: https://developer.apple.com/documentation/eventkit/ekeventstore/4162273-requestfullaccesstoreminders

How do I use this function so that the prompt requesting for access to the user's Reminders app pops up at the launch of the app every time unless they've previously given permission?

Also what would be the function to create the reminder once I do have permissions? This is the code ChatGPT gave me to do so, but I just keep getting "Failed to create Reminder URL".

func createReminder() {
        let reminderTitle = "******** Groceries"
        var subtaskStrings: [String] = []

        for ingredient in shoppingList {
            subtaskStrings.append(ingredient)
        }

        let subtasks = subtaskStrings.map { (ingredient) -> [String: Any] in
            return [
                "title": ingredient,
                "completed": false
            ]
        }

        let reminderData: [String: Any] = [
            "title": reminderTitle,
            "subtasks": subtasks
        ]

        if let reminderURL = createURL(for: "x-apple-reminder://", with: reminderData) {
            UIApplication.shared.open(reminderURL)
        } else {
            print("Failed to create Reminder URL")
        }
    }

Also I intend on expanding this function to the notes app. But im taking one step at a time.

Any help would be GREATLY appreciated. Thanks!