visionosj2objc

Can J2ObjC be built for Apple Vision Pro?


I have an iOS project that runs on J2ObjC v1.2. It can work on visionOS as an iPadOS app. I'm researching if this project can be migrated to a visionOS native app with immersive view support.

I think the app can be rewritten by naive visionOS SDK and get rid of J2ObjC, which will take me a few months. It is better if we can reuse J2ObjC and save some efforts.

Does J2ObjC support visionOS? Is it possible to build J2ObjC from source code for visionOS?


Solution

  • J2ObjC doesn't support visionOS. AFAIK, there's nothing blocking someone from doing so, it's just a matter of adding that architecture slice to its Make templates; for example, here's the commit that added watchOS support.

    That said, does it really make sense? The core subset library of j2objc's JRE is 17M, while the full JRE is a whopping 52M. So even small apps will be big.

    More importantly, j2objc is focused on sharing non-UI code, and my guess is that most vision apps will predominantly support graphics and UI. We developed j2objc back when Google wanted its enterprise apps like Gmail, Calendar and Docs to work offline (like on a flight). So all of the server-side business logic and data objects needed to be replicated, with sophisticated sync support between them. I don't see that being a requirement for any vision app, though. Won't most of the interesting data and app logic be done on the server?

    You have a few code-sharing options that may be a better fit. Kotlin MP supports iOS, and (like j2objc) there shouldn't be any technical barriers to it supporting visionOS. Its runtime is much smaller than any JRE, so your app will be smaller. Another option is React/Native, though I've never used it.