• Posted June 27, 2014, 9 a.m. - 10 years, 6 months ago

Introduction to Apple’s Swift – New Coding Language

As well as unveiling iOS 8 at the Worldwide Developers Conference this month, Apple also introduced us to Swift, its new programming language for iOS and OS X app development which is set to replace Objective-C – the object orientated programming language, making it easier and faster to develop API’s.

At the launch Apple’s Craig Federighi asked the question “What would it be like if we had Objective C with the baggage of C?”  Designed by Chris Lattner, renowned software developer and author of the LLVM project, key features of Apple’s latest offering include:

 

  • The ability for developers to see their programming in real time, with faster performance speeds and increased efficiency compared with Objective-C.  The playground interactive feature evaluates code as it is written with descriptions also appearing on screen.
  • A new programming language for use with Cocoa and Cocoa Touch Frameworks that offers easy integration and has the ability to work side by side with Objective-C, allowing for its addition into current apps.
  • Swift offers a clean and clear simplified syntax with APIs far easier to read and maintain, the potential for errors is reduced through inferred types, with syntax features including 3-character keyword usage such as (var) variable and (let) constant, and memory managed automatically through this release.
  • Safety is key with the elimination of entire categories of common errors associated with programming code, variables and constants are initialized prior to use, array bounds are checked, as are integers for overflows.
  • Unlike Objective-C semicolons are not required for statements, no pointers exist and header files are also no longer a requirement.  There is also further improvements to some of the error-prone behaviours of the C-family languages.
  • Multiple return types, namespaces, closures and generics also feature in Swift.

 

With a beta version now available for iOS and OS X developers, a free downloadable book from iTunes entitled The Swift Programming Language includes a formal reference, detailed feature guide and tour of the language for those who wish to learn more about what Swift can offer, in preparation for the final version of Swift which is due to be released in the Autumn.