/swift-client

Nimiq RPC client written in Swift for iOS

Primary LanguageSwiftOtherNOASSERTION

Nimiq Swift Client

Swift implementation of the Nimiq RPC client specs.

Usage

Initialize a NimiqClient object using predefined configuration.

let config = Config(
    scheme: "http",
    host: "127.0.0.1",
    port: 8648,
    user: "luna",
    password: "moon"
)

let client = NimiqClient(config: config)

Once the client have been set up, we can call the methodes with the appropiate arguments to make requests to the Nimiq node.

When no config object is passed in the initialization it will use default values in the Nimiq node.

let client = NimiqClient()

// make rpc call to get the block number
let blockNumber = try client.blockNumber()!

print(blockNumber) // displays the block number, for example 748883

API

The complete API documentation is available here.

Check out the Nimiq RPC specs for behind the scene RPC calls.

Installation

Swift Package Manager

To integrate NimiqClient in your app with SPM. Just add the package as a dependency:

import PackageDescription

let package = Package(
    name: "MyApp",
    dependencies: [
        .package(url: "https://github.com/nimiq-community/swift-client", from: "0.0.1"),
    ]
)

CocoaPods

To use CocoaPods, add the following to your Podfile:

pod 'NimiqClient'

Carthage

To use Carthage, add the following to your Cartfile:

github "nimiq-community/swift-client"

Contributions

This implementation was originally contributed by rraallvv.

Please send your contributions as pull requests.

Refer to the issue tracker for ideas.

Develop

After cloning the repository, open the project bundle NimiqClient.xcodeproj in Xcode.

All done, happy coding!

Testing

All tests are in the /Tests folder and can be run from Xcode.

Documentation

The documentation is generated automatically with Jazzy.

To generate the documentation first intall Jazzy:

$ gem install jazzy

Then generate the documentation running Jazzy from the repository root directory:

$ jazzy

License

Apache 2.0