Skip to main content


Rest Api in swift 4 Using URLSession And JSONSerialization Xcode 9 Example

A Short Example call Rest Api with JSON Foundation framework NSURLSession and NSJSONSerialization -

Getting Started - Basic Rest API request with Swift 4

func restApiRequest(){
let sessionConfig = URLSessionConfiguration.default
// Session Configuration
        let sessionUrl = URLSession(configuration: sessionConfig)
// Load configuration into Session
        let url = URL(string: "YOUR URL STRING")!
        let task = sessionUrl.dataTask(with: url, completionHandler: {
            (data, response, error) in
                if error != nil {
                } else {
                    do {
                        if let json = try JSONSerialization.jsonObject(with: data!, options: .allowFragments) as? [String: Any]
                    } catch {
                        print("error in JSONSerialization")
Recent posts

iOS MapKit Tutorial: Getting Started Search Location and Directions on Mapkit

MapKit is a really useful API available on iOS devices that makes it easy to display maps, user locations with locality, and even draw routes your location to your destination.
Getting Started User Location
Create a new project single view appplication in Swift. - MKLocationMap

Open Info.plist from the Project navigator and configure the location permission prompt message NSLocationWhenInUseUsageDescription
Add "NSLocationAlwaysAndWhenInUseUsageDescription" instead of "Privacy - Location Always and When in use usage description".

import UIKit import MapKit
protocol HandleMapSearch { func dropPinZoomIn(placemark:MKPlacemark) } class ViewController: UIViewController{ let locationManager = CLLocationManager() var resultSearchController:UISearchController! var selectedPin:MKPlacemark? @IBOutletvar mapView: MKMapView! overridefunc viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. locationManager.delegat…

How to Get Started Firebase UI Auth Provider Swift 4 iOS

I am starting a tutorial how to install a firebase Authentication in iOS Swift application and how to use Firebase UI Auth. You can use Firebase Authentication to allow to users different type login your application or sign In / sign Up  with including email id or password, with facebook login, twitter, Gmail, pinterest or more social account authentication. This blog post help you started, how to start firebase UI auth.

Create a account firebase Console. If you have a Google account already then you are active only firebase consoleOpen and go to seen right side - GO TO CONSOLE
Click add project -> Type project name and if you mind customize project id and select your country code then accept term or condition create project. NextGo to dashboard overview and select your app platform.
Now if you add ‘Add Firebase to your iOS app’, Then Copy your bundle ID past after type your nick name did you like, This is the bundle identifier of your Xcode project. Like …

Facebook Login - Facebook Authentication and Cocoapods

Create a new application facebook login and authentication a facebook user using their iOS SDK with Cocoapods. Below are the steps in which we'll be following: First Getting Started guide from Facebook's iOS SDK Documentation Create a new iOS project Swift

Open facebook Developer Account and create new App after go to setting and click basic -> add platform ios Then add Bundle id your ios project like com.xxxx, Configuring Facebook with Bundle ID Then go ahead Download facebook sdk for ios other wise install pod file your project.
Go ahead to open terminal and go ahead your project folder.

Got create podfile -> pod init
Open podfile -> open podfile Paste ->  pod 'FBSDKCoreKit' 
               pod 'FBSDKShareKit' 
               pod 'FBSDKLoginKit' podfile and save

Then go to terminal or install podfiles -> pod Install

Enabling Facebook's Authentication Mech…

Change the Color of the Status Bar - StatusBarStyle Tutorial in Swift

How to Set Status Bar Style Color in Swift  The status bar can have a dark and light appearance inside your app In this tutorial the appearance of the status bar color will be changed try two type. This tutorial is made with Xcode 9 and built for iOS 11, swift 3 & swift 4.

1:- iOS 11 and Swift 4, Xcode 9

      Info.plist - add row View controller-based status bar appearance and set it to NO      In file appDelegate.swift -> didFinishLaunchingWithOptions in       UIApplication.shared.statusBarStyle = .lightContent  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions:   [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    application.statusBarStyle = .lightContent // .default     return true }

2:- Add With a function =>Go to the ViewController.swift file and add the following lines of code.    override var preferredStatusBarStyle: UIStatusBarStyle {                       return .lightContent                 }

Design Patterns on iOS using Swift

Design Patterns on iOS using Swift - Singleton Design Pattern Example
iOS Design Patterns Tutorial - Design patterns are evolved as reusable solution to the problem that we encounter every day of programming
Types of Design Patterns - iOS Developer Live
Creational: This type design deals with the object creation and initialization.    Eg: Singleton, Factory, Abstract Factory.
Structural: This type design pattern deals with class and object composition Eg: MVC, Decorator, Adapter, Bridge, Facade.
Behavioral: Deals with the communication between classes and object    Eg: Observer, and, Memento

Creational Pattern - Singleton Design Patterns Creational Pattern - Only one Instance of a particular classes, singleton pattern belongs to Ceational type pattern, This pattern is used when we need to ensure that only one object of a particular class need to be created. Only one object available across the application in a controlled  Declaring all constructor of the class to be privateProvide static met…

How to Designing for iPhone X iOS Swift

Designing for iPhone X iOS Swift

iPhone X features an all-screen Super Retina display, providing more space to display content and create deeply immersive experiences. Learn how to design your app or game to look and feel great on iPhone X, and all iOS devices. Click Here