Posts

Post not yet marked as solved
5 Replies
For people also struggling with a button styled Toggle(), Apple recommended in a Feedback to also place the .buttonStyle(.borderless) before the .toggleStyle(.button). Unfortunately that doesn’t work on macOS for me. Neither of the other tricks helped either … but at least for iOS and visionOS it seems to work for me (running iOS 17.4).
Post not yet marked as solved
2 Replies
I don’t think this is possible. There seems to be a private framework that Apple uses for Animoji called AvatarKit. There’s a project on GitHub that plays around with that very framework. Though, as they mention: This project relies heavily on Apples private API and you should therefore not try to submit this code to App Store.
Post not yet marked as solved
1 Replies
Apples support document, does not list the iPad Mini as supported devices (as of March 24, 2024): iPhone 12 or later iPad Air (5th generation) iPad Pro 11-inch (3rd generation) or later iPad Pro 12.9-inch (5th generation) or later Mac with Apple silicon In another thread, a user confirmed that the iPad Mini 6 is supported though …
Post not yet marked as solved
1 Replies
According to the Spotlight your app with App Shortcuts session (at 13:34) you need to add shortTitle and systemImageName to the AppShortcut that it appears in Spotlight. AppShortcut( intent: ShowTopDonutsIntent(), phrases: [ "\(.applicationName) Trends for \(\.$timeframe)" ], shortTitle: "Trends", systemImageName: "chart.line.uptrend.xyaxis" ) In the session they also say: Note that if I want the entity shown at the top level in Spotlight or Shortcuts, my entities need to have an image or symbol in the display representation. Though, to be fair I couldn’t get it to work for AppEnums – only for AppEntities. See my questions for more details.
Post not yet marked as solved
1 Replies
Yes, that’s possible. Check out this great example on GitHub: https://github.com/mralexhay/Booky/blob/main/Shortcuts/Actions/OpenBook.swift The code is basically the following: // These will be the options in the Shortcut action to open a book or navigate to the library enum NavigationType: String, AppEnum, CaseDisplayRepresentable { case library case book // This will be displayed as the title of the menu shown when picking from the options static var typeDisplayRepresentation = TypeDisplayRepresentation(name: "Navigation") static var caseDisplayRepresentations: [Self:DisplayRepresentation] = [ .library: DisplayRepresentation(title: "Library", subtitle: "Return to the home page", image: .init(systemName: "books.vertical")), .book: DisplayRepresentation(title: "Book", subtitle: "Navigate to a specific book", image: .init(systemName: "book")) ] } struct OpenBook: AppIntent { // Title of the action in the Shortcuts app static var title: LocalizedStringResource = "Open Book" // Description of the action in the Shortcuts app static var description: IntentDescription = IntentDescription("This action will open the selected book in the Booky app or navigate to the home library.", categoryName: "Navigation") // This opens the host app when the action is run static var openAppWhenRun = true // A dynamic lookup parameter @Parameter(title: "Book", description: "The book to open in Booky", requestValueDialog: IntentDialog("Which book would you like to open?")) var book: ShortcutsBookEntity // An enum parameter @Parameter(title: "Navigation", description: "Choose whether to open a book or navigate to Booky's library", default: .book, requestValueDialog: IntentDialog("What would you like to navigate to?")) var navigation: NavigationType // How the summary will appear in the shortcut action. static var parameterSummary: some ParameterSummary { Switch(\OpenBook.$navigation) { Case(NavigationType.book) { Summary("Open \(\.$navigation) \(\.$book)") } Case(NavigationType.library) { Summary("Open \(\.$navigation)") } DefaultCase { Summary("Open \(\.$navigation) \(\.$book)") } } } @MainActor // <-- include if the code needs to be run on the main thread func perform() async throws -> some IntentResult { do { if navigation == .book { let matchingBook = try BookManager.shared.findBook(withId: book.id) ViewModel.shared.navigateTo(book: matchingBook) } else { ViewModel.shared.navigateToLibrary() } return .result() } catch let error { throw error } } }
Post not yet marked as solved
1 Replies
Yes, the Navigator class is probably a singleton class here. Probably so that it can be used outside the apps main thread. It’s basically an ObservableObject object that you can then use as @EnvironmentObject to bind a @Published variable for example to a NavigationStack(path: $navigator.somePath) or TabView(selection: $navigator.someView). This way you can control which view/navigation path the app should navigate to from outside any view. Quite useful for things like Shortcuts. Code Example Apple’s NavigationCookbook example uses this technique. Though, another great example is Booky on GitHub! It’s a great source for the same concept here + generally how AppIntents work for Shortcuts. Check out the specific places in code her: Singleton Class Binding in App View Intent Action Use
Post marked as Apple Recommended
As confirmed by an Apple engineer on the other post, Tip Kit is now finally available starting with Xcode Beta 5! Check out the Xcode release notes for more information and known issues.
Post not yet marked as solved
4 Replies
Yes, @lyonnaip is right! The Apple Documentation states that the SwiftData framework will be available on: iOS 17.0+ iPadOS 17.0+ macOS 14.0+ Mac Catalyst 17.0+ tvOS 17.0+ watchOS 10.0+
Post not yet marked as solved
9 Replies
First I was confused as well, but your own comment @Mcorey and looking at the example code helped me to figure it out. As you’ve said you basically have to omit the @Relationship in one of the entities and replace it with a simple variable in the other one. Example Code Main Entity: @Model final public class MainItem { var title: String @Relationship(inverse: \ChildItem.item) var childs: [ChildItem]? } Child Entity: @Model final public class ChildItem { var timestamp: Date // Add inverse as a simple variable var item: ChildItem? }
Post not yet marked as solved
1 Replies
Hi there! Apple’s App Store Connect Help states the following for App Units: App Units The number of first time purchases of your app made on the App Store on devices running macOS 10.14.1, iOS 8, or tvOS 9, or later. An app unit is counted when a customer taps the ‘Get’ or ‘Price’ button for the first time. App updates, downloads from the same Apple ID onto other devices, and redownloads to the same device are not counted. Family Sharing downloads are included for free apps, but not for paid apps. – https://help.apple.com/app-store-connect/#/itc21781223f If users already bought or downloaded the app for free, they get tagged as “Installations” when they redownload the app. We once tested this for a campaign with friends who didn’t bought the app yet. As expected exactly after the 5 purchases (aka App Units) the campaign appeared in ASC. The answer is a little late, but maybe it helps someone. – Alex