ASNetworking 0.1.5

ASNetworking 0.1.5

Maintained by ‘ASNetworking’.



  • By
  • Appspia

ASNetworking

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

ASNetworking is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'ASNetworking'

Usage

let APIProvider: API = .development

enum API: ASNetworking {
    // Example for Server Type
    case development
    case production
    
    var baseUrl: String {
        switch self {
        case .development:
            return "https://rss.itunes.apple.com"
        case .production:
            return "https://rss.itunes.apple.com"
        }
    }
}

extension API {
    func topPodcasts(countryCode: String, count: Int) -> ASHttpResponse<Podcasts> {
        let requestData = ASRequestData(urlString: baseUrl + "/api/v1/\(countryCode)/podcasts/top-podcasts/all/\(count)/explicit.json")
        return httpRequest(requestData: requestData)
    }
}

// Use APIProvider
APIProvider.topPodcasts(countryCode: "us", count: 100).response { result in
    switch result {
    case .success(let item):
        // Do somthing for success
    case .failure:
        // Do somthing for failure
    }
}

Author

Appspia, [email protected]

License

ASNetworking is available under the MIT license. See the LICENSE file for more info.