Swiftpack.co - Package - nimiq-community/swift-client

Nimiq Swift Client

Swift implementation of the Nimiq RPC client specs.

Usage

Initialize a NimiqClient object using predefined configuration and get the current block number.

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

let client = NimiqClient(config: config)

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

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

API

The complete API documentation is available here.

Check out the original Nimiq RPC specs for the behind-the-scenes 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"

Build

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

All done, happy coding!

Test

You need a start a Testnet Nimiq node:

nodejs index.js --protocol=dumb --type=full --network=test --rpc

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 install Jazzy:

gem install jazzy

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

jazzy

Add a blank file in the /docs folder with the name .nojekyll for the documentation hosted on GitHub Pages:

touch docs/.nojekyll

Contributions

This implementation was originally contributed by rraallvv.

Bug reports and pull requests are welcome! Please refer to the issue tracker for ideas.

License

Apache 2.0

Github

link
Stars: 0

Dependencies

Used By

Total: 0

Releases

Nimiq RPC client v1.0 in Swift - 2020-09-07 11:52:52

Initial implementation of the Nimiq RPC client in Swift written by @rraallvv. Thank you!!