title: How would I draw to a mutable in-memory bitmap?
body: <p>I'm trying to write a <strong>simple painting app</strong> for iOS as a first non-trivial project. Basically, on every touch event, I need to open a graphics context on the bitmap, draw something over top of where the user left off, and close it.</p>
  
  <p><code>UIImage</code> is immutable, so it's not exactly suitable for my purposes; I'd have to build a new bitmap and draw the old one into the new one. I can't imagine that performing well. Is there any sort of mutable bitmap class in UIKit, or am I going to have to go down to <code>CGImageRef</code>?</p>