Thread Safe Design

threadsThread safe design is achieved when operations on certain shared data structures can be safely executed from multiple threads at the same time. There are multiple ways to achieve thread safety using synchronisation tools provided by the iOS. They mostly consist of mutex locks (NSLock class or @synchronized directive) or the use of queues and GCD.

Continue reading

Circlemania – iPhone Game

circlemania_iconCirclemania is a visual perceptive game in which you have to find the last emerging circle among all other circles that have appeared previously. You are limited to 5 seconds for each turn. The faster you find the correct circle the more points you get.

Check it out at:

Continue reading

CMMotionManager and Low-pass filter

lowpass_filterIn Catchup, an iPhone game I recently published on the app store, I am using device motion sensor in order to move the main character. In order to make the character movements smooth I’m using a low-pass filter.

Low-pass filter provides a smoother form of a signal, removing the short-term fluctuations, and leaving the longer-term trend.

Continue reading

CatchUp – iPhone Game

catchup-iconCatchUp is an iPhone game I created using cocos2d framework. The game concept is very simple. Tilting the device you’re moving the character and avoiding other game characters chasing you. The more time you succeed in avoiding the chasing characters, the better the score.

Check it out at:

Continue reading

LTimer – iOS NSTimer helper class


LTimer is a simple iOS NSTimer helper class that allows easy dispatch of different NSTimer configurations. Supports blocks and method invocations.

Check it out at my GitHub repo:

Continue reading

LPlaceholderTextView – UITextView subclass with placeholder

lplaceholdertextview_placeholder_cropLPlaceholderTextView is a UITextView subclass with placeholder text and placeholder text color properties. In order to use in your project just import the LPlaceholderTextView class and use it as in the code sample below.

LPlaceholderTextView is available on my GitHub repo:

  • lplaceholdertextview_placeholder
  • lplaceholdertextview_text

Franko – Arduino Self Balancing Robot

FrankoMy latest Arduino DIY project is a self balancing robot.

Arduino Uno R3 microcontroller board is used for this project. MPU6050, an 6DOF IMU (with accelerometer and gyroscope) is used to get the angle and L298N motor controller board controls the 2 motors.

The motors are 12V 122rpm and the wheels are 8cm in diameter.

Robot size is 17x10x30 cm. Three plexiglas plates are used to hold the frame and parts. Standard PID controller is used to control the robot. To tune the PID controller parameters 3 potentiometers are used.

Continue reading

LASIImageView – download image with progress indicator

LASIImageViewSampleLASIImageView is a UIImageView subclass that supports asynchronous image download with different progress indicators. It is possible to choose among three different progress indicator styles, with or without percent text.

In order to use it, just add LASIImageView class files to the project and set the instance imageUrl property to download and display the image.

LASIImageView includes shared appearance settings. Appearance can also be specified for any LASIImageView instance, overriding the global appearance for that object.

ASIHTTPRequest is used for image download. Request settings can be set for LASIImageView instances globally, or per instance, overriding the global settings.

Continue reading

iOS Data Model using Core Data

contacts-screenshotLCDDataSource is a sample project hosted on my GitHub repo that presents a simplified process of getting remote data and storing it using Core Data framework. The data source implementation itself is in the LAbstractASIDataSource class and LCDParserInterface.h defines a protocol that the parser must conform to. Other classes are listed below. The model uses a Root context for async data persistance (saving data in background so main thread is not blocked). Main context is used on the main thread – presenting data to the user (UI). Worker contexts are used by the data sources and parsers for asynchronous data fetching and parsing. There is only one Root and one Main context, but multiple Worker contexts – one for each data source. Contexts are in a parent-child relationships: Root->Main->Worker(s). Any Worker context may be easily merged into Main context or discarded at all times without disturbing the main context.

Continue reading

MFMailCompose ViewController slow

Recently I ran into some issues with MFMailComposeViewController in iOS 6 and 7. After sending a couple of emails (or just opening and dismissing the mail compose view controller) the presenting animation becomes very slow, after a few more iterations the mail compose view becomes black and not responsive for a while. This message is output to the console: MFMailComposeViewController timed out waiting for fence barrier from

The issue goes away after the appearance code is removed: [UINavigationBar appearance] and [UIBarButtonItem appearance]. The workaround is creating and using UINavigationController subclass in the entire project and setting the appearance for that class: [UINavigationBar appearanceWhenContainedIn:[CustomNavigationController class], nil] and [UIBarButtonItem appearanceWhenContainedIn:[CustomNavigationController class], nil].