Note: Source code (RemoteImage) available on Github Yesterday, I explained how to use the NSURLConnection API to load a remote JSON file. Today I will show you how to use the same API to load a remote image. In fact, the NSURLConnection, similar to URLStream (in AS3) can load pretty much anything, basically it will download raw bytes, once loaded, you are free to do whatever you want with them.
Note: Source code (RemoteJSON) available on Github Loading something remotely is a pretty simple task in Flash. We can use the URLStream or URLLoader object, a URL is wrapped inside a URLRequest object, we call the load() API and we are done. So I was wondering what it looks like in Swift and specifically loading a JSON file, which is a common thing to do today, so here is a little snippet
As you guys know, I always loved playing with binary stuff, and one of the frustrating thing in ActionScript has always been the lack of more granular data types. In ActionScript 3, whatever type you use, it will either occupy 64 or 32 bits in memory, even for a simple boolean. Not super optimized. So if you were to work with a byte (which is 8-bit), the smallest data type you could use
Note: Source code (DrawingText) available on Github In the last article, we covered the basics of bitmap drawing with Swift and the Quartz/Core Image APIs. As I was playing with that, I wondered how text could be drawn on a bitmap. In Flash, the BitmapData API does not have an API for drawing text, the workaround was to use a TextField offscreen that would be passed to the BitmapData.draw API.