Fetching contributors…
Cannot retrieve contributors at this time
91 lines (56 sloc) 6.16 KB

Commercetools Sunrise iOS 🌅

Stories in Ready

The mobile shop template using the latest version of Commercetools SDK, and providing you with the best and quickest way to get up and running with the commercetools platform.

Getting started


  • iOS 10.0+ / watchOS 3.0+
  • Xcode 8.1+
  • Swift 3.0+

Installing CocoaPods Dependencies

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.1.0+ is required to build the latest Sunrise project.

Then, run the following command:

$ pod install

Commercetools Project Configuration

Sunrise is a mobile shop template that relies on the commercetools platform, and the first step after successfully installing and being able to build the project is to configure Commercetools SDK with your project key and credentials, as well as other SDK specific settings (e.g anonymousSession, keychainAccessGroupName, shareWatchSession, desired logging level, etc).

You can optionally decide to have multiple environments (staging, qa, production), and this project provides a good example on how to make this work.

Mobile Shop Template Features

The main goal of this project is to provide you with the best practices on how to utilize the Commercetools SDK along with current iOS trends, and quickly start with your own mobile shop. We are constantly working on adding new features, and you can always check the status by looking at the project's Waffle board.

This is the list of features you can find in the current version of the Sunrise app:

  • Products overview: a customer can browse for products on the overview screen, and navigate to product details. Optionally for an authenticated customer, Sunrise provides the ability to customize products overview experience, by choosing whether to browse the entire online inventory, or just the products which are in stock in your favorite store.
  • Product details: all product related details, customized depending on selected preference on the overview screen.
  • Click 'n' collect: from the product details, a customer can reserve an item to be picked up from one of the stores selected on the score selection screen.
  • Carts: products can be added to the cart from the details page, and managed on the cart tab (delete items, change quantity, etc).
  • Search: textual search, with results presented on the product overview screen.
  • My account:
    • Login and registration screen in case the customer has not previously logged in.
    • Orders and reservations overview, when the customer is logged in. Customer's preferred store can also be seen under my preferences section, and changed from the subsequent screens containing map and list view of the available stores.

Push Notifications

Another important aspect of a mobile shop template is the ability to receive notifications important to the customer. Sunrise iOS project provides an example on how to implement a notification that is triggered when a customer reserves an item to be picked up in a store.

Storing Customer Tokens

In order to be able to deliver a notification to the customer's device, you first need to save the push token somewhere. There are many possible scenarios, and the approach used in Sunrise project is simply storing it in a Customer's custom field.


Depending on the business case, you might want to trigger customer notifications based on a certain event or change that occurred on the e-commerce platform. The best way to accomplish that is to subscribe to one or more messages provided by the Commercetools platform.

Delivering Notifications

Sunrise uses serverless push notification solution. We have prepared both IronWorker and AWS Lambda functions, which work when triggered from IronMQ or AWS SNS respectively, for messages delivered using the commercetools platform subscription.

Rich Content Notifications (Notification Content Extension)

Sunrise provides an example on how to use keychain access group to share the same customer access tokens between the main iOS app, and a notification content extension (although, the same goes for any kind of iOS extension). Notification delivery methods from the examples above prepare the payload with the proper category value, and includes additional information needed to load the rich content.

Reservation Confirmation Notification

Triggered on OrderCreated message. Function for delivering the notification retrieves the apnsToken from the customer's custom field, for the customerId specified in the OrderCreated message payload.

phone notification

watch notificaiton

[](definitions for the top badges)