mirror of
https://github.com/aljazceru/breez-sdk-docs.git
synced 2025-12-17 13:54:20 +01:00
move swift examples (#100)
* move swift examples * swift workflow * fixup * rewirte gettingStarted * add README for swift * update fiat examples and addresss feedback
This commit is contained in:
5
snippets/swift/BreezSDKExamples/.gitignore
vendored
Normal file
5
snippets/swift/BreezSDKExamples/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
storage.sql
|
||||
sync/
|
||||
sync_storage.sql
|
||||
.swiftpm
|
||||
.build
|
||||
23
snippets/swift/BreezSDKExamples/Package.resolved
Normal file
23
snippets/swift/BreezSDKExamples/Package.resolved
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"pins" : [
|
||||
{
|
||||
"identity" : "breez-sdk-swift",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/breez/breez-sdk-swift",
|
||||
"state" : {
|
||||
"revision" : "dcbb39d45bc6797447bf20f52bc22344026d0662",
|
||||
"version" : "0.2.9"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "swift-argument-parser",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apple/swift-argument-parser",
|
||||
"state" : {
|
||||
"revision" : "8f4d2753f0e4778c76d5f05ad16c74f707390531",
|
||||
"version" : "1.2.3"
|
||||
}
|
||||
}
|
||||
],
|
||||
"version" : 2
|
||||
}
|
||||
24
snippets/swift/BreezSDKExamples/Package.swift
Normal file
24
snippets/swift/BreezSDKExamples/Package.swift
Normal file
@@ -0,0 +1,24 @@
|
||||
// swift-tools-version: 5.9
|
||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "BreezSDKDocs",
|
||||
platforms: [.macOS(.v12)],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.2.3"),
|
||||
.package(url: "https://github.com/breez/breez-sdk-swift", from:"0.2.9")
|
||||
],
|
||||
targets: [
|
||||
// Targets are the basic building blocks of a package, defining a module or a test suite.
|
||||
// Targets can depend on other targets in this package and products from dependencies.
|
||||
.executableTarget(
|
||||
name: "BreezSDKDocs",
|
||||
dependencies: [
|
||||
.product(name: "ArgumentParser", package: "swift-argument-parser"),
|
||||
.product(name: "BreezSDK", package: "breez-sdk-swift"),
|
||||
],
|
||||
path: "Sources"),
|
||||
]
|
||||
)
|
||||
17
snippets/swift/BreezSDKExamples/Sources/BuyBtc.swift
Normal file
17
snippets/swift/BreezSDKExamples/Sources/BuyBtc.swift
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// BuyBtc.swift
|
||||
//
|
||||
//
|
||||
// Created by ruben on 14/11/2023.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import BreezSDK
|
||||
|
||||
func buy(sdk: BlockingBreezServices) -> BuyBitcoinResponse? {
|
||||
// ANCHOR: buy-btc
|
||||
let buyBitcoinResponse = try? sdk.buyBitcoin(
|
||||
req: BuyBitcoinRequest(provider: .moonpay))
|
||||
// ANCHOR_END: buy-btc
|
||||
return buyBitcoinResponse
|
||||
}
|
||||
25
snippets/swift/BreezSDKExamples/Sources/ConnectingLsp.swift
Normal file
25
snippets/swift/BreezSDKExamples/Sources/ConnectingLsp.swift
Normal file
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// ConnectingLsp.swift
|
||||
//
|
||||
//
|
||||
// Created by ruben on 14/11/2023.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import BreezSDK
|
||||
|
||||
func getLspInfo(sdk: BlockingBreezServices) -> LspInformation?{
|
||||
// ANCHOR: get-lsp-info
|
||||
let lspId = try? sdk.lspId()
|
||||
let lspInfo = try? sdk.lspInfo()
|
||||
// ANCHOR_END: get-lsp-info
|
||||
return lspInfo
|
||||
}
|
||||
|
||||
|
||||
func connectLsp(sdk: BlockingBreezServices, lspId: String) {
|
||||
// ANCHOR: connect-lsp
|
||||
try? sdk.connectLsp(lspId: lspId)
|
||||
// ANCHOR_END: connect-lsp
|
||||
|
||||
}
|
||||
48
snippets/swift/BreezSDKExamples/Sources/FiatCurrencies.swift
Normal file
48
snippets/swift/BreezSDKExamples/Sources/FiatCurrencies.swift
Normal file
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// FiatCurrencies.swift
|
||||
//
|
||||
//
|
||||
// Created by ruben on 14/11/2023.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import BreezSDK
|
||||
|
||||
func listSupportedFiatCurrencies(sdk: BlockingBreezServices) -> [FiatCurrency]? {
|
||||
// ANCHOR: list-fiat-currencies
|
||||
let supportedFiatCurrencies = try? sdk.listFiatCurrencies()
|
||||
// ANCHOR_END: list-fiat-currencies
|
||||
return supportedFiatCurrencies
|
||||
}
|
||||
|
||||
func getCurrentRates(sdk:BlockingBreezServices) -> [Rate]? {
|
||||
// ANCHOR: fetch-fiat-rates
|
||||
let fiatRates = try? sdk.fetchFiatRates()
|
||||
// ANCHOR_END: fetch-fiat-rates
|
||||
return fiatRates
|
||||
}
|
||||
|
||||
func getFiatCurrencyAndRates(sdk: BlockingBreezServices) -> [(FiatCurrency,Rate)]? {
|
||||
// ANCHOR: get-fiat-currencies-and-rates
|
||||
var ratesMap = [String:Rate]()
|
||||
if let supportedFiatCurrencies = try? sdk.listFiatCurrencies(), let fiatRates = try? sdk.fetchFiatRates() {
|
||||
for fiatRate in fiatRates {
|
||||
ratesMap[fiatRate.coin.lowercased()] = fiatRate
|
||||
}
|
||||
|
||||
let sorted = supportedFiatCurrencies.sorted(by: { f1, f2 in
|
||||
f1.id<f2.id
|
||||
})
|
||||
|
||||
var result = [(FiatCurrency,Rate)]()
|
||||
for currency in sorted {
|
||||
if let rate = ratesMap[currency.id.lowercased()] {
|
||||
result.append((currency, rate))
|
||||
}
|
||||
|
||||
}
|
||||
return result
|
||||
}
|
||||
// ANCHOR_END: get-fiat-currencies-and-rates
|
||||
return nil
|
||||
}
|
||||
51
snippets/swift/BreezSDKExamples/Sources/GettingStarted.swift
Normal file
51
snippets/swift/BreezSDKExamples/Sources/GettingStarted.swift
Normal file
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// GettingStarted.swift
|
||||
//
|
||||
//
|
||||
// Created by ruben on 13/11/2023.
|
||||
//
|
||||
|
||||
import BreezSDK
|
||||
|
||||
// ANCHOR: init-sdk
|
||||
// SDK events listener
|
||||
class SDKListener: EventListener {
|
||||
func onEvent(e: BreezEvent) {
|
||||
print("received event ", e)
|
||||
}
|
||||
}
|
||||
|
||||
func gettingStarted() throws -> BlockingBreezServices? {
|
||||
// Create the default config
|
||||
let seed = try? mnemonicToSeed(phrase: "<mnemonic words>")
|
||||
|
||||
let inviteCode = "<invite code>"
|
||||
let apiKey = "<api key>"
|
||||
var config = defaultConfig(envType: EnvironmentType.production, apiKey: apiKey,
|
||||
nodeConfig: NodeConfig.greenlight(
|
||||
config: GreenlightNodeConfig(partnerCredentials: nil, inviteCode: inviteCode)))
|
||||
|
||||
// Customize the config object according to your needs
|
||||
config.workingDir = "path to an existing directory"
|
||||
|
||||
|
||||
// Connect to the Breez SDK make it ready for use
|
||||
guard seed != nil else {
|
||||
return nil
|
||||
}
|
||||
let sdk = try? connect(config: config, seed: seed!, listener: SDKListener())
|
||||
|
||||
return sdk
|
||||
}
|
||||
// ANCHOR_END: init-sdk
|
||||
|
||||
func gettingStartedNodeInfo(sdk: BlockingBreezServices) {
|
||||
// ANCHOR: fetch-balance
|
||||
if let nodeInfo = try? sdk.nodeInfo() {
|
||||
let lnBalance = nodeInfo.channelsBalanceMsat
|
||||
let onchainBalance = nodeInfo.onchainBalanceMsat
|
||||
}
|
||||
// ANCHOR_END: fetch-balance
|
||||
}
|
||||
|
||||
|
||||
27
snippets/swift/BreezSDKExamples/Sources/ListPayments.swift
Normal file
27
snippets/swift/BreezSDKExamples/Sources/ListPayments.swift
Normal file
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// ListPayments.swift
|
||||
//
|
||||
//
|
||||
// Created by ruben on 13/11/2023.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import BreezSDK
|
||||
|
||||
func ListPayments(sdk: BlockingBreezServices) -> [Payment]? {
|
||||
// ANCHOR: list-payments
|
||||
let payments = try? sdk.listPayments(req: ListPaymentsRequest())
|
||||
// ANCHOR_END: list-payments
|
||||
return payments
|
||||
}
|
||||
|
||||
func ListPaymentsFiltered(sdk: BlockingBreezServices) -> [Payment]? {
|
||||
// ANCHOR: list-payments-filtered
|
||||
let payments = try? sdk.listPayments(
|
||||
req: ListPaymentsRequest(
|
||||
filters: [.sent],
|
||||
fromTimestamp: 1696880000,
|
||||
includeFailures: true))
|
||||
// ANCHOR_END: list-payments-filtered
|
||||
return payments
|
||||
}
|
||||
32
snippets/swift/BreezSDKExamples/Sources/LnurlAuth.swift
Normal file
32
snippets/swift/BreezSDKExamples/Sources/LnurlAuth.swift
Normal file
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// LnurlAuth.swift
|
||||
//
|
||||
//
|
||||
// Created by ruben on 14/11/2023.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import BreezSDK
|
||||
|
||||
func auth(sdk: BlockingBreezServices) {
|
||||
// ANCHOR: lnurl-withdraw
|
||||
// Endpoint can also be of the form:
|
||||
// keyauth://domain.com/auth?key=val
|
||||
let lnurlAuthUrl = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttvdankjm3lw3skw0tvdankjm3xdvcn6vtp8q6n2dfsx5mrjwtrxdjnqvtzv56rzcnyv3jrxv3sxqmkyenrvv6kve3exv6nqdtyv43nqcmzvdsnvdrzx33rsenxx5unqc3cxgeqgntfgu"
|
||||
|
||||
|
||||
if let inputType = try? parseInput(s: lnurlAuthUrl) {
|
||||
if case .lnUrlAuth(let `data`) = inputType {
|
||||
let result = try? sdk.lnurlAuth(reqData: data)
|
||||
switch result {
|
||||
case .ok:
|
||||
print("Successfully authenticated")
|
||||
case .errorStatus(let error):
|
||||
print("Failed to authenticate: \(error)")
|
||||
case .none:
|
||||
print("Failed to authenticate")
|
||||
}
|
||||
}
|
||||
}
|
||||
// ANCHOR_END: lnurl-withdraw
|
||||
}
|
||||
26
snippets/swift/BreezSDKExamples/Sources/LnurlPay.swift
Normal file
26
snippets/swift/BreezSDKExamples/Sources/LnurlPay.swift
Normal file
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// LnurlPay.swift
|
||||
//
|
||||
//
|
||||
// Created by ruben on 14/11/2023.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import BreezSDK
|
||||
|
||||
func pay(sdk: BlockingBreezServices) -> LnUrlPayResult? {
|
||||
// ANCHOR: lnurl-pay
|
||||
// Endpoint can also be of the form:
|
||||
// lnurlp://domain.com/lnurl-pay?key=val
|
||||
// lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttsv9un7um9wdekjmmw84jxywf5x43rvv35xgmr2enrxanr2cfcvsmnwe3jxcukvde48qukgdec89snwde3vfjxvepjxpjnjvtpxd3kvdnxx5crxwpjvyunsephsz36jf
|
||||
var response: LnUrlPayResult?
|
||||
let lnurlPayUrl = "lightning@address.com"
|
||||
if let inputType = try? parseInput(s: lnurlPayUrl) {
|
||||
if case.lnUrlPay(let `data`) = inputType {
|
||||
let amountMSat = data.minSendable
|
||||
response = try? sdk.payLnurl(req: LnUrlPayRequest(data: data, amountMsat: amountMSat, comment: "comment"))
|
||||
}
|
||||
}
|
||||
// ANCHOR_END: lnurl-pay
|
||||
return response
|
||||
}
|
||||
27
snippets/swift/BreezSDKExamples/Sources/LnurlWithdraw.swift
Normal file
27
snippets/swift/BreezSDKExamples/Sources/LnurlWithdraw.swift
Normal file
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// LnurlWithdraw.swift
|
||||
//
|
||||
//
|
||||
// Created by ruben on 14/11/2023.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import BreezSDK
|
||||
|
||||
func withdraw(sdk: BlockingBreezServices) -> LnUrlWithdrawResult? {
|
||||
// ANCHOR: lnurl-withdraw
|
||||
// Endpoint can also be of the form:
|
||||
// lnurlw://domain.com/lnurl-withdraw?key=val
|
||||
var response: LnUrlWithdrawResult?
|
||||
let lnurlWithdrawUrl = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4exctthd96xserjv9mn7um9wdekjmmw843xxwpexdnxzen9vgunsvfexq6rvdecx93rgdmyxcuxverrvcursenpxvukzv3c8qunsdecx33nzwpnvg6ryc3hv93nzvecxgcxgwp3h33lxk"
|
||||
|
||||
if let inputType = try? parseInput(s: lnurlWithdrawUrl){
|
||||
if case.lnUrlWithdraw(let `data`) = inputType {
|
||||
let amountMsat = data.maxWithdrawable
|
||||
let description = "Test withdraw"
|
||||
response = try? sdk.withdrawLnurl(request: LnUrlWithdrawRequest(data: data, amountMsat: amountMsat))
|
||||
}
|
||||
}
|
||||
// ANCHOR_END: lnurl-withdraw
|
||||
return response
|
||||
}
|
||||
48
snippets/swift/BreezSDKExamples/Sources/ReceiveOnchain.swift
Normal file
48
snippets/swift/BreezSDKExamples/Sources/ReceiveOnchain.swift
Normal file
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// ReceiveOnchain.swift
|
||||
//
|
||||
//
|
||||
// Created by ruben on 14/11/2023.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import BreezSDK
|
||||
|
||||
func generateReceiveOnchainAddress(sdk: BlockingBreezServices) -> String? {
|
||||
// ANCHOR: generate-receive-onchain-address
|
||||
let swapInfo = try? sdk.receiveOnchain(req: ReceiveOnchainRequest())
|
||||
|
||||
// Send your funds to the bellow bitcoin address
|
||||
let address = swapInfo?.bitcoinAddress
|
||||
// ANCHOR_END: generate-receive-onchain-address
|
||||
|
||||
return address
|
||||
}
|
||||
|
||||
func getSwapInProgress(sdk: BlockingBreezServices) -> SwapInfo? {
|
||||
// ANCHOR: in-progress-swap
|
||||
let swapInfo = try? sdk.inProgressSwap()
|
||||
// ANCHOR_END: in-progress-swap
|
||||
return swapInfo
|
||||
}
|
||||
|
||||
func listRefundables(sdk:BlockingBreezServices) -> [SwapInfo]? {
|
||||
// ANCHOR: list-refundables
|
||||
let refundables = try? sdk.listRefundables()
|
||||
// ANCHOR_END: list-refundables
|
||||
return refundables
|
||||
}
|
||||
func executeRefund(sdk: BlockingBreezServices, refundables: SwapInfo,satPerVbyte: UInt32) -> RefundResponse? {
|
||||
// ANCHOR: execute-refund
|
||||
let destinationAddress = "..."
|
||||
let response = try? sdk.refund(req: RefundRequest(swapAddress: refundables.bitcoinAddress, toAddress: destinationAddress, satPerVbyte: satPerVbyte))
|
||||
// ANCHOR_END: execute-refund
|
||||
return response
|
||||
}
|
||||
|
||||
func getChannelOpeningFees(sdk: BlockingBreezServices, amountMsat: UInt64) -> OpenChannelFeeResponse? {
|
||||
// ANCHOR: get-channel-opening-fees
|
||||
let response = try? sdk.openChannelFee(req: OpenChannelFeeRequest(amountMsat: amountMsat))
|
||||
// ANCHOR_END: get-channel-opening-fees
|
||||
return response
|
||||
}
|
||||
18
snippets/swift/BreezSDKExamples/Sources/ReceivePayment.swift
Normal file
18
snippets/swift/BreezSDKExamples/Sources/ReceivePayment.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// ReceivePayment.swift
|
||||
//
|
||||
//
|
||||
// Created by ruben on 13/11/2023.
|
||||
//
|
||||
|
||||
import BreezSDK
|
||||
|
||||
func receivePayment(sdk: BlockingBreezServices) -> ReceivePaymentResponse? {
|
||||
// ANCHOR: receive-payment
|
||||
let repsonse = try? sdk.receivePayment(
|
||||
req: ReceivePaymentRequest(
|
||||
amountMsat: 3_000_000,
|
||||
description: "Invoice for 3 000 000 sats"))
|
||||
// ANCHOR_END: receive-payment
|
||||
return repsonse
|
||||
}
|
||||
46
snippets/swift/BreezSDKExamples/Sources/SendOnchain.swift
Normal file
46
snippets/swift/BreezSDKExamples/Sources/SendOnchain.swift
Normal file
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// SendOnchain.swift
|
||||
//
|
||||
//
|
||||
// Created by ruben on 14/11/2023.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import BreezSDK
|
||||
|
||||
func GetCurrentFees(sdk: BlockingBreezServices) -> ReverseSwapPairInfo? {
|
||||
// ANCHOR: estimate-current-reverse-swap-total-fees
|
||||
let sendAmountSat:UInt64 = 50_000
|
||||
let currentFees = try? sdk.fetchReverseSwapFees(req: ReverseSwapFeesRequest(sendAmountSat: sendAmountSat))
|
||||
print("Total estimated fees for reverse swap: \(String(describing: currentFees?.totalEstimatedFees))")
|
||||
// ANCHOR_END: estimate-current-reverse-swap-total-fees
|
||||
return currentFees
|
||||
}
|
||||
|
||||
func ListCurrentFees(currentFees: ReverseSwapPairInfo) {
|
||||
// ANCHOR: get-current-reverse-swap-min-max
|
||||
print("Minimum amount, in sats: \(currentFees.min)")
|
||||
print("Maximum amount, in sats: \(currentFees.max)")
|
||||
// ANCHOR_END: get-current-reverse-swap-min-max
|
||||
}
|
||||
|
||||
func StartReverseSwap(sdk: BlockingBreezServices, currentFees: ReverseSwapPairInfo) -> SendOnchainResponse? {
|
||||
// ANCHOR: start-reverse-swap
|
||||
let destinationAddress = "bc1.."
|
||||
let amountSat = currentFees.min
|
||||
let satPerVbyte: UInt32 = 5
|
||||
|
||||
let response = try? sdk.sendOnchain(req: SendOnchainRequest(amountSat: amountSat, onchainRecipientAddress: destinationAddress, pairHash: currentFees.feesHash, satPerVbyte: satPerVbyte))
|
||||
// ANCHOR_END: start-reverse-swap
|
||||
return response
|
||||
}
|
||||
|
||||
func checkReverseSwap(sdk: BlockingBreezServices) {
|
||||
// ANCHOR: check-reverse-swaps-status
|
||||
if let inProgressReverseSwaps = try? sdk.inProgressReverseSwaps() {
|
||||
for rs in inProgressReverseSwaps {
|
||||
print("Reverse swap \(rs.id) in progress, status is \(rs.status)")
|
||||
}
|
||||
}
|
||||
// ANCHOR_END: check-reverse-swaps-status
|
||||
}
|
||||
20
snippets/swift/BreezSDKExamples/Sources/SendPayment.swift
Normal file
20
snippets/swift/BreezSDKExamples/Sources/SendPayment.swift
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// SendPayment.swift
|
||||
//
|
||||
//
|
||||
// Created by ruben on 13/11/2023.
|
||||
//
|
||||
|
||||
import BreezSDK
|
||||
|
||||
func sendPayment(sdk: BlockingBreezServices) -> SendPaymentResponse? {
|
||||
// ANCHOR: send-payment
|
||||
// The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount.
|
||||
// The amountMsat is required in case an amount is not specified in the bolt11 invoice'.
|
||||
let req = SendPaymentRequest(bolt11: "...", amountMsat: 3_000_000)
|
||||
let response = try? sdk.sendPayment(req: req)
|
||||
// ANCHOR_END: send-payment
|
||||
return response
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// SendSpontaneous.swift
|
||||
//
|
||||
//
|
||||
// Created by ruben on 14/11/2023.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import BreezSDK
|
||||
|
||||
|
||||
func sendSpontaneousPayment(sdk: BlockingBreezServices) -> SendPaymentResponse? {
|
||||
// ANCHOR: send-spontaneous-payment
|
||||
let response = try? sdk.sendSpontaneousPayment(
|
||||
req: SendSpontaneousPaymentRequest(
|
||||
nodeId: "...",
|
||||
amountMsat: 3_000_000))
|
||||
// ANCHOR_END: send-spontaneous-payment
|
||||
return response
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// StaticChannelBackup.swift
|
||||
// BreezSDKDocs
|
||||
//
|
||||
// Created by ruben on 14/11/2023.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import BreezSDK
|
||||
|
||||
func retrieveBackupFiles() -> StaticBackupResponse? {
|
||||
// ANCHOR: static-channel-backup
|
||||
let backupData = try? staticBackup(req:StaticBackupRequest(workingDir: "<working directory>"))
|
||||
// ANCHOR_END: static-channel-backup
|
||||
return backupData
|
||||
}
|
||||
13
snippets/swift/BreezSDKExamples/Sources/main.swift
Normal file
13
snippets/swift/BreezSDKExamples/Sources/main.swift
Normal file
@@ -0,0 +1,13 @@
|
||||
// The Swift Programming Language
|
||||
// https://docs.swift.org/swift-book
|
||||
|
||||
print("Hello, tester!")
|
||||
if let sdk = try gettingStarted(){
|
||||
if let fiarRates = getFiatCurrencyAndRates(sdk: sdk) {
|
||||
for fiat in fiarRates {
|
||||
print("rate \(fiat)\n")
|
||||
print("------------------------")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
8
snippets/swift/README.md
Normal file
8
snippets/swift/README.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# How to run
|
||||
```
|
||||
cd BreezSDKExamples
|
||||
|
||||
swift build
|
||||
|
||||
swift run
|
||||
```
|
||||
Reference in New Issue
Block a user