How to use singleton with Alamofire using Swift 3? I am new in iOS and I am bit confused that how to use singleton with Alamofire and how singleton is important. I created a networkWrapper class in that I have written Alamofire  post and get method, but I didn't use singleton.
How can I create a Wrapper class of Alamofire with singleton? How can I get all tricks that is really important?
Below is my code for wrapper class:
import Foundation
import UIKit
import Alamofire
import SwiftyJSON

class AFWrapper: NSObject {

//TODO :-
/* Handle Time out request alamofire */


 class func requestGETURL(_ strURL: String, success:@escaping (JSON) -> Void, failure:@escaping (Error) -> Void)
    {
Alamofire.request(strURL).responseJSON { (responseObject) -> Void in
//print(responseObject)
if responseObject.result.isSuccess {
let resJson = JSON(responseObject.result.value!)
//let title = resJson["title"].string
//print(title!)
success(resJson)
}

if responseObject.result.isFailure {
let error : Error = responseObject.result.error!
failure(error)
}
    }
  }

static func requestPOSTURL(_ strURL : String, params : [String : AnyObject]?, headers : [String : String]?, success:@escaping (JSON) -> Void, failure:@escaping (Error) -> Void){
    Alamofire.request(strURL, method: .post, parameters: params, encoding: JSONEncoding.default, headers: headers).responseJSON { (responseObject) -> Void in
//print(responseObject)
if responseObject.result.isSuccess {
let resJson = JSON(responseObject.result.value!)
success(resJson)
}
if responseObject.result.isFailure {
let error : Error = responseObject.result.error!
failure(error)
}
    }
  }
}  

In my controller:
if newLength == 6
{
let textZipCode = textField.text! + string

let dict = ["id" : "43","token": "2y103pfjNHbDewLl9OaAivWhvMUp4cWRXIpa399","zipcode" : textZipCode] as [String : Any]

//Call Service
AFWrapper.requestPOSTURL(HttpsUrl.Address, params: dict as [String : AnyObject]?, headers: nil, success: { (json) in
// success code
print(json)
}, failure: { (error) in
//error code
print(error)
})


setFields(city: "Ajmer", state: "Rajasthan", country: "India")
return newLength <= 6
}


I didn't look deep into your code. In swift we can create singleton by
static let sharedInstance = AFWrapper()

And it will create singleton instance of a class, so that class and static for singleton class instance functions are not necessary. Please refer below code for singleton class.
import Foundation
import UIKit
import Alamofire
import SwiftyJSON

class AFWrapper: NSObject {

    static let sharedInstance = AFWrapper()

    //TODO :-
    /* Handle Time out request alamofire */


    func requestGETURL(_ strURL: String, success:@escaping (JSON) -> Void, failure:@escaping (Error) -> Void)
    {
Alamofire.request(strURL).responseJSON { (responseObject) -> Void in
//print(responseObject)
if responseObject.result.isSuccess {
let resJson = JSON(responseObject.result.value!)
//let title = resJson["title"].string
//print(title!)
success(resJson)
}

if responseObject.result.isFailure {
let error : Error = responseObject.result.error!
failure(error)
}
}
    }

    func requestPOSTURL(_ strURL : String, params : [String : AnyObject]?, headers : [String : String]?, success:@escaping (JSON) -> Void, failure:@escaping (Error) -> Void){
Alamofire.request(strURL, method: .post, parameters: params, encoding: JSONEncoding.default, headers: headers).responseJSON { (responseObject) -> Void in
//print(responseObject)
if responseObject.result.isSuccess {
let resJson = JSON(responseObject.result.value!)
success(resJson)
}
if responseObject.result.isFailure {
let error : Error = responseObject.result.error!
failure(error)
}
}
    }
}

Now you can call Singleton class instance function by
AFWrapper.sharedInstance.requestPOSTURL(HttpsUrl.Address, params: dict as [String : AnyObject]?, headers: nil, success: { (json) in
    // success code
    print(json)
}, failure: { (error) in
    //error code
    print(error)
})


May be you need that : 
import UIKit
import Alamofire

struct FV_API
{
    //URL is http://www.stack.com/index.php/signup
    static let appBaseURL = ""  // assign your base url suppose:  http://www.stack.com/index.php
    static let apiSignUP = ""   // assign signup i.e: signup
}

class APIManager: NSObject
{
    //MARK:- POST APIs
    class func postAPI(_ apiURl:String, parameters:NSDictionary, completionHandler: @escaping (_ Result:AnyObject?, _ Error:NSError?) -> Void)
    {
var strURL:String = FV_API.appBaseURL  // it gives http://www.stack.com/index.php and apiURl is apiSignUP

if((apiURl as NSString).length > 0)
{
strURL = strURL + "/" + apiURl    // this gives again http://www.stack.com/index.php/signup 
}

_ = ["Content-Type": "application/x-www-form-urlencoded"]

print("URL -\(strURL),parameters - \(parameters)")

      let api =  Alamofire.request(strURL,method: .post, parameters: parameters as? [String : AnyObject], encoding: URLEncoding.default)

// ParameterEncoding.URL
api.responseJSON
{
response -> Void in

print(response)

if let JSON = response.result.value
{
print("JSON: \(JSON)")
completionHandler(JSON as AnyObject?, nil)
}
else if let ERROR = response.result.error
{
print("Error: \(ERROR)")
completionHandler(nil, ERROR as NSError?)
}
else
{
completionHandler(nil, NSError(domain: "error", code: 117, userInfo: nil))
}
}
    }

In other NSObject I made that method i.e for Signup:
class SignUp: NSObject
{
    class func registerWithAPI(firstName: String, lastName:String, completionHandler: @escaping (_ Result:AnyObject?, _ Error:NSError?) -> Void)
    {
let dict = NSMutableDictionary()

if !firstName.isEmpty
{
dict.setValue(firstName, forKey: "firstname")
}
if !lastName.isEmpty
{
dict.setValue(lastName, forKey: "lastname")
}

APIManager.postAPI(FV_API.apiSignUP, parameters: dict)
{
(Result, Error) -> Void in
completionHandler(Result, Error)
}
    }
}

In controller class I made method to call api like:
func apiForSignup()
    {
SignUp.registerWithAPI(firstName: txtFieldFirstName.text!, lastName: txtFieldLastName.text!)
{
(Result, Error) -> Void in
// write code
}


Updated for Swift 4
import UIKit
import Alamofire
import SwiftyJSON
//
// MARK:- ipv6 Configuration...
//
private var webView = UIWebView(frame: CGRect.zero)
private var secretAgent: String? = webView.stringByEvaluatingJavaScript(from: "navigator.userAgent")
var authHeaders: HTTPHeaders = ["User-Agent": secretAgent!, "Content-Type": "application/json; charset=utf-8"]

class ApiManager: NSObject {

    static let sharedInstance = ApiManager()

    func requestGETURL(_ strURL: String, success:@escaping (JSON) -> Void, failure:@escaping (Error) -> Void) {

Alamofire.request(strURL).responseJSON { (responseObject) -> Void in

if responseObject.result.isSuccess, let resJson = responseObject.result.value {
success(JSON(resJson))
}

if responseObject.result.isFailure {
let error : Error = responseObject.result.error!
failure(error)
}
}
    }

    func requestPOSTURL(_ strURL: String, params: [String : Any]?, headers: [String : String]?, success:@escaping (JSON) -> Void, failure:@escaping (Error) -> Void) {

Alamofire.request(strURL, method: .post, parameters: params, encoding: JSONEncoding.default, headers: authHeaders).responseJSON { (responseObject) -> Void in

if responseObject.result.isSuccess, let resJson = responseObject.result.value {
success(JSON(resJson))
}

if responseObject.result.isFailure {
let error : Error = responseObject.result.error!
failure(error)
}
}
    }
}