The code is still here and you can still clone it, however the library will not receive any more updates or support.
This repository is a collection of extensions, snippets and tweaks we commonly use at Nodes.
- iOS 8.0+
- Swift 2.0+
github "nodes-ios/Nodes" ~> 2.0
Last versions compatible with lower Swift versions:
Swift 3.1
github "nodes-ios/Nodes" == 1.0.2
Swift 3.0
github "nodes-ios/Nodes" == 1.0.0
Swift 2.3
github "nodes-ios/Nodes" == 0.2.5
Swift 2.2
github "nodes-ios/Nodes" == 0.2.2
- Add the framework to your project
- Put it inside the
Embedded Binaries
section on your target settings
This framework contains an unwrapper to be used with Serializable's extension for Alamofire. It then automatically extracts data from the response using the same pattern we commonly use in our API's.
You however need to manually set this unwrapper on the Parser inside Serializable. Best place to do this is in your AppDelegate
.
import Serpent
import Nodes
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// ...
Parser.defaultUnwrapper = unwrapper()
// ...
}
To have easier access to pagination information from the API we provide a PaginatedResponse
struct, which can be used instead Alamofire's native Response
. Implementation is simple:
func fetchInformationFromAPI(completion: PaginatedResponse<Information, NSError> -> Void) {}
You can then access the pagination information in the callback like this:
// ...
fetchInformationFromAPI(completion: { response in
switch response.result {
case .Success(let object):
print(object.data) // Your model, in this case `Information`
print(object.meta.paginator) // The meta (paginator) data
break
default: break
}
})
// ...
Made with ❤️ at Nodes.
Nodes is available under the MIT license. See the LICENSE file for more info.