Category Archives: Objective-C

Realm Objective-C & Swift 0.96

Realm Objective-C & Swift 0.96
// Realm News

Realm Objective-C & Swift 0.96 is out with official support for null properties, keypath collection queries, RealmCollectionType Swift protocol, and more!

Video: Swift 2 Optionals

Swift 2 Optionals
// NSScreencast (free videos)

In this free episode, we take a look at a core Swift 2 feature: Optionals. Unlike Objective-C, where nil is considered a no-op, in Swift nil is specifically recognized by the compiler, which forces you to handle cases where nil might be present in a variable.

First steps with the Mapbox iOS SDK

via First steps with the Mapbox iOS SDK | Mapbox.

Mapbox Mobile is our vector maps library for mobile platforms. This guide will walk you through installing the Mapbox iOS SDK using CocoaPods and Xcode to load a map, place a pin on it, and change the map style. This guide supports Objective-C and Swift.

Heads up! We’re still actively developing Mapbox Mobile and will update this guide and add new ones as we improve its amazing features.

Install a Google SDK using CocoaPods

via Install a Google SDK using CocoaPods  |  Google APIs for iOS  |  Google Developers.

Google distributes several iOS specific APIs and SDKs via CocoaPods. CocoaPods is an open source dependency manager for Swift and Objective-C Cocoa projects. CocoaPods makes it easy to install or update new SDKs when working with Xcode.

You can install the CocoaPods tool on OS X by running the following command from the terminal. Detailed information is available in the Getting Started guide.

Efficient JSON in Swift with Functional Concepts and Generics

via Efficient JSON in Swift with Functional Concepts and Generics.

A few months ago Apple introduced a new programming language, Swift, that left us excited about the future of iOS and OS X development. People were jumping into Swift with Xcode Beta1 immediately and it didn’t take long to realize that parsing JSON, something almost every app does, was not going to be as easy as in Objective-C. Swift being a statically typed language meant we could no longer haphazardly throw objects into typed variables and have the compiler trust us that it was actually the type we claimed it would be. Now, in Swift, the compiler is doing the checking, making sure we don’t accidentally cause runtime errors. This allows us to lean on the compiler to create bug free code, but means we have to do a bit more work to make it happy. In this post, I discuss a method of parsing JSON APIs that uses functional concepts and Generics to make readable and efficient code.

How To Test UIAlertController in Swift

via How To Test UIAlertController in Swift.

Recently I read a blog post about testing UIAlertController in Objective-C using control swizzling. Posts like this always trigger me to find a way to test the same without the swizzling. I know that swizzling is a powerful tool developers should have access to in their developer tool box. But I personally avoid it when ever I can. In fact only one app I worked on in the last six years used swizzling. And today I believe we could have implemented it without it.

So how to test UIAlertController in Swift without the swizzling?


via NSDecimalNumber – Ry’s Objective-C Tutorial – RyPress.

The NSDecimalNumber class provides fixed-point arithmetic capabilities to Objective-C programs. They’re designed to perform base-10 calculations without loss of precision and with predictable rounding behavior. This makes it a better choice for representing currency than floating-point data types like double. However, the trade-off is that they are more complicated to work with.