Has anyone figured out how to use the new OpenURLIntent
intent to open their own app using a custom URL scheme?
I have the following code:
@available(iOS 18, *)
struct BarcodeScannerControlWidget: ControlWidget {
var body: some ControlWidgetConfiguration {
StaticControlConfiguration(kind: "scannerIntent") {
ControlWidgetButton(action: OpenBarcodeScannerIntent()) {
Label("Scan Barcode", systemImage: "barcode.viewfinder")
}
}
.displayName("Scan Barcode")
}
}
@available(iOS 18, *)
struct OpenBarcodeScannerIntent: AppIntent {
static var title: LocalizedStringResource = "Scan Barcode"
func perform() async throws -> some IntentResult & OpensIntent {
let url = "myscheme:///barcodeScanner
let openURLIntent = OpenURLIntent(url)
return .result(opensIntent: openURLIntent)
}
}
Running this intent doesn't seem to do anything. If I replace the URL with say "https://www.apple.com", the intent opens up safari with that URL.