Supporting tools, iExplorer and Phone Disk

I thought I’d explain my normal use pattern for Codea in case that is useful to the devs or other users.

I find typing on iPad pretty hard work, partly because of the limited keyboard and tactile feedback, but also after an hour or so it kills my back. Getting old I suppose. So I’m doing most coding on my laptop on desktop with a full screen. This works pretty great, except I like to edit-run-test and spin through that loop extremely quickly.


First two days I was using iExplore and dragging my file into the appropriate Codea project folder. This was a little bit laborious - I get about 4 clicks and 2 drags, a dialog box or two on my desktop. Also Codea writes out the code files to the iPad storage when the user exits the project, so you need to do the desktop file drag-drop after exiting the Codea project to the Codea project select menu. Otherwise you have to do it again. I think I can edit-run-test 2 times a minute.

Phone Disk

Now I’ve upgraded to Phone Disk. This is advertised at $20 which I expect to pay, but the trial is reasonable giving a hundred or so (can’t remember exactly) MBs of transfer data before requiring registration. I have a feeling it doesn’t count bytes transferring from the desktop to the iPad. My use case is to have Unitron (editor) open with the file saved direct to the mounted iPad filesystem. This means all I have to do is Command-S to save my file straight to iPad. Marvellous. Also I have to remember to exit my running Codea project (touch ‘BACK’) and exit the code editing screen (touch ‘X’) first. There’s a risk I’ll mess up and overwrite my code but I’m taking that risk because it makes the coding experience so interactive, and also taking occasional backups.

So overall I’ve found Phone Disk works really great for me, although it has a few warts and wrinkles that you expect from a small code shop, which you can work around by occassionally resetting state via the UI.


Unitron is just the editor I have on this desk top laptop. It comes with Unity. I have a feeling Unity was never authorized on this machine so it will be demo only, but it is a pretty neat editor with syntax highlighting for lua built-in. Maybe you can download Unitron on its own, I’m not sure.


My dream (and what I might do if I had buildable code for Codea) is to have Codea detect the file has been updated under it’s feet and reload automatically, ideally controllable with a per-project setting to confirm with user or just do it. Then it takes less than a second to run new code on iPad - simply press Command-S.

Haha. @Martin - I was just about to post about how great iExplorer, Phone Disk, and libmobiledevice is. I was also going to post about all the things you can hack with them. About the keyboard problem I really suggust a BlueTooth keyboard. Best accessory I ever bought. I just love how you can use the arrow keys ad shift-arrow keys to select code, the tab, and pasteboard management. I will be even more useful when Codea 1.3 comes out. About Unity, there are am y unity apps on iOS. But no Unity coders.

I do something similar in Linux ( One thing I found is that you have to keep the tab order list in the Info.plist file in sync with the files in the project whenever you create, delete or rename files. Codea crashes if the tab order list refers to nonexistent files. I wish it handled that condition more robustly; it would make editing code inthis way much easier.

@Martin thanks for sharing your workflow. It’s very informative. I think it’s important that we support this sort of workflow, so I’ll look at having Codea detect external modifications and reload the file for version 1.3.1 (version 1.3 is already sent off, so we can’t make it in that version).

@Nat we’ll have Codea behave better when the tab order list becomes invalid.

Any other suggestions for making it easier to work with externally?

HTTP code editing from computer - Basically a website that Codea makes that your computer accesses over the local network. Kind of like what Phone Drive does…
In my dreams. I know… Or not. Whatever. I could be like that just to download a .txt file with the code in it… Is that considered code sharing?

As far as ideas, we use an app at work called “cloud readers” to load PDFs on the fly to the iPad. You bring up a screen in the app. It displays a IP address. You then go to a PC type in the IP address. It serves a simple web page to upload a file. We don’t use other more standard methods because this iPad is for guests so the attempt is to keep most of it disabled. It’s really a sad tortured life for this iPad.

As far as back issues with the iPad, I work reclined which prevents back issues. I do tend to avoid apps that can’t be played with the iPad in a vertical position.

the dream for me would be able to wirelessly edit codea code on my PC and have it update on the ipad automagically so then I can just press play on the ipad and see the results. That will probably go against the no-uploading code to the app rule though.

That’s what I meant. Kind of. Download and upload files.

@ruilov it’s possible without violating the rule. All I’d have to do is make Codea monitor the project folder for changes and refresh when they happen. Then you’d have to use an app like Phone Disk to mount the device and save directly to the project dir.

Now I’m starting to see why Codea Sync could be useful.

@Zoyt Oh absolutely, you can check out all the files in all your iOS applications. A lot to see there.


Well, that’s great news. Now I’m looking forward to 1.3 aaannndd 1.3.1

Hmm, other suggestions for supporting external workflow? I suppose if Codea checked over the contents of the project directory for new code files it would make adding files to a project easier. At present you have to add a file to a project in Codea, then you can copy in the body from the host machine. You don’t really do this very often though, so not a big need. (I’m more concerned about the inner edit loop I mentioned).

I see that @Nat mentions a crash bug in the other direction (removing files from the project). This sounds a little more annoying.

Many thanks!

“Any other suggestions for making it easier to work with externally?”

I’ve found that Codea will discard edits that I’ve made from Linux when the iPad is mounted as a disk. I think it happens when the project is open on the iPad. When I close the project, it saves the files from the open editors, overwriting the changes I’ve made “behind its back”, so to speak.

I wonder if Codea could be made more aware of changes coming in from elsewhere. Maybe update the contents of the editor if the file changes on filesystem.

And, vice versa: automatically save Codea’s editor contents automatically when the user has not edited for a short while. I imagine that the short while can be very short: maybe a few milliseconds. Or even after every editing gesture. (I’m not sure what the effect on power consumption would be. Maybe only do that if the iPad is plugged into a power source).

Many thanks for taking this unusual use case into consideration.

One other thought… it would be nice if Codea would ignore unexpected files in the project directory. Maybe it could just ignore those that start with a “.” character.

That would let us put Codea projects directly under version control, instead of fiddling about with overlay filesystems.

Just thought I’d mention (once again) a little supporting tool for if you have an existing bluetooth keyboard coupled with a Mac and find (as I do) it too much of a hassle to uncouple the keyboard from your Mac and recouple with your iPad (and back again) when Mac and iPad are at the same location.

It’s called Type2Phone and is available for a few bucks on the mac app store.

@Blanchot - I forgot about that. I saw it’s release right after I bought my keyboard. I am yet to try it. But hooking and unhooking the keyboard from my iPad is not only lengthy, but battery draining for both devices. As I’ve mentioned before, im looking into doing something like libmobiledevice for Codea so you can read, drag, and drop files. It would also have a built in sprite pack builder. Sounds useful?

Let me know if it is, and I might do it (and I always love help).

It would be really keen if Codea noticed changes to the project folder. +10 votes. I can’t say how many times I’ve forgotten to restart codea and spent time sitting, confused.

But how would that work? Would you simply restart the running app? Or I guess it’d be up to the user to stop/start it again.

Mabey one of those pull to the left to reload just like apps like Pulse does? But apple might get suspiciouse and not like our use of iExplorer… X(

“But how would that work? Would you simply restart the running app”

I’m not bothered about the app magically using the changed code after it has started running. That’s very tricky to get right. If this was Smalltalk the VM would be designed to do that, but the Lua VM is not. And what would happen if the setup method changed? I don’t think it’s really possible with Codea’s programming model.

I’m more interested in having the editor contents reflect changes to the files so that edits from another computer are not overwritten by Codea.

What’s the current state of this? I’ve tried editing lua files using notepad++ while my iPad is mounted on my linux workstation – but if codea is open and the project is loaded the changes don’t show up (and codea saves the current files on exiting the project, even if no changes were made while inside codea, thus overwriting any changes made externally)