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