Latest 1.2
Homepage https://github.com/murphb52/IceAndFireKit
License MIT
Platforms ios 8.0, requires ARC
Authors

CI Status
Version
License
Platform

Usage

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

Accessing API

Use the IceAndFireRequestEngine singleton to perform requests to fetch data for single objects or for a list of objects.

3 ways to fetch information

Fetch object by id

Pass in an id and specify the return type in the completion handler to fetch an object.

Example:

var houseObject : IceAndFireHouse?
IceAndFireRequestEngine.sharedInstance.fetchIceAndFireObject(1) { (iceAndFireObject : IceAndFireHouse?, error : NSError?) -> Void in
houseObject = iceAndFireObject
}

Fetch objects by page / limit

Fetches a page of objects from the API. Optional page and limit is used within the request for pagination. ResponseType is defined within the completionHandler

Example:

var charactersArray : [IceAndFireCharacter]?
IceAndFireRequestEngine.sharedInstance.fetchIceAndFireObjectsWithPage(2, limit: 10) { (iceAndFireObjects : [IceAndFireCharacter]?, error : NSError?) -> Void in
charactersArray = iceAndFireObjects
}

Populate minimal object using its resource url

Populates a basic object using its resource URL. All objects returned from an API can contain other resource URLs. These objects are parsed into its specific type and its url popluated. This means you have a simple way to populate each of the "minified" objects

Example:

var book = IceAndFireBook(urlString: "http://anapioficeandfire.com/api/books/2")
IceAndFireRequestEngine.sharedInstance.fetchIceAndFireObject(book) { (iceAndFireObject : IceAndFireBook?, error : NSError?) -> Void in
book = iceAndFireObject
}

Pagination Links

Fetching pages will return an IceAndFireLinkHeaders object. This can contain 4 pagination NSURLs. prev, next, first and last. They will be a reference to the appropriate page based on the keyword.

These can be used for simple pagination chaining

Requirements

Installation

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

pod "IceAndFireKit"

Author

Brian, [email protected]

License

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

Latest podspec

{
    "name": "IceAndFireKit",
    "version": "1.2",
    "summary": "Simple library for easy access to AnApiOfIceAndFire.",
    "description": "A Simple Swift implementation of interaction with the Api AnApiOfIceAndFire.nRequestEngine and Models to get information from the API (https://anapioficeandfire.com) in an easily accesible way",
    "homepage": "https://github.com/murphb52/IceAndFireKit",
    "license": "MIT",
    "authors": {
        "Brian Murphy": "[email protected]"
    },
    "source": {
        "git": "https://github.com/murphb52/IceAndFireKit.git",
        "tag": "1.2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This