WooCommerce SDK for iOS, OS X, tvOS and watchOS, written purely in Swift.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Carthage/Checkouts
Sources
Tests
WooCommerceSDK.xcodeproj
WooCommerceSDK.xcworkspace
.gitignore
.gitmodules
.travis.yml Switch from travis-ci.com to travis-ci.org Feb 8, 2016
Cartfile Lock Alamofire to 3.1.5 due to the issue #1056 in Alamofire 3.2 Feb 10, 2016
Cartfile.private
Cartfile.resolved
LICENSE
README.md

README.md

WooCommerceSDK

Build Status Carthage compatible

A wrapper around WooCommerce REST API for iOS, OS X, tvOS and watchOS, written purely in Swift.

Requirements

  • iOS 8.0+ / Mac OS X 10.9+ / tvOS 9.0+ / watchOS 2.0+
  • Xcode 7.2+
  • WooCommerce 2.4+

Usage

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"

Get an Order

let orderId = 12
Order.get(orderId) { success, order in
    print(order)
}

Get a Customer

let customerId = 2
Customer.get(customerId) { success, customer in
    print(customer)
}

Get Customer Orders

let customerId = 2
Customer.getOrders(customerId) { success, orders in
    print(orders)
}

Get a Product

let productId = 8
Product.get(orderId) { success, product in
    print(product)
}

Get List of Product Categories

ProductCategory.getAll(limit: 100, completion: { success, categories in
    print(categories)
})

Get All Products by Category

var category = ProductCategory()
category.slug = "hoodies"
Product.getAll(byCategory: category) { success, products
    print(products)
}

Installation

Carthage

Add this to your Cartfile:

github "thii/WooCommerceSDK"

then

$ carthage update

License

MIT