The Must Knows for iOS Developers II

Just as we promised you guys, in the previous article of iOS developers the must-knows, we are back with the second installment of the article. That’s because there are so much unknown about the iOS development thus one article isn’t sufficient enough to share everything. So, let’s start the post and get to the work.

-1. React or Not

Functional Reactive Programming (FRP) is a new trend. The motive of the FRP is to enable easy composition of asynchronous operations and data streams. The easy way to explain this process is by a code.

For example, suppose Henry and his sister, Jen want to buy a brand new gaming console. For this, Henry and Jen get £5 from their parents every week. But, Jen makes extra £5 by delivering newspapers. So, if they both save every cent, we can check every week if they can buy a console or not. Whenever their savings get affected the combined calculation get affected. If the message is saved, then it can be subscribed using this syntax.

// Savings
let timmySavings = Variable(5)
let jennySavings = Variable(10)
var isConsoleAttainable =
.combineLatest(timmy.asObservable(), jenny.asObservable()) { $0 + $1 }
.filter { $0 >= 300 }
.map { “($0) is enough for the gaming console!” }
// Week 2
timmySavings.value = 10
jennySavings.value = 20
.subscribe(onNext: { print($0) }) // Doesn’t print anything
// Week 20
timmySavings.value = 100
jennySavings.value = 200
.subscribe(onNext: { print($0) }) // 300 is enough for the gaming console!

This example just scratches the surface with what we can do with FRP. However, once you get hold of it, then it can open lots of new opportunities for you. You can tweak with the two main contenders of the Swift FRP; RxSwift and ReactiveCocoa.

-2. Dependency Manager

CocoaPods and Carthage are the two dependency of Swift and C Cocoa projects which has been mostly used. They mainly simplify the process of implementing a library and updating it.

CocoaPods is loaded with the libraries which are built with Ruby and can be downloaded using this command;

$ sudo gem install cocoapods

After this command, you have to create Podlife for the project. To do that you can run the following command;

$ pod install

For custom Podlife, you can use this structure;

platform :ios, ‘8.0’

target ‘MyApp’ do
pod ‘AFNetworking’, ‘~> 2.6’
pod ‘ORStackView’, ‘~> 3.0’
pod ‘SwiftyJSON’, ‘~> 2.3’

After this, you have to install the new pods. Later, you can open projects .xcworkspace and never forget to import your dependencies for that.

Carthage is the polar opposite to CocoaPods with the decentralized manager. However, it’s a downside is that it becomes highly difficult for users to find existing libraries. But, on the contrary, it requires less maintenance work and doesn’t fail on the central point.

-3. Storage of Information

Okay, so first let’s save data for your apps in a simple manner. NSUserDefaults, called this way because it’s generally used to save default user data, that is put in when the app is first loaded. That’s why it’s made to be simple, but it implies some limitations as well. One of the limitations is the type of objects. The objects that can be stored are; NSData, NSDate, NSNumber, NSDictionary, NSString, and NSArray.

Further NSNumber can be accepted in; Uint, Int, Float, Double, and Bool. Objects can be saved in the following manner;

let keyConstant = “objectKey”
let defaults = NSUserDefaults.standardsUserDefaults()
defaults.setObject(“Object to save”, objectKey: keyConstant)

To read it, you can use this command;

if let name = defaults.stringForKey(keyConstant) {

Here, Keychain is a password system and store passwords, certificates and private keynotes. It has double layer device encryption. The first level is for lock screen passcodes like the encryption key. The second one is for key generated by and stored on the device.

CoreData is Apple framework, for your application to communicate with the database. It simplifies the process by reducing the codes and eliminating the need to test the code.

So, folks now observe these iOS developers must know while we will shortly return with the other must-knows in the next installment.

Leave a Comment

Your email address will not be published.

You may use these HTML tags and attributes: <a href=""> <abbr> <acronym> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Send a Message