Affiliate Disclosure
If you buy through our links, we may get a commission. Read our ethics policy.

IBM Swift Sandbox lets you test Apple's newly open-source programming language in your browser

Just hours after Apple made its Swift programming language open source, IBM has introduced a new, simple, and free browser-based way for developers to get started writing code.

Created at IBM's Mobile Innovation Lab in Austin, the new IBM Swift Sandbox tool is now available to test in beta form on the developerWorks website. Swift Sandbox allows developers to write Swift code and execute it in a server environment on top of Linux.

John Petitto, an IBM Swift developer, detailed the new tool on Friday in a post to Big Blue's developer website. The sandbox runs on IBM Cloud in a Docker container, and allows testers to use both the latest versions of Swift and its standard library.

Petitto teased that Swift Sandbox is just the beginning from IBM, which has openly embraced Apple's programming language for iOS and OS X. Now that it's open source, Petitto said that the Swift Sandbox tool "barely scratches the surface of what's possible."

In an interview this week, Apple senior Software VP Craig Federighi revealed that IBM has been a "major source" of feedback on Swift. The Armonk, New York-based company has an ongoing partnership to develop enterprise-focused mobile apps on iOS via Swift.



27 Comments

🎁
LoneStar88 9 Years · 325 comments

Wow. I'm not a developer (yet), but this would seemingly portend a potentially huge end run around the corporate Windoze hegemony.

🕯️
vmarks 21 Years · 762 comments

I don't know that it does that completely - There's no reason Swift won't become available for Windows, because it is open source, after all. Yes, it could help break the dominance of Windows-only applications (although that's been fading on its own for quite some time) but it probably doesn't leave Windows out in the cold. Not a developer yet? Definitely use that IBM link. Seeing the code on one side of the screen and the results on the other is one of the best ways to begin.

applesauce007 17 Years · 1704 comments

This is very cool. It even supports Apple's foundation framework. The browser interface is very responsive. This allows any platform with a web browser to try out Swift.

🎅
Marvin 18 Years · 15355 comments

I always wondered if IBM had an interest in Swift in part because of Java/Oracle: http://stackoverflow.com/questions/3824372/where-can-i-find-a-particular-version-of-the-ibm-jdk-jre-for-windows http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14514070 "Unfortunately you can get hold of the JDK only as part of another IBM product (say, Websphere or any Rational product) that you purchased. Our licensing agreement with Sun/Oracle forbids us from providing direct downloads of the IBM JDK on any platforms that Oracle/Sun also support (namely Windows and Linux). If you look at the Java downloads section of the developerWorks website, you'll only find SDKs for AIX, z/OS and Linux on System p/z, since those are IBM owned platforms that Oracle doesn't support." Swift running server-side allows for a replacement for Java and for some businesses replacing Java can cut some costs out: http://www.oracle.com/us/corporate/pricing/price-lists/java-embedded-price-list-1977272.pdf Java is used to develop Android apps too. It would be good to see adoption of Swift in the game SDKs (Unreal, Unity) at least. Having it able to run server-side means an app developer would only need to know one language to make cloud apps. Games have been made where heavy processing parts run on a server: http://www.developer-tech.com/news/2015/aug/05/gamescom-microsoft-demonstrates-power-its-cloud/ https://www.youtube.com/watch?v=MJfEUJ57qD8 http://www.extremetech.com/gaming/215532-microsoft-buys-havok-physics-from-intel-could-boost-xbox-one-cloud-gaming As long as the connection is stable, a Swift app can send off a calculation to a server that runs up a number of instances in the same Swift code hundreds of times faster than the device could do on its own and just send back the results.

☕️
dick applebaum 17 Years · 12525 comments

This is very cool. It even supports Apple's foundation framework. The browser interface is very responsive. This allows any platform with a web browser to try out Swift.

The following site has been available for several months and works a little better than the new IBM site:

http://www.swiftstub.com/ But the IBM site will, certainly, be of greater influence to enterprise.

Here is some Swift code that works on both sites.  It shows one approach to creating an  Ordered Dictionary.   I suspect that Apple will implement a high-performance  Ordered Dictionary  API to support its recently acquired  FoundationDB.

//
//  OrderedDictionary.swift
//  SwiftDataStructures
//
// http://timekl.com/blog/2014/06/02/learning-swift-ordered-dictionaries/
//
//  Created by Tim Ekl on 6/2/14.
//  Copyright (c) 2014 Tim Ekl. All rights reserved.
//

struct OrderedDictionary<Tk: Hashable, Tv> {
    var keys: Array<Tk> = []
    var values: Dictionary<Tk,Tv> = [:]
    
    var count: Int {
        assert(keys.count == values.count, "Keys and values array out of sync")
        return self.keys.count;
    }
    
    // Explicitly define an empty initializer to prevent the default memberwise initializer from being generated
    init() {}
    
    subscript(index: Int) -> Tv? {
        get {
            let key = self.keys[index]
            return self.values[key]
        }
        set(newValue) {
            let key = self.keys[index]
            if (newValue != nil) {
                self.values[key] = newValue
            } else {
                self.values.removeValueForKey(key)
                self.keys.removeAtIndex(index)
            }
        }
    }
    
    subscript(key: Tk) -> Tv? {
        get {
            return self.values[key]
        }
        set(newValue) {
            if newValue == nil {
                self.values.removeValueForKey(key)
                self.keys.filter {$0 != key}
            }
            
            let oldValue = self.values.updateValue(newValue!, forKey: key)
            if oldValue == nil {
                //self.keys.filter {$0 > key}
                self.keys.append(key)
                print("Keys After Adding: \(key) \(keys)")
                od.keys = od.keys.sort()
                print("Keys After Sorting: \(keys)")
            }
        }
    }
    
    var description: String {
        //od.keys = od.keys.sort()
        print("==od.keys: \(od.keys)")
        var result = "{\n"
        for i in 0..<self.count {
            result += "[\(i)]: \(od.keys[i]) => \(od[i]!)\n"
        }
        result += "}"
        return result
    }
}


var od = OrderedDictionary<String,Int>()
print(od.description)
od["Tim"] = 19
print(od.keys)
print(od.description)
od["Tim"] = 24
print(od.description)
od["Alice"] = 12
print(od.description)
od["Catherine"] = 23
print(od.description)
od["Becky"] = 3
print("od.description--\(od.description)")
print("od --\(od)")
od["Alice"] = 42
print("od.description--\(od.description)")
print(od)
print(od.keys)
print(od.keys[0...2].contains("Tim"))
print(od.values)

//var sortedKeys = sort(&od.keys, <)
print(od.description)