/r/iOSProgramming
A subreddit to discuss, share articles, code samples, open source projects and anything else related to iOS, macOS, watchOS, tvOS, or visionOS development.
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:
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
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??
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.
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 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.
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.
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.
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 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
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
Is anyone else getting errors when trying to run your app on iPadOS?
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?
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?
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.
To not get this, just add this to you info.plist
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.
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.
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.
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)
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?
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()
}
}
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?
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.
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?
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!
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?
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?
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
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
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.
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.
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.
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?
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.
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)
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!