Post

Replies

Boosts

Views

Activity

Reply to How to use `.focusedSceneObject()` with @Observable?
I'm just migrating some ObservedObjects to Observable and ran into this problem with a Commands menu with a FocusedObject dependency. I want some entries in the menu to be enabled and to act on state from the Observable object. What finally worked for me (so far) is using a FocusedValues extension. I couldn't get this to work without the key path API, despite what the documentation says, and there doesn't appear to be a single example on the Internet. struct MyFocusedObservableStateValue: FocusedValueKey { typealias Value = MyObservableStateType } extension FocusedValues { var myObservableState: MyFocusedObservableStateValue.Value? { get { self[MyFocusedObservableStateValue.self] } set { self[MyFocusedObservableStateValue.self] = newValue } } } struct ItemActionsCommandMenu: Commands { @FocusedValue(\.myObservableState) var myObservableState var body: some Commands { CommandMenu("Menu Name") { // use myObservableState as needed (Note: It's optional) Button("Action") { } .disabled(...) } } } Elsewhere in App: myContentView .focusedSceneValue(\.myObservableState, myObservableState)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’25
Reply to Why does my universal links not work??
Can you clarify how you are testing the links? I've found that the simulator will not always open the links in my app, especially via Safari opening it in. The most reliable method for me has been to put the link into Reminders or another system app and then tap on it.
Topic: Safari & Web SubTopic: General Tags:
Jun ’24
Reply to AppIntentsPackage protocol with SPM package not working
As far as I can tell, reexporting an AppIntent defined in a framework using AppIntentsPackage and includedPackages has never worked since it was introduced at WWDC23. @gohnjanotis @alexanderwe I believe the only solution is to add your app intents directly to your app target and also any other extension target that uses them, I was able to get my shortcuts showing up in Shortcuts doing this. Unfortunately this workaround wouldn't work for an AppIntent defined in an SPM package like in the original question prompt.
Topic: App & System Services SubTopic: General Tags:
Sep ’23
Reply to AppIntentsPackage protocol with SPM package not working
Agree, I'm seeing the same thing here. It looks like prefixing AppIntents. in the shortcut provider actually just hides the shortcuts entirely from the metadata parser. if you look at the built Metadata.appintents/extract.actionsdata in derived data, it's clear the AppShortcutsProvider is detected correctly but that the intents, entities, and queries are not detected from the underlying package / framework. Assuming a beta bug with the package intent re-exporting at this point, too.
Topic: App & System Services SubTopic: General Tags:
Jun ’23
Reply to AppIntentsPackage protocol with SPM package not working
+1. I have roughly the same setup except I'm using a dynamic framework instead of a SPM package. I got the same error when I reference my AppIntent in a AppShortcutsProvider. Weirdly enough I just discovered that prefixing all the AppShortcut types with AppIntents fixed the issue for me. import AppIntents import MyIntentsFramework struct MyShortcutsProvider: AppShortcutsProvider { static var appShortcuts: [AppIntents.AppShortcut] { AppIntents.AppShortcut( intent: MyAppIntent(), phrases: ["Open \(.applicationName)"], shortTitle: "Title", systemImageName: "plus" ) } }
Topic: App & System Services SubTopic: General Tags:
Jun ’23
Reply to How to use `.focusedSceneObject()` with @Observable?
I'm just migrating some ObservedObjects to Observable and ran into this problem with a Commands menu with a FocusedObject dependency. I want some entries in the menu to be enabled and to act on state from the Observable object. What finally worked for me (so far) is using a FocusedValues extension. I couldn't get this to work without the key path API, despite what the documentation says, and there doesn't appear to be a single example on the Internet. struct MyFocusedObservableStateValue: FocusedValueKey { typealias Value = MyObservableStateType } extension FocusedValues { var myObservableState: MyFocusedObservableStateValue.Value? { get { self[MyFocusedObservableStateValue.self] } set { self[MyFocusedObservableStateValue.self] = newValue } } } struct ItemActionsCommandMenu: Commands { @FocusedValue(\.myObservableState) var myObservableState var body: some Commands { CommandMenu("Menu Name") { // use myObservableState as needed (Note: It's optional) Button("Action") { } .disabled(...) } } } Elsewhere in App: myContentView .focusedSceneValue(\.myObservableState, myObservableState)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’25
Reply to App rejected, because in-app purchase didn't load
Same here, I've received this rejection on several app submissions over the last few weeks. Resubmitting and crossing my fingers the view loads seems to be all that works. SubscriptionStoreView doesn't seem to timeout appropriately in a no-network situation. It'd be nice to be able to have control over prefetching the products before showing the view.
Replies
Boosts
Views
Activity
Dec ’24
Reply to Why does my universal links not work??
Can you clarify how you are testing the links? I've found that the simulator will not always open the links in my app, especially via Safari opening it in. The most reliable method for me has been to put the link into Reminders or another system app and then tap on it.
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to App Store Review Request error Swift 6
It's a known issue and has been reported. See: https://forums.swift.org/t/swift-5-10-concurrency-and-xctest/69929/12 https://github.com/swiftlang/swift/issues/72181 You'll have to comment it out for now or not enable Swift 6 complete concurrency checking.
Topic: App & System Services SubTopic: StoreKit Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to iOS: Unable to see the option of App Icon in the Product Page Optimization page in the app store connect
Same here after having an app approved with multiple icons in the binary.
Replies
Boosts
Views
Activity
Jan ’24
Reply to TipKit: showing a popover tip on a SwiftUI toolbar button
Specifying an arrow direction on my bottomBar toolbar button makes the tooltip show up for me. .popoverTip(tip, arrowEdge: .bottom)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to AppIntentsPackage protocol with SPM package not working
As far as I can tell, reexporting an AppIntent defined in a framework using AppIntentsPackage and includedPackages has never worked since it was introduced at WWDC23. @gohnjanotis @alexanderwe I believe the only solution is to add your app intents directly to your app target and also any other extension target that uses them, I was able to get my shortcuts showing up in Shortcuts doing this. Unfortunately this workaround wouldn't work for an AppIntent defined in an SPM package like in the original question prompt.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Sep ’23
Reply to iOS 17b6: Simultaneous accesses to ..., but modification requires exclusive access crash using Observation and SwiftUI
Not fixed in RC unfortunately.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’23
Reply to New Navigation / Title Bar Buttons are totally broken on latest Ventura beta for Catalyst apps
Hi @conradstoll, any chance you figured out anything here? We're seeing the same crash logs after changing our Ventura + Catalyst app to a SwiftUI with toolbars app.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jul ’23
Reply to xcodebuild exportLocalizations gives internal error when SWIFT_EMIT_LOC_STRINGS is YES
Thanks @Frameworks Engineer, I've filed FB12495249. I've narrowed the problem down to using an App Intent and have reproduced with a barebones sample project. Does not seem to be related to SWIFT_EMIT_LOC_STRINGS after all.
Replies
Boosts
Views
Activity
Jul ’23
Reply to AppIntentsPackage protocol with SPM package not working
Agree, I'm seeing the same thing here. It looks like prefixing AppIntents. in the shortcut provider actually just hides the shortcuts entirely from the metadata parser. if you look at the built Metadata.appintents/extract.actionsdata in derived data, it's clear the AppShortcutsProvider is detected correctly but that the intents, entities, and queries are not detected from the underlying package / framework. Assuming a beta bug with the package intent re-exporting at this point, too.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’23
Reply to AppIntentsPackage protocol with SPM package not working
+1. I have roughly the same setup except I'm using a dynamic framework instead of a SPM package. I got the same error when I reference my AppIntent in a AppShortcutsProvider. Weirdly enough I just discovered that prefixing all the AppShortcut types with AppIntents fixed the issue for me. import AppIntents import MyIntentsFramework struct MyShortcutsProvider: AppShortcutsProvider { static var appShortcuts: [AppIntents.AppShortcut] { AppIntents.AppShortcut( intent: MyAppIntent(), phrases: ["Open \(.applicationName)"], shortTitle: "Title", systemImageName: "plus" ) } }
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’23
Reply to SwiftUI Preview Don't work iOS 15 Xcode 13.0
In my case I messed up my previews by deleting simulator folders from the filesystem without going through xcode. I fixed this by running: xcrun simctl --set previews delete all
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’23