在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:ipfs-shipyard/swift-ipfs-http-client开源软件地址:https://github.com/ipfs-shipyard/swift-ipfs-http-client开源编程语言:Swift 99.6%开源软件介绍:swift-ipfs-api
For more information about IPFS or the API commands click the links. The Swift IPFS API shell/client is an asynchronous library that provides native calls to an IPFS node. Table of ContentsInstallIn the root of your project:
or
or
if you want both platforms. For more information on how to install via Carthage see the README UsageAdd the required frameworks to your project in Xcode:
ExamplesIn your code: import SwiftIpfsApi
do {
let api = try IpfsApi(host: "127.0.0.1", port: 5001)
try api.id() { (idData : JsonType) in
guard let id = idData.object?["ID"]?.string else {
return
}
print("Yay, I've got an id: \(id)")
}
} catch {
print(error.localizedDescription)
} The Swift IPFS API client is asynchronous, but if you want to use a command synchronously (eg. if you run it in its own thread) you can always use dispatch groups: let group = dispatch_group_create()
dispatch_group_enter(group)
let multihash = try! fromB58String("QmXsnbVWHNnLk3QGfzGCMy1J9GReWN7crPvY1DKmFdyypK")
try! api.refs(multihash, recursive: false) {
result in
for mh in result {
print(b58String(mh))
}
dispatch_group_leave(group)
}
dispatch_group_wait(group, DISPATCH_TIME_FOREVER) RequirementsSwift 3 ContributeFeel free to join in. All welcome. Open an issue! This repository falls under the IPFS Code of Conduct. License |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论