MXNetworkingSwift 2.0.1

MXNetworkingSwift 2.0.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Apr 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Meniny.



  • By
  • Elias Abel

MXNetworking-in-Swift

MXNetworing is a delightful networking framework for iOS platform.

Requre Swift 3.0+.

Usage

  • Base URL
// MARK: BASR URL
MXNetworking.setBaseURLString("http://exp.yourdomain.com")
  • Request Headers
// MARK: REQUEST HEADERS
var headers = URLRequest.standardHeaders()
headers["Accept"] = "*/*"
URLRequest.setStandardHeaders(headers)
  • Sample Request
let url = MXNetworking.urlByAppendingParameters(["device": "iphone5", "version": "1.0.0"], toURL: "/exp_name.php")

MXNetworking.getRequestByAppending(url, forType: RequestType.url, data: nil) { (status, responseObject, error) in
    if status == ResponseStatus.success {
        // code here...
    } else {
        // code here...
    }
}

Trouble Shooting

  • ATS

Add this to your Info.plist file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>
</plist>