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

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
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
116 views

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
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

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
romeoAndJuliet.reduce(0){ count, density
title in title.hasPrefix("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

https://www.hackingwithswift.com/
https://github.com/hsavit1/Awesome-Swift-Education
https://thinkster.io/a-better-way-to-learn-swift
https://itunes.apple.com/us/book/swift-programming-language/id881256329?mt=11
https://github.com/swifteducation

13
THANK
YOU!
Your Name

You might also like