I'm testing with Version 16.1 beta (16B5001e).
Just to be clear. When replacing:
ShareView(message:"Hello (row)"
with:
ShareView(message:"Hello (selectedNo)"
I would expect to see 'Hello 1 when clicking on 'goto world 1' but I get 'Hello nil' the first time, on subsequent clicks on 'goto world1' it works and I see Hello Optional(1)
Post
Replies
Boosts
Views
Activity
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
}
}
I'm seeing similar issue, now with Xcode 15 beta.4. Has anyone else found a way to make WeatherKit work with 15.4?
Failed to generate jwt token for: com.apple.weatherkit.authservice with error: Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)"
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.
I got the same error before I added the WeatherKit to the project.