| copyright |
|
||
|---|---|---|---|
| lastupdated | 2017-05-18 |
{:new_window: target="_blank"} {:shortdesc: .shortdesc} {:screen: .screen} {:codeblock: .codeblock} {:pre: .pre}
{: #tutorial}
The following end-to-end tutorial walks you through the steps to create a project from the Mobile Basic Starter. This guide includes installing prerequisite tools, and the steps to run the project in Xcode and Android Studio.
{: #dev_tools}
Ensure that you install the prerequisite developer tools {: new_window}.
{: #choose_how}
You can create a project by using either the web-based {{site.data.keyword.dev_console}} or through the command-driven {{site.data.keyword.dev_cli_notm}}.
{: #create-devex}
-
Create a {{site.data.keyword.dev_console}} project in {{site.data.keyword.Bluemix}}.
-
From the Getting Started
page in the {{site.data.keyword.dev_console}}, click Create Project.
You can alternatively click Create Project from the Projects page.
-
Select Mobile App and click Next.
-
Select Basic and click Next.
-
Enter your project name. For this tutorial, use
MobileBasicProject. -
Select your platform. For this tutorial, use
Swift. -
Click Create.
-
-
Optional: Add the Authentication capability.
-
Click Add for Authentication on the Project Overview page.
You can alternatively select Create or Add Existing on the Capabilities > Authentication page.
-
Enter your service name and click Create.
-
Toggle on Authentication.
-
Select your identity provider and enter the information to configure it. You can enable only one identity provider.
-
For more information about configuring Authentication, see Configuring identity providers}
{: new_window}.
-
-
Optional: Add the Analytics capability.
-
Click Add for Analytics in the Project Overview page.
You can alternatively click Create or Add Existing from the Capabilities > Analytics page.
-
Enter your service name and click Create.
-
Toggle off Demo Mode to see your analytics data after you run your app.
-
For more information about configuring Analytics, see Getting started with {{site.data.keyword.mobileanalytics_short}}
{: new_window}.
-
-
Optional: Add the {{site.data.keyword.mobilepushshort}} capability.
-
Click Add for {{site.data.keyword.mobilepushshort}} in the Project Overview page.
You can alternatively click Create or Add Existing from the Capabilities > {{site.data.keyword.mobilepushshort}} page.
-
Enter your service name and click Create.
-
For iOS, configure Apple Push Notification Service
{: new_window}.
-
For Android, configure Firebase Cloud Messaging
{: new_window}.
-
-
Optional: Add the Data capability.
-
Click View for Data on the Project Overview page.
You can alternatively select Create on the Data page.
-
Choose {{site.data.keyword.cloudant_short_notm}} or {{site.data.keyword.objectstorageshort}}.
-
Enter your service name and click Create.
-
For more information about configuring {{site.data.keyword.cloudant_short_notm}}, see Getting started with {{site.data.keyword.cloudant_short_notm}}
{: new_window}.
-
For more information about configuring {{site.data.keyword.objectstorageshort}}, see Getting started with {{site.data.keyword.objectstorageshort}}
{: new_window}.
-
-
Generate your project code:
-
Click Get the Code on the Project Overview page to select your language.
You can alternatively click on the Code page.
-
Click Generate Swift.
-
When the project code is finished generating, click Download Swift to download your project archive.
-
-
Begin working with your downloaded project:
-
Expand the archived file.
-
Navigate to the new project directory.
-
Use the {{site.data.keyword.dev_cli_notm}} to proceed.
-
-
Optional: Update your project to generate a new language.
{: #create-cli}
-
Ensure that you install the {{site.data.keyword.dev_cli_short}}.
-
In your Terminal prompt, navigate to a local directory of your choice and run the following command.
bx dev create{: codeblock}
-
Provide the following values when prompted:
- Select a pattern: 2 (for Mobile)
- Select a starter: 1 (for Basic)
- Select a platform: 3 (for iOS Swift)
- Enter a name for your project:
MobileBasicProjectCLI
-
If you want to add services to your project, type
yat the question prompt and answer the remaining questions. -
When your
MobileBasicProjectCLIis successfully saved, navigate to theMobileBasicProjectCLI/MobileBasicProjectCLI-Swiftfolder.
{: #run_swift}
-
Extract the
MobileBasicProject-Swift.zipfile. -
Open the
README.mdfile in a Markdown viewer to review the steps to configure your project.-
Open your Terminal and navigate to your project folder.
-
Run
pod setupif you need to set up your CocoaPods repository. -
Run
pod updateif you need to update you update your existing pods. -
Run
pod installto install the pods for your project.
-
-
Open your
BasicProject.xcworkspaceXcode workspace.
-
-
Run your app.
{: #run_cordova_xcode}
-
Extract the
MobileBasicProject-Cordova.zipfile. -
Open the
README.mdfile in a Markdown viewer to configure your project.- Open your
platforms/iosproject in Xcode.
- Open your
-
Run your app.
{: #run_cordova_studio}
-
Extract the
BasicProject-Cordova.zipfile. -
Open the
README.mdfile in a Markdown viewer to configure your project.- Open your
platforms/androidproject in Android Studio.
- Open your
-
Run your app.
{: #run_android}
-
Extract the
MobileBasicProject-Android.zipfile. -
Open the
README.mdfile in a Markdown viewer to configure your project.- Open your
BasicProject-Androidproject in Android Studio.
- Open your
-
Run your app.