Get Updates By E-mail 

Subscriber Counter

iOS Development Source Code Examples

This section is for app source code examples and code snippets that do not come with an in-depth tutorial.

Example: An iOS Sprite Kit Based Version Of The Game 2048

Earlier this year I mentioned a Sprite Kit based example of Flappy Bird, and a nice library for adding a number of useful features to Sprite Kit such as tileable textures.

Here’s a source code example from Danqing Liu providing a Sprite Kit based version of the web based game from Gabriele Cirulli.

Here’s an image showing the Sprite Kit based version in action:
2048

Guide And Examples: Simplifying Code Using The Builder Pattern In Objective-C

In the builder pattern one creates a new objects using a dedicated builder object allowing you to avoid having to make multiple constructors, and greatly increasing the readability of your code when initializing complex objects.

This example from Klass Pieter Annema illustrates the builder pattern well with some code such as this:

Pizza *pizza = [[[[[PizzaBuilder alloc] init] setPepperoni:YES] setMushrooms:YES] setSize:12] build];

Becomes this:

PizzaBuilder *builder = [[PizzaBuilder alloc] init];
builder.size = 12;
builder.pepperoni = YES;
builder.mushrooms = YES;
Pizza *pizza = [builder build];

And using a configuration block can become even simpler:

Example: A Real Time Chat App Complete Featuring Login By Facebook/Twitter

Early this year I mentioned a very extensive project for those looking to build full featured messaging apps called Spika.

Here’s another nice open source example for those integrated in providing chat features within an app called AwesomeChat from Related Code.

AwesomeChat shows how to use a Facebook/Twitter login, a great looking user interface with nice animations, data detectors for phone numbers, dates, and links, avatar images pulled from Facebook/Twitter, sound effects, a backend server and more.

Example: Easily Creating Dynamic Transitions On iOS With UIDynamics

About a month ago I mentioned a nice UIKit UIDynamics example providing a number of examples showing how to perform collision, gravity, snapping and more with UIDynamics.

Here’s an example by Finn Gaida that shows how you can easily create a dynamic transition using UIDynamicAnimator.

With just a couple of lines of code the example shows how to create a unique transition with full physics.

Here’s an animation from the readme showing FGDynamicsTransition in action:
FGDynamicsTransition

iOS 7 UIDynamic Source Code Examples Demonstrating Gravity, Collisions, Snapping And More

I’ve mentioned a nice set of iOS 7 source code examples demonstrating the usage of many features added with the iOS 7 SDK and a tutorial explaining the basics of the UIDynamics API through the building of a Pong game.

Here’s a set of examples submitted by Jacky Li demonstrating usage of the UIDynamic API.

Included are examples  of gravity, collisions, attaching objects together in a group, and how to smoothly snap objects on a specific location.