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
Post
Replies
Boosts
Views
Activity
Seems like the Framework isn’t included in beta 1 and will be available at a later point: https://developer.apple.com/forums/thread/731073?answerId=755102022#755102022
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?
}
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+
I noticed the same! The code the session uses at 6:58 isn’t working. The .modelContainer(for: [Trip.self, BucketListItem.self, LivingAccommodation.self]) code you’ve mentioned in the other comment is only for simple cases, and not really something to achieve the customization like yours …
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.
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
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.
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
}
}
}
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 …
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.
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).
After tons of experimenting (and help from Stack Overflow) I found the solution a few months ago.
This basically matches CryptoKoa’s answer above, so I’m accepting theirs. Just wanted to provide the slightly different code I’ve used regarding the different naming of the old Core Data model.
@main
struct MyApp: App {
let container: ModelContainer
init() {
// Legacy placement of the Core Data file.
let dataUrl = URL.applicationSupportDirectory.appending(path: "Model.sqlite")
do {
// Create SwiftData container with migration and custom URL pointing to legacy Core Data file.
container = try ModelContainer(
for: Foo.self, Bar.self,
migrationPlan: AppMigrationPlan.self,
configurations: ModelConfiguration(url: dataUrl))
} catch {
fatalError("Failed to initialize model container.")
}
}
var body: some Scene {
WindowGroup {
ContentView()
}
.modelContainer(container)
}
}
[quote='756215021, Forums Product Manager, /thread/756215']
Apple Developer Relations and Apple engineering are joining forces to field your questions and work to solve your technical issues.
[/quote]
This is super exciting to hear! I (and I think many other fellow devs) highly appreciate your efforts to make this happen. Getting more direct help from Apple engineers will be such a great thing. I’m looking forward to it.
Thanks a ton for all those news and updates. Keep it coming! 🙌
Thanks for the improvements and also thanks a lot for updating us on those changes! Great to see that our feedback get’s valued. Keep it coming! 👏