Live data from Hacker News

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

news.ycombinator.com

61–70 of 74 posts

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

#61
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.

Why Kotlin?

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

#63

Earlier quoted context omitted.

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.

I agree. https://tauri.app/start/prerequisites/

> Tauri requires various system dependencies for development on Linux. These may be different depending on your distribution ...

> WebView 2 is already installed on Windows 10 (from version 1803 onward) ...

> iOS development requires Xcode and is only available on macOS.

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

#64
post #27

Earlier quoted context omitted.

If you just need C instead of C++ then .m suffices, ojective-c is a strict superset of C.

It‘s a superset of ANSI-C. One needs to be carful to mention this. I‘m not aware that this had changed and also added some small grieve back in the days for me. But I sadly can‘t remember anymore what didn‘t work for me.

I'd be curious if you can remember what differences there were. It's compatible with all C99 and C11 syntax I've tried

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

#65
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.

ooh why?

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

#66

Objective-C is designed in such a way that, generally speaking, anything you can do with Objective-C syntax can also be done with a simple C function call to one of the Objective-C runtime functions. So you can write an entire iOS app in pure C. However, the Objective-C stuff is a lot more pleasant to use if you use the syntax for it. As others have mentioned, for something like a simple game (rather than a normal GU…

I’ve written a pure C Mac desktop app in 2024 that called the objective-c bindings directly. It is using a modified version of this library https://github.com/ColleagueRiley/RGFW

While I don’t think that library does iOS specifically, you can have a look at the code to see how you can call objective-c from c. Spoiler: doing so kind of sucks, and also the library code isn’t the most elegant thing I’ve seen.

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

#67
I think a better question is - could people practically write macos/ios apps without xcode.

I remember the feeling I first got (decades ago) when moving from C to objective C.

Having an xcodeproj was like the camel's nose under the tent, and then you couldn't go back. And you frequently had a big mess going forward when the next xcode version came out and it wouldn't work.

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

#68

Earlier quoted context omitted.

Objective-C is a C superset, while Objective-C++ is a C++ superset, where C++ is a mostly C superset. You're not really buying anything using Objective-C++ by adding another form of OOP, except perhaps for interop with C++.

It’s the interop that’s a big deal. The platform is Obj-C (or was, now it’s Swift), most useful non-iOS-specific libraries are C/C++, being able to use Obj-C++ to glue everything together is really convenient. Vastly easier than e.g. JNI on Android.

There it is. True, it's very painful to wrap C++ code into C libraries (or requiring C calling conventions) where C++ isn't allowed.

Separately, I'm wondering if anyone uses Kotlin Multiplatform and how well that works for iOS development.

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

#70

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?

SDL2 + Lua is a pretty common combo. Lua is very easy to interface with and integrate.
Post reply on HN