By using this website you implicitly accept our cookies. For more informations read our Cookie policy

Swift Quickstart

Create a Marketcloud application

A Marketcloud account is required

In order to create an application, you need to create a Marketcloud account first.

Create an account

Create an application

An application is where your store's data will live. Simply create one choosing an application name and a plan. We’ve got several plans including our favorite, Free!

Create your first product

Add data using the dashboard

Once you created your application you can log into its dashboard just by clicking on it. Here you can open the "products" section and create your first product You can also add images and variants!

Bootstrap your frontend

Install the SDK

The easiest way to install the Swift SDK is using Carthage. Create your cartfile with

touch Cartfile

And then add the following line to it.

github "Marketcloud/marketcloud-swift-sdk"

Now run

carthage update

This command will generate the .framework file you can add to your XCode project.

On your application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script in which you specify your shell (ex: bin/sh), add the following contents to the script area below the shell:

$(SRCROOT)/Carthage/Build/iOS/Marketcloud.framework

If you need a more detailed step by step guide, please refer to our GitHub repository.

Configure the client

In order to query the API, you must set your application's public key into the client, You can find the public key under the information section.

import Marketcloud
var marketcloud = Marketcloud(key: "insert_your_public_key_here");
Query the API

Use the Swift client

Congratulations you are ready to query the API! Use the client to retrieve the product you created earlier:


marketcloud.getProducts()
				

The code above will retrieve a paginated list of products, you can also use the first parameter to filter them by any key.


marketcloud.getProducts(filter:[String: Any])
				
Well done!

You have a Marketcloud powered application!

In these 5 little steps you obtained:

  • Full featured dashboard to manage your store

  • Infinite frontend flexibility

  • A fast and scalable backend for your eCommerce applications

Now you can add more features to your app by checking the documentation, or you can spend more time on the dashboard adding more stuff!

Questions?

We're super happy to help with any question you might have! Send us an email, or get in touch with us in our Slack channel !