IBM/swift-sandbox

Name: swift-sandbox

Owner: International Business Machines

Description: Tutorial for the Swift Package Catalog and Swift Sandbox

Created: 2017-03-14 05:35:19.0

Updated: 2018-04-30 20:38:56.0

Pushed: 2017-03-15 15:07:54.0

Homepage:

Size: 1598

Language: null

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

swift-sandbox

Learn how to utilize the IBM Swift Package Catalog and the IBM Swift Sandbox to accelerate your Swift development with ease.

IBM Swift Package Catalog IBM Swift Sandbox

Outline

This tutorial takes less than 5 minutes to complete!

Section 1: IBM Swift Package Catalog

  1. Search for packages
  2. View package dependents
  3. Submit a package

Section 2: IBM Swift Sandbox

  1. Try out a sample
  2. Create a snippet
  3. Share your snippet
Section 1: IBM Swift Package Catalog

In this section you will become familiar with the main features of the IBM Swift Package Catalog, and how they can augment your Swift development experience.

Search for packages

Searching for community Swift packages is one of the main value adds provided by the IBM Swift Package Catalog. Swift packages are mildly categorized, but we support fuzzy search on packages as well.

Please open Swift Package Catalog in a new tab.

In the search bar on the landing page, enter a package or category you are looking for:

Hint: If you aren't sure what you are looking for, try json.

Search for json packages

Note: After filling in the search bar, hitting Enter or clicking See All Results for "json" will bring you to a comprehensive search page with more results.

Checkpoint

Search for, navigate to, and view the READMEs for each of the following packages:

View package dependents

Being able to easily view the Swift packages that depend on a specific Swift package gives some valuable insight into the community view of that package. This is easy to view with the IBM Swift Package Catalog.

While viewing the READMEs from the previous Checkpoint, off to the right there is a panel of information about each of the packages:

View package details

By arrowing down on the Dependents field for each, you can view the dependents. Likewise, if you are interested in the Dependencies of a given package.

Checkpoint

View the dependents and dependencies for the following packages:

Submit a package

We try our best to populate our Swift package index on a regular basis as new packages are released, but we are only humans. If you know about Swift packages that you can't find while searching the IBM Swift Package Catalog then please help us out. Its easy, all you need is a public GitHub repo.

From any page in the catalog, click the Submit a Package in the navigation bar.

Submit a Package navbar

Then simply submit the url associated with the package's GitHub repository.

Submit a Package form

Note: It can take a few moments before our backend processes your submission. If you don't see the package appear in the catalog within an hour, something likely didn't work. Check that the url you submitted is accurate, and the repository is public.

Section 2: IBM Swift Sandbox

In this section we build on the Swift Package Catalog experience and discover the IBM Swift Sandbox environment where you can try out Swift server samples, or craft entirely new snippets of Swift code rapidly, in a safe environment.

Try out a sample

Back in your Swift Package Catalog browser tab, either navigate to the IBM-Swift/SwiftyJSON package or just click here SwiftyJSON

You will notice that this particular package has a new button near the View on GitHub button that looks like this:

Try in Sandbox

When a Swift package in the Swift Package Catalog has this button it means the package owner has provided samples to try out the package code in the Swift Sandbox. Go ahead and click Try in Sandbox for IBM-Swift/SwiftyJSON and select one of the registered samples that appear:

Choose Swift sample

Once you are redirected to the IBM Swift Sandbox, run the sample as is by clicking the play button in the bottom middle of the screen:

Run sample

The result is output in the right hand side panel.

Checkpoint

Did the sample run successfully? It should have output:



Create a snippet

In the interest of time, simply change the json name value to be Bob instead of Jack:

Edit sample

Bonus: If you are feeling brave, ditch the sample and create your own snippet. It just has to run within 5 seconds, and no network activity.

Checkpoint

Run the modified sample (now your custom snippet) to see the changed result. It should now output:



Share your snippet

Now that you have made some custom snippet on the IBM Swift Sandbox, you should probably share it with the world. We make sharing your snippet, easy!

Click the Save Code button on the bottom navigation bar:

Save Code navbar

Fill in the form:

Save Code input

After clicking Save you will have the option to share via link or social media:

Share Code

Checkpoint

Send your code snippet link to a friend.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.