Disposition, easier setters for CGRects

CGRects are widely used in iOS and OSX development, but some useful setters (particularly CGRectSetSize and CGRectSetOrigin) are definetively missing. So, I’ve programmed Disposition, a set of functions that can help avoid some unnecessary code when setting up CGRect’s properties.

The header file, currently defines the following fancy functions (which I hope increases over time and with the help of collaborations):

void CGRectSetSize(CGRect *rect, CGSize size);
void CGRectSetWidth(CGRect *rect, CGFloat width);
void CGRectSetHeight(CGRect *rect, CGFloat height);

void CGRectSetOrigin(CGRect *rect, CGPoint originPoint);
void CGRectSetX(CGRect *rect, CGFloat x);
void CGRectSetY(CGRect *rect, CGFloat y);

As usual, distributed under a MIT License.

iOhYes, a podcast for iOS developers

Join Adam, Jason and John, three iOS devs from US teamed-up in the endeavor of recording iOhYes, a podcast for iOS developers by iOS developers.

Their show discusses the latest news in the iOS scene and shares perspectives on the Objective-C language, its related technologies and the craftsmanship of software in general.

A recommended resource for keeping in touch with interesting news of the platform, discovering related projects and repositories and having a good laugh every now and then.

Travis CI and iOS Projects

Travis is a Continuos Integration platform targeted to the Open Source Community. Among many other languages, it now supports Objective-C projects, but its lack of documentation can give the impression that it is a difficult task to achieve while in fact it quite simple. Find out how simple it is to configure your iOS Xcode project hosted in Github in 3 steps:

1. Configuration File

All Travis projects start with a YAML configuration file named travis.yml. An iOS project actually requires a very simple one:

language:objective-c
before_script:
  - cd TwinkleStarExample   # in case your project resides in a sub-directory
xcode_sdk: iphonesimulator

The xcode_sdk: line is important to avoid the error:

Code Sign error: The identity 'iPhone Developer' doesn't match any valid, non-expired certificate/private key pair in your keychains

2. Shared Schemes

Ensure the schemes of your target are Shared. This option makes a scheme visible to anyone using that project. To enable it, go to the menu: Product > Scheme > Manage Schemes.

This prevents the following error:

xcodebuild: error: The project 'PROJECT_NAME' does not contain a scheme named 'SCHEME_NAME'.

3. Success

Writing a configuration file and making a few clicks in Xcode are for sure exhausting!

Reward yourself by opening a can of Cola and start enjoying the benefits of continuous integrated builds. 🙂

For some examples, refer to some of my iOS repositories in Github:

Transcontinental

If you’ve worked with the Core Location class CLPlacemark, you might have noticed that despite having properties like ‘ISOCountryCode’ or ‘ocean’, there is not a property, nor an easy way to obtain its corresponding continent.

To solve this, I’ve programmed a small category on CLPlacemark that allows you to obtain its continent with a simple method:

NSString *continentForPlacemark = [paramPlacemark continent];

The continent is retrieved from a table using the ISOCountryCode property of the placemark. Also a simple Country-to-Continent decoder is available:

NSString *expectedContinent = [continentDecoder continentForCountryCode:@"PL"];

The name of this project is Transcontinental and is available as a MIT Licensed repository in Github. It also includes a simple example which should make its use clear as water.

Enjoy!