Apple is winning the AI race

Apple is winning the AI race

I don't think people realize how easy it is to make use of on-device AI models in an app on most of Apple's devices shipped in the past two years. And I'm talking about the currently shipping 26 versions of iOS and macOS...not some upcoming developer releases or betas.

A few lines of code are all you need.

First you make a struct to hold the generated results and you give the model instruction would what should go in it the data structure...in our case, an array:

@Generable
struct TagSuggestions {
    @Guide(description: "One or two lowercase tags: first is the best category, second only if it adds real value", .count(1...2))
    var tags: [String]
}

Next you give the model its instructions...think of these as the system prompt:

private let instructions = """
    You suggest tags for a personal journal entry that will be published as a blog post. \
    Your main job is to pick the best **category** tag — the single broadest topic the entry \
    belongs to. Prefer reusing a tag that already exists on the blog over inventing a new one; \
    only create a new tag when none of the existing ones fit at all. \
    Suggest at most one additional, more specific tag, and only when it clearly adds value. \
    When in doubt, suggest just the category. Tags are lowercase.
    """

For example, let's say you want to suggest some possible tags for a user of a blogging app based on the contents of the post that they've written.

Next you initiate the model and session:

let session = LanguageModelSession(model: model, instructions: instructions)

Finally, you construct the prompt and ask the model to respond to it by generating the TagSuggestions model.

let prompt: String
if existingTags.isEmpty {
    prompt = "Entry:\n\(body)"
} else {
    prompt = "Existing tags on the blog: \(existingTags.joined(separator: ", "))\n\nEntry:\n\(body)"
}
let response = try await session.respond(to: prompt, generating: TagSuggestions.self)

It's really that easy.

Notice what we haven't done and what isn't happening:

  • We haven't made any network requests
  • We haven't signed up for API access for openrouter or another model provider,
  • We don't need to manage API or user authentication credentials
  • There are no servers
  • We haven't sent the user's data to a third party,
  • And perhaps most importantly, it doesn't cost us or the user any additional money. We're using the hardware they already paid for and the battery they've already charged.
  • No one is training models on the user data

This is already available on 10s or 100s of millions of Apple devices already out there in the users' pockets and on their desks. In a couple years as older devices get retired, Apple's entire installed device base will support on device AI. And when people update the OS on their Apple devices (which almost everyone does), apps and developers will get access to even better on device models and the ability to transparently access more powerful models in Apple's secure cloud on the 27 versions.

All of this happens without the developer having to be responsible for handing user data over to a party the user hasn't already proactively opted-in to trusting. Sure you might not be doing agentic coding with these models or generating full length feature films on iPhones in the next year or two, but most apps aren't Claude Code or Kimi Code competitors. Many existing apps can often benefit from a sprinkling of AI to reduce some user friction here or add a bit of convenience there. The operating system tools and hardware to accomplish today is already out there waiting to be used. That looks like winning to me!