/r/iOSProgramming

Photograph via snooOG

A subreddit to discuss, share articles, code samples, open source projects and anything else related to iOS, macOS, watchOS, tvOS, or visionOS development.

FAQ

About

There is an extensive FAQ for beginners. Please browse it first before asking questions that are answered there.

If you are looking to get started (iOS programming in general or some specific area), here are more relevant links for you:

  • Swift or Objective-C? if you don't know which language to choose. (New posts asking this will be removed)

Related Subreddits

Related Links

There's too many to list them all, however here's a convenient link to all programming guides at apple.com

Take note that this list is live and based on most frequent questions in posts will be updated with "quicklinks".

/r/iOSProgramming

151,270 Subscribers

1

Keyboard is bouncing when .onSubmit is executed (@FocusState)

https://stackoverflow.com/questions/79299771/keyboard-is-bouncing-when-onsubmit-is-executed-focusstate/79299855#79299855

I am struggling with a keyboard which is bouncing every time .onSubmit is executed. I found similar questions online, but none of them has a clue... Please help!!

0 Comments
2024/12/22
16:00 UTC

50

We love to wait one minute to see minor code changes 🤣

13 Comments
2024/12/22
14:42 UTC

2

How to let XCode use system proxy

Hi guys. I need to get XCode use the system proxy but can't find any solution after a bit of digging.

The problem is that all the internet traffic has to go through the school proxy if I want to use the school's network. Right now I can't add any package dependencies because XCode can't talk to GitHub. I don't want to use my hotspot all day, as that will drain my battery fairly quickly.

5 Comments
2024/12/22
10:06 UTC

15

I made a Solar System simulator with RealityKit that lets you explore planets and moons in real-time

https://preview.redd.it/sicvo66rda8e1.jpg?width=2360&format=pjpg&auto=webp&s=e7767013c55be796c0d7e2f7bbb56147d791f0f7

Hi folks, my app Planetaria is now live on the App Store. You can explore the Solar System in both AR and non-AR modes. It's also available on Apple Vision Pro with a fully immersive experience.

All objects appear at their true, real-time positions and orientations. You can set the simulation to a time in the past or future to see what it looks like then. And you can also speed up or rewind to watch how the objects move over time.

I'm hoping to get some feedback about how to make it better! Please check it out and let me know what you think :-)

Download Link: https://apps.apple.com/us/app/planetaria-space-simulator/id1546887479

2 Comments
2024/12/21
23:42 UTC

2

Fitness app to improve your cardiovascular health

My first app, Target Zone Keeper, is live on the AppStore! 🎉 It's a fitness app for Apple Watch (with iOS companion) designed to help you improve your cardiovascular health by staying in the right heart rate zone during workouts.

https://preview.redd.it/cs66udkxw98e1.png?width=1768&format=png&auto=webp&s=fe166fa005b2a49b8f9cc4591bfcd94d7968148b

The app on Apple Watch guides you to stay in a particular heart rate zone (% of your maximum heart rate) during your workout. It would let you know if you need to increase your pace, slow it down or just keep going at the same tempo. No complex setup needed!

How it works:

  • Set your target heart rate zone (based on your goals) on your Apple Watch
  • Begin your workout by pressing START button, and the app will measure your heart rate and provide real-time feedback using haptic alerts, screen colors, and on-screen messages to guide your pace. To finish workout, swipe left and click STOP button
  • Customize the haptics and colors via the companion iPhone app to suit your preferences
  • Your workouts are saved to the iPhone’s Fitness app, and you can track your progress using the Cardio Fitness (VO2 max) metrics in the iPhone’s Health app

It’s super convenient for activities where you don't want to interrupt your workout or just can’t keep checking your watch - cycling, swimming, wearing gloves, etc (you can rely just on haptics alone). The app keeps you focused on your workout without any unnecessary distractions.

Tip for getting started:
If you’re new to heart rate training, begin with Zone 2 (60-70% of your maximum heart rate) to build a solid cardiovascular base. As your fitness improves, gradually incorporate Zone 3 (70-80%) workouts to further enhance your aerobic capacity.

I’d love to hear your feedback!

0 Comments
2024/12/21
21:51 UTC

0

Is there any AI coding assistant that integrates into Xcode like Copilot does into VS Code?

5 Comments
2024/12/21
21:50 UTC

14

Made ProSim for Xcode Simulator

ProSim is an all-in-one companion app for Xcode, with more than 27 essential simulator tools.

I originally built this app for myself because I couldn’t find any other apps for Xcode Simulator on the App Store that passed all of these:

  • In addition to customizing the status bar, accessibility settings, changing locations, testing deep links and push notifications i wanted this:
  • able to take screenshots with bezels and add custom backgrounds with different colors and even add texts to them. All in one place. No more going to Figma for simple screenshots to share online.
  • well-designed & easy to navigate the way i wanted it
  • didn’t collect any data. none.
  • easy to navigate. not bloated. i should get to what i want as fast as possible
  • available as a one-time purchase without subscriptions. purchase one time, receive updates even on future versions. no ads, no recurring subscriptions.

There was simply no app with all these 27+ features on the App Store that passed the above criteria.

You can get it here on the Mac App Store:

https://apps.apple.com/app/prosim-for-xcode-simulator/id6664058266

Feel free to message me with any feature requests or feedback.

https://preview.redd.it/u854umdgu98e1.jpg?width=2048&format=pjpg&auto=webp&s=0091a5216d93ca337af640db1c283c54271adae9

6 Comments
2024/12/21
21:43 UTC

8

Building TimeSlower: Lessons from Developing a Productivity App

Hey everyone! I've spent countless hours in this sub while working on my app, so I wanted to share some challenges I faced during development and get feedback from fellow engineers (who, like me, are the target audience).

The app is a blended Pomodoro timer and to-do list called TimeSlower. Its core idea is that every task you create includes an estimate, and you work on tasks with a timer. The app gives you a daily schedule with approximate completion times, helping you avoid overcommitting and reducing the stress of a never-ending to-do list.

This opinionated workflow provides insights into your productivity and offers tips to improve it. For example, it encourages you to be more conservative with estimates, break tasks into smaller chunks, avoid skipping breaks, and more. It reminds you to rest, helps prevent burnout, and fights procrastination—benefits central to the Pomodoro technique.

I built this app because I believe in the method (Pomodoro + to-do lists with estimates). It worked wonders for me when I was a team lead juggling a packed schedule, and even more so after becoming a father with even less time to spare. I think it’s an excellent way for engineers to get things done efficiently.

Now, let’s dive into the challenges.

https://preview.redd.it/ssouvwzxq98e1.png?width=2880&format=png&auto=webp&s=7d6569a9b2496129ba78709317144c3e1ccfdc83

SwiftUI Learning Curve for a UIKit Guy

I have a decent amount of UIKit experience (about seven years), working mostly on relatively small apps, including three 0→1 projects and one total rewrite. However, I was completely new to SwiftUI, and, to my surprise, my prior experience didn’t help much. Layouts, dependency injection, and the view lifecycle all felt foreign. I adopted a "learn-as-you-go" approach, which worked but came at a significant cost. I ended up rewriting core systems like navigation, dependency injection, view structure, and local database access at least three times.

Here were my major mistakes:

  1. Using a simplified MVVM pattern where all the logic lived in the ViewModel, which communicated with views via callbacks. This led to ViewModel instances being recreated every time the view was rendered and caused bugs like unintended re-renders.
  2. Relying on simple constructor-based dependency injection. View trees quickly became unmanageably complex, and passing data by value vs. reference caused issues.
  3. Keeping too many observable properties in main views (e.g., tabs), which triggered unnecessary re-renders of the entire view tree.
  4. Misusing .onAppear callbacks in subviews, causing performance problems.
  5. Trusting ChatGPT to write code I didn’t fully understand (more on that below).

Trusting ChatGPT to Write a Lot of Code

When I started the app in January 2024, AI was at its hype peak. Like many others, I was both concerned about job safety and excited about using AI as a "junior developer." Early on, ChatGPT worked well—about 30% of its code worked on the first try, and with 2–3 iterations, that figure rose to 90%. I used it to write small SRP classes, tests, and simple views, and my perceived velocity skyrocketed. Working 2–3 hours a day, I was producing 8–10 hours’ worth of code (in volume, if not quality). Everything seemed great—until the "AI poops" started appearing.

Long story short: I had to rewrite nearly every line of ChatGPT-generated code. Issues ranged from poor view composition and buggy logic to bad injection patterns, inconsistent naming, and ignorance of SwiftUI's quirks. The main problem was that I couldn’t immediately validate its code due to my lack of SwiftUI expertise. Later, I switched to Cursor, which is far more useful if you know what you’re doing.

Realm Sync Deprecation

One of the features I wanted was device sync—where tasks or timers created on macOS reflect instantly on iOS, and vice versa. After some quick research, I chose Realm with MongoDB for local storage and planned to enable Atlas Device Sync later. I focused on macOS first, thinking I could "flip the switch" for sync later. However, by the time I started testing sync, MongoDB had deprecated Atlas Device Sync.

Fortunately, I used a clean architecture approach, keeping models strictly for data storage and display. To save time, I switched to SwiftData, which supports iCloud sync. However, I had to adjust my architecture since SwiftData’s integration with SwiftUI is less powerful than Core Data’s. In hindsight, Firebase might have been a better choice, but the frustration with Realm was still fresh.

“Quick and Dirty” Comes Back to Bite

This is the last time I’ll go for “quick and dirty” to get a prototype out fast. The messy code I wrote early on caused major setbacks during refactoring. Core features frequently broke with every release, and iteration speed slowed to a crawl. At its worst, any change on macOS broke the iOS version and vice versa. I eventually had to stop and clean everything up.

Once I improved reliability, iteration speed increased. By version 2.0.7, I had 63.3% unit test coverage for the logic module, though UI tests remain at zero. Lesson learned!

What Went Well: Cross-Platform Sharing

One thing that worked out well was sharing code between macOS and iOS. This was my main reason for choosing SwiftUI over UIKit, and it paid off. Despite building the macOS app first and then adapting it for iOS, the process was remarkably straightforward. Fixing alignment issues and implementing a new navigation system took about a week, and adding features for both platforms feels seamless. CI is also simple—it really feels like working on one app.

SwiftData and iCloud Integration

SwiftData has been great for a new product with simple use cases. It took time to get it working due to my messy state management, but the overall experience was positive. However, a major downside is the lack of manual sync control. You often have to wait several seconds (sometimes tens of seconds) for data to sync. I mitigated this somewhat with NSUbiquitousKeyValueStore, which enables faster syncs (within ~5 seconds)—good enough for a Pomodoro timer.

Feedback and Next Steps

As 2024 comes to an end, I’m pausing feature development to gather initial user feedback (starting with this post). I’d be incredibly grateful for any comments or suggestions. Hopefully, this app resonates with other developers struggling with burnout and procrastination. Link to appstore: https://apps.apple.com/us/app/timeslower/id980075267

Cheers!

0 Comments
2024/12/21
21:24 UTC

1

OneSignal push notifications only working on some devices. Anyone experience this?

I’m using APNS with two apps, and only some OneSignal notifications go through.

We tested on seven iPhones, some with older versions of iOS. One app seems to deliver to more devices, but not all.

Would this be an issue with the SDK, meaning we’d need to update that and resubmit both apps?

Or is there done way I can check the subscribed/active/inactive status of the devices? Honestly, in OneSignal I’ve never been able to determine which devices are which, or how to make a device active/subscibed.

Would updating the .p12 certificate to a .p8 token possibly work?

Thanks in advance for anything!

4 Comments
2024/12/21
19:28 UTC

71

So i made my App free for 24 Hours

19 Comments
2024/12/21
18:59 UTC

1

Any recommendations on interview/job hunting coaching services?

Hi everyone!

I am an iOS developer with around 3 years of professional experience. I got laid off around four months ago and have been struggling to land an offer. I was wondering if anyone has had any experience or can recommend any interview/ job placement coaching services, please?

I've seen many services online but with such high prices and options I wanted to see if anyone had any recommendations first, specially if it's iOS focused.

Thank you!

1 Comment
2024/12/21
17:24 UTC

1

Steptastic - MAJOR UPDATE. Use your gym workouts to virtually travel around the world!

Very happy to announce that the feature I've been working on for the past month and a bit is now available to the public for Solo Challenges and Group Challenges in Steptastic!

Instead of walking, cycling or swimming to virtually travel the world, you can now use your calories burnt during a workout to travel around the world!

https://preview.redd.it/cu6cb96jj88e1.png?width=3300&format=png&auto=webp&s=fbc332a63a0d2098919817321431429dc8a16755

Here is the app description for further information:

Every step, cycle, swim, or workout, counts towards your Virtual Challenge.

Create daily goals for you to work towards, and view analytics on your recent, and future activity.

Create, or join Group Challenges to challenge your friends and family head to head, or join forces and work together to travel the world, virtually of course!

Set yourself a challenge for the new year and walk from Paris, France, to Athens, Greece, or Cycle from Brazil to Canada. Now that would be a journey and a half!

Download Steptastic here!

0 Comments
2024/12/21
17:19 UTC

1

Melonote - AI voice note taker

Hey all,

Would love to share my new app. Melonote - AI voice note taker. This is how its onboarding page look like.

https://i.redd.it/xp967nohf88e1.gif

Here's the brief introduction of the product.

Take control of your learning, work, and productivity with Melonote – the app that transforms meetings, audio, video, and notes into actionable summaries, flashcards, and multiple-choice quizzes. Whether you're in the office, classroom, or on the go, Melonote empowers you to stay ahead with AI-driven content generation and interactive learning tools.

You may give it a try at : https://apps.apple.com/my/app/melonote-ai-voice-note-taker/id6670156126

Thank you.

0 Comments
2024/12/21
16:59 UTC

1

Swift 6 concurrency question

I have a project where we are using swift 6 concurrency, we are also using SwiftUI. From my understanding in swift 6 the models should be a struct. However, if it is a struct then let’s say that model is being used in multiple view models. How would they get updates since the struct is a value type?

4 Comments
2024/12/21
16:27 UTC

5

I subscribed for a Developer account on Apple and trying to enroll my iPhone for testing purposes they say I've got to wait two weeks to enroll my IPhone

Having to wait two weeks to enroll my one of my devices seems really unfair, I'm paying for two weeks of development that I can't use has anyone else experienced this? If so do you know of any way to resolve it?

5 Comments
2024/12/21
15:27 UTC

7

📚Hey book lovers: I build a Reading App called ReadHero for iOS! 📱✨

3 Comments
2024/12/21
14:45 UTC

1

Feedback on MVVM with Coordinator Pattern Design

What do you think about this MVVM Coordinator pattern design?
I'm curious to hear your thoughts. Do you think this approach is solid, or could it use some improvement? Would love your feedback

https://preview.redd.it/qmp8d5cur78e1.png?width=4096&format=png&auto=webp&s=aa01df35d7f727fba0aa661b333bd780ed80e4ca

5 Comments
2024/12/21
14:42 UTC

0

Ever had trouble conveying this core principle for customers?

You probably all know this problem: customers wat their work done good and fast and preferably by don’t want to pay anything all at the same time.

That’s where my app comes in (Also my first one publicly available on the app store 🎉). Simply style it how you’d like and let your clients choose their preferences. They can only ever choose two.

I’d be happy if you checked it out: https://apps.apple.com/app/good-fast-cheap/id6711341141

Thanks for reading (:

Edit: spelling

13 Comments
2024/12/21
13:43 UTC

1

ASO keywords mystery. Please explain.

Can someone help to solve the ASO mystery?

I have an app whose name starts with "Expense Tracker". For the last several months I've been trying hard to make my app listed for the keywords "expense tracking" and never succeeded.

I don't mean to be on the top N or something. I literally mean just to appear on the list, be it in the very last position. But the app is never on the list.

The keyword popularity is 41, difficulty is 53. It's still a difficult keyword, I understand. But why isn't the app in the search results at all?

There are other keywords with similar characteristics where the app is listed. But this magical phrase (which is my main aim) keeps kicking my app out. What can be special about it?

0 Comments
2024/12/21
05:10 UTC

3

Can anyone share your experience in handling CONSUMPTION_REQUEST to reduce refund rate?

I am currently focused on reducing the high rate of approved refunds. Many users are utilizing our high-cost backend AI processing and then requesting refunds afterward.

I use pure StoreKit2, to handle subscription and in-app purchase, without any issue.

I also do not have a server, to handle any purchase related thingy.

We are quite confused on how to generate data for `ConsumptionRequest`.

For instance, how are we going to generate the data for appAccountToken?

Do we need more modify our code from

        let result = try await product.purchase()

    to

        let token = createUUID(...)
        let purchaseOption = Product.PurchaseOption.appAccountToken(token)
        let result = try await product.purchase(options: [purchaseOption])

If yes, where we can store this token, so that we can respond to CONSUMPTION_REQUEST with the same token?

How can we perform sandbox testing for CONSUMPTION_REQUEST case? I guess during the testing, we need server to send us a valid transaction id, so that we can retrieve sandbox purchasing information, via API https://developer.apple.com/documentation/appstoreserverapi/get_transaction_info ?

If you have any experience in handling CONSUMPTION_REQUEST, or you know any good step-by-step tutorial, can you please share with us?

Sorry for the long question. Thank you for reading.

7 Comments
2024/12/21
11:51 UTC

0

I did my first "paid marketing" for touchgrass.now yesterday

The "paid marketing" is between speech marks because I paid for Twitch bits for a text to speech donation on primeagen's stream. I asked him how to market touchgrass.now (my app that blocks other apps until you literally touch grass) and he replied "Seems like you just did"

Resulted in +50 unique visitors and +~20 to the waitlist (although I'm not sure of the quality of these sign ups, it being twitch and all)

0 Comments
2024/12/21
11:17 UTC

2

RC Realtime Lap Times & Statistics

Just got my app, RCTRK, through App Store review yesterday! And this isn't really an attempt to promote it - since you literally need to be racing 1/10 scale RC-cars at one particular physical race track in Stockholm, Sweden to be able to use it.

If you are competitively racing RC-cars you have a transponder in the car that when it does pass over the detection loop (a cable underneath the track) it registers a pass in the "decoder device". It is possible to get the id of the transponder and timestamp of the passing by connecting to a port and listen to TCP/IP packets. So I built a Node.js script that does this, and forwards the data to a Supabase Edge Function that in turn puts it into a Postgres database. I'm then using Supabase Realtime feature to over websocket stream the lap times to the iOS app.

Users sign in using Apple ID, registers their transponders and assign them to a car entity. Then they can see their own track times (and others) realtime, or historically. And a bunch of other interesting statistics like "race simulation time" (a race is done over 5 minutes, so consistency is more important than one fast lap and a lot of crashes).

It has been really fun to develop an app where you are this "close" to the users. People in the RC-club are pretty ecstatic, with lots of screenshots and discussion in the club's private FB group after being at the track. And some people are referring to it as "without the app it is like go outside for a run and forgetting to turn on your Garmin watch". 😂

App is developed with SwiftUI and the Supabase Swift SDK.

https://preview.redd.it/n57yknusm68e1.png?width=1024&format=png&auto=webp&s=c14e86ba9976891387d1266e4a3b49f199b3b7f5

0 Comments
2024/12/21
11:10 UTC

1

Time to Set Goals

During the RevenueCat Ship-a-ton in September, I built an app to track goals. Before that, I used a Notion template.

It’s not a habit tracker—it’s more for a big-picture view. Hope it can be useful for someone next year.

https://apps.apple.com/app/goal-tracker-plan-progress/id6502180081?platform=iphone

0 Comments
2024/12/21
09:01 UTC

34

Weight Loss Tracking Buddy V2 is now available on the the App Store.

Just in time for January. Weight Loss Tracking Buddy is your ultimate Calorie Counter, Macro Tracker, Meal Planner, and Weight Loss Tracker.

Would appreciate a roast of the app, screenshots, AppStore copy.

Any ratings or reviews would also be awesome 🤩

15 Comments
2024/12/21
08:49 UTC

26

Why is Apple doing this to me? Really need advice.

In December 2022 I published an application. This far it has tens of thousands of downloads, it has a lot of paying customers (subscribers, etc, I have published more than 20 updates so far successfully and never had any problem.

But while publishing my last update around 2 weeks ago a bug happened (regarding an API key) that I noticed too late. This version with the bug also got published without any problem.

So after noticing it, I immediately fixed the bug, uploaded a new version and sent my app for review.

Guess what happened? Suddenly I received the 4.3.0 SPAM rejection. I kept asking for more information, asking them what they want me to change. I told them we published the app in December 2022, never had any problems. I only kept improving the app. I do not even look at competition. I do not copy anyone. I just think by myself and come up with features by myself.

I have developed this application only by myself from ground up. I don't even know how many months in total I have spent developing and improving it.

So after receiving the 4.3.0 SPAM rejection, I changed the branding of my app (to be even more unique) and added more features. And the app still got rejected.

I then sent an appeal, but after 5 days they reply still want to reject it.

What is happening here? Why is Apple suddenly, out of nowhere, preventing me to earn a living and publish a crucial update to my app?

Also, why are they not telling me what EXACTLY is wrong and what they want me to do?

I could spend 2 weeks more to add features, design, etc. and they could keep rejecting it without any real reason.

What can I do in this situation?

13 Comments
2024/12/20
22:30 UTC

1

Help debugging high CPU usage in app

Hi all, I have a SwiftUI project that is experiencing very high CPU usage on my front screen.

I have followed guidance on running a Profiler, but I don't really know what it is I'm looking for. I wanted to see if I could see the code (or generalized area) the usage was happening in, but I think I'm only getting machine code.

I also notice CPU spikes when I switch back and forth to a subview, so I suspect something is getting redrawn more than it needs to be.

Would posting the trace file be useful?

10 Comments
2024/12/20
19:48 UTC

Back To Top