Swift implementation of the Nimiq RPC client specs.
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
The complete API documentation is available here.
Check out the Nimiq RPC specs for behind the scene RPC calls.
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"),
]
)
To use CocoaPods, add the following to your Podfile:
pod 'NimiqClient'
To use Carthage, add the following to your Cartfile:
github "nimiq-community/swift-client"
This implementation was originally contributed by rraallvv.
Please send your contributions as pull requests.
Refer to the issue tracker for ideas.
After cloning the repository, open the project bundle NimiqClient.xcodeproj
in Xcode.
All done, happy coding!
All tests are in the /Tests
folder and can be run from Xcode.
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