0% found this document useful (0 votes)
401 views14 pages

Swift Programming Language

Swift is a modern, type-safe programming language introduced by Apple in 2014 for building apps for Apple platforms like iOS, macOS, watchOS and tvOS. It is influenced by languages like C, Python, Ruby and Rust. Swift emphasizes safety, performance and expressiveness. Key features include type safety, protocol-oriented programming, generics, optionals, closures and more. Swift code can be tested and evaluated in an interactive playground and supports both object-oriented and functional programming approaches. While powerful, Swift does have some disadvantages like increased complexity for classes. Overall, Swift is recommended for both beginners and experts as an expressive, future-proof language.

Uploaded by

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

Swift Programming Language

Swift is a modern, type-safe programming language introduced by Apple in 2014 for building apps for Apple platforms like iOS, macOS, watchOS and tvOS. It is influenced by languages like C, Python, Ruby and Rust. Swift emphasizes safety, performance and expressiveness. Key features include type safety, protocol-oriented programming, generics, optionals, closures and more. Swift code can be tested and evaluated in an interactive playground and supports both object-oriented and functional programming approaches. While powerful, Swift does have some disadvantages like increased complexity for classes. Overall, Swift is recommended for both beginners and experts as an expressive, future-proof language.

Uploaded by

phareze
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
  • Overview
  • Goal, Philosophy & Influence
  • REPL (Read-Eval-Print-Loop)
  • Playground
  • Default Arguments
  • Types in Swift
  • First-class Objects
  • Functional Approach
  • Object Oriented Approach
  • Disadvantages of Swift
  • Recommendations
  • References

SWIFT

PROGRAMMING
LANGUAGE
Presented by:

May
2021
Overview
 Modern language
 Type safety
 Works with C and Objective-C
 Open source
 Writes apps for tvOS, MacOS, iOS, WatchOs
 Apple’s new programming language
 Introduced in 2014
 Chris Latner, John McCall, Doug Gregor, Ted Kremenek and Joe Groff were behind
the development

2
Goal, Philosophy & Influence

 The goal is to create the best language for system programming


from mobile to cloud
 Its philosophy is the ability to be used with protocol-oriented
programming
 Influenced by;
 C#
 Python
 Ruby
 Haskell
 Rust
 Objective-C
3
REPL(Read-Eval-Print-Loop)

 X-Code playground allow


developers to write swift code
 In the figure results of the swift
code are displayed on the sidebar
 Useful in testing and evaluating
code without creating an entire
swift project

Image: Cory Bohon/TechRepublic

4
Playground
 Real Playful
 Real Simple
 Real Swift Code

5
Default Arguments

Arguments are always provided in the same order


as those of functions parameter list

6
Types in Swift
o Swift supports the concept of generic programming
with static typing ending up with less meta-
programming power
 Compound types-type with no name
 Tuple types
 Function type
 Named types
 Protocols
 Enumerations
 Structures
 Classes

7
First-class Objects

 Flexible constructs are the major swift code building block


 Swift doesn’t require the implementation of separate for custom classes and
structures
 Potential classes have the additional cost of increased complexity

8
Functional Approach

Swift trailing closure syntax


let act1SceneCount = Information balance and terseness
[Link](0){ count, density
title in [Link]("Act 1") ? count
Use high-order code functions
+ 1 : count } instead of procedural code

9
Object Oriented Approach

struct InMemoryImage: Helps in structuring code


NamedImageData,
ImageDataCompressing,
Enables reusability and code
ImageDataEncoding { extension
var name: String Finally, Swift supports multiple
var data: Data } paradigms

10
Disadvantages of Swift

11
Recommendations

I would like to recommend the use of Swift programming


language to both novice and pro developers since it’s an
expressive and clean language with a simplified syntax.
Swift is also future proof as it can be extended for additional
features.

12
References

[Link]
[Link]
[Link]
[Link]
[Link]

13
THANK
YOU!
Your Name

 
SWIFT 
PROGRAMMING 
LANGUAGE
Presented by:
May
2021
Overview
Modern language
Type safety
Works with C and Objective-C
Open source
Writes apps for tvOS, MacOS, iOS, WatchOs
3
Goal, Philosophy & Influence 
The goal is to create the best language for system programming 
from mobile to cloud
Its ph
REPL(Read-Eval-Print-Loop)
X-Code playground allow 
developers to write swift code
In the figure results of the swift 
code
Playground
Real Playful
Real Simple
Real Swift Code
5
Default Arguments
6
Arguments are always provided in the same order 
as those of functions parameter list
Types in Swift
7
o Swift supports the concept of generic programming 
with static typing ending up with less meta-
programmin
First-class Objects
Flexible constructs are the major swift code building block
Swift doesn’t require the implementation of
Functional Approach
9
let act1SceneCount = 
romeoAndJuliet.reduce(0){ count, 
title in title.hasPrefix("Act 1") ? count 
+ 1
Object Oriented Approach
10
Helps in structuring code
Enables reusability and code 
extension
Finally, Swift supports mult

You might also like