Post

Replies

Boosts

Views

Activity

Reply to Dynamic app shortcuts using AppShortcutsProvider and configurable AppIntent
If you look at the definition of AppShortcutsProvider, you see it a {get} and it uses @AppShortcutsBuilder for special formatting of the shortcuts. So, you'll have to eternalize your conditional definition of appshortcuts. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) public protocol AppShortcutsProvider { @AppShortcutsBuilder static var appShortcuts: [AppShortcut] { get } /// The background color of the tile that Shortcuts displays for each of the app's App Shortcuts. static var shortcutTileColor: ShortcutTileColor { get } } Here's one way to accomplish this: struct EventManagerShortcuts: AppShortcutsProvider { static var shortcutTileColor: ShortcutTileColor = .lime // Max 10 shortcut actions per App. We need to make them dynamic by role and condition. static var appShortcuts: [AppShortcut] { return EventManagerShortcuts().createAppShortcuts() } private func createAppShortcuts() ->[AppShortcut] { var appshortcuts = [AppShortcut]() // Access the ViewModel let viewModel = HomePage() // Filter the objects we want to show as Shortcuts let activeHomePageElements = viewModel.homePageElements .filter({ $0.systemState != .idle && $0.userState != .idle }) //. use std syntax for the loop to create shortcuts for element in activeHomePageElements { switch element.action { case .AssignAgenda: let NextMeetingShortcutPhrases : [AppShortcutPhrase<NextMeetingShortcut>] = [ "Start a business event with \(.applicationName)", "\(.applicationName) business meeting", "Event for \(.applicationName)", "Start a Salesforce event with \(.applicationName)" ] let nextMeetingShortcut = AppShortcut(intent: NextMeetingShortcut(), phrases: NextMeetingShortcutPhrases, // shortcutsUIButton(style: .darkOutline) // shortcutTileColor: Color.green, shortTitle: "Next Business Meeting", systemImageName: "person.3") appshortcuts.append(nextMeetingShortcut) case .PrepareEvents: break ............ Etc. } } return appshortcuts } }
Jan ’24
Reply to Simulator causing Mac audio distortion
The XCode simulator generates sounds (anything from Picker wheel clicking to audio/haptic generated by the App) and every time it generates a sound it pauses any Bluetooth device I have connected for a second or two. When it starts again, the audio is distorted and audio level is changed. This is really annoying. From reading the replies above, I directed the system audio to the Mac Studio speakers and that solved the problem, but now I'm not getting the alerts as I'm on headphones. The solution is for Apple to overlay the two audio channels seamlessly without stopping/starting any audio.
May ’23