First I thought this might work for you:
public struct MyShortcutsProvider: AppShortcutsProvider {
public static var appShortcuts: [AppShortcut] = shortcuts()
private static func shortcuts() -> [AppShortcut] {
if #available(iOS 18.0, *) {
[AppShortcut(intent: IntentA(), phrases: [""])]
} else {
[AppShortcut(intent: IntentB(), phrases: [""])]
}
}
But apparently it's not that easy to make @AppShortcutsBuilder static var appShortcuts: [AppShortcut] { get } dynamic.