ios – How to Dynamically Open App with AppIntent


I am trying to dynamically determine whether the AppIntent opens the app, as dictated by the openAppWhenRun property. Sometimes it should open the app and sometimes it shouldn’t.

What I have tried

  1. I tried having nested AppIntents so the main AppIntent would either run the AppIntent which opens the app or run the AppIntent which doesn’t. However, it gave me the following error: Function declares an opaque return type 'some IntentResult & OpensIntent', but the return statements in its body do not have matching underlying types
    func perform() async throws -> some IntentResult & OpensIntent {
        if (condition) {
                return .result(opensIntent: OtherIntent())
        }
            
        return .result(opensIntent: NestedIntent())
    }
  1. I tried making “ not static and changing it at runtime but this didn’t work

It’s important to note that I also don’t want to use needsToContinueInForegroundError() or requestToContinueInForeground() since they require user confirmation.

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img