How to minimise Xcode file

Hey Guys, been a while since I’ve popped in…

I’ve developed an app for my own usage (a simple timer that involves basic graphics, touch, and sound) and I had installed it using Xcode-beta without a developer license.

The app uses a crazy amount of battery, and even some mobile data (without any network functions) on my iPhone 5, so I was wondering, is there any way to fix this and otherwise minimise the app footprint on a device? Possibly remove extra libraries, cut out unnecessary functions (within reason of course, I don’t need to remove the code for print() :slight_smile: )


@Jordan sorry about the battery use. It happens because Codea is designed primarily around motion graphics. That is, it continuously renders the screen at 60 frames per second.

For apps such as timers that update infrequently this is overkill. It would be necessary to add a special mode where you update the screen yourself, instead of having draw() called automatically. Although this would then remove a lot of the simplicity of Codea.

The mobile data usage shouldn’t happen unless explicitly requested (http.request). I’ll look into that.

@Simeon, maybe openURL?

whats the differrence between minimise and optimise?

@simeon you could have a targetFPS api call that could then be set to 1 to only draw every second.

@Dylan yeah, the target fps could increase the frame interval on the display link (would have to be 60, 30, 15, 7.5, 3.75).

Alternatively we could introduce an update() loop from which draw() can be called manually. The update loop could be run in sync with the app’s regular event loop.

@Simeon, I think I’m just stuck then. My timer updates pretty much every millisecond, with subtle animations too - only solution to the battery issues would be to recode the entire thing in Xcode, and that seems like too much effort for such a small gain…