HomeiOS Developmentswift - Methods to conditionally embrace AppIntents that for ios 17, whereas...

swift – Methods to conditionally embrace AppIntents that for ios 17, whereas supporting ios 16


I attempted to do:

    static public var appShortcuts: [AppShortcut] {
    AppShortcut(
        intent: OpenAppIntent(),
        phrases: ["Start (.applicationName)"],
        shortTitle: "Begin nothing fancy title",
        systemImageName: "canine.circle.fill"
    )
    
    /// `OpenShortcutIntent` permits individuals to rapidly open shortucts.
    if #out there(iOS 17, *) {
        AppShortcut(intent: OpenShortcutIntent(), phrases: [
            "Play (.$shortcut)",
            "Play (.$shortcut) on (.applicationName)"
        ],
                    shortTitle: "Play Characteristic",
                    systemImageName: "cloud.rainbow.half",
                    parameterPresentation: ParameterPresentation(
                        for: .$shortcut,
                        abstract: Abstract("Play (.$shortcut)"),
                        optionsCollections: {
                            OptionsCollection(ShortcutEntityQuery(), title: "Shortcuts", systemImageName: "cloud.rainbow.half")
                        }
                    ))
    } else {
        // Fallback on earlier variations
    }
}

That produces the next error:

(Closure containing management movement assertion can’t be used with consequence builder ‘AppShortcutsBuilder’)

If I attempt to not help ios 16 in any respect with the AppIntents like this:

@out there(iOS 17.0, *)
public class LaunchGameShortcuts: AppShortcutsProvider {

I get a crash in ios16 as a result of it cant discover the intent, after I launch it from Shortcuts. I assume the xcode construct course of is producing some meta information that’s uncovered in ios 16.

The explanation I cant expose the OpenShortcutIntent intent is that:

'init(intent:phrases:shortTitle:systemImageName:parameterPresentation:)' is simply out there in iOS 17.0 or newer

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments