'Shopify iOS SDK error: Value of type 'Storefront.ShopQuery' has no member 'currencyCode'
I'm getting started with Shopify's iOS sdk and in following the official readme on GitHub, I keep getting an error that I can't get rid of. I've followed the setup and pasted the example code line for line and I get This error no matter what project I try to use it on (full code in attachments)
Value of type 'Storefront.ShopQuery' has no member 'currencyCode'
How can I fix this error?
import Buy
import Pay
class shopify {
let client = Graph.Client(shopDomain: "-", apiKey: "-")
func example() {
let query = Storefront.buildQuery { $0
.shop { $0
.name()
.currencyCode()
.refundPolicy { $0
.title()
.url()
}
}
}
let task = client.queryGraphWith(query) { response, error in
let name = response?.shop.name
let currencyCode = response?.shop.currencyCode
let moneyFormat = response?.shop.moneyFormat
}
task.resume()
}
}
Solution 1:[1]
You find this in paymentSetting, I guess
let query = Storefront.buildQuery { $0
.shop { $0
.name()
.paymentSettings { $0
.currencyCode()
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | David Mardashev |