/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

154,372 Subscribers

2

How to delete unused iCloud containers?

Created a couple for testing in Xcode. Wanted to clean up but couldn't find the delete button anywhere. Only has the + icon. Looks like what we should do is to simply ignore unused ones and create new containers??

0 Comments
2025/02/03
19:27 UTC

0

Built an Esports Prediction Game with AI in 3 Months – Here’s What I Learned

We recently launched PickR, our esports match prediction game built with the help of AI, and I wanted to share some of my biggest takeaways from building a project from scratch with AI’s help. I have many years of experience with iOS development, but this was my first time relying so heavily on AI throughout the entire process—and it’s completely changed my workflow.

Setting Up for Development

I use Cursor as my main dev environment, and this post covers everything you need to get it up and running with breakpoints for debugging: How to Use Cursor for iOS Development. And I use Proxyman for network debugging. For app previews, though, I still stick with Xcode.

AI Gets About 80% of UI/UX Done

AI has been a huge game-changer for my UI development flow. In Figma, we use a plugin called Figma to Code, which generates messy SwiftUI code—but it nails the styling (fonts, gradients, background colors, etc.). We have lots of linear and radical gradients in the app, so that makes my life so much easier.

For layouts, I usually send a screenshot to Cursor or ChatGPT, and it works well for smaller UI components. Sending an entire screen doesn’t work as well, so I break things down. By combining AI-generated styling with AI-assisted layout suggestions, I can get about 80% of the UI done. The last 20% still requires some manual tweaking to match the design perfectly.

AI Handles API Endpoints and Data Models Amazingly Well

This part is where AI really works well. I just copy and paste the cURL output or API specs into Cursor, and it generates all the boilerplate code. This has been a huge time-saver, especially since some of our data models are quite complex with multiple nested layers.

Refactor and Optimize—My Go-To Prompts

I like to keep my code simple and easy to read, and I’ve found myself using the "Refactor and Optimize" prompt a lot in Cursor. It does a great job of cleaning up the code, making it more efficient and easier to understand. This is super useful once I'm done adding the business logic in addition to the AI-generated UI/UX code.

AI is Great for UI and Unit Tests

Our app’s match system has 10+ different states, each with different colors, fonts, and gradients. AI makes it incredibly easy to generate unit test cases and UI tests, ensuring nothing breaks when we add new features. It's also a time saver when it comes to generate multiple variations of the previews.

AI Struggles with Performance Issues

AI can help spot simple bugs, but when it comes to performance issues—like memory leaks or lag—AI isn’t as reliable. If you’re an experienced app developer, you probably already know common pitfalls that impact performance. These require a deeper understanding beyond the basics and some experience debugging apps.

If you’re into esports or interested in our app, you can check out our app here: PickR.gg

AppStore: https://apps.apple.com/us/app/pickr-esports-prediction/id6736686111

https://preview.redd.it/f96tffvvdyge1.png?width=1200&format=png&auto=webp&s=0c42e650c06339ae67cc9afcd9b6c05f6ac69ef6

2 Comments
2025/02/03
17:00 UTC

5

Pinterest Clone SwiftUI

Excited to launch my new SwiftUI Pinterest Clone tutorial series! I'll be building a Pinterest-style app using SwiftUI, Firebase & Cloudinary! 🔥

✅ Basic & advanced UI implementations
✅ Google & Facebook Sign-In
✅ Email/Password Authentication
✅ iOS 17's Observation framework for state management
✅ Multi-language support with String Catalogs
✅ …and a lot more!

Watch here 👉 https://www.youtube.com/watch?v=93NclDIZrE8

4 Comments
2025/02/03
15:41 UTC

1

iPadOS getting Issue.

Is anyone else getting errors when trying to run your app on iPadOS?

6 Comments
2025/02/03
14:57 UTC

3

Notification when user gives rating/feedback

Is there a way to configure the App Store Connect app to send out a push notification when someone gives a rating or feedback to an app I own on the App Store? How about email?

2 Comments
2025/02/03
13:58 UTC

3

Just got banking jobs. What should i learn?

Hello i just recently got ios job in banking mobile apps. What do i meed to learn in this time gap before the job started? Lets say i know basic security like OWASP (ofc implementing is different matter). Anyway what topic that is heavily used in banking? Something like scalability, security or anything?

5 Comments
2025/02/03
13:50 UTC

9

Get rid of the "Missing compliance" warning forever

I learnt this recently and thought I'd share this with you all. If you upload builds to Test Flight, you might be getting the "Missing Compliance" warning.

https://preview.redd.it/jmypbeshhxge1.png?width=432&format=png&auto=webp&s=6dda62bec7f7ccd0c526a6354e2860cfd3254023

To not get this, just add this to you info.plist

https://preview.redd.it/jo3xa65lhxge1.png?width=948&format=png&auto=webp&s=6c5c34ffce1e99cfaa1163c73075b167836ed8be

Edit (credits to rjhancock : This should ONLY be done if you are using exempt'd encryption. IE: Only making HTTPS calls or using the built in methods within the system. There are rules for this for legal compliance with US Export laws.

9 Comments
2025/02/03
13:47 UTC

1

Internal error for entitlement

OSStatus error:[-34018] Internal error when a required entitlement isn't present, client has neither application-identifier nor keychain-access-groups entitlements. Internal error when a required entitlement isn't present, client has neither application-identifier nor keychain-access-groups entitlements.

I'm trying to run a macOS app and find this in the Xcode console after clicking some button in the app. I checked my Entitlements file and the keychain-access-groups key is present in it. I just want to test the app locally so there's no need to configure anything in the apple dev account I guess.

0 Comments
2025/02/03
12:41 UTC

9

Where to find native iOS freelance jobs. Upwork looks dead. Is there any other sites

I’m trying to find freelance works in native iOS. I have 2 years of experience and have a full time job as an ios developer. I want to earn some additional income and my full time job is boring it feels like maintaining existing applications and some minor feature implementations so my skills are not much used. Where can I find freelance ios jobs. All of them I see on upwork is either Flutter or a developer who can lend their apple developer account.

2 Comments
2025/02/03
11:19 UTC

0

Double hashing implementation.

Hello guys, I'm trying to implement hashTable data structure for learning purposes! I handle collision by using double hashing method from website geeksforgeeks(dot)org, but I face a problem when calling add(71). The problem is double hashing the value of 71 keeps returning 1 or 8, which is already taken by value 15 and 8 respectively.

So my question is,

Is my code wrong? Or,

Is the double hashing method is flawed?

here is the website I've been reading:
https://www.geeksforgeeks.org/introduction-to-hashing-2/
https://www.geeksforgeeks.org/collision-resolution-techniques/
https://www.geeksforgeeks.org/double-hashing/

class Hashing {

   private var size: Int = 0

   private var capacity: Int!

   private var prime: Int = 0

   private var arr: [Int?]!

   

   init(capacity: Int) {

self.capacity = capacity

self.arr = [Int?](repeating: nil, count: capacity)

self.prime = primeSmallerThanCapacity()

print("Prime: \(prime)")

   }

   

   public func count() -> Int {

return size

   }

   

   public func add(_ value: Int) {

if (size == capacity) {

print("Doubling capacity!")

doublingCapacity()

}

var numberOfCollisions: Int = 0

var indexToAdd = indexFor(value)

while (arr[indexToAdd] != nil && numberOfCollisions < capacity) {

if (arr[indexToAdd] == value) {

print("value already exist!")

return

}

numberOfCollisions += 1

indexToAdd = indexFor(value, collisionNumber: numberOfCollisions)

}

print("Index to add: \(indexToAdd), for value: \(value)")

arr[indexToAdd] = value

size += 1

   }

   

   public func isContains(_ value: Int) -> Bool {

if (size == 0) {

print("Hash is empty!")

return false

}

var numberOfCollisions: Int = 0

var index = indexFor(value)

while (arr[index] != value && numberOfCollisions < capacity) {

numberOfCollisions += 1

index = indexFor(value, collisionNumber: numberOfCollisions)

}

if (numberOfCollisions == capacity) {

print("Value is not exist!")

return false

} else {

if (arr[index] == value) {

return true

} else {

return false

}

}

   }

   

   public func remove(_ value: Int) -> Int? {

if (size == 0) {

print("Hash is empty!")

return nil

}

var numberOfCollisions: Int = 0

var indexToRemove = indexFor(value)

while (arr[indexToRemove] != value && numberOfCollisions < capacity) {

numberOfCollisions += 1

indexToRemove = indexFor(value, collisionNumber: numberOfCollisions)

}

if (numberOfCollisions == capacity) {

print("Value is not exist!")

return nil

} else {

if (arr[indexToRemove] == value) {

size -= 1

return value

} else {

return nil

}

}

   }

   

   private func indexFor(_ key: Int, collisionNumber: Int = 0) -> Int {

return (h1(key) + collisionNumber * h2(key)) % capacity

   }

   

   private func h1(_ key: Int) -> Int {

return key % capacity

   }

   

   private func h2(_ key: Int) -> Int {

return (prime - (key % prime))

   }

   

   private func primeSmallerThanCapacity() -> Int {

for i in stride(from: self.capacity - 1, to: 1, by: -1) {

if (isPrime(i)) {

return i

}

}

return 0

   }

   

   private func isPrime(_ num: Int) -> Bool {

if (num == 0 || num == 1) {

return false

} else {

var counter = 0

for i in 2..<num {

if (num % i == 0) {

counter += 1

}

if (counter == 1) {

return false

}

}

return true

}

   }

   

   private func doublingCapacity() {

let lastCapacity: Int = capacity

self.capacity = capacity * 2

self.prime = primeSmallerThanCapacity()

for i in lastCapacity..<capacity {

arr.append(nil)

}

   }

}

let hash = Hashing(capacity: 14)

hash.add(8)

hash.add(15)

hash.add(22)

hash.add(29)

hash.add(36)

hash.add(43)

hash.add(50)

hash.add(57)

hash.add(64)

hash.add(71)

hash.add(78)

hash.add(85)

hash.add(92)

hash.add(99)

0 Comments
2025/02/03
09:50 UTC

5

Optimizing build times apps with large numbers of assets

I have about 500 image assets in an app and this is of course dragging down my build times. Even SwiftUI previews are chugging. When I look at the build timeline it's mostly asset compilation which makes sense. Can I bring this down? Are there any common tips or tricks to speed up build times when dealing with so many assets?

5 Comments
2025/02/03
08:30 UTC

2

Why won't state won't update when the user moves?

I am working on a very simple app to get user location, display the latitude and longitude, and update the values as the user moves. The code compiles and runs on a physical but the values don't seem to change even if I move a significant enough distance that they should. Also the checkIfLocationServicesIsEnabled threw this warning " This method can cause UI unresponsiveness if invoked on the main thread. Instead, consider waiting for the -locationManagerDidChangeAuthorization: callback and checking authorizationStatus first." So it's currently not being used. I am still getting used to apple user location so any help with any aspect of that would be greatly appreciated. import SwiftUI import MapKit

struct ContentView: View {

@StateObject private var viewModel = ContentViewModel()




var body: some View {
    VStack {            

        Text("Latitude is \(viewModel.locationManager?.location?.coordinate.latitude ?? 0.0)")
       Text("Longitude is \(viewModel.locationManager?.location?.coordinate.longitude ?? 0.0)")
    }
    .onAppear(){
        //viewModel.checkIfLocationServicesIsEnabled()
        viewModel.makeManager()
    }
    .padding()
}
}
    #Preview {
ContentView()
 }

 final class ContentViewModel: NSObject, ObservableObject, CLLocationManagerDelegate{
@Published var region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 0.0, longitude: 0.0),        
span:MKCoordinateSpan(latitudeDelta: 0.0, longitudeDelta: 0.0))

var locationManager: CLLocationManager?

func checkIfLocationServicesIsEnabled(){
    if CLLocationManager.locationServicesEnabled(){
        locationManager = CLLocationManager()
        locationManager!.desiredAccuracy = kCLLocationAccuracyBest
        locationManager!.delegate = self
                } else {
        print("Error no location on")
    }
}


func makeManager(){
    locationManager = CLLocationManager()
    locationManager!.delegate = self

}

private func checkLocationAuthorization(){
guard let locationManager = locationManager else {return}

switch locationManager.authorizationStatus{

case .notDetermined:
    locationManager.requestWhenInUseAuthorization()
case .restricted:
    print("Restricted")
case .denied:
    print("Denied")
case .authorizedAlways, .authorizedWhenInUse:
    region = MKCoordinateRegion(center: locationManager.location!.coordinate, 
span: MKCoordinateSpan(latitudeDelta: 0, longitudeDelta: 0))
@unknown default:
    break
}
}

func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) {
    checkLocationAuthorization()
 }
}
6 Comments
2025/02/03
07:29 UTC

2

How long do Apple App appeals take ?

Its been around 2 weeks since I've sent out my appeal to apple after my 3rd rejection for spam. So far, I have received absolutely nothing. What should i do?

8 Comments
2025/02/03
01:51 UTC

25

[serious question] Why are so many app and game devs scared of paid UA?

Context: I'm an app marketer but not here to promote. Rather I would like to open a dialogue (and rant a little) around something that I've started to notice since entering the app marketing industry especially game marketing and get your honest views and opinions on why does this happen.

I've been analysing marketing campaigns for small, young, and solo game dev studios and I've encountered this mentality a lot.

A lot of the app developers I've come across are generally afraid or repelled by the idea of running paid ad campaigns citing reasons such as "it's too expensive" or "we're bootstrapped" or the universal "let's do ASO first" reasons.

Maybe it's the lack of education or discussions available online to explain that you don't need humongous budgets to start your paid UA campaigns because you can get started for as low as 600$ a month in ads and still manage to get thousands of installs. Or that ASO is 80% one time task with mild to frequent tweaks based on the app market trends.

I've also met folks who had under 1k installs in one quarter of ASO but still not consider paid ads or other avenues of app marketing.

This is not an attack on anyone. This is not me trying to gun you down.

I really want to know what thought process goes in for you when you build your marketing strategies. Is it something that's not talked about as often or covered in this industry or is it a lack of easily available resources, case studies, etc.

Because I've seen how actively indie devs work on marketing their games and softwares on pc but I see a fraction of the folks put in the same effort when it comes to mobile apps and games.

Again, I'm just trying to figure out how to reach app devs like you and get my message across so more folks can avoid the trap of burning out while trying to grow organically.

25 Comments
2025/02/02
22:16 UTC

0

VSCode over Xcode

Are there benefits to using VSCode instead of Xcode for iOS development?

I don’t use the preview section of the editor in Xcode, so would not miss that. Can VSCode start the simulator and debugging as Xcode does?

7 Comments
2025/02/02
21:32 UTC

29

How can I improve it?

I’m adding dashboard information (distance, speed, course information) to my watch-first boat race countdown app. I am taking a minimalism approach and think that it’s pretty readable/glanceable. I tried throwing some colors in there but it turned out very distracting.

Any suggestion would be appreciated!

16 Comments
2025/02/02
21:02 UTC

1

Is it possible to test an iMessage extension in the simulator?

How do developers usually test iMessage extensions? I am trying to make a game in which two players make their moves back and forth to each other (like the chess.com iMessage app). I’m not able to send messages on the simulator, what is the proper way to test an app like this?

3 Comments
2025/02/02
18:57 UTC

0

Hello, fellow iOS devs! I’ve been using AI to help me understand swiftUI and made a quick tutorial to share what I’ve learned. Hope it gives you a laugh while being helpful—would love to hear your thoughts. Thank you so much!

1 Comment
2025/02/02
14:23 UTC

1

App Architecture for Communication

I am having an issue where I have to share/communication how a whole app/system works to a new team member. I need resources that can help me create an architecture for apps we work on. I mean it would show how screens connect with each other and also how data flows. I am currently considering getting system design interview book but not sure if that would solve the problem. What would you recommend?

2 Comments
2025/02/02
14:18 UTC

222

This little trick can increase your app download by 50%

70 Comments
2025/02/02
10:29 UTC

2

Transferring the app to another account - did anyone went through it?

Despite being an iOS dev for 10 years I've never transfered the app. I'm aware of technical requirements needed, but I'm interested particularly:

- How long does the process take from when you initiate the process

- Is the App that is currently live on the store, reviewed in the process again (The app was updated few years ago) and thus subject to recent App Store Guidelines

Thanks :D

4 Comments
2025/02/02
10:16 UTC

8

How do Apple Developer API rate limits work?

Background

I'm thinking specifically about the Apple Music API. The rate limit is not specified. It's just mentioned that 429 Too Many Requests would be returned when the rate limit is hit. However, according to this third party service:

The API has a rate limit of 20 requests per second per user

Scenario

Let's say I write a client application that displays the last 10 songs played by the user on the home page through the Get Recently Played Tracks endpoint. This would be in addition to features that hit similar user-specific endpoints.

I would use the developer token along with the user's oAuth token to achieve this.

Question

If a few hundred/thousands people use the application at the same time, the rate limit of 20 requests per second per user would be hit. Does the "20 requests per second per user" phrase use "user" to refer to the developer or the client user?

Surely it must be the client user right? Otherwise, it would be difficult to scale any application at all without hitting the rate limit, since user-specific endpoints can't be cached using some middleman server.

5 Comments
2025/02/02
08:49 UTC

0

Has anyone tried using Rednote to promote their apps?

While using Rednote, I noticed that some independent products have set up official accounts there, posting videos and screenshots related to their products.

I'm curious about how effective this is. Honestly, it would be amazing to gain some organic traffic in the Chinese market.

8 Comments
2025/02/02
05:08 UTC

2

Test App Intents?

I'm an amateur swift developer and I'm trying to get started making an app driven by app intents. But I'm not sure how to test all the AI and context features without a compatible iPhone, since I have an iPhone 13 right now. Does this work for non-ai phones? What will the difference in functionality be and will the simulator provide support?

3 Comments
2025/02/02
04:20 UTC

3

How to build a community for your app?

Hi all, I’ve seen a lot of posts on here that have been able to grow a strong community for their apps. I’m curious on which platforms would be best and any tips on doing this.

12 Comments
2025/02/02
03:39 UTC

13

I Made a Posture Correcting App For All of You Coders!

Hey everyone! Some of you may recognize my app from my post earlier this week: My Tips From Growing 0 to 700k ARR. I was told not to promote the app and wait until Saturday to post about my app so here it is below is a FREE YEAR of premium!

My posture fixing app: Postura was inspired to make my own posture better and it really works. Here is a list of features for any of you who may need some help staying upright:

- Posture Reminders: Get consistent or random reminders to classically condition yourself to correct your posture each time your phone gets a notification.

- Posture Routines: Choose from a curated set of routines created from your yoga profile, or create your own from our list of poses

- Analytics/Challenges: Stay motivated by completing challenges or keeping a streak!

HERE is a FREE YEAR of premium! Would love to get some feedback on the design, and if you have any questions please ask them here. (Link will expire in 2 weeks)

Postura Graphics

6 Comments
2025/02/02
01:33 UTC

1

Launched my word game collection made entirely in SwiftUI!

App: Letterbox - Daily Word Games
https://apps.apple.com/us/app/letterbox-daily-word-games/id6452469243

Inspired by daily word game apps like NYT Games - I decided to build my own and see if I can make the games in SwiftUI. It's been a pleasure to develop and I ran into surprisingly less SwiftUI issues than I expected.

Would love the feedback from this community! Also if anyone is interested in how any of the SwiftUI magic I used or any particular feature, I'm happy to share code / knowledge!

Currently Letterbox contains 5 daily word games. I just released my latest game Letter Lights last week. Letter Sink, Word Rush and Searchle are free to play every day and I've locked Letter Lights and Letter Lock behind a subscription wall along with the ability to retry daily games. Let me know what you think of this payment model - I know subscriptions rub people the wrong way, but I decided to try it out. I wanted to provide a premium gaming experience without any annoying ads shoved in your face. I was thinking of lifting the paywall from Letter Lights and Letter Lock to give free users more to do. Lmk what you think!

Thanks for checking out my app!

0 Comments
2025/02/01
22:12 UTC

0

Free Lifetime - Screen Time Control - ZenChi

1 Comment
2025/02/01
21:04 UTC

Back To Top