0% found this document useful (0 votes)
2 views

Swift

Swift is a general-purpose programming language developed by Apple for various platforms, designed to be safer and easier to use than Objective-C. It has evolved since its introduction in 2014, becoming open-source in 2015 and introducing significant features like protocol-oriented programming and module stability. Key features include type casting, optional types, and tuples for returning multiple values.

Uploaded by

Shivani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Swift

Swift is a general-purpose programming language developed by Apple for various platforms, designed to be safer and easier to use than Objective-C. It has evolved since its introduction in 2014, becoming open-source in 2015 and introducing significant features like protocol-oriented programming and module stability. Key features include type casting, optional types, and tuples for returning multiple values.

Uploaded by

Shivani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

NAME:SHIVANI KUMARI

USN:1MY18MCA22

SWIFT PROGRAMMING LANGUAGE


Swift is a general-purpose,multi-paradign,compiled programming language developed by Apple
Inc. for iOS, iPadOS, macOS, watchOS, tvOS, and Linux.
Swift is designed to work with Apple’s Cocoa and Cocoa Touch frameworks and the large body
of existing Objective-C code written for Apple products. It is built with the open source LLVM
compiler framework andhas been included in Xcode since version 6, released in 2014. On Apple
platforms, it uses the Objective-C runtime library which allows C, Objective-C, C++ and Swift
code to run within one program.Apple intended Swift to support many core concepts
associated with Objective-C, notably dynamic dispatch, widespread late binding, extensible
programming and similar features, but in a “safer”way, making it easier to catch software bugs;
Swift has features addressing some common programming errors like null pointer
dereferencing and provides syntactic sugar to help avoid the pyramid of doom. Swift supports
the concept of protocol extensibility, anextensibility system that can be applied to types, structs
and classes, which Apple promotes as a real change in programming paradigms they term
“protocol-oriented programming”.

EVOLUTION
Swift was introduced at Apple’s 2014 Worldwide Developers Conference. It underwent an
upgrade to version 1.2 during 2014 and a more major upgrade to Swift 2 at WWDC 2015.
Initially a proprietary language, version 2.2 was made open-source software under the Apache
License 2.0 on December 3,2015, for Apple’s platforms and Linux.Through version 3.0 the
syntax of Swift went through significant evolution,with the core team making source stability a
focus in later versions. In the first quarter of 2018 Swift surpassed Objective-C in measured
popularity.Swift 4.0, released in 2017, introduced several changes to some built-in classes and
structures. Code written with previous versions of Swift can be updated using the migration
functionality built into Xcode. Swift 5, released in March 2019, introduced a stable binary
interface on Apple platforms, allowing theSwift runtime to be incorporated into Apple
operating systems. It is source compatible with Swift 4.Swift 5.1 was officially released in
September 2019. Swift 5.1 builds on the previous version of Swift 5 by extending the stable
features of the language to compile-time with the introduction of module stability. The
introduction of module stability makes it possible to create and share binary frameworks that
will work with future releases of Swift.

WHY SWIFT
Objective-C and Swift are two main programming languages used to build iOS apps.But Swift is
considered best programming language for developing apple applications.Developers prefer
swift programming language over objective-c because of the following reasons:
1. Swift requires less code
2. Swift is safer
3. Swift is easier to read and easier to learn than Objective-C
4. Simple syntax

KEY FEATURES
Key features of swift programming language are:
1. Type Casting
2. Optional type variable in Swift
3. Tuples and multiple return values

1.TYPE CASTING
Type casting is a way to check the type of an instance, or to treat that instance as a different
superclass or subclass from somewhere else in its own class hierarchy.Type casting in Swift is
implemented with the is and as operators.

2)Optional type variable


Optionals type handles the absence of a value. Optionals say either “there is a value, and it
equals x” or “there isn’t a value at all”.If a variable is defined as optional, then to get the value
from this variable, we will have to unwrap it. This just means putting an exclamation mark at
the end of the variable.
3)Tuples and multiple return values
Tuples are helpful in returning multiple values from a function.We can name the variables of a
tuple while declaring , and can call them using their names.The values in a tuple can be of any
type, and do not need to be of same type.For example, (‘xyz’, 123) is a tuple with two values,
one of string Type, and other is integer type.We can access the values of tuple using the index
numbers that start from 0.

You might also like