Commit 3883f028 by Brent Gulanowski Committed by GitHub

Merge pull request #230 from Shopify/task/update-readme

Update README files
parents 0c2a0a2d 50e17661
# Mobile Buy SDK - Product View
The SDK includes an easy-to-use product view to make selling simple in any app. The `BUYProductViewController` displays any product, it's images, price and details and includes a variant selection flow. It will even handle Apple Pay and web checkout automatically:
The SDK includes an easy-to-use product view to make selling simple in any app. The `ProductViewController` displays any product, it's images, price and details and includes a variant selection flow. It will even handle Apple Pay and web checkout automatically:
![Product View Screenshot](https://raw.github.com/Shopify/mobile-buy-sdk-ios/master/Assets/Product_View_Screenshot_1.png)
You can also theme the `BUYProductViewController` to better match your app and products being displayed:
You can also theme the `ProductViewController` to better match your app and products being displayed:
![Product View Screenshot](https://raw.github.com/Shopify/mobile-buy-sdk-ios/master/Assets/Product_View_Screenshot_2.png)
Simply initialize the `BUYProductViewController` and present it from any view controller in your app to sell a product from you shop.
Simply initialize the `ProductViewController` and present it from any view controller in your app to sell a product from you shop.
### Getting started
The `BUYProductViewController` needs a `BUYClient` setup with your shop's credentials to work, so first create a `BUYClient` object:
The `ProductViewController` needs a `BUYClient` setup with your shop's credentials to work, so first create a `BUYClient` object:
```objc
BUYClient *client = [[BUYClient alloc] initWithShopDomain:@"yourshop.myshopify.com"
......@@ -20,7 +20,7 @@ BUYClient *client = [[BUYClient alloc] initWithShopDomain:@"yourshop.myshopify.c
channelId:@"99999"];
```
Now, create a `BUYProductViewController` with the `BUYClient`, and optionally add Apple Pay and a custom theme.
Now, create a `ProductViewController` with the `BUYClient`, and optionally add Apple Pay and a custom theme.
```objc
// Optionally customize the UI:
......@@ -28,13 +28,13 @@ BUYTheme *theme = [[BUYTheme alloc] init];
theme.style = BUYThemeStyleLight;
theme.tintColor = [UIColor redColor];
BUYProductViewController *productViewController = [[BUYProductViewController alloc] initWithClient:self.client theme:theme];
ProductViewController *productViewController = [[ProductViewController alloc] initWithClient:self.client theme:theme];
// Optionally enable Apple Pay:
productViewController.merchantId = @"MERCHANT_ID";
```
Now the `BUYProductViewController` is ready to load a product and be presented in your app:
Now the `ProductViewController` is ready to load a product and be presented in your app:
```objc
[productViewController loadProduct:@"PRODUCT_ID" completion:^(BOOL success, NSError *error) {
......
......@@ -4,7 +4,7 @@ The Advanced Sample App demonstrates how to perform several tasks related to cre
- Fetch collections
- Fetch products
- Optionally present using the `BUYProductViewController`
- Optionally present using the `ProductViewController`
- Create a checkout
- Apply shipping rate
- Apply gift cards and discounts
......@@ -35,7 +35,7 @@ The Advanced Sample App demonstrates several tasks that can be performed using t
###### `ProductListViewController`
* Fetches the products and displays them in a list
* Can present a product using the `BUYProductViewController` and demo the theme settings on the controller, or
* Can present a product using the `ProductViewController` and demo the theme settings on the controller, or
* Creates a checkout with the selected product and pushes to the `ShippingRatesTableViewController`
###### `ShippingRatesTableViewController`
......
......@@ -95,13 +95,13 @@ Initialize the `BUYClient` with your credentials from the *Mobile App Channel*
```objc
BUYClient *client = [[BUYClient alloc] initWithShopDomain:@"yourshop.myshopify.com"
apiKey:@"aaaaaaaaaaaaaaaaaa"
channelId:@"99999"];
appId:@"99999"];
```
### Storefront API
After initializing the client with valid shop credentials, you can begin fetching collections.
```objc
[client getCollections:^(NSArray<BUYCollection *> *collections, NSError *error) {
[client getCollectionsPage:1 completion:^(NSArray<BUYCollection *> *collections, NSError *error) {
if (collections && !error) {
// Do something with collections
} else {
......@@ -113,7 +113,7 @@ Having a collection, we can then retrieve an array of products within that colle
```objc
BUYCollection *collection = collections.firstObject;
[client getProductsPage:0 inCollection:collection.collectionId completion:^(NSArray<BUYProduct *> *products, NSUInteger page, BOOL reachedEnd, NSError *error) {
[client getProductsPage:1 inCollection:collection.collectionId completion:^(NSArray<BUYProduct *> *products, NSUInteger page, BOOL reachedEnd, NSError *error) {
if (products && !error) {
// Do something with products
} else {
......@@ -180,9 +180,7 @@ The Mobile Buy SDK includes a number of targets and schemes:
* **Buy**: This is the Mobile Buy SDK dynamic framework. Please refer to the installation section above
* **Buy Static** (target only): This is the Mobile Buy SDK static framework. This build is based on the current build configuration. To build a universal framework that can run on a device and on the Simulator and to be included in your app, please refer to the `Static Universal Framework` target below
* **Static Universal Framework**: This builds a **static** framework from the `Buy Static` target using the `build_universal.sh` script in the `Static Universal Framework` target and copies the built framework in the `/Mobile Buy SDK Sample Apps` folder. This is a fat binary that includes arm and i386 slices. Build this target if you have made any changes to the framework that you want to test with the sample apps as the sample apps do not build the framework directly but embed the already built framework
* **Static Universal Framework**: This builds a **static** framework from the `Buy` target using the `build_universal.sh` script in the `Static Universal Framework` target and copies the built framework in the `/Mobile Buy SDK Sample Apps` folder. This is a fat binary that includes arm and i386 slices. Build this target if you have made any changes to the framework that you want to test with the sample apps as the sample apps do not build the framework directly but embed the already built framework
* **Mobile Buy SDK Tests**: Tests for the Mobile Buy SDK framework. See instructions below
......@@ -194,27 +192,27 @@ The repo includes 3 sample apps. Each sample apps embeds the dynamic framework a
* [Advanced Sample App](https://github.com/Shopify/mobile-buy-sdk-ios/tree/master/Mobile Buy SDK Sample Apps/Sample App Advanced/README.md)
* [Swift Sample App](https://github.com/Shopify/mobile-buy-sdk-ios/tree/master/Mobile Buy SDK Sample Apps/Sample App Swift/README.md)
* [Web Sample App](https://github.com/Shopify/mobile-buy-sdk-ios/tree/master/Mobile Buy SDK Sample Apps/Sample App Web/README.md)
* [Customers Sample App](https://github.com/Shopify/mobile-buy-sdk-ios/tree/master/Mobile Buy SDK Sample Apps/Sample App Customers/README.md)
We suggest you take a look at the **Advanced Sample App** and test your shop with the sample app before you begin. If you run into any issues, the **Advanced Sample App** is also a great resource for debugging integration issues and checkout.
### Product View
The SDK includes an easy-to-use product view to make selling simple in any app. The `BUYProductViewController` displays any product, it's images, price and details and includes a variant selection flow. It will even handle Apple Pay and web checkout automatically:
The Advanced Sample App includes an easy-to-use product view to make selling simple in any app. The `ProductViewController` displays any product, it's images, price and details and includes a variant selection flow. It will even handle Apple Pay and web checkout automatically:
![Product View Screenshot](https://raw.github.com/Shopify/mobile-buy-sdk-ios/master/Assets/Product_View_Screenshot_1.png)
You can also theme the `BUYProductViewController` to better match your app and products being displayed:
You can also theme the `ProductViewController` to better match your app and products being displayed:
![Product View Screenshot](https://raw.github.com/Shopify/mobile-buy-sdk-ios/master/Assets/Product_View_Screenshot_2.png)
The [Advanced Sample App](https://github.com/Shopify/mobile-buy-sdk-ios/tree/master/Mobile Buy SDK Sample Apps/Sample App Advanced/) includes a demo of the `BUYProductViewController`. Documentation on how to use the `BUYProductViewController` is also available [here](https://github.com/Shopify/mobile-buy-sdk-ios/tree/master/Mobile Buy SDK Sample Apps/Sample App Advanced/PRODUCT_VIEW_README.md).
The [Advanced Sample App](https://github.com/Shopify/mobile-buy-sdk-ios/tree/master/Mobile Buy SDK Sample Apps/Sample App Advanced/) includes a demo of the `ProductViewController`. Documentation on how to use the `ProductViewController` is also available [here](https://github.com/Shopify/mobile-buy-sdk-ios/tree/master/Mobile Buy SDK Sample Apps/Sample App Advanced/PRODUCT_VIEW_README.md).
### Unit Tests
To run the Mobile Buy SDK integration tests against an actual shop, you will need a Shopify shop that is publicly accessible (not password protected). Please note that the integration tests **will create an order** on that shop. This is to validate that the SDK works properly with Shopify. Modify the **test_shop_data.json** file to contain your shop's credentials and the required product IDs, gift cards, and discounts as necessary.
If the credentials in the **test_shop_data.json** are empty, running the integration tests will use using mocked respoonses. The mocked responses are defined in **mocked_responses.json**. Do not check in credentials in this file.
If the credentials in the **test_shop_data.json** are empty, running the integration tests will use mocked respoonses. The mocked responses are defined in **mocked_responses.json**. Do not check in credentials in this file.
Alternatively, you can edit the `Mobile Buy SDK Tests` scheme and add the following arguments to the **Environment Variables**:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment