How-tos

IBM Cloud Tools for Swift with non-Swift Runtimes

Share this post:

Disclaimer: IBM Cloud Tools for Swift (ICT) is no longer supported. Check out IBM Cloud App Service to take advantage of the same features of ICT in a more comprehensive experience for building Cloud Native applications in any programming language.


Currently in beta, the IBM Cloud Tools for Swift (ICT) application runs on MacOS and is part of a larger effort to bring Swift to the server and radically simplify end to end mobile application development. If you are interested in Swift, explore the resources available on the Swift@IBM developer portal.

ICT is for developers who are most productive in the Xcode environment and want complementary deployment and management capabilities in a local environment. We use this tool ourselves to extend proven productivity with Xcode in these areas:

  • Code generation and provisioning to pre-tested Kitura runtimes
  • Unified management of credentials
  • Centralized control and monitoring of assets deployed on the cloud
  • Local notifications of remote actions

Since many existing iOS and MacOS clients currently connect to Node.js backends, ICT also facilitates managing and monitoring Node.js and other Bluemix runtimes.

In this post, I’ll show you the steps for creating a Node.js app and using ICT running locally on your computer to make a change to the app, redeploy it, and add a service to it.

A platform’s value is proportional to the ways in which it can be misused. A smart person from the past

If you need a quick overview, please see this step-by-step guide demonstrating how to deploy an end-to-end Swift app and this video demonstration of ICT.

Setting up

First log into Bluemix; if you need an account, click the button below to register for free.

In this walkthru, use the new Bluemix console UI. Begin by selecting the big plus icon on your dashboard. Then select Cloud Foundry Applications and finally SDK for Node.js:

Pick Node Runtime

Name your application and click on the Create button:

Name Application

While Bluemix is creating the initial app, you’ll see some steps to take. Look for the button labeled Download Starter Code:

Download starter code

Click it, unzip the file, and move its contents to a folder that you’ll remember.

Adding the sample app to ICT

If you haven’t done so already, download and install IBM Cloud Tools for Swift:

Start and log into ICT with your Bluemix credentials, then select the + button in the top right to create a new project:

empty page

On the Project Creation screen, select the Create Empty Project button:

project selection

Give your project a name that reflects your application:

name screen

Your project should now be created and you should be on the detail screen:

detail screen

Right now there’s nothing in it, but we’re about to fix that. Select the + button across from Cloud Runtimes. You should see a pop up, select the + sign for the Add existing Cloud Runtime option:

add existing runtime

A sheet should appear showing a list of all your current Bluemix Applications. Select the app you created earlier and click Next:

runtime selection

A dialog should appear to select the folder that contains your app. Find the folder you downloaded earlier and select it:

file picker

ICT running locally on your computer will now try to contact your Cloud Foundry app on Bluemix; when it does, it should show up on the project detail page with a Running status. Click on the app card:

proj detail 2

You can now see the details of the application, including its URL on Bluemix and where it lives on your local computer:

app detail

Updating the sample app with ICT

From the App Detail screen, click on the application link below its name; this should open up the default Bluemix Node.js greeting page with a header saying “Hi there!”:

hello world

We’re going to make a slight change to this page. Open the directory that has the app code—ICT can open Finder at the location for you by clicking on the path—and go into the public folder. Open up index.html and change the h1 tag on line 18 to some new title:

index.html

Save the file and go back to the App Detail page in ICT and select the Deploy icon:

deploy

Once ICT notifies you that the app is running again, open up the Bluemix route. You should now see your changes reflected on the page:

changed page

Adding a service to the sample app using ICT

In the Bluemix console, select your app from the Dashboard and click on Connect New in the Connections section:

new connection

Select the Cloudant NoSQL DB service and give it a name that you’ll recognize easily; then click the Create button to add it to your app:

cloudant service

When prompted, restage your app to make the service available for use. Then go back to ICT and before long, you should see your new service appear in the Services section:

app with service

Getting service credentials from within ICT

On the App Detail Screen, hover over the service card and select the Download Credentials option:

export creds

Select the folder where you want to save the credentials:

save creds

You should see a new file in that folder called credentials-your service name.json:

see new file

Open up that file and you should see the credentials needed to use the service in your app locally:

view credentials

Conclusion

IBM Cloud Tools eases application management for Bluemix users both using Swift and non-Swift applications. It will make any Bluemix user’s life much easier when updating and monitoring their applications. We are continuously improving the app based on your feedback (feel free to offer feedback in the comments section below). You can also see a demo of deploying a Swift app in this video.

—Contributions by Brian White Eagle (@bweagle)

More stories
May 1, 2019

Two Tutorials: Plan, Create, and Update Deployment Environments with Terraform

Multiple environments are pretty common in a project when building a solution. They support the different phases of the development cycle and the slight differences between the environments, like capacity, networking, credentials, and log verbosity. These two tutorials will show you how to manage the environments with Terraform.

Continue reading

April 29, 2019

Transforming Customer Experiences with AI Services (Part 1)

This is an experience from a recent customer engagement on transcribing customer conversations using IBM Watson AI services.

Continue reading

April 26, 2019

Analyze Logs and Monitor the Health of a Kubernetes Application with LogDNA and Sysdig

This post is an excerpt from a tutorial that shows how the IBM Log Analysis with LogDNA service can be used to configure and access logs of a Kubernetes application that is deployed on IBM Cloud.

Continue reading