Skip to main content

Posts

Showing posts from March, 2021

Create APIManager Class Using Alamofire Swift

Create APIManage.Swift File. // //    APIManager.swift // //    Created by Dixit Akabari on 7/1/20. //    Copyright © 2020 Dixit Akabari. All rights reserved. // import  UIKit import  Alamofire open   class   APIManager :  NSObject  {           // =========== POST API Calling ===========           public   class   func   callPostAPI (param: [ String :  Any ], URlName:  String , controller:  UIViewController , withblock: @escaping  ( _  response:  AnyObject ?)-> Void ){                           //check internet connection available or not          if  ( AppDelegate . getAppDelegate (). connected ()) {                                        let  url =  "Base_Url"   +  URlName                           //API headers              var  _headers :  HTTPHeaders  = [ "Content-Type" : "application/x-www-form-urlencoded" ]              _headers[ "Authorization" ] =  "token"   // pass api token here if need                           AF . sess