Monday 9 June 2014

Introducing Swift programming language

Swift, Programming language  without the constraints of C compatibility,  Introduced by at WWDC 2014 keynote. Which has been met with a positive & exciting response from the whole apple and apple developers community.

So far Apple’s default development environment for iOS, Xcode, has been using the language Objective-C since iOS release; It was highly adopted by Apple, and has written Cocoa /  Cocoa -Touch  framework APIs with Objective-C.


Swift uses the same LLVM compiler and runtime as Apple’s Objective-C implementation, so Swift and Objective-C code can live side-by-side in the same application. The language provides access to all of the Cocoa and Cocoa Touch features developers are currently used to from Objective-C.

Xcode 6 comes with deeply integrated Swift support.It will feature an interactive “Playground” that allows you to edit your code and watch how your changes influence your app in real-time. Xcode’s debugging console now also supports Swift syntax natively.As per Greg Federighi, Apple senior vice president for software engineering,

"Swift is fast, it is modern, it is designed for safety, and it enables a level of interactivity and development that you've never seen before on the platform"The main concept behind Swift existence is to remove overhead caused by C language dependancy and keep Apple's adopted Objective-C language feel as it is.

Swift features such capabilities as,


  • Closures (similar to blocks in C and Objective-C) unified with function pointers
  • Tuples and multiple return values
  • Generics
  • Fast and concise iteration over a range or collection
  • Structs that support methods, extensions, protocols.
  • Functional programming patterns, e.g.: map and filter

Some swift code snippet :


  • //let keyword to make a constant, var keyword to make a variable
    var variable = 90
    variable = 67
    let constant = 88
    
    //create array using square brackets []
    var languageList = ["C", "Objective C", "JAVA"]
    languageList[1] = "Swift"
    

Apple states by introducing swift : "Swift is an innovative new programming language for Cocoa and Cocoa Touch. Writing code is interactive and fun, the syntax is concise yet expressive, and apps run lightning-fast. Swift is ready for your next iOS and OS X project — or for addition into your current app — because Swift code works side-by-side with Objective-C."

Developers can start development with Swift to implement new application features or enhance existing features. Apps built with swift can be submitted
 to the App Store and Mac App Store when iOS 8 and OS X Yosemite are released this fall.

Reference / More Info :
https://developer.apple.com/swift/
https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/
https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/

No comments :

Post a Comment