0% found this document useful (0 votes)
44 views38 pages

Swift Programming Language: Cihad Horuzoglu

Swift is Apple's programming language that can be used to write apps for iOS, Mac, watchOS and tvOS. It is an open source language that works with C and Objective-C and provides type safety and modern features like playgrounds. Swift uses common data types like integers, strings and doubles. It supports variables, constants, comparison operators, for loops, functions with default arguments, optionals, structs and classes with properties and methods, arrays, sets, dictionaries, enumerations, protocols, extensions and reference counting for memory management.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views38 pages

Swift Programming Language: Cihad Horuzoglu

Swift is Apple's programming language that can be used to write apps for iOS, Mac, watchOS and tvOS. It is an open source language that works with C and Objective-C and provides type safety and modern features like playgrounds. Swift uses common data types like integers, strings and doubles. It supports variables, constants, comparison operators, for loops, functions with default arguments, optionals, structs and classes with properties and methods, arrays, sets, dictionaries, enumerations, protocols, extensions and reference counting for memory management.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

Swift Programming Language

Cihad Horuzoglu
Swift Overview
● Apple’s new programming language
● Write apps for iOS, Mac, watchOS,
tvOS, etc.
● Open source!
● Works with C and Objective-C
● Type Safety
● Modern Language
Playgrounds
How works Playground
IBM Bluemix Swift
Data Types
● Integers: 0, 1, 2, 42, 31337, -10
● String: “Kermit”, “Gonzo”, “Ms. Piggy”
● Double: 1.5, 3.14159, 81.2, 578.238
● Boolean: true, false
Variables
Constants
Comparison & Booleans
For Loops
Scope
“age” is available for entire scope

“myString” is available just in “for” scope


Functions
Default Arguments
Optionals
Struct vs. Class
Struct: Class:
Struct
Struct: Methods
Struct: Property Mutability
Struct: Instance Mutability
Struct: Properties
Class
● Similar features with
structs
○ Properties
○ Methods
● Need to write initializers
yourself
Arrays
Sets
Dictionaries
Enumerations
An enumeration defines a common type for a
group of related values and enables you to work
with those values in a type-safe way within your
code.

Features

● Method
● Computed Properties
Protocol
Stored Properties
Computed Properties
Property Access
Properties Sample

Stored Property

Computed Property
Extensions
Safe Unwrapping

Example
“ is ” keyword
Errors
Throwing Errors Handling Errors
Reference Counting
De-initializers
Resources
● https://github.com/swifteducation
● https://itunes.apple.com/us/book/swift-programming-
language/id881256329?mt=11
● https://thinkster.io/a-better-way-to-learn-swift
● https://github.com/hsavit1/Awesome-Swift-Education
● https://www.hackingwithswift.com/
Thank You!
@cihadhoruzoglu

You might also like