Forgive me for the overlap with recent Xcode-related posts…bottom-line question that I have is: aside from tweaks and updates that @Simeon has mentioned lately to support the latest Swift and Xcode, just how robust is the Codea-to-Xcode-to-iOS app, from a technical perspective?
Is it WYSIWYG, in that however my project works in Codea, that’s how it works as an app? Any limitations? Features that work in Codea but not so much once exported? Etc.?
Decision is, do I seriously pursue making full-fledged apps via Codea (because, well, I really enjoy dev in Codea), or do I make the decision to start investing my time to get up to speed with Swift and Xcode?
Cargo-Bot feels just fine as an app, sooo…yes? Is is a viable approach to app making?
Cargo-Bot is a good example of an optimal Codea export since it’s a game. It has highly custom UI, it’s self-contained, it doesn’t rely on particular features of iOS
Shade is an example where we’ve merged Codea and UIKit (see https://codea.io/blog/looking-through-the-shade-ui/). But doing that requires a fairly deep technical understanding of the Lua C API, because you basically have to write your own bridge from UIKit to Lua. The exported Codea project provides a way to do this (CodeaAddon) but it’s not easy and I wouldn’t recommend it
Apps where you have a lot of custom graphics and UI are where Codea is a viable option
I would recommend looking into Xcode and Swift if you want to take advantage of iOS-native features and make apps like Apple’s own
In the future I’ll be expanding on Codea’s UI support to build native UI through Lua, but that’s not now
From a technical perspective when you export your app you get an Xcode project with a structure like:
Project
- MyApp.codea
- AppDelegate.swift
- MyAppViewController.swift
- Frameworks
|_ Codea's engine frameworks
- Addon
|_ An empty "addon" class where you can start writing native C <-> Lua code to expose your own native functions to Codea
You can edit your MyApp.codea project on your compute by dragging the bundle onto a text editor like VS Code, Atom or Sublime Text. Then you can edit your Codea code and build-and-run in Xcode to immediately see the changes on your device or in the simulator
You need to keep certain things in mind though, like where your assets are located. Assets in your project folder, i.e., MyApp.codea, are read-only once you export your project. So if your app needs to write assets to disk you should be writing to the asset.documents location