Camera and UIImagePickerController to take photos with swift

You can easily integrate camera functionality in your application using UIImagePickerController which is built-in UIKit. It requires very few steps to do so. I am providing the basic steps below Make your viewcontroller calss conform to UIImagePickerControllerDelegate and UINavigationControllerDelegate Add extention to your viewcontroller Your code is almost done. Now add some button or function … Read more

SSL Pinning for preventing Man in Middle Attack

Communicating with a server gives an entirely new dimension to an application and can do a huge amount of value addition for both client and business. But communication with server also comes with its share of risks. A insecure connection is really a bad idea but a poorly implemented https connection is even worse. In … Read more

Swift Defer Statement explained

When you want to ensure that a code block is executed just before control exits the scope, Swift Defer Statement comes to your rescue. Sometimes a function is required to have multiple conditional exit point and covering those exit points without swift defer statement can lead to code duplication or it might just not be possible to … Read more

Swift nonmutating setters. an Oxymoron?

While going through Xcode 10.1 release notes I stumbled upon a very unfamiliar term “nonmutating setters”. Inquisitiveness had the best of me and I spent time reading about it and implementing examples. Here is the jest for you nonmutable setters cannot be used within Classes or protocol bound classes nonmutable setters do not mutate instance nonmutable … Read more

Using Codable with object under single root key

While using codable we come across situations when our object keys are not at the root level //Final code /* JSON data { “dog”: { “id”: 1, “task”: “bow wow” } }*/ struct Dog: Codable { let id: Int let task: String } let decoder = JSONDecoder() let userDictionary = try decoder.decode([String: Dog].self, from: jsonData) let … Read more

Using PromiseKit and Alamofire For Clean API Layer

Promise kit and Alamofire when used together create a very powerful and flexible API Layer Every App interacting with web services contains an API layer which separates API handling from the rest of the application logic. Usually, the API layer is implemented using delegates or escaping closures. Escaping closures and delegates are neat but we can achieve … Read more

Parsing JSON into Swift Objects directly

Parsing JSON data in into swift objects have become super easy with Swift 4 JSONDecoder.Given below is a simple example which hits a Api and parses the JSON data directly to student object.We are assuming that we have a JSON response which has same keys as names of properties. import UIKit struct Student:Decodable{// property name should be … Read more


Join group of Software Professionals