Implementation of the Polywrap client in Swift.
PolywrapClient is available through Swift Package Manager and Cocoapods.
Add pod to your Podfile:
pod 'PolywrapClient'
To add Polywrap Client as an SPM package to your project in Xcode you must do: File -> Swift Packages -> Add Package Dependency. And then enter https://github.com/polywrap/swift-client
Add it as a dependency within your Package.swift manifest:
let package = Package(
...
dependencies: [
.package(url: "https://github.com/polywrap/swift-client.git", from: "0.0.3")
],
...
)
Create a new Polywrap Client Config Builder instance, add the bundles you want to use, and then create a new Polywrap Client instance from the builder.
import PolywrapClient
struct CatArgs: Codable {
var cid: String
var ipfsProvider: String
}
func main() throws {
let client = BuilderConfig()
.addSystemDefault()
.build()
let catResult: Data = try client.invoke(
uri: try Uri("wrapscan.io/polywrap/ipfs-http-client@1.0"),
method: "cat",
args: CatArgs(
cid: resolveResult.cid,
ipfsProvider: resolveResult.provider
)
)
print(catResult)
}
Please check out our contributing guide for guidelines about how to proceed.