Bye-bye Brackets – Swift is here for iOS developers

Developers around the world tuned in this week to watch Apple CEO Tim Cook take the stage to talk about everything iRelated. Anticipation has been building in recent weeks about a health platform, perhaps something in the IOT space, and other great additions to the iOS platform. However, the topic that developers are buzzing about took nearly everyone by surprise – the introduction of Swift.

Since the first iPhone SDK, developers have been using the Objective-C language to build their iOS apps. As hundreds of thousands of developers have adopted the language over the past few years, there have been great strides made to improve the Xcode / Objective-C experience. However, the technology is changing, the developers are changing and the tools used are changing. As the developer experience evolves, it needed a language to keep up. Enter Swift.

What is Swift?

Swift is a new object-oriented programming language created for building iOS and OS X applications and tools. Designed to be fast and modern, it simplifies code significantly – making it easier to read and write. Its syntax is reminiscent of languages that many developers already know – python and javascript come to mind. With inferred types, closures, generics and tuples, new and existing developers will feel comfortable working with this language. Check out the snippets below from Apple’s site for some basic examples:

Iterate through a dictionary and print the contents

let people = ["Anna": 67, "Beto": 8, "Jack": 33, "Sam": 25]
for (name, age) in people {
    println("\(name) is \(age) years old.")
}

Function definition – recognize those classes?

func configureLabels(labels: UILabel[]) {
    let labelTextColor = UIColor.greenColor()
    for label in labels {
        // label inferred to be UILabel
        label.textColor = labelTextColor
    }
}

What does this mean for my existing apps?

The first question that most developers ask is – how does this fit into my current workflow? I have apps built and deployed, frameworks that I depend on, but all of them are in Objective-C! Not to worry, Apple has made it clear that you can start using Swift right away with your existing projects – but Objective-C is by no means going away. With the ability to mix and match languages within a single project, you can phase the new language into your new and existing projects if you choose to do so, at a pace that works for you.

What about Kii?

Swift is still brand new to us at Kii as well – so we’ll be investigating this new language alongside our developers to see how our existing framework integrates with the new language. We’ll expand our guides and documentation to cover Swift and make sure any developers adopting Swift can continue to use our cloud toolkits just as easily as before! Swift is designed to work with existing Objective-C classes and methods, so we expect the transition to go smoothly – but we’ll make official announcements once our investigation is complete.

How can I get started with Swift?

Guides and documentation have already been released to registered Apple developers – as well as an iBook for your reading pleasure. Head over to Apple’s site to get everything you need! Betas have also been released for iOS8 and Xcode 6 – which includes full Swift support, including a ‘playground’ which shows the results of your code in real-time. This is a great feature particularly for SpriteKit and game developers who wish to see their changes take effect immediately without having to re-build and launch the app.

As developers, we’re very excited to dive into Swift and start learning about all it has to offer – and we hope you are too! This is a major announcement and a big change for iDevs everywhere, so let us know your thoughts.

Happy coding 🙂

- Share -

Chris Beauchamp

More posts from

  • Kii IoT platform enables customers to create smart, connected solutions and services
  • Long track record of supporting customers like Docomo, Toshiba, Kyocera and many others
  • Strong ecosystem partners across the globe, consisting of carriers, device/sensor manufacturers, system integrators, network/infrastructure providers, chip vendors and solution developers
  • HQ in Tokyo, US HQ in Silicon Valley & offices in China, Taiwan, Hong Kong and Europe (UK, Spain, Germany)
  • www.kii.com