Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Swift 2.0

2,737 views

Published on

Swift 2.0 also includes a lot of new language features and refinements. Expect to see blog posts exploring the features in more depth, and be sure to watch for the WWDC sessions covering these topics all this week. A few of the new features include:

Error handling model: The new error handling model in Swift 2.0 will instantly feel natural, with familiar try, throw, and catch keywords. Best of all, it was designed to work perfectly with the Apple SDKs and NSError. In fact, NSError conforms to a Swift’s ErrorType. You’ll definitely want to watch the WWDC session on What’s New in Swift to hear more about it.

Availability: Using the latest SDKs ensures you get access to new features and information about platform changes. But sometimes you still need to target an older OS, and Swift makes doing so much easier and safer. The Swift compiler now shows an error when you use an API that is too new for your target OS, and #available blocks can safely wrap lines of code to only run when on the right OS versions.

Protocol extensions: Swift is very focused on protocol-oriented development — there’s even a session on the topic at WWDC 2015. Swift 2.0 adds protocol extensions, and the standard library itself uses them extensively. Where you used to use global functions, Swift 2.0 now adds methods to common types so functions chain naturally, and your code is much more readable.

Swift-er SDKs: Swift 2 works even better with the Apple SDKs, thanks in part to two new features in Objective-C: nullability annotations and generics. The SDKs have been updated to annotate API that cannot return nil so you don’t need to use optionals as often. And with a true generics system employed by the SDKs you can more often preserve detailed type information in your Swift 2 code.

Published in: Technology
  • Be the first to comment

Swift 2.0

  1. 1. Swift 2.0 The programming language Get ready for a change
  2. 2. A modern programming language that is safe, fast, and interactive. “ ”
  3. 3. Apple Gives Open Source a Swift 2 Kick
  4. 4. Swift is a powerful and intuitive programming language for iOS, OS X, and iWatchOS. WHAT IS SWIFT?
  5. 5. Swift is a powerful and intuitive programming language for iOS, OS X, and iWatchOS. Writing Swift is interactive and fun, the syntax is concise yet expressive, and apps run lightning-fast. WHAT IS SWIFT?
  6. 6. Swift is a powerful and intuitive programming language for iOS, OS X, and iWatchOS. Writing Swift is interactive and fun, the syntax is concise yet expressive, and apps run lightning-fast. Swift is ready for your next project — or addition into your current app — because Swift code works side-by-side with Objective-C. WHAT IS SWIFT?
  7. 7. SWIFT FEATURES
  8. 8. ERROR HANDLING MODEL An advanced error handling model provides clear, expressive syntax for catching and throwing errors.
  9. 9. ERROR HANDLING MODEL An advanced error handling model provides clear, expressive syntax for catching and throwing errors. The new error model was designed to work seamlessly with NSError and the Cocoa frameworks.
  10. 10. ERROR HANDLING MODEL An advanced error handling model provides clear, expressive syntax for catching and throwing errors. The new error model was designed to work seamlessly with NSError and the Cocoa frameworks. Error handling code now looks like :
  11. 11. ERROR HANDLING MODEL
  12. 12. SYNTAX IMPROVEMENTS New syntax features let you write more expressive code while improving consistency across the language.
  13. 13. SYNTAX IMPROVEMENTS New syntax features let you write more expressive code while improving consistency across the language. Here is just a sampling of Swift 2.0 enhancements.
  14. 14. SYNTAX IMPROVEMENTS - Powerful control flow with do, guard, defer, and repeat - Keyword naming rules unified for functions and methods - Protocol extensions and default implementations - Extended pattern matching to work in if clauses and for loops New syntax features let you write more expressive code while improving consistency across the language. Here is just a sampling of Swift 2.0 enhancements.
  15. 15. AVAILABILITY It has built-in availability checking to make it easy to build the best possible app for each target OS version.
  16. 16. The compiler will give you an error when using an API too new for your minimum target OS, and a new keyword lets you wrap blocks of code in a conditional version check to run only on specific OS releases. AVAILABILITY It has built-in availability checking to make it easy to build the best possible app for each target OS version.
  17. 17. OPEN SOURCE Unique combination of elegance, power, and safety has the opportunity to move the entire software industry forward. It is exciting to imagine what we will build together.
  18. 18. MODERN Swift is the result of the latest research on programming languages, combined with decades of experience building Apple platforms. Memory is managed automatically, and you don’t even need to type semi-colons. All this modern thinking results in a language that is easy and fun to use.
  19. 19. MODERN
  20. 20. INTERACTIVE PLAYGROUNDS Playgrounds make writing Swift code incredibly simple and fun. The Playground let you do following : - Share curriculum to teach programming with beautiful text and interactive code. - Design a new algorithm and watch its results every step of the way. - Create new tests and verify they work before promoting into your test suite. - Experiment with new APIs to hone your Swift coding skills. - Turn your experiments into documentation with example code that runs within the playground.
  21. 21. OBJECTIVE-C INTEROPERABILITY Swift code co-exists along side your existing Objective-C files in the same project, with full access to your Objective-C API, making it easy to adopt.
  22. 22. OTHER FEATURES - Swift has many other features to make your code more expressive: - Closures unified with function pointers - Tuples and multiple return values - Generics - Fast and concise iteration over a range or collection - Structs that support methods, extensions, and protocols - Functional programming patterns, e.g., map and filter - Native error handling using try / catch / throw
  23. 23. References https://developer.apple.com/swift/
  24. 24. ABOUT Us We are ChromeInfo Technologies, a Mobile App Development, Web Development and Software Testing company with development center in India. Mobile Application Development Android Application Development iPhone Application Development iPad Application Development Web Development Software Testing
  25. 25. Follow Us
  26. 26. THANK YOU

×