It’s now easier than ever to deploy your apps to the cloud using IBM Cloud Tools for Swift (ICT).  With the release of version 1.3, Mac users have an even simpler interface for deploying, managing and monitoring end-to-end applications. The improved Swift application makes using the Swift@IBM server-side tools and technologies super easy.  Download the Beta version here.  Then take these 4 simple steps to learn how to navigate our new UI. 

1. Start a new Project

Click the “+” in the upper right hand corner of the application from the Projects view, the default view when you load the application.

create-a-new-project

Figure 1. Create New Project

You will see several options for new projects including sample apps and an empty project. The sample apps are built on Kitura, a web framework created by IBM for writing Swift on the Server. An empty project allows you to add your existing projects to ICT, so you can manage and monitor them within the app.

project-options

Figure 2. Project Options

2. Create the ToDo List sample app locally

The ToDo List sample app is a great way to learn how to write Swift on the client and the server. Hover over ToDo List App and click View.

view-project

Figure 3. View Project

You will see a description of the project, a ReadMe, and information for local development. In previous versions of ICT, you deployed to the cloud immediately, but now you can save files locally to view and test before pushing the application to IBM Cloud.

project-readme

Figure 4. Project ReadMe

Double check to make sure you meet the local development requirements (Xcode 8 in this case), then click Save Files to Local Computer.

Name the project then click Next. Note: your project name should not have spaces in it. You will get an error if it does.

name-project1

Figure 5. Name Project

Choose where to save the project files and click Place. Note: the folder name should not have spaces in it. You will get an error if there are spaces in the path.

place-project

Figure 6. Place Project

This will bring you to a screen with Local Server Repositories, Cloud Runtimes, and Client Apps. 
A Local Server Repository is your server side code that you can run locally. A Cloud Runtime is a cloud application hosted on IBM Cloud with your server side code. A Client App is your front end code that talks to your server, for example ToDo List Sample comes with an iOS app.

files-saved

Figure 7. Files Saved

Run the project in Xcode to get it working locally!

3. Deploy the ToDo List Sample App to the Cloud

From the project view, click on Provision and Deploy Sample Server on IBM Cloud.

deploy-to-ibm-cloud

Figure 8. Deploy to IBM Cloud

If you haven’t signed in to IBM Cloud, you will be prompted to sign in. If you do not have an IBM ID, sign up for one and get started with your free 30-day trial. Note: you will need to set up your Region, Org and Spaces before returning to ICT.

sign-in-to-bluemix

Figure 9. Sign In to IBM Cloud

If you have multiple orgs, you will be prompted to choose which one you’d like to put the Cloud Runtime.

migrate-projects-to-orgs

Figure 10. Migrate Projects to Orgs

Check that you meet all the IBM Cloud requirements for creating a Cloud Runtime then click next. You can look at your memory usage and current services by going to the IBM Cloud web UI.

bluemix-project-requirements

Figure 11. IBM Cloud Project Requirements

Give a unique name for your Cloud Runtime and select a Space then click Next.

name-cloud-runtime

Figure 12. Name Cloud Runtime

You will be brought back to the project screen, but this time you will have a Cloud Runtime loading!

loading-cloud-runtime

Figure 13. Loading Cloud Runtime

ICT automatically creates a Cloud Runtime and a Cloudant Database on IBM Cloud for you, this may take a few minutes, but you will receive a notification once it’s complete. 

Open the client app in Xcode to run your app with an IBM Cloud Runtime.

You can now switch between running your client app locally and remotely by changing the Connected to: field on the client app. This is helpful for quickly testing code changes before you deploy to IBM Cloud.

connected-to

Figure 14. Connected To

On the Local Server Repository card, you’ll see a Deploy to: field.

deploy-to

Figure 15. Deploy To

This allows you to choose where you deploy your server-side code if you have multiple Cloud Runtimes associated with your project. You may have this if you choose to set up testing, staging and production environments for your application.

4. Checkout your Cloud Runtime Logs

To view logs and errors of your Cloud Runtime, click Open Logs on the Cloud Runtime card.

logs

Figure 16. Logs

To learn more about this feature, read our instructions.

ICT offers other advanced features like creating a custom project from a sample application hosted in github. To learn more about that feature, check out our instructions on how to create a supported manifest.yml file.

Get Support and Provide Feedback

If you haven’t already done so, download the latest version of ICT. If you have questions along the way, reach out to us through dWAnswers. If you have any feedback, fill out our survey to help us improve the tool. Stay up to date on IBM initiatives around Swift by visiting our website.

5 comments on"4 Steps to Mastering the New and Improved IBM Cloud Tools for Swift"

  1. After
    “Figure 7. Files Saved
    Run the project in Xcode to get it working locally!”

    How do you do you run the project in Xcode?

    There are 3 different README.md files in the Xcode files generated by ICT. These involve running THE CLI, setting up a FaceBook Dev acct, * downloading and installing Couchdb, data base unit tests, etc.

    Most of the README instructions are unclear as to which directory the commands are to be run.
    After fiddling around for several hours, I gave up — I never got it to work locally.

    I think that the concept of ICT is brilliant!

    However, The ICT ToDo List project is flawed:
    • at the very best, it misleads the user that ICT can generate and run the project without any tedious, error-prone CLI activity
    * at the very worst — it doesn’t work!

    I feel that it is very important that the user’s first exposure to ICT should result in positive reinforcement:
    • the documentation/demo/tutorial matches what is generated for the project
    • successfully running the project locally
    • successfully running the project on the cloud

    Unfortunately, the ToTo List project does none of these — and leaves the user with the impression that ICT is not worth the hassle/effort.

    * The setup for FaceBook login adds unnecessary steps to the project. A simple dictionary could be used to set up several UserID/Password combinations. Then, after the project is running, the user could, optionally, add FaceBook login.

    • Hi, thanks for the feedback. We had a glitch in the populator.sh script that caused the TodoList not to work. It has been resolved now. Perhaps adding an “anonymous” login would be useful for this example?

      • Richard Applebaum September 30, 2016

        Thanks for the response! Got the Cloud working, still can’t get the local version working. I realize that we’ve gotta-lotta-beta stuff (ICT, macOS, iOS, Xcode, Swift 3).

  2. Unfortunately in my case it does not work. Both the local installation and the cloud. I tried to install using the wizard from IBM Cloud Tools 1.3.0.1.

    I believe it has something to do with the connection to the database as the client can send requests to the server. The server cannot retrieve or store data.

    For the moment I would try and understand the client/server connection that works, so I can have a starting point for my application. I would love to see the db work as well.

    I know all these are quite new and the changes to swift 3 have messed everything up, but in order to not disappoint new users it is best if the examples do work without a lot of configuration / messing around.

    • Richard Applebaum October 11, 2016

      Here’s how I got it to work:
      1. Install locally with ICT
      2. Do not try to run locally *
      3. Immediately deploy [the server/db] to Bluemix Cloud runtime *
      4. Open the logs to follow along — it will hiccough a few times, but eventually run
      5. Then link to the Client App Xcode project
      6. Update the apps recommended settings (you’ll have to start a compile to get the option to do so)
      7. Compile and run the Client (I used simulator)

      * AFAICT, the [Swift] package and CLI activities for local deployment are different from what is used for IBM Cloud Bluemix — maybe node.js NPM packages.

      I think the ICT concept is to deploy and test the server/db locally using Swift packages — then redeploy your local copy of the server/db to the IBM Cloud Bluemix. But I don’t think that is happening yet…

      As you noted, Swift 3 is not nailed down — neither is the Swift Package manager. So, I don’t think that local deployment –> Cloud deployment is practical, yet, for all but the simplest projects, e.g. Kitura.

      FWIW, after all the tedium of trying to get the ToDo List server/db working locally (lots of README files with incomplete instructions & lots of CLI activity — I suggested that ICT could automate the process by using Swift to generate and execute shell scripts and/or swift.scripts. As it turns out, this is straightforward — I have a macOS Swift Playground that does just that — generating and executing shell and swift scripts – to create and run a Swift Package. It should, also, be possible to do this on Swift Playgrounds on the iPad.

      However, I was never able to determine all that is needed to deploy the ToDo List server/db locally — so I just gave up.

Leave a Reply