A wrapper around WooCommerce REST API for iOS, OS X, tvOS and watchOS, written purely in Swift.
- iOS 8.0+ / Mac OS X 10.9+ / tvOS 9.0+ / watchOS 2.0+
- Xcode 7.2+
- WooCommerce 2.4+
Initialize the client once anywhere in your app (preferred to be in your AppDelegate
).
let client = Client.sharedClient
client.siteURL = "https://example.com"
client.consumerKey = "YOUR_API_CONSUMER_KEY"
client.consumerSecret = "YOUR_API_CONSUMER_SECRET"
let orderId = 12
Order.get(orderId) { success, order in
print(order)
}
let customerId = 2
Customer.get(customerId) { success, customer in
print(customer)
}
let customerId = 2
Customer.getOrders(customerId) { success, orders in
print(orders)
}
let productId = 8
Product.get(orderId) { success, product in
print(product)
}
ProductCategory.getAll(limit: 100, completion: { success, categories in
print(categories)
})
var category = ProductCategory()
category.slug = "hoodies"
Product.getAll(byCategory: category) { success, products
print(products)
}
Add this to your Cartfile
:
github "thii/WooCommerceSDK"
then
$ carthage update
MIT