Nomics.com Swift SDK
Table of Contents
Description
NomicsSDK is a simple API interface for crypto projects using the Nomics.com API written in Swift.
Key features
- Usable in iOS, tvOS, watchOS and macOS
- Simple API interface through enumerations
- Type-safe API parameters
- Easily extensible
- Unit test coverage & great documentation
Usage
General
Implementing and using the SDK is straightforward. To get started, simply include it by using your favourite package manager below. Or, you can install it manually.
import NomicsSDK
Then, create a APIConfig
configuration object and instantiate the SDK with it:
let config = APIConfig(with: "2018-09-demo-dont-deploy-b69315e440beb145", for: .production)
let sdk = NomicsSDK(with: config)
After that, you can use request endpoints as you wish:
sdk.request(dataType: [Price].self,
endpoint: Endpoint.Currency.prices,
success: { data in
// Data is an array of price objects
}, error: { error in
// Can be a decoding error, or a request error
})
In order to make the generic request and decoding mechanism aware of what type of data will be passed into the callback, you need to provide the data type in the request method invocation.
Generally, you'll only be concerned with two different types of calls:
[Price].self
and
Price.self
The former is when you want the SDK to decode an array of Price
objects, and the latter is a single object. You can know which to use by checking out the endpoint documentation at nomics.com for detailed endpoint documentation.
Installation
Cocoapods
NomicsSDK is available through CocoaPods. To install, simply add the following line to your Podfile:
pod 'NomicsSDK'
Carthage
NomicsSDK is also available through Carthage. To install, just write in your Cartfile:
github "ndizazzo/nomics-swift-sdk"
Swift Package Manager
NomicsSDK supports SPM! Add this line to your Package.swift
file:
.Package(url: "https://github.com/ndizazzo/nomics-swift-sdk.git", from: "1.0.0")
Authors
- Nomics.com provide the API this SDK interfaces with.
- The TinyNetworking class is inspired by the efforts of the team at objc.io. Please refer the source file for additional context, as well as check out their work!
- Nick DiZazzo made this with
❤️
Contributing
If you'd like to contribute to this project, check the simple CONTRIBUTING guidelines for more info.
License
NomicsSDK is available under the MIT license. See the LICENSE file for more info.