/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

137,990 Subscribers

1

Understanding mobile app developer behaviors - 1 minute survey

Dear Mobile App Developers,
I am a researcher exploring app developer behaviors. Your input in this short survey would be incredibly valuable for my research. It will only take a minute of your time. Thank you for sharing your insights! No personal information will be asked for or collected.

Survey Link

0 Comments
2024/04/15
22:52 UTC

1

DSA enforcement

I need to perform an update of my businesses address - which Apple is saying will take an indefinite amount of time. This is a pre req for DSA.

In the meanwhile I could use some guidance around when DSA will start getting enforced?

I worry in the process of getting my account address up to date I could get shut out of selling in EU countries as I would not have been able to fill out DSA in time.

1 Comment
2024/04/16
00:01 UTC

1

How to have calendar display selected dates in highlighted color?

0 Comments
2024/04/15
22:20 UTC

0

How I can make an iOS app without an Mac?

Hello, I’m interested to make an iOS app, I would like to learn more about it. However, I don’t have conditions to buy a Mac for me and I only have a PC running Linux on it, I would like to know if it is possible to develop an App for iOS without a Mac. Basically I just want to make my app in some type of program and then generate an .ipa file, it is possible?

19 Comments
2024/04/15
21:49 UTC

2

Is there a possible way to execute a trigger using app intents when a button is tapped?

I found a way that makes possible to execute actions in shortcuts, that is App Intents. But, I felt some difficult to define the intent action. What I need is that when a button in my widget is tapped, the action (the action would be open a modal in the screen) defined into the intent be executed. The point is, I dont know how to tell to the intent that it should open some view.
How can I do that?
The current code is like that:

intent:

struct ShowAnotherViewIntent: AppIntent {
    static var title: LocalizedStringResource = "show text"

    init() {}
    
    func perform() async throws -> some IntentResult {
        // perform some logic to show the modal here
        return .result()
    }
}

main view:

struct my_widgetEntryView : View {
    var entry: Provider.Entry
    
    var body: some View {
        Button(intent: ShowTextIntent()) {
            HStack(content: {
                Image(systemName: "plus.magnifyingglass")
                Text("Show something")
            })
        }
        .buttonStyle(.borderedProminent)
        .controlSize(.small)
        .buttonBorderShape(.roundedRectangle)
    }
}

view to be shown when widget button is tapped:

struct ModalView: View {
    var body: some View {
        VStack(content: {
           Text("Placeholder")
        })
    }
}
0 Comments
2024/04/15
19:46 UTC

6

Free ASO Tool for keyword volume and difficulty

This might not be super relevant to this subreddit, but the ASO subreddit i could find is really small and doesn't look very active.

Are there any free ASO tools for checking keyword volume and keyword difficulty. Unlike web (semrush, Ahref, moz) the ASO tool subscriptions are very high end.

So was looking for free recommendations. Anyone ? Thanks!

1 Comment
2024/04/15
19:45 UTC

2

First Package/Framework

Hey all, I just pushed my first package on GitHub. This is a Date selector/ Calendar component in SwiftUI. I found myself reusing the same code in my personal projects and thought it was a perfect opportunity to try making my own package. The theme examples are pretty tame but I think you could get pretty funky with the customization. I'm reaching out here for any advice and feedback. Thanks!

1 Comment
2024/04/15
19:24 UTC

0

Force user to call function in package

Hi. I'm currently working on a package and I want to force the user to run a function for things to be set up properly, basically like FirebaseApp.configure does it. How can I make sure a user call a certain function before they can use the rest of the package? Thanks

13 Comments
2024/04/15
19:08 UTC

1

MacOS simple app for viewing logs and screen recordings side by side - LogJam

Hey everyone , I'm thrilled to announce the launch of my macOS app! It’s designed as sneak peek for LogJam+ a MacOS app in making that will allow realtime monitoring on devices and simulator process while working on the apps to generate informative metrics about app impact on system.

Basically idea came from frustration to figure out how parts of the production app are not working logically correctly only when in specific environments.
Adding logs has certainly helped but getting screen recording and going trough 10MB+ logs isn't really most pleasant experience. That's why I created LogJam , which allows for Side by Side Logs and Screen recording viewing. You can try it for FREE, no hidden costs, it's simple app that lets you import .txt file and process it to match timestamp in your screen recording.

App uses Regex to figure out what part is timestamp what is actual content of your logs. You can even write your own Regex to match with your usage. App was written entirely in SwiftUI.

Be free to let me know what you think, happy to add some cool features to enhance experience even further. Code is not open-sourced because it's simply mess of a weekend project.

Here are the links for those interested:
Website: https://logjam.pro
App Store: https://apps.apple.com/us/app/logjam-side-by-side-debugger/id6483495263

0 Comments
2024/04/15
18:37 UTC

3

Supported country

Hi everybody, I want to publish a flutter app to the apple app store. However, before I buy the developer subscription, I wanna know If my country is supported. I live in Iraq, when I wanted to publish my app on google play I couldn't, because of my country of residence. Does apple have such restrictions?

4 Comments
2024/04/15
15:49 UTC

4

How to understand if projects are feasible or not (in a team setting)?

I see fellow peers/coworkers discussing potential projects with PMs and designers, when I would be completely unsure how we would do something like that.

So basically, when a designer/PM suggests a product idea, how can I build the skills to be able to say whether or not we can do that, and whether or not it is a huge project (multiple quarters/over a year) and whether or not we have enough resources to do it? And approximately how it would be built? (Esp if it’s not a standard feature)

I’ve been doing iOS for ~7yrs now and I usually don’t pitch in during these discussions. Peers even with less experience seem to be able to confidently discuss the ideas with PMs even if the idea is just spontaneously brought up and seem to have a fair understanding of what it would entail at a broad level in terms of time and resources.

6 Comments
2024/04/15
15:46 UTC

2

App ideas and/or colab?

Title. Looking to make an app with someone else. Im 14, 1 year in to swiftui and swift

2 Comments
2024/04/15
15:45 UTC

2

Build SwiftUI navigation with UINavigationControllers

Hello everyone, I've published my first YouTube video today, explaining how we can use UINavigationController's with UIHostingControllers to manage our app's navigation while building our views with SwiftUI. I've been using this approach in my own projects and I really like how it scales. I will be showing you how to do it from scratch, show you its benefits and finally discuss the disadvantages of this approach.

You can check it out here: https://youtu.be/-Oc5TTEmb-M?si=AN7qEWsxmWw1dOaQ

I would be happy to hear your feedbacks :)

0 Comments
2024/04/15
15:03 UTC

3

WritingTools is iPadOS 18?

Today I got a few interesting crashes in my app.

Apple seems to be cooking up something related to writing tools.

There’s even a new WritingToolsUI framework.

Anyone else knows anything about it?

Perhaps this is related to Apple’s AI writing assistant?

https://preview.redd.it/8u2m2unqimuc1.png?width=2968&format=png&auto=webp&s=e2eca83fd4104cf491960454b05e35e55068fad0

https://preview.redd.it/rk7bbvnqimuc1.png?width=2968&format=png&auto=webp&s=56a4e1050e8e570f7aef0b7618a455c7680367f2

https://preview.redd.it/xu3yevnqimuc1.png?width=2968&format=png&auto=webp&s=9eb0da321de0a11e9625a4667715cefcad90db26

1 Comment
2024/04/15
10:52 UTC

26

WhatsApp Clone SwiftUI

Hello iOS community, I started a new tutorial series where we will be building a WhatsApp clone using swiftui and firebase. In this tutorial series you'll learn to:
📝 Send text messages
🎙️ Record and send voice messages
🖼️ Send image messages
🎥 Send video messages
😊 Express yourself with emoji icons
🔓 Sign in and Sign out effortlessly
🔄 Update your profile with ease
...and a lot more!

Hope you enjoy it.

PART 1 - Getting Started https://www.youtube.com/watch?v=pt2GluOyfMw

PART 2 - Inbox View https://www.youtube.com/watch?v=v-JTA_Z0YG8

PART 3 - Inbox Row View https://www.youtube.com/watch?v=f4bwK3cM06M

PART 4 - Circular Profile Image View https://www.youtube.com/watch?v=buJGOUaXVEw

PART 5 - New Message View https://www.youtube.com/watch?v=qf6zIZMzFqE

PART 6 - Chat View https://www.youtube.com/watch?v=fKG8gQgSCCA

PART 7 - Chat Message Cell https://www.youtube.com/watch?v=QFf7jqq6W-Y

PART 8 - Message and Message Group Model https://www.youtube.com/watch?v=gRCFexcDBao

PART 9 - Profile View https://www.youtube.com/watch?v=0UTCJVcR7qU

0 Comments
2024/04/15
10:38 UTC

14

From Android to iOS, What Should I & Developers Focus On?

TLDR: Questions for those who switched from Android Development to iOS Development: What was the hardest part about transitioning to iOS development? What topics should I focus more on in iOS development? What are the must-learn aspects? If you faced any challenges during your transition or have any advice, I'd appreciate your insights.

As an Android (Kotlin) developer at a startup, I've been tasked with developing the same application for iOS that I've previously developed for Android. I have the freedom to choose the programming language. While I have experience with Flutter, I personally don't see a bright future for it. Since I may not be at this startup indefinitely, I believe it would be more beneficial for me to develop skills in a more promising field. Therefore, I'm interested in starting native iOS development. To accelerate and refine my transition process, I have a few questions for those who have experience in Android development and later learned iOS development: What was the hardest part about transitioning to iOS development? What topics should I focus more on in iOS development? What are the must-learn aspects? If you faced any challenges during your transition or have any advice, please share.

11 Comments
2024/04/15
09:12 UTC

3

alternative app icons causing binary to fail during processing

https://preview.redd.it/vv97tdhbxkuc1.png?width=2598&format=png&auto=webp&s=06fb36bd77856cafdd680ef5e7edac386ccc4767

https://preview.redd.it/gs35vchbxkuc1.png?width=726&format=png&auto=webp&s=aae736d73f29a95a6c11e344f97b5cf80f018966

https://preview.redd.it/t88szahbxkuc1.png?width=1628&format=png&auto=webp&s=8fe92de2a43eeeea6a963c31351da8172dde6fa4

I am able to change the app icon from within the app, but when I upload this build to App Store Connect, it fails and then I get an email saying it can't locate the assets. But the assets are clearly there and named correctly.

Any ideas on why its actually failing? If I remove all the alternative icons and just leave the default "AppIcon-Dark" it uploads successfully.

2 Comments
2024/04/15
05:32 UTC

0

Using Open AI's Assistant API, Should i use middleman Flask app or direct calls from IOS app?

Title basically says it all, i just created a flask app for a program in which an Assistant will be computing rendering information given from the user on a constant basis, will be creating visuals based on user input and other features. I want to prioritize security and computation efficiency. I hrd that the MiddleMan method doesn't help with latency though. Any input would help, thanks.

7 Comments
2024/04/15
03:30 UTC

0

Hello everyone I want to see if anyone can make me an Application for free as I know this is a big request but I have an idea for an application but I don’t know how to code so I cannot develop one I’m doing this application for my country/community and therefore it will be completely free

36 Comments
2024/04/15
01:30 UTC

5

WWDC blacklist for not attending when invited?

Does anyone think Apple excludes a developer from the lottery WWDC invites if they missed one they were in invited to?

I was invited a few years ago and accepted, but at the last minute I didn’t go.

I haven’t been invited since and I’m wondering if they hold that against people.

12 Comments
2024/04/14
21:56 UTC

0

Is Vision unreliable in Xcode playgrounds?

I'm trying to play around with Vision for document detection. I'm following along with a WWDC21 video called Extract Document Data using Vision. In the video the presenter shows off a demo in an Xcode playground.

However, when I try this it does not work. When I try to get the VNImageRequestHandler to perform my VNDetectDocumentSegmentationRequest I get a rather unhelpful error: Error Domain=com.apple.Vision Code=9 "ImageAnalyzer failure with status 8539 (Espresso error)" UserInfo={NSLocalizedDescription=ImageAnalyzer failure with status 8539 (Espresso error)}

I saw in this post on Stackoverflow some people asserting that Vision requests only work on actual devices and fail in playgrounds or the simulator. Is this true? Is it just unreliable, hence why the presenter was successful and I am not?

https://stackoverflow.com/questions/70473725/ios-vision-framework-unable-to-setup-request-in-vndetecthumanbodyposerequest

My code:

guard let uInputImage = loadImage(at: "/TestDocument.heic")
else { fatalError("Could not load image") }

guard let gInputImage = uInputImage.cgImage
else { fatalError("Could not convert to cgImage") }

let inputImage = CIImage(cgImage: gInputImage)

let requestHandler = VNImageRequestHandler(ciImage: inputImage)

let documentDetectionRequest = VNDetectDocumentSegmentationRequest()

do {
    try requestHandler.perform([documentDetectionRequest]) //fails here
}
catch {
    print(error)
}
1 Comment
2024/04/14
21:54 UTC

0

Change app name

Hello all, I want to change my apps name. How will that affect urls to rate the app, or URLs to download the app?

3 Comments
2024/04/14
17:04 UTC

0

Abetter Xcode open source IDE?

Why doesn't this exist?

11 Comments
2024/04/14
14:46 UTC

7

When does it make sense to reset the undo/redo stacks for UndoManager?

Hi all, I was wondering what strategies you’ve adopted if your app uses the UndoManager API.

Let’s say that an app has “significant screens”, where the user performs undoable actions. Should the UndoManager be reset when a user navigates away from or to another significant screen? Or is this too aggressive a strategy. Looking at iOS apps, Reminders seems to do this.

However, other apps like Mail, Photos, Phone do not. At most, undo/redo is disabled in certain non-significant screens, but the stacks do not reset. Never clearing the undo stack may lead to memory issues, but even if it didn’t, would this be too confusing for users? As they may undo an action but not see the result.

10 Comments
2024/04/14
13:02 UTC

1

Implementing a Complex Subscription Model with Periodic Credit Grants Using RevenueCat: Assistance Needed

Hello,

My iOS app features a rather intricate subscription model. Users have the option to subscribe monthly or annually, with each subscription period granting them a specific number of credits (e.g., 100 credits/month or 1200 credits/year). Ideally, customers should receive these credits immediately upon their initial subscription or each time their subscription renews automatically. However, the standard subscription options don't support this functionality with simple settings, necessitating a custom solution on my part as the developer.

Firstly, I'm wondering if RevenueCat offers a straightforward solution to implement this subscription model? I've searched online resources but haven't come across any suitable solutions.

Secondly, if there isn't a simple solution available, I'd like to outline my proposed approach for addressing this issue and inquire about how I can achieve it with RevenueCat's assistance. My plan involves crediting the users' accounts each time they subscribe or renew their subscription, and then storing this information on a server such as Firebase. Identifying when a user subscribes for the first time is straightforward if it's done within the app. However, I'm uncertain about how to capture the information when a subscription renews automatically. Additionally, relying solely on app activity may not suffice, as users may not interact with the app for extended periods. To address this, I'm considering maintaining a comprehensive record of all subscription periods that the customer has paid for, possibly including unique identifiers, allowing me to credit the appropriate amount of credits once I receive notification of each subscription period. However, I haven't been able to identify a corresponding property in any of the RevenueCat classes/structs that I've found online. Could you please provide guidance on this matter?

Thank you in advance.

1 Comment
2024/04/14
07:36 UTC

1

SwiftUI TVOS focus not working for a button inside HStack

I'm building a TVOS app using SwiftUI. I'm new to SwiftUI.

Here is my movie detail UI

https://preview.redd.it/e5o9k5ymkfuc1.png?width=1920&format=png&auto=webp&s=4419b927ec5772301b541ca5748349fc9693acb2

Here I need to add focus to Add To Watch list button. But when I try to move using the Apple TV remote in simulator only Back button receives the focus. the button is not receiving. Here is my code . Here inside HeaderView when I place a button outside of the HStack it receives focus. While inside the Stack it is not receiving the focus

import SwiftUI
import SDWebImage
import SDWebImageSwiftUI

struct MovieDetailScreen: View {

u/ObservedObject var vm = DetailScreenViewModel()
var movieId: String
var body: some View {
GeometryReader{ reader in
ScrollView{
VStack{
//Header View
HeaderView(movieData: vm.movieDetail)
.frame(height: reader.size.height / 1.5)

Text("Screen Shots")
.font(.largeTitle)
.bold()
}
}
}

.onAppear(perform: {
vm.getMovieData(id: movieId)
})
}
}

#Preview {
MovieDetailScreen(movieId: "343611")
}

struct HeaderView: View {
u/Environment(\.dismiss) var dimiss
var movieData: MovieDeatilResponse.MovieDetail?

var body: some View {
ZStack(alignment:.bottom){
WebImage(url: URL(string: "https://image.tmdb.org/t/p/original/" + (movieData?.backdropPath ?? "")), content: { image in
image.resizable()
// .frame(width:reader.size.width,height: reader.size.height / 1.5)

}, placeholder: {
ProgressView()
.frame(height: 500)
})

VStack(alignment:.leading){
Button(action: {
dimiss()
}, label: {
Text("Back")
}).padding(.bottom,80)
.padding(.leading,40)

HStack(alignment:.center){
AsyncImage(url: URL(string: "https://image.tmdb.org/t/p/original/" + (movieData?.posterPath ?? ""))) { image in
image.resizable()
.frame(width:300,height:400)
.border(Color.white, width: 4)
.shadow(color:.black,radius: /*@START_MENU_TOKEN@*/10/*@END_MENU_TOKEN@*/)
} placeholder: {
ProgressView()
.frame(width:200,height:200)
}

VStack(alignment:.leading,spacing:10){
Text("\(movieData?.originalTitle ?? "")")
.font(.largeTitle)
.bold()
Text("\(movieData?.overview ?? "")")
.font(.subheadline)
Text("Release Date: \(movieData?.releaseDate ?? "")")
Text("Language: \(movieData?.originalLanguage ?? "")")
HStack{
Text("Score: \(movieData?.popularity?.rounded() ?? 0.0)")
Text("Run Time: \(movieData?.runtime ?? 0) min")
Button(action: {
//Btn Action not working unable to focus
}, label: {
Label("Add To Watch List", systemImage: "popcorn")
})
}

}

}.background(Color.black.opacity(0.5))

}

}
}
}

2 Comments
2024/04/14
11:30 UTC

4

Properties are getting saved in Core Data but is not getting fetched properly

Link to Stack Overflow question : https://stackoverflow.com/q/78322986/21416280

I have a core data entity called UserList and it has one to many relationship with other entities like Users , UserLinks , UserAllowedSellRoles and UserAllowedBuyRoles . I have to save various properties of each in these entities corresponding to the currently logged in user id in UserList .

The thing is that data is getting saved properly but when I try to fetch it every data except for the one saved in Users entity is getting fetched . I inspected the db and the data related to users are there in Users entity and it persists too but it is not getting fetched . Can somebody help me to find what is wrong ?

0 Comments
2024/04/14
07:08 UTC

10

App for personal use?

Hi all!

Quick question I (fear) think I already know the answer to I’d like to create an app for personal use. It’d for-fun-project, with no intent of ever publishing it or making money off of it as it’s meant to fulfill a personal niche.

However, from what I’m reading, even if I only want it to function on my own iPhone/Mac, I’d still need to pay the 99$/year

Am I wrong? Is there a better way to create an app for personal use? Thanks in advance

31 Comments
2024/04/14
07:02 UTC

Back To Top