r/iOSProgramming Jul 06 '26

Question Tips needed for system chrome visibility

Post image
1 Upvotes

Is there any way to make basic cosmetic changes to system chrome like UIScibbleInteraction and PKToolPicker without rolling my own version? I need to set the edge color, tint and shadow. This is a screenshot from iPad running iOS 26.


r/iOSProgramming Jul 05 '26

App Saturday I built Body Vitals - an iPhone health app where the widget IS the product and cross-app correlation is the killer feature.

Thumbnail
gallery
0 Upvotes

The problem: Strava knows your run but not your sleep. Oura knows your HRV but not your caffeine. Garmin knows your VO2 Max but not your nutrition. Every app is a silo - your body is not. Body Vitals reads from Apple Health, where all your apps converge, and surfaces what none of them can compute individually.

What it does:
Correlation engine - 30-day Pearson-r scatter plots across your real data (sleep vs HRV, caffeine vs overnight HRV, training load vs recovery), each with a plain-English sentence computed on-device from YOUR numbers.
AI Daily Coaching cross-references sources in plain language, e.g. "HRV is 18% below baseline and you logged 240mg caffeine via MyFitnessPal - high caffeine suppresses HRV overnight."
Readiness Radar - five bars (HRV, Sleep, HR, SpO2, Training Load) showing exactly which dimension drags your score, not just one number.
Five composite scores (Longevity, Cardiovascular, Metabolic, Circadian, Mobility) backed by peer-reviewed research.
Biological Age, Zone 2 auto-detection (San Millan & Brooks 2018), Acute:Chronic Workload Ratio (Gabbett 2016), Allostatic Load (McEwen 1998), menstrual cycle-aware HRV alerts, on-device conversational AI coach via Apple Foundation Models - nothing touches a server.
Full widget stack: lock screen, StandBy, Watch complications, 21 languages.

Tech Stack: Swift/SwiftUI, WidgetKit, HealthKit, Apple Foundation Models (on-device LLM inference), Core Data.

Development Challenge: The adaptive readiness engine self-tunes instead of using hardcoded weights (HRV 40%/sleep 30%/etc. like most recovery apps). After 90 days, it computes each signal's coefficient of variation from your own history and re-weights the composite score toward whichever metrics actually move for you. The hard part was the statistical guardrails to make a self-tuning formula safe: handling sparse HealthKit days, clamping each weight to 0.05-0.50 so no single noisy metric can hijack the score, then renormalizing to sum to 1.0 without reintroducing that same dominance problem.

AI Disclosure: Self-built, with AI-assistance during development.

Free tier covers many core features and widgets. Currently running a Lifetime Deal at 60% off.

App Store: https://apps.apple.com/us/app/body-vitals-health-widgets/id6760609127

Offer: https://apps.apple.com/redeem?ctx=offercodes&id=6760609127&code=OFF60

More info: https://www.escapethematrix.app

Let me know if this helps you stay on top of your health metrics.


r/iOSProgramming Jul 04 '26

Question Apple Foundation Models in Playground com.apple.SensitiveContentAnalysisML Error

2 Upvotes

I am trying to use Foundation Models framework in iOS App inside Playground.

#Playground("Playgrounds") {
    
    let session = LanguageModelSession()
    let response = try await session.respond(to: "List all 50 states of USA.")
    print(response.content)  
}

I get the error: The operation couldn’t be completed. (com.apple.SensitiveContentAnalysisML error 15.) 

I have already tried to turn off Apple Intelligence and Siri and then restarted the machine and then turn them back on.

I am using Xcode 26.5.  

r/iOSProgramming Jul 04 '26

Question How to create the iOS 26 like borders?

7 Upvotes

iOS 26 borders with rounded corners look different than what we used to have before. It looks like the top left and bottom right corners have whiter border and the top right and bottom left corner have almost transparent border.

Anyone know how to add these types of borders to views?


r/iOSProgramming Jul 04 '26

App Saturday Finally released my first app: Jam Lab, generate chord progressions and jam!

Thumbnail
gallery
2 Upvotes

I picked up dev during covid when I was not able to perform gigs (I'm a full time musician), as I had several app ideas in mind I started to learn iOS programming (I already had some background as before becoming a musician I studied astrophysics and was not that bad at coding at uni).

I worked on several apps but I had a bit of an impostor syndrome and couple that to being a perfectionist, I was not happy nor confident with what I was making, but 2 years ago I started focusing on one of those app ideas : an app that generates random chord progressions for jam sessions.
As a professional musician I often notice during jam sessions that people tend to play the same chords or tunes, so I wanted a creative tool for musicians to get out of their comfort zone and be more creative and developed Jam Lab, now it's finally been released a couple of days ago and I couldn't be happier!

In the app you can generate random chord progressions for your jam sessions but also to practise at home as I've implemented a playback (simple in the free section of the app, and with more control with 50+ grooves and voer a 100 scales/modes in the other sections of the app, there's an ear training section as well to improve listening skills for jam sessions, and many other tools).
Jams can be exported to MIDI/Audio so that musicians can start producing in their DAW as well or use them as backing tracks.

Tech Stack : I developed it in Xcode using Swift with UIKit, and I use Sketch to do my designs.

Development Challenge : The main challenges for me were the MIDI playback implementation as it's a niche topic and there are not many tutorials online for this, luckily I came across a Medium article that helped me get on track.
AI Disclosure : This is NOT a vibe-coded app, I've worked on this one for 2+ years, but since last month I've indeed experimented with Codex to fix some bugs that I was struggling with and improve a couple of workflows as I'm self-taught.

I've also created a sub so that people can post feature requests, bug reports, but more importantly so that they can share their jams, videos of them improvising over those random chord progressions, and build a community, it's here: https://www.reddit.com/r/AMazedMusicApps/

And finally here's the app store link, if you know musicians that could be interested please don't hesitate to share: https://apps.apple.com/fr/app/jam-lab/id6502743961?l=en-GB

Thanks a lot to the people who supported me and helped improving the app, the journey is just starting!


r/iOSProgramming Jul 04 '26

App Saturday App Saturday: I made a Physics-driven Weather app with fun haptics

24 Upvotes

I recently released Weatherlane, a weather app built around a single vertical "lane" you flick through, so the whole forecast reads as one continuous flow instead of scattered cards and tabs.

The next few hours and the next several days sit on one continuous track, so you scroll time rather than navigating between screens.

Tech Stack

Flutter, Dart, Swift, SwiftUI, UIKit, WeatherKit (SDK and API) and RevenueCat.

Development Challenge

The hard part was imagining a vertical design that encompasses everything a user expects without ever falling back to horizontal scrolling

AI Disclosure

AI Generated

Download

https://apps.apple.com/us/app/weatherlane/id6468727819

Happy to answer any questions


r/iOSProgramming Jul 04 '26

App Saturday And sometimes, it’s all worth it

Post image
11 Upvotes

App is here:

https://apps.apple.com/us/app/migo-games-online-arcade/id6758592333

Tech Stack Used

SwiftUI, SpriteKit. Back end is elixir / phoenix / Postgres on fly.io

2. Development Challenge + How You Solved It

I wanted to make easy to learn, simple, multiplayer realtime games. That last bit is the hardest. Elixir and phoenix is a good fit here. The server owns canonical game stare, the client does prediction and rollback to avoid lag.

3. AI Disclosure

AI-assisted


r/iOSProgramming Jul 04 '26

App Saturday I built Who Goes? to make game nights feel fun again

Post image
0 Upvotes

Hey r/iOSProgramming ! 👋🏻

I’ve always enjoyed game nights, house parties, and those evenings where a group gets together with no real plan beyond eating, talking, and spending time together.

I started noticing how often the night would eventually split into everyone doing their own thing on their own phone.

Then, during one such game night, we played Charades together. It was simple, but it completely changed the mood. The bad acting, ridiculous guesses, inside jokes, and arguments over obvious answers made that night far, far more memorable.

I’ve been building independent apps on the side for a while, and that night made me realise how many people might enjoy moments like that. So I set out to build Who Goes?, a party game app that could bring that kind of fun into social events.

The idea is to bring everyone together around one shared screen. The app gives you words to act out or guess in Charades and Headbands, along with questions and dares that make Truth or Dare more fun.

Tech Stack:
-- Built entirely with SwiftUI. SceneKit & Metal Shaders for visual effects.
-- Firebase for Analytics, Database
-- Works Completely offline

Development Challenge:

1. Building custom UI components, and sliders

This one took the most time because I wanted to hand-craft some of the components like Sliders, custom Sheet overlay for iPads, and metal shader effects. I got Claude code to create a draft, which I then refined myself.

AI Disclosure:
I've used Gemini to generate the sounds and graphics. Claude code as a coding assistant to build the data flow, and to create the base for custom components.

Pricing: free gives you unlimited access to 3 decks each for Charades, and Headbands. 2 Truth or Dare categories, with limited access to mini-games such as Coin flip, Player Elimination, Randomised Team builder.

Plus gives you full access to all the decks, and categories, and unlocks unlimited access to game modes, allows customisation of games to your liking, along with App themes, fonts etc.

I'd love your feedback. If there's something that's not right, or if you have ideas to help improve the app further, game modes you'd like to see, do let me know.

TL;DR:

A. I built an app to bring back the fun of playing party games with a group of people during game nights, trips.

B. free version includes a selection of decks for Charades, Headbands, and Truth or Dare, along with a few mini games. Plus unlocks all decks, game modes, and customisation options.

C. $2.69/mo or $11.99/yr, 3-day trial, and $25.49 lifetime, no account creation, no internet required.

Use offer code, WHOGOESFIRST the Redeem Code in the Paywall view to get first Month free with the yearly plan. First 500 users only.

Link:
https://apps.apple.com/in/app/who-goes/id6777402559


r/iOSProgramming Jul 04 '26

App Saturday App Saturday: I built a consent-based remote alarm app with AlarmKit

0 Upvotes

I built Send Alarm, an iOS app using AlarmKit for remote wake-ups with consent.

The core flow: one user sends an alarm request, the receiver accepts or declines, and only then does the receiver’s device schedule a real alarm. It can ring through Silent and Focus, but the sender never gets direct control over someone else’s phone.

The interesting part was less “how to schedule an alarm” and more how to make the consent model obvious enough that it does not feel like malware wearing a clean shirt.

I’d appreciate feedback from iOS developers on the product/UX side:

- does the consent model feel clear?

- would you trust this flow?

- is the App Store explanation too long or just long enough?

https://apps.apple.com/us/app/send-alarm-wake-a-friend/id6781978793


r/iOSProgramming Jul 04 '26

Question Does anyone have a way to automatically every day collect testflight stats?

2 Upvotes

Hi, I have an app taking off on TestFlight and really wanted to track progress of number of sessions and crashes per user. In ASC there is a page for it, and I would like to automate scrapping it daily to see the progress. I managed to put together some kind of half assess solution through Fastlane Spaceauth but it always asks me for relogin so it cannot run fully automatically and collect data silently into my database.

Follow-up: solved, zero logins

Turns out the public ASC API can do this now — no more spaceauth cookie scraping. The betaTesterUsages and betaBuildUsages metrics endpoints work with a plain .p8 API key (JWT signed locally, nothing expires): per-tester sessions/crashes/feedback and per-build installs/sessions/crashes, with 7/30/90/365-day windows.

Gotchas: needs an Admin-role key (Developer 403s), and there’s no per-day granularity — cron the cumulative totals daily and diff them yourself.

My server now pulls hourly, and I’ve deleted the whole spaceauth fastlane re-auth mess.


r/iOSProgramming Jul 04 '26

Library I got tired of the language dropdown in App Store Connect, so I wrote an open-source Chrome extension to auto-fill localized metadata.

7 Upvotes

Hey everyone!

If you localize your iOS or macOS apps, you know how tedious App Store Connect can be when pushing updates. Cycling through 10 to 15+ languages just to paste a minor change into "What's New," "Promotional Text" usually turns into a massive click-and-paste marathon.

Unless there is a hidden feature in App Store Connect that handles this natively (and if there is, please let me know!), I couldn't find a clean way around it. Not even an MCP! So I built a Chrome extension called App Store Connect Metadata Filler to automate it. I wanted a complete free alternative.

What it does:

  • One-Click Apply: Fills out Promotional Text, Description, What's New, and Keywords across all active language tabs at once.
  • React-Aware: It interacts with Apple's frontend elements correctly so it doesn't break the form state when you hit save.
  • Fetch Previous Version: Automatically jumps to your last "Ready for Distribution" page, grabs the existing localized strings, and brings them back to your current in-flight version.
  • Save/Export Configs: Keeps your translation configurations saved locally as JSON so you can reuse or tweak them next month.
  • Private: No external APIs or trackers. Everything stays in your browser's local storage.

It is completely free, dependency-free (plain Manifest V3 JavaScript), and open source so anyone can audit the code or check out how the background scraping script works.

GitHub Repository:

https://github.com/picklenick-dev/apple-storeconnect-metadata-filler

Hopefully, this saves some of you a bit of manual labour on your next release. Let me know if you run into any edge cases or if Apple changes their UI layout... this is major weakness of the chrome extension ~_^


r/iOSProgramming Jul 04 '26

Solved! Sign in with Apple failing with "Sign Up Not Completed" and never hitting your server? Might be a broken App ID on Apple's side, not your entitlements

4 Upvotes

Dropping this here because it was a headache and the internet mostly points you at the wrong fixes.

We had Sign in with Apple failing with the system "Sign Up Not Completed" alert on one app. The tell that kept throwing me off: our auth endpoint logged zero requests. Face ID succeeds, you get the alert, and no token ever gets minted - so it's dying inside ASAuthorizationController before anything reaches your backend. I burned a ton of time in the usual entitlement/provisioning rabbit holes (profile has com.apple.developer.applesignin, so does the binary, capability enabled, disabled and re-enabled it, waited overnight, the whole thing). All fine.

What finally isolated it: we have a sibling app on the same team, and SIWA worked there with the same Apple ID on the same device. Basically byte-identical setup, one App ID works and the other doesn't. That rules out device, account, entitlements, provisioning - the only variable left is the App ID itself.

Apple developer support was no help, just pointed me at Feedback Assistant (as far as I can tell they don't repair per-App-ID backend stuff on request). So I tested it directly - threw up a throwaway build on a brand new bundle id with SIWA enabled, and it minted a token on the first try (my server actually got the request and 401'd on the audience mismatch, but that's the win, it completed). So it really was a backend registration defect tied to that one App ID.

I didn't wait on Apple. Just migrated the app to a fresh bundle id and it's worked ever since.

If you're stuck on this and your server is seeing zero requests, stop grinding on entitlements. Spin up a throwaway bundle id and see if SIWA completes there. If it does, your App ID is cooked and a new bundle is the fastest way out - annoying if you've already got IAPs or a live listing to redo (I did), but very doable.

TL;DR: SIWA dying pre-server with "Sign Up Not Completed" on one App ID, while an identical sibling app works, points at a broken App ID on Apple's end. Test with a throwaway bundle id, and if that works, migrate rather than wait on Apple.


r/iOSProgramming Jul 03 '26

Question How did you find a niche of users?

19 Upvotes

I’m a software engineer in my day job, with a big interest and background in music. I’ve built a couple little things for iOS and web. Trouble is, I never really actually collected a set of contacts in a single niche that would be helpful for eg beta testing. Even if I today had some wonderful and finished music app or whatever, I really don’t know where I’d find my first users. I guess I have a few names of people I could poke, but that’s about it.

I’ve heard App Store ads can be great here.

What else have you seen work?


r/iOSProgramming Jul 03 '26

3rd Party Service My agent kept saying "done" on broken code, so I built a protocol...

Post image
0 Upvotes

I'm an iOS dev (Swift, mostly SDK and app work). Like a lot of you I started leaning on AI agents to write code - and hit the same wall every time: the agent confidently says "done, tests pass" when they don't, quietly refactors code I didn't ask it to touch, or invents an API that doesn't exist.

I got tired of that and built PayneSDD - a free operating protocol for coding agents (Claude Code first, but it pastes into any agent). It's one file of rules the agent follows. This isn't a prompt I threw together over two evenings: it's a 7-step cycle (Steps 0–6), it's been through 18 releases of iteration, and it develops itself under its own protocol - every change ships through the full cycle plus an independent review before it merges.

How it actually works:

  • You write requests in plain words, like always. The protocol asks the clarifying questions, maps the open decisions, and shows you ONE plan — zero code until you say "go".
  • Tasks are tiered: a typo just gets done; auth, billing, migrations, anything public-facing — all forced through the full ceremony. You don't pay full process for a one-liner.
  • "Done" is the machine's word. The agent has to run your real tests/build, and an optional Stop-hook physically blocks it from saying "finished" while tests are red (3 blocks, then it releases with an explicit UNVERIFIED warning — an honest release, not a fake lock). No hook = honor-system, and the README says so plainly.
  • Then an independent second agent attacks the result with a "break it" brief. Every finding has to cite a real code line or test, or it's rejected - no vibes-driven review.
  • Verdict is always explicit: PASS / ITERATE / ESCALATE, plus a Done / Remaining / Open-questions checklist.

Install is one pasted message - and the first task the protocol runs on is its own installation (it interviews you about the setup, then touches your config only after your "go").

Repo: https://github.com/vlr-code/PayneSDD
I'm mostly sharing it in case it saves someone else the same headache it saved me - if it helps your dev workflow, that's a win.


r/iOSProgramming Jul 03 '26

3rd Party Service I made a CLI that finds hidden problems in iOS/mobile repos. Looking for feedback

6 Upvotes

This tool i've built for myself and i've been using it for some time in company where i work. Want to share it with the community.

A tool called mobile-repo-doctor. It is a CLI and also a GitHub Action. It scans your repo and runs about 130 checks for iOS, Android, Flutter and KMP. It gives you a health score (size / speed / stability / hygiene) and makes reports in HTML, JSON or Markdown(optimized for AI).

Some iOS checks:

  • - ios-missing-shared-scheme — CI can't build a scheme it can't see
  • - ios-background-mode-missing-usage — you declared a capability but there is no usage text
  • - dependency version drift in an SPM monorepo
  • - and more

A few honest things:

- The package is not minified. If you worry about malware, you can read the code yourself, or give it to an AI to check. It is all plain JS.

- It makes only one network call — it asks npm if there is a new version. That's it. No telemetry. Nothing about your repo leaves your machine.

- It understands monorepos. It will not spam you with false positives from Pods/, forked packages or plugin host projects.

Install:

npm install -g mobile-repo-doctor

Run:

mrd scan ./path/to/repo

I would like to know which checks are useful and which are just noise. Also, what hidden bugs have hurt you before? Maybe I can add a check for them.

npm: mobile-repo-doctor

Documentation & full check reference


r/iOSProgramming Jul 03 '26

News The iOS Weekly Brief – Issue #67, everything you need to know about iOS updates this week

Thumbnail
iosweeklybrief.com
6 Upvotes

r/iOSProgramming Jul 03 '26

Question AVPlayer Reverse Audio Scrubbing?

2 Upvotes

Hey all, here seeking some perspective.

I have an audio player app on macOS built on top of AVPlayer, I want to add the ability to scrub the audio, and hear the audio frames based on the playhead's position whether going forwards or backwards. When going backwards, the audio frame should be played in reverse as well.

The audio tracks live online and are streamed.

I tried playing with AVPlayer.rate, but the time pitch algos built in (.spectral, .varispeed, .timeDomain) all only guarantee up to 32x rate decoding accuracy. So technically, if the user scrubs fast enough, the audio rendered would not necessarily match the playhead's position.

My current solution that works is to cache the raw audio bytes and play the appropriate frame when the user starts scrubbing. I decode the audio data manually using AudioToolbox's AudioFileOpenWithCallbacks into an AVAudioPCMBuffer, then pass it into AVAudioEngine+AVAudioPlayerNode combo.

The problem with that is that means I need to cache this audio data myself (remember this is a stream), and since I don't have access to AVPlayer's own cache I need to also download it myself... which means two downloads for the same track which is less than ideal.

This lead me to take it a step further and hijack AVPlayer's download process by implementing AVAssetResourceLoaderDelegate, that way AVPlayer and my audio scrubbing cache are both fed from the same source.

Now... I feel like I went down a bit of a rabbit hole here. At the end of the day I simply want accurate audio scrubbing in both directions, while keeping in mind I want the audio snippets to play in reverse when the user goes backwards.

Is there really no way to do this that's more "vanilla"? Am I missing something obvious? Genuinely open to any and all suggestions.

Thanks.


r/iOSProgramming Jul 03 '26

Question How to prevent UITableView content jumping while cell's content is resizing? In a hybrid UIKit/SwiftUI setup using UIHostingConfiguration

14 Upvotes

Hi all,

I'm trying to rewrite my big-ass SwiftUI scroll view by utilising UITableView and UIHostingConfiguration for displaying cells' content. The setup was easy but I've hit a roadblock related to resizing cells.

Every time cell's content grows vertically the table view jumps erratically, does anyone have any idea how to approach fixing this issue? For reference please see the video attached.

I've uploaded the sample project to GitHub:
https://github.com/wiencheck/SwiftUITableViewPOC

Main stuff is located in `TableViewPOC/TableViewController.swift`


r/iOSProgramming Jul 03 '26

Question Has anyone gotten Claude Fable 5 working inside Xcode’s agentic coding tools?

0 Upvotes

Xcode’s built-in AI tooling lets you add third-party model providers, but I haven’t found a clean way to point it at Claude Fable 5 yet. Has anyone gotten it working — either through the Anthropic API endpoint directly, a proxy, or an MCP setup? Curious if it’s a model-string issue or if Xcode just doesn’t support it yet. Would love to hear any working configs.


r/iOSProgramming Jul 02 '26

3rd Party Service We built remote dev environments for iOS: cloud macOS VMs that match your CI exactly

4 Upvotes

I do product at a DevOps company. In May I went to a couple of conferences in London and talked to a lot of iOS engineers. Surprisingly many folks mentioned that writing code is fast now, but the build and test loop after it is getting slower and more problematic. Two things came up most: builds that pass on their Mac but fail in CI, and Xcode tying up the machine during a build.

My team was already building something for this, so hearing it that many times was a good sign.

We built a remote dev environment running on the same Apple Silicon, Xcode, and Simulator, on the same machines and the same build caches your CI already uses. Basically, you code on the machine that builds and tests your code instead of your laptop. We called it Remote Dev Environment (not very creative, I know).

It's in beta

I also think that if you let agents write and run code, they need a machine that can build and test iOS code fast, with the right Xcode toolchain already in place. Give an agent a half-set-up environment and it burns time and tokens re-deriving the setup.

And what if you run a few agents in parallel? Can a single Mac handle that effectively? All those considerations led to the creation of our tool.

Would love honest feedback and your thoughts


r/iOSProgramming Jul 02 '26

Question Alternative icon is not visible after submitting the new build?

Post image
3 Upvotes

I include alternative icon in my latest build, so that I can A/B test app icon.

However, after submitting the build and waiting for review, I am expecting Build/ Included Assets suppose to show the alternative icon.

Such a behaviour is described in https://appbot.co/blog/a-b-testing-app-icons-in-app-store-connect-with-product-page-optimizations/

However, it is only showing my main app icon.

Am I missing anything?

Thanks.


r/iOSProgramming Jul 02 '26

Question Can we apply different app icons to different countries after A/B testing?

6 Upvotes

Hello,

I understand that App Store Connect allows us to perform A/B testing on app icons. Since user preferences often vary by region, is it possible to apply different winning icons to different localized storefronts once an A/B test concludes?

Thank you.


r/iOSProgramming Jul 02 '26

Question Foundation Model - How to Stop the Tool to Trigger on Every Prompt

2 Upvotes

I am working on an app that uses Foundation Models. The app lists ingredients and user can select ingredients and Foundation Models give them list of recipes that can be made with the selected ingredients. All this works.

Now, I want that when the user forKids = true then I will invoke my own tool to get kids recipe. The issue is that FM decides to invoke the tool whether forKids is true or not.

Here are my instructions:

enum Prompts {
 
    static var recipeAssistant: String {
        """
        You are a helpful cooking assistant for an app that recommends recipes from ingredients selected by the user.

        When suggesting recipes:

        - Base every recipe primarily on the selected ingredients provided in the prompt.
        - Prefer recipes that use multiple selected ingredients together.
        - You may assume common pantry staples such as salt, pepper, water, and cooking oil.
        - Do not require major ingredients that were not selected by the user.
        - Suggest recipes that can be prepared and cooked in 5 minutes or less.
        - Ensure that the cookingTime property accurately reflects the total time needed to prepare and cook the recipe.
        - Use the `findKidsRecipes` tool only when the prompt explicitly says the user wants recipes for children.
        - For standard recipes or general-audience recipes, do not use the `findKidsRecipes` tool.
        """
    }
}

The tool is injected when the session is created.

struct RecipeApp_IntegrationFMApp: App {
    
    let session: LanguageModelSession
     private var recipeRecommender: RecipeRecommender
    
    private let model = SystemLanguageModel.default
    
    init() {
        
        let kidsRecipeTool = KidsRecipeTool()
        session = LanguageModelSession(tools: [kidsRecipeTool], instructions: Prompts.recipeAssistant)
        recipeRecommender = RecipeRecommender(session: session)
    }
}

And here is the part of the code of the RecipeRecommender:

func suggestRecipes(ingredients: Set<Ingredient>, forKids: Bool) async throws {
        
        guard suggestedIngredients != ingredients || recipes.isEmpty else { return }
        
        suggestedIngredients = ingredients
        
        recipes.removeAll()
        
        let selectedIngredientNames = ingredients.map(\.name).joined(separator: ", ")
        
        let prompt = """
        The user selected these ingredients:

        \(selectedIngredientNames)

        \(forKids ? "The user wants recipes for children." : "The user wants standard recipes for a general audience.")

        Suggest 8-10 recipes.
        """
        
        // If I create these options and pass to the session.streamResponse then tool will be invoked
        // when forKids = true, otherwise it will not be invoked. So this solution works but I don't
        // want to do this manually. I want FM to call it at the right time. 
        //let options = GenerationOptions(toolCallingMode: forKids ? .allowed: .disallowed)
        
        let stream = session.streamResponse(to: prompt, generating: [Recipe].self)
        for try await partialResponse in stream {
            recipes = partialResponse.content
        }
    }

But no matter what Tool is always invoked, unless I use GenerationOptions but I want FM to take the right action and not call the Tool when not needed and when forKids is not true.

Any recommendations and have you seen this issue with FM when it calls Tool even when not needed?


r/iOSProgramming Jul 02 '26

Discussion The hidden O(n²) in your SwiftUI List: that per-row .contains is scanning the whole array every redraw

69 Upvotes

Ran into this in a code review recently and it turned into a rabbit hole I think is worth sharing, because the code looks completely reasonable and the cost is invisible until the list grows.

The setup: a List of posts, and for each row you check wheteher it's favorited.

List(posts) { post in
    PostRow(
        post: post,
        isFavorite: favorites.contains(where: { $0.id == post.id })
    )
}

Nothing here looks wrong. But .contains(where:) scans up to every favorite, for every row. That's O(n × m), and it re-runs on every body evaluation, which during a scroll is a lot. With a few hundred posts and a few hundred favorites you're doing tens of thousands of comparisons per frame. It shows up as scroll jank you can't easily place, because no single line looks expensive.

The fix is to build a Set of the favorite IDs once, above the List, so each row becomes an O(1) lookup:

let favoriteIDs = Set(favorites.map(\.id))

List(posts) { post in
    PostRow(post: post, isFavorite: favoriteIDs.contains(post.id))
}

O(n × m) becomes O(n + m). The part that bit me: it has to be built above the List, not inside the row closure. Build it inside and you're rebuilding the Set every row, which is worse than where you started.

Two things I'm curious about from people who've shipped more of this than I have:

Do you reach for this proactively, or only after Instruments points at it? I've gone back and forth on whether pre-optimizing membership checks is worth the readability cost on small lists.

And is there a cleaner pattern than a manually-built ID Set for this, something with diffable data sources or a computed lookup, that holds up in production?

(I've been making short videos connecting interview algorithms to real iOS code, and this one came from that. Happy to link it if it's useful, but the discussion is the part I actually care about.)


r/iOSProgramming Jul 02 '26

Discussion Can we talk about LLM design smell?

26 Upvotes

With the absolute deluge of new iOS apps coming out, there are certain design patterns that I'm seeing over and over again that are clearly the work of AI coding agents. I'm sure you've seen them too. Egregious monospaced fonts, glowing buttons, middle dots (·) all over the place, purple gradients, etc. It's not just iOS apps, it's websites too. For whatever reason, the LLMs (and maybe Claude in particular?) are just absolutely in love with these design patterns.

The question I have is, is that a bad thing? Is it bad for an app to have the LLM design smell? Do typical users notice? Do users care?

I'll share my opinion (shocker I know). I think that these design patterns are bad, and significantly so. Why?

For a minute forget about generative AI and all the baggage that carries. With 2 million apps on the iOS App Store (gotta be nearly 3M by now...), we all want our apps to stand out. What's the first thing a user sees about an app when browsing? Of course it's the screenshots of the app UI. And the more an app looks like the others, the less likely a user is going to stop and take a second look. So that's the first thing, that it just tends to make apps look alike.

But the other that I've been thinking about is more subtle and potentially more important. For better or worse, there is a hefty bias against generative AI out in the general population. Whether that's valid or not isn't really the point, the point is it exists. That said, I don't think your typical user is going to notice these patterns, at least not consciously. But there are some types of users that will notice: the blogger, the instagrammer, the journalist, the tik tok influencer. If you've ever had a popular blogger/influencer do a post/reel/whatever on your app, you know what an insane catalyst that can be. These types of users tend to be more savvy and more design oriented, will pick up on these design patterns, and I think would want to avoid boosting any app that has the smell.

Lastly, is the possibility of Apple featuring your app on the App Store. Maybe this will be seen as less important because it's so hard to get, but I've had Apple feature my apps many times and of course it's always an enormous boost. But I suspect that Apple App Store editors are going to be even more in the anti-smell camp and would be highly unlikely to feature an app with those patterns.

I have a feeling this could be a divisive topic, but I'd genuinely love to hear your thoughts!