SlideShare a Scribd company logo
Apple’s New Swift Programming
Language Takes Flight With New
Enhancements And Features
Recently Apple team has released Swift 1.2 as a part of Xcode 6.3 beta. Beta release includes
a significantly enhanced swift compiler and as well as new features in the Swift language.
Apples team has came up with improvements in compiler and new language features in Swift
1.2 beta release ,let’s dive into improvements in Swift language
Compiler Enhancements:
Apple team has come up with enhancements in compiler to be more stable and improved
performance in every aspect. By these enhancements developer can see an better
experience when working with Swift in X- code , some of the most visible enhancements
includes are:
• Incremental Builds — Source files that haven’t changed will no longer be re-compiled by
default, which will significantly improve build times for most common cases. Larger
structural changes to your code may still require multiple files to be rebuilt.
• Faster Executables — Debug builds produce binaries that run considerably faster, and new
optimizations deliver even better Release build performance.
• Better Compiler Diagnostics — Clearer error and warning messages, along with new Fix-
its, make it easier to write proper Swift 1.2 code.
• Stability Improvements — The most common compiler crashes have been fixed. You
should also see fewer SourceKit warnings within the Xcode editor.
Enhancements and Features:
Let’s take a look on enhancements and new features introduced in Swift language to
overcome cons of Objective-C. In Swift language , Function has come up with enhancements
like ability to return multiple values , nested functions etc. Swift’s unified functions syntax is
flexible enough to express anything fro simple C-style function with no parameter names to a
complex Objective-C-style method with local and external parameter names for each
parameter. Every function in Swift has a type, consisting of the function’s parameter types
and return type, which makes it easy to pass functions as parameters to other functions, and
to return functions from functions. Functions can also be written within other functions to
encapsulate useful functionality within a nested function scope.
Simple example of function with multiple input parameters:
Functions can have multiple input parameters, which are written within the function’s
parentheses, separated by commas.
This function takes a start and an end index for a half-open range, and works out how many
elements the range contains:
1
2
3
4
5
6
7
8
9
func halfOpenRangeLength(start: Int, end: Int) -> Int {
return end - start
}
println(halfOpenRangeLength(1, 10))
// prints "9"
Closures: Closures are self-contained blocks of functionality that can be passed around and
used in your code. Closures in Swift are similar to blocks in C and Objective-C and to lambdas
in other programming languages. Closures can capture and store references to any constants
and variables from the context in which they are defined. In Swift, the simplest form of a
closure that can capture values is a nested function, written within the body of another
function. A nested function can capture any of its outer function’s arguments and can also
capture any constants and variables defined within the outer function.
Here’s an example of a function called makeIncrementer, which contains a nested function
called incrementer. The nested incrementer function captures two
values, runningTotal and amount, from its surrounding context. After capturing these
values, incrementer is returned by makeIncrementer as a closure that incrementsrunning
Total by amount each time it is called.
1
2
3
4
5
6
7
8
9
10
11
func makeIncrementer(forIncrement amount: Int) -> () -> Int {
var runningTotal = 0
func incrementer() -> Int {
runningTotal += amount
return runningTotal
}
Enumerations: Enumerations in Swift are first-class types in their own right. They adopt
many features traditionally supported only by classes. Enumerations can also define
initializers to provide an initial member value; can be extended to expand their functionality
beyond their original implementation; and can conform to protocols to provide standard
functionality.
You introduce enumerations with the enum keyword and place their entire definition
within a pair of braces:
1
2
3
4
5
enum SomeEnumeration {
// enumeration definition goes here
}
Multiple member values can appear on a single line, separated by commas:
1
2
3
4
5
enum Planet {
case Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune
}
Generics: Generics are one of the most powerful features of Swift, and much of the Swift
standard library is built with generic code. Generic code enables you to write flexible, reusable
functions and types that can work with any type, subject to requirements that you define.
You can write code that avoids duplication and expresses its intent in a clear, abstracted
manner.
More powerful optional unwrapping with if let — The if let construct can now unwrap
multiple optional at once, as well as include intervening boolean conditions. This lets you
express conditional control flow without unnecessary nesting.
New native Set data structure — An unordered collection of unique elements that bridges
withNSSet and provides value semantics like Array and Dictionary.
Nullability may now be expressed in Objective-C headers — New Objective-C extensions in
Clang allow you to express the nullability of pointers and blocks in your Objective-C API. You
can provide Objective-C frameworks that work great with Swift code, and improve your
Swift experience when mixing and matching with Objective-C code in your own project.
Apple’s New Swift Programming Language Takes Flight With New Enhancements And Features

More Related Content

PPTX
Python component in mule
PPTX
Function overloading in c++
PPT
Basic structure of C++ program
PPTX
FUNCTION CPU
PPTX
Compilation of c
PPTX
Lambda expressions java8 - yousry
PPT
3 Function Overloading
DOCX
C++ question and answers
Python component in mule
Function overloading in c++
Basic structure of C++ program
FUNCTION CPU
Compilation of c
Lambda expressions java8 - yousry
3 Function Overloading
C++ question and answers

What's hot (20)

PPT
Introduction to Procedural Programming in C++
PPTX
Function overloading
PPTX
Java script function
PPTX
INLINE FUNCTION IN C++
PPTX
Function overloading and overriding
ODP
Pluggable Pipelines
PPT
Basics1
RTF
over all view programming to computer
PDF
JDT Embraces Lambda Expressions - EclipseCon North America 2014
PDF
Chapter 11 Function
PPTX
Inline functions & macros
DOCX
Differences between method overloading and method overriding
PDF
Handout # 4 functions + scopes
PPT
Advanced Java Topics
PDF
Functional JavaScript Fundamentals
PDF
General structure of c++
PDF
Unit 3
PDF
Swift Tutorial Part 1. The Complete Guide For Swift Programming Language
PDF
Eclipse and Java 8 - Eclipse Day India 2013
Introduction to Procedural Programming in C++
Function overloading
Java script function
INLINE FUNCTION IN C++
Function overloading and overriding
Pluggable Pipelines
Basics1
over all view programming to computer
JDT Embraces Lambda Expressions - EclipseCon North America 2014
Chapter 11 Function
Inline functions & macros
Differences between method overloading and method overriding
Handout # 4 functions + scopes
Advanced Java Topics
Functional JavaScript Fundamentals
General structure of c++
Unit 3
Swift Tutorial Part 1. The Complete Guide For Swift Programming Language
Eclipse and Java 8 - Eclipse Day India 2013
Ad

Viewers also liked (19)

DOC
Marcus James CV 2016
PDF
Solve Quad Graph Calc.pdf
PPTX
Dispositivos de almacenamiento
PDF
Code Resume
PDF
Danforth Bus Cards
PDF
Resumo t3 lengua_6
 
PDF
Grom Capabilities 2016
PDF
Municipal OWI Prosecution
PDF
Creating spaces for learning. Designing the UCD Health Sciences Library ASME ...
PDF
JoshStuckeyResume
PDF
Klsmsithportfolio
PPTX
Psicologia de la Gestalt
 
PDF
R2 lengua 6
 
PPTX
ESPA 2014-2020_Yfistamenes parousiash
PPTX
El Reina Ana en medio de una Tormenta
PPTX
Anatomy of a connected product
PPS
Marea neagră
Marcus James CV 2016
Solve Quad Graph Calc.pdf
Dispositivos de almacenamiento
Code Resume
Danforth Bus Cards
Resumo t3 lengua_6
 
Grom Capabilities 2016
Municipal OWI Prosecution
Creating spaces for learning. Designing the UCD Health Sciences Library ASME ...
JoshStuckeyResume
Klsmsithportfolio
Psicologia de la Gestalt
 
R2 lengua 6
 
ESPA 2014-2020_Yfistamenes parousiash
El Reina Ana en medio de una Tormenta
Anatomy of a connected product
Marea neagră
Ad

Similar to Apple’s New Swift Programming Language Takes Flight With New Enhancements And Features (20)

PDF
Swift, swiftly
PPTX
PPT.pptxvkjvwbjbbikvhixhkiheihhiiihwxhhi
PPTX
Swift programming language
PDF
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 02)
PDF
Using Swift for all Apple platforms (iOS, watchOS, tvOS and OS X)
PPTX
Developer’s viewpoint on swift programming language
PDF
Swift, a quick overview
PDF
Quick swift tour
DOCX
Swift language seminar topic
PDF
Intro toswift1
PDF
Ios 12 Programming Fundamentals With Swift Swift Xcode And Cocoa Basics 5th E...
PDF
Swift Tutorial Part 2. The complete guide for Swift programming language
PDF
Advanced Swift Updated For Swift 5 Chris Eidhof
PPT
Swift Programming - Part 2
PDF
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 03)
DOCX
PDF
iOS 9 Programming Fundamentals with Swift Swift Xcode and Cocoa Basics 2nd Ed...
PDF
iOS 9 Programming Fundamentals with Swift Swift Xcode and Cocoa Basics 2nd Ed...
PDF
What’s new in Swift 5.2-5.3
Swift, swiftly
PPT.pptxvkjvwbjbbikvhixhkiheihhiiihwxhhi
Swift programming language
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 02)
Using Swift for all Apple platforms (iOS, watchOS, tvOS and OS X)
Developer’s viewpoint on swift programming language
Swift, a quick overview
Quick swift tour
Swift language seminar topic
Intro toswift1
Ios 12 Programming Fundamentals With Swift Swift Xcode And Cocoa Basics 5th E...
Swift Tutorial Part 2. The complete guide for Swift programming language
Advanced Swift Updated For Swift 5 Chris Eidhof
Swift Programming - Part 2
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 03)
iOS 9 Programming Fundamentals with Swift Swift Xcode and Cocoa Basics 2nd Ed...
iOS 9 Programming Fundamentals with Swift Swift Xcode and Cocoa Basics 2nd Ed...
What’s new in Swift 5.2-5.3

More from Azilen Technologies Pvt. Ltd. (20)

PDF
Software Product Development for Startups.pdf
PPTX
How Chatbots Empower Healthcare Ecosystem?
PPTX
[Step by-step guide] configure document generation functionality in ms dynami...
PPTX
How to overcome operational challenges in getting consistent beacon behavior
PPTX
Liferay dxp – the good, the bad and the ugly
PPTX
Realm mobile platform – explore real time data synchronization capabilities
PPTX
A step by step guide to develop temperature sensor io t application using ibm...
PPTX
How to create an angular 2.0 application in liferay dxp to fetch the ootb adv...
PPTX
Register Virtual Device and analyze the device data
PPTX
Analytics and etl based bi solutions
PPTX
Advanced risk management & mitigation system
PPTX
Server driven user interface (sdui) – framework for i os applications!
PPTX
How to integrate portlet as widget in liferay to any website application
PPTX
A walkthrough of recently held wwdc17
PPTX
How wearable devices are changing our lives
PPTX
iPad Application as Return Process Automation Solution for eCommerce Store
PPTX
[Part 3] automation of home appliances using raspberry pi – all set to automa...
PPTX
Rfid systems for asset management — the young technology on its winning path
PPTX
[Part 2] automation of home appliances using raspberry pi – implementation of...
PPTX
[Part 1] automation of home appliances using raspberry pi – software installa...
Software Product Development for Startups.pdf
How Chatbots Empower Healthcare Ecosystem?
[Step by-step guide] configure document generation functionality in ms dynami...
How to overcome operational challenges in getting consistent beacon behavior
Liferay dxp – the good, the bad and the ugly
Realm mobile platform – explore real time data synchronization capabilities
A step by step guide to develop temperature sensor io t application using ibm...
How to create an angular 2.0 application in liferay dxp to fetch the ootb adv...
Register Virtual Device and analyze the device data
Analytics and etl based bi solutions
Advanced risk management & mitigation system
Server driven user interface (sdui) – framework for i os applications!
How to integrate portlet as widget in liferay to any website application
A walkthrough of recently held wwdc17
How wearable devices are changing our lives
iPad Application as Return Process Automation Solution for eCommerce Store
[Part 3] automation of home appliances using raspberry pi – all set to automa...
Rfid systems for asset management — the young technology on its winning path
[Part 2] automation of home appliances using raspberry pi – implementation of...
[Part 1] automation of home appliances using raspberry pi – software installa...

Recently uploaded (20)

PDF
KodekX | Application Modernization Development
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Encapsulation theory and applications.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
KodekX | Application Modernization Development
Network Security Unit 5.pdf for BCA BBA.
Chapter 3 Spatial Domain Image Processing.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Encapsulation theory and applications.pdf
cuic standard and advanced reporting.pdf
Electronic commerce courselecture one. Pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Review of recent advances in non-invasive hemoglobin estimation
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Agricultural_Statistics_at_a_Glance_2022_0.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
NewMind AI Weekly Chronicles - August'25 Week I
Reach Out and Touch Someone: Haptics and Empathic Computing
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf

Apple’s New Swift Programming Language Takes Flight With New Enhancements And Features

  • 1. Apple’s New Swift Programming Language Takes Flight With New Enhancements And Features Recently Apple team has released Swift 1.2 as a part of Xcode 6.3 beta. Beta release includes a significantly enhanced swift compiler and as well as new features in the Swift language. Apples team has came up with improvements in compiler and new language features in Swift 1.2 beta release ,let’s dive into improvements in Swift language Compiler Enhancements: Apple team has come up with enhancements in compiler to be more stable and improved performance in every aspect. By these enhancements developer can see an better experience when working with Swift in X- code , some of the most visible enhancements includes are: • Incremental Builds — Source files that haven’t changed will no longer be re-compiled by default, which will significantly improve build times for most common cases. Larger structural changes to your code may still require multiple files to be rebuilt. • Faster Executables — Debug builds produce binaries that run considerably faster, and new optimizations deliver even better Release build performance.
  • 2. • Better Compiler Diagnostics — Clearer error and warning messages, along with new Fix- its, make it easier to write proper Swift 1.2 code. • Stability Improvements — The most common compiler crashes have been fixed. You should also see fewer SourceKit warnings within the Xcode editor. Enhancements and Features: Let’s take a look on enhancements and new features introduced in Swift language to overcome cons of Objective-C. In Swift language , Function has come up with enhancements like ability to return multiple values , nested functions etc. Swift’s unified functions syntax is flexible enough to express anything fro simple C-style function with no parameter names to a complex Objective-C-style method with local and external parameter names for each parameter. Every function in Swift has a type, consisting of the function’s parameter types and return type, which makes it easy to pass functions as parameters to other functions, and to return functions from functions. Functions can also be written within other functions to encapsulate useful functionality within a nested function scope. Simple example of function with multiple input parameters: Functions can have multiple input parameters, which are written within the function’s parentheses, separated by commas. This function takes a start and an end index for a half-open range, and works out how many elements the range contains: 1 2 3 4 5 6 7 8 9 func halfOpenRangeLength(start: Int, end: Int) -> Int { return end - start } println(halfOpenRangeLength(1, 10)) // prints "9" Closures: Closures are self-contained blocks of functionality that can be passed around and used in your code. Closures in Swift are similar to blocks in C and Objective-C and to lambdas in other programming languages. Closures can capture and store references to any constants and variables from the context in which they are defined. In Swift, the simplest form of a closure that can capture values is a nested function, written within the body of another function. A nested function can capture any of its outer function’s arguments and can also capture any constants and variables defined within the outer function.
  • 3. Here’s an example of a function called makeIncrementer, which contains a nested function called incrementer. The nested incrementer function captures two values, runningTotal and amount, from its surrounding context. After capturing these values, incrementer is returned by makeIncrementer as a closure that incrementsrunning Total by amount each time it is called. 1 2 3 4 5 6 7 8 9 10 11 func makeIncrementer(forIncrement amount: Int) -> () -> Int { var runningTotal = 0 func incrementer() -> Int { runningTotal += amount return runningTotal } Enumerations: Enumerations in Swift are first-class types in their own right. They adopt many features traditionally supported only by classes. Enumerations can also define initializers to provide an initial member value; can be extended to expand their functionality beyond their original implementation; and can conform to protocols to provide standard functionality. You introduce enumerations with the enum keyword and place their entire definition within a pair of braces: 1 2 3 4 5 enum SomeEnumeration { // enumeration definition goes here } Multiple member values can appear on a single line, separated by commas: 1 2 3 4 5 enum Planet { case Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune } Generics: Generics are one of the most powerful features of Swift, and much of the Swift standard library is built with generic code. Generic code enables you to write flexible, reusable functions and types that can work with any type, subject to requirements that you define. You can write code that avoids duplication and expresses its intent in a clear, abstracted manner. More powerful optional unwrapping with if let — The if let construct can now unwrap
  • 4. multiple optional at once, as well as include intervening boolean conditions. This lets you express conditional control flow without unnecessary nesting. New native Set data structure — An unordered collection of unique elements that bridges withNSSet and provides value semantics like Array and Dictionary. Nullability may now be expressed in Objective-C headers — New Objective-C extensions in Clang allow you to express the nullability of pointers and blocks in your Objective-C API. You can provide Objective-C frameworks that work great with Swift code, and improve your Swift experience when mixing and matching with Objective-C code in your own project.