Live data from Hacker News

Is it possible to write plain C iOS app in 2025?

news.ycombinator.com

51–60 of 74 posts

Re: Is it possible to write plain C iOS app in 2025?

#51

If you just want to write C and are ok linking to stuff that is in other languages, then I used SDL2 for my game which I wrote in C and is on the app store. It was a very pleasant experience, and if I were doing an iOS thing again, I would likely do something similar. I think I had one objective C file in there for calling a library function I needed, but otherwise I just wrote C code.

Would it also be possible to write in both C and another (small, implementation written in C) higher level language? For example Lua or similar?

Re: Is it possible to write plain C iOS app in 2025?

#52
post #44

Yes. And many are when you require a common code-base for iOS, Android, and other devices. (But C++ is used more commonly) Video games are the ones that do this by default. It would be close to impossible to have feature parity by coding a game for iOS in Swift, for Android in Java, for Steam in C++, etc. Unreal or Unity will have C/C++ code-bases with very light integration layers to do system calls.(The payment sys…

I would go for Kotlin Multiplatform if I needed a shared code-base these days.

Re: Is it possible to write plain C iOS app in 2025?

#53
There is this beautiful single-header library to write simple graphical programs in C, portably to standard unixes, macos, and windows:

https://github.com/ColleagueRiley/RGFW.git

It was discussed recently around here: https://news.ycombinator.com/item?id=42217535

The macos backend is a neat hack, written in pure C.

Re: Is it possible to write plain C iOS app in 2025?

#54

If you just want to write C and are ok linking to stuff that is in other languages, then I used SDL2 for my game which I wrote in C and is on the app store. It was a very pleasant experience, and if I were doing an iOS thing again, I would likely do something similar. I think I had one objective C file in there for calling a library function I needed, but otherwise I just wrote C code.

Would you be open to answering a few more questions about this? My email is in my profile or I could reach out to you if you provided a way.

Re: Is it possible to write plain C iOS app in 2025?

#56
post #9

If you just want to write C and are ok linking to stuff that is in other languages, then I used SDL2 for my game which I wrote in C and is on the app store. It was a very pleasant experience, and if I were doing an iOS thing again, I would likely do something similar. I think I had one objective C file in there for calling a library function I needed, but otherwise I just wrote C code.

Just SDL2? Do you have access to OpenGL or some sound library as well? and if so what library are you using? How do you handle input and networking?

SDL does have a platform-agnostic render library for basic stuff, and you can integrate Metal into it pretty easily.

Re: Is it possible to write plain C iOS app in 2025?

#57
Well, you could basically do any llvm supported language. I remember a few years ago I tried creating a DSL just for fun and the sake of testing on iOS.

You can create a frontend of whatever language you want for llvm so it’d translate it to llvm-ir.

You just need a small wrapper in objective c to make it work.

Re: Is it possible to write plain C iOS app in 2025?

#59
post #44

Yes. And many are when you require a common code-base for iOS, Android, and other devices. (But C++ is used more commonly) Video games are the ones that do this by default. It would be close to impossible to have feature parity by coding a game for iOS in Swift, for Android in Java, for Steam in C++, etc. Unreal or Unity will have C/C++ code-bases with very light integration layers to do system calls.(The payment sys…

Before settling on Electron, I recommend exploring Tauri. It's more lightweight, it's better with sandboxing and it allows dropping down to Rust when performance is critical.

It's more lightweight because it doesn't include a browser engine. The obvious downside is that there is more room for compatibility issues. I'm not sure it's worth it.

Re: Is it possible to write plain C iOS app in 2025?

#60
I wrote an app that has minimal Objective C that then just calls C++ code. You can either add .cpp files to your project, or if I recall correctly, you can just define C++ functions in your obj c files. In my app, Objective C just sets up the UI and then it calls C++ functions to do calculations. Not exactly your question, but might be helpful.
Post reply on HN