SlideShare a Scribd company logo
Swift Programming
Language
Hello World
println(“Hello World!”)
//var using make a variable.
var hello = “Hello”
//let using make a constants.
let world = “World!”
println(“(hello) (world)”)
Simple Values
var name = “ANIL”
//Weight type is Double.
var weight: Double = 74.4
//Correct.
var myVariable = 4
myVariable = 10
//Wrong, because myVariable type is Integer now.
var myVariable = 4
myVariable = “Four”
Simple Values
var text = “ANIL”
var number = 7
//Combining two variables to one variable.
var textNumber = text + String(number)
println(textNumber)
For - If - Else - Else If
//0,1,2,3,4,5,6,7,8,9
for var i = 0; i < 10; i++ {
println(i)
}
//1,2,3,4,5
for i in 1…5 {
println(i)
}
if condition {
/* Codes */
}
else if condition {
/* Codes */
}
else {
/* Codes */
}
Switch - Case
var str = “Swift”
//break is automatically in Swift
switch str {
case “Swift”, “swift”:
println(“Swift”)
case “Objective - C”:
println(“Objective - C”)
default:
println(“Other Language”)
}
Switch - Case
let somePoint = (2,0)
//We can giving a label.
mainSwitch: switch somePoint {
case (2,0) where somePoint.0 == 2:
println(“2,0”)
//Second case working to.
fallthrough
//x value doesn’t matter.
case (_,0):
println(“_,0”)
default:
println(“Other Point”)
}
Array - Dictionary
//Make an array.
var cities = [“Istanbul”, “Sivas”, “San Francisco”, “Seul”]
println(cities[0])
//Make a dictionary.
var cityCodes = [
“Istanbul Anadolu” : “216”,
“Istanbul Avrupa” : “212”,
“Ankara” : ”312”
]
println(cityCodes[“Istanbul Anadolu”]!)
Array
var stringArray = [“Hello”, “World”]
//Add element into the array.
stringArray.append(“Objective - C”)
//Insert element into the array.
stringArray.insert(“Apple”, atIndex: 2)
//Remove element into the array.
stringArray.removeAtIndex(3)
//Remove last element into the array.
stringArray.removeLast()
//Get element into the array.
stringArray[1]
stringArray[1…3]
//Get all elements into the array.
for (index, value) in enumerate(stringArray) {
println(“(index + 1). value is: (value)”)
}
//Get element count in the array.
stringArray.count
Array
var airports = [“SAW” : “Sabiha Gokcen Havalimani”,
“IST” : “Ataturk Havalimani”]
//Add element in the dictionary.
airports[“JFK”] = “John F Kennedy”
//Get element count in the dictionary.
airports.count
//Update element in the dictionary.
airports.updateValue(“John F Kennedy Terminal”,
forKey: “JFK”)
Dictionary
Dictionary
//Remove element in the dictionary.
airports.removeValueForKey(“JFK”)
//Get all elements into the dictionary.
for (airportCode, airport) in airports {
println(“Airport Code: (airportCode) Airport:
(airport)”)
}
//Get all keys.
var keysArray = airports.keys
//Get all values.
var valuesArray = airports.values
Functions
//Make a function.
func hello(){
println(“Hello World!”)
}
//Call a function.
hello()
//personName is parameter tag name.
func helloTo(personName name:String){
println(“Hello (name)”)
}
Functions
/*#it works, same parameter name and parameter tag
name. This function returned String value. */
func printName(#name: String) -> String{
return name
}
//This function returned Int value.
func sum(#numberOne: Int numberTwo: Int) -> Int{
return numberOne + numberTwo
}
Functions
//Tuple returns multiple value.
func sumAndCeiling(#numberOne: Int numberTwo: Int)
-> (sum: Int, ceiling: Int){
var ceiling = numberOne > numberTwo ? numberOne
: numberTwo
var sum = numberOne + numberTwo
return (sum,ceiling)
}
Functions
func double(number:Int) -> Int {
return number * 2
}
func triple(number:Int) -> Int {
return number * 3
}
func modifyInt(#number:Int modifier:Int -> Int) -> Int {
return modifier(number)
}
//Call functions
modifyInt(number: 4 modifier: double)
modifyInt(number: 4 modifier: triple)
Functions
/* This function have inner function and returned
function, buildIncrementor function returned function
and incrementor function returned Int value. */
func buildIncrementor() -> () -> Int {
var count = 0
func incrementor() -> Int{
count++
return count
}
return incrementor
}
Functions
/* Take unlimited parameter functions */
func avarage(#numbers:Int…) -> Int {
var total = 0;
for n in numbers{
total += n;
}
return total / numbers.count;
}
Structs
/* Creating Struct */
struct GeoPoint {
//Swift doesn’t like empty values
var latitude = 0.0
var longitude = 0.0
}
/* Initialize Struct */
var geoPoint = GeoPoint()
geoPoint.latitude = 44.444
geoPoint.longitude = 12.222
Classes
/* Creating Class */
class Person {
var name:String
var age:Int
//nickname:String? is optional value.
var nickname:String?
init(name:String, age:Int, nickname:String? = nil){
self.name = name
self.age = age
self.nickname = nickname
}
}
Classes
/* Creating Sub Class */
class Class : SuperClass {
var name:String
init(name:String){
self.name = name
super.init(age: age, nickname: nickname)
}
func printName(){
println(name)
}
}
Classes
/* Creating Class (Static) Method */
class MyClass {
class func printWord(#word:String) {
println(word)
}
}
/* Calling Class (Static) Method */
MyClass.printWord(word: “Hello World!”)
Enums
/* Creating Enum */
enum Direction {
case Left
case Right
case Up
case Down
}
//Call Enum Value
Direction.Right
or
var direction:Direction
direction = .Up
Enums
/* Creating Enum with Parameter(s) */
enum Computer {
//RAM, Processor
case Desktop(Int,String)
//Screen Size
case Laptop(Int)
}
//Call Enum Value with Parameter(s)
var computer = Computer.Desktop(16,”i7”)
Enums
/* Creating Enum with Int */
enum Planet:Int {
case Mercury = 1, Venus, Earth, Mars, Jupiter, Saturn,
Uranus, Neptune
}
/* Call Enum Value for Raw Value */
//Returns 3
Planet.Earth.toRaw()
//Returns Mars (Optional Value)
Planet.Earth.fromRaw(4)
Ad

More Related Content

What's hot (20)

REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with Spring
Joshua Long
 
Java Programming for Designers
Java Programming for DesignersJava Programming for Designers
Java Programming for Designers
R. Sosa
 
Declarative UIs with Jetpack Compose
Declarative UIs with Jetpack ComposeDeclarative UIs with Jetpack Compose
Declarative UIs with Jetpack Compose
Ramon Ribeiro Rabello
 
Packages and interfaces
Packages and interfacesPackages and interfaces
Packages and interfaces
vanithaRamasamy
 
Java Fundamentals
Java FundamentalsJava Fundamentals
Java Fundamentals
Shalabh Chaudhary
 
Java Tokens
Java  TokensJava  Tokens
Java Tokens
Madishetty Prathibha
 
Core java concepts
Core java  conceptsCore java  concepts
Core java concepts
Ram132
 
Introduction to Spring's Dependency Injection
Introduction to Spring's Dependency InjectionIntroduction to Spring's Dependency Injection
Introduction to Spring's Dependency Injection
Richard Paul
 
Swift in SwiftUI
Swift in SwiftUISwift in SwiftUI
Swift in SwiftUI
Bongwon Lee
 
Deep dive into swift UI
Deep dive into swift UIDeep dive into swift UI
Deep dive into swift UI
OsamaGamal26
 
I/O Streams
I/O StreamsI/O Streams
I/O Streams
Ravi Chythanya
 
TypeScript Presentation
TypeScript PresentationTypeScript Presentation
TypeScript Presentation
Patrick John Pacaña
 
Angular Data Binding
Angular Data BindingAngular Data Binding
Angular Data Binding
Jennifer Estrada
 
Swift vs Objective-C
Swift vs Objective-CSwift vs Objective-C
Swift vs Objective-C
Mindfire Solutions
 
Java arrays
Java arraysJava arrays
Java arrays
Kuppusamy P
 
Spring boot
Spring bootSpring boot
Spring boot
Gyanendra Yadav
 
Routing & Navigating Pages in Angular 2
Routing & Navigating Pages in Angular 2Routing & Navigating Pages in Angular 2
Routing & Navigating Pages in Angular 2
Knoldus Inc.
 
Lets make a better react form
Lets make a better react formLets make a better react form
Lets make a better react form
Yao Nien Chung
 
C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#
Dr.Neeraj Kumar Pandey
 
TypeScript Best Practices
TypeScript Best PracticesTypeScript Best Practices
TypeScript Best Practices
felixbillon
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with Spring
Joshua Long
 
Java Programming for Designers
Java Programming for DesignersJava Programming for Designers
Java Programming for Designers
R. Sosa
 
Declarative UIs with Jetpack Compose
Declarative UIs with Jetpack ComposeDeclarative UIs with Jetpack Compose
Declarative UIs with Jetpack Compose
Ramon Ribeiro Rabello
 
Core java concepts
Core java  conceptsCore java  concepts
Core java concepts
Ram132
 
Introduction to Spring's Dependency Injection
Introduction to Spring's Dependency InjectionIntroduction to Spring's Dependency Injection
Introduction to Spring's Dependency Injection
Richard Paul
 
Swift in SwiftUI
Swift in SwiftUISwift in SwiftUI
Swift in SwiftUI
Bongwon Lee
 
Deep dive into swift UI
Deep dive into swift UIDeep dive into swift UI
Deep dive into swift UI
OsamaGamal26
 
Routing & Navigating Pages in Angular 2
Routing & Navigating Pages in Angular 2Routing & Navigating Pages in Angular 2
Routing & Navigating Pages in Angular 2
Knoldus Inc.
 
Lets make a better react form
Lets make a better react formLets make a better react form
Lets make a better react form
Yao Nien Chung
 
C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#
Dr.Neeraj Kumar Pandey
 
TypeScript Best Practices
TypeScript Best PracticesTypeScript Best Practices
TypeScript Best Practices
felixbillon
 

Viewers also liked (18)

A swift introduction to Swift
A swift introduction to SwiftA swift introduction to Swift
A swift introduction to Swift
Giordano Scalzo
 
20 Facts about Swift programming language
20 Facts about Swift programming language20 Facts about Swift programming language
20 Facts about Swift programming language
Rohit Tirkey
 
Swift Introduction
Swift IntroductionSwift Introduction
Swift Introduction
Natasha Murashev
 
Swift programming language
Swift programming languageSwift programming language
Swift programming language
Nijo Job
 
Swift sin hype y su importancia en el 2017
 Swift sin hype y su importancia en el 2017  Swift sin hype y su importancia en el 2017
Swift sin hype y su importancia en el 2017
Software Guru
 
McAdams- Resume
McAdams- ResumeMcAdams- Resume
McAdams- Resume
Katey McAdams
 
Swift 2
Swift 2Swift 2
Swift 2
Jens Ravens
 
Интуит. Разработка приложений для iOS. Лекция 5. Сложные Views
Интуит. Разработка приложений для iOS. Лекция 5. Сложные ViewsИнтуит. Разработка приложений для iOS. Лекция 5. Сложные Views
Интуит. Разработка приложений для iOS. Лекция 5. Сложные Views
Глеб Тарасов
 
Swift Introduction
Swift IntroductionSwift Introduction
Swift Introduction
Savvycom Savvycom
 
Swift
SwiftSwift
Swift
DesarrolloWeb.com
 
Введение в разработку для iOS
Введение в разработку для iOSВведение в разработку для iOS
Введение в разработку для iOS
Michael Dudarev
 
Openstack Swift Introduction
Openstack Swift IntroductionOpenstack Swift Introduction
Openstack Swift Introduction
Park YounSung
 
Преимущества и недостатки языка Swift
Преимущества и недостатки языка SwiftПреимущества и недостатки языка Swift
Преимущества и недостатки языка Swift
Andrey Volobuev
 
OpenStack Swift In the Enterprise
OpenStack Swift In the EnterpriseOpenStack Swift In the Enterprise
OpenStack Swift In the Enterprise
Hostway|HOSTING
 
iOS for Android Developers (with Swift)
iOS for Android Developers (with Swift)iOS for Android Developers (with Swift)
iOS for Android Developers (with Swift)
David Truxall
 
Initial presentation of swift (for montreal user group)
Initial presentation of swift (for montreal user group)Initial presentation of swift (for montreal user group)
Initial presentation of swift (for montreal user group)
Marcos García
 
Swift
SwiftSwift
Swift
Kika Fernandez Hernandez
 
A swift introduction to Swift
A swift introduction to SwiftA swift introduction to Swift
A swift introduction to Swift
Giordano Scalzo
 
20 Facts about Swift programming language
20 Facts about Swift programming language20 Facts about Swift programming language
20 Facts about Swift programming language
Rohit Tirkey
 
Swift programming language
Swift programming languageSwift programming language
Swift programming language
Nijo Job
 
Swift sin hype y su importancia en el 2017
 Swift sin hype y su importancia en el 2017  Swift sin hype y su importancia en el 2017
Swift sin hype y su importancia en el 2017
Software Guru
 
Интуит. Разработка приложений для iOS. Лекция 5. Сложные Views
Интуит. Разработка приложений для iOS. Лекция 5. Сложные ViewsИнтуит. Разработка приложений для iOS. Лекция 5. Сложные Views
Интуит. Разработка приложений для iOS. Лекция 5. Сложные Views
Глеб Тарасов
 
Введение в разработку для iOS
Введение в разработку для iOSВведение в разработку для iOS
Введение в разработку для iOS
Michael Dudarev
 
Openstack Swift Introduction
Openstack Swift IntroductionOpenstack Swift Introduction
Openstack Swift Introduction
Park YounSung
 
Преимущества и недостатки языка Swift
Преимущества и недостатки языка SwiftПреимущества и недостатки языка Swift
Преимущества и недостатки языка Swift
Andrey Volobuev
 
OpenStack Swift In the Enterprise
OpenStack Swift In the EnterpriseOpenStack Swift In the Enterprise
OpenStack Swift In the Enterprise
Hostway|HOSTING
 
iOS for Android Developers (with Swift)
iOS for Android Developers (with Swift)iOS for Android Developers (with Swift)
iOS for Android Developers (with Swift)
David Truxall
 
Initial presentation of swift (for montreal user group)
Initial presentation of swift (for montreal user group)Initial presentation of swift (for montreal user group)
Initial presentation of swift (for montreal user group)
Marcos García
 
Ad

Similar to Swift Programming Language (20)

Bologna Developer Zone - About Kotlin
Bologna Developer Zone - About KotlinBologna Developer Zone - About Kotlin
Bologna Developer Zone - About Kotlin
Marco Vasapollo
 
Js hacks
Js hacksJs hacks
Js hacks
Nishchit Dhanani
 
Say It With Javascript
Say It With JavascriptSay It With Javascript
Say It With Javascript
Giovanni Scerra ☃
 
Stuff you didn't know about action script
Stuff you didn't know about action scriptStuff you didn't know about action script
Stuff you didn't know about action script
Christophe Herreman
 
Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6
Visual Engineering
 
Wakanday JS201 Best Practices
Wakanday JS201 Best PracticesWakanday JS201 Best Practices
Wakanday JS201 Best Practices
Juergen Fesslmeier
 
05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboards05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboards
Denis Ristic
 
EcmaScript unchained
EcmaScript unchainedEcmaScript unchained
EcmaScript unchained
Eduard Tomàs
 
JavaScript for PHP developers
JavaScript for PHP developersJavaScript for PHP developers
JavaScript for PHP developers
Stoyan Stefanov
 
Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02
Seri Moth
 
Soundreader.classpathSoundreader.project Soundre.docx
Soundreader.classpathSoundreader.project  Soundre.docxSoundreader.classpathSoundreader.project  Soundre.docx
Soundreader.classpathSoundreader.project Soundre.docx
whitneyleman54422
 
Kotlin For Android - Functions (part 3 of 7)
Kotlin For Android - Functions (part 3 of 7)Kotlin For Android - Functions (part 3 of 7)
Kotlin For Android - Functions (part 3 of 7)
Gesh Markov
 
K is for Kotlin
K is for KotlinK is for Kotlin
K is for Kotlin
TechMagic
 
Php 5.6
Php 5.6Php 5.6
Php 5.6
Federico Damián Lozada Mosto
 
golang_refcard.pdf
golang_refcard.pdfgolang_refcard.pdf
golang_refcard.pdf
Spam92
 
PathOfMostResistance
PathOfMostResistancePathOfMostResistance
PathOfMostResistance
Edward Cleveland
 
Impress Your Friends with EcmaScript 2015
Impress Your Friends with EcmaScript 2015Impress Your Friends with EcmaScript 2015
Impress Your Friends with EcmaScript 2015
Lukas Ruebbelke
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
Lorenzo Dematté
 
Swift - the future of iOS app development
Swift - the future of iOS app developmentSwift - the future of iOS app development
Swift - the future of iOS app development
openak
 
java write a program to evaluate the postfix expressionthe program.pdf
java write a program to evaluate the postfix expressionthe program.pdfjava write a program to evaluate the postfix expressionthe program.pdf
java write a program to evaluate the postfix expressionthe program.pdf
arjuntelecom26
 
Bologna Developer Zone - About Kotlin
Bologna Developer Zone - About KotlinBologna Developer Zone - About Kotlin
Bologna Developer Zone - About Kotlin
Marco Vasapollo
 
Stuff you didn't know about action script
Stuff you didn't know about action scriptStuff you didn't know about action script
Stuff you didn't know about action script
Christophe Herreman
 
05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboards05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboards
Denis Ristic
 
EcmaScript unchained
EcmaScript unchainedEcmaScript unchained
EcmaScript unchained
Eduard Tomàs
 
JavaScript for PHP developers
JavaScript for PHP developersJavaScript for PHP developers
JavaScript for PHP developers
Stoyan Stefanov
 
Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02
Seri Moth
 
Soundreader.classpathSoundreader.project Soundre.docx
Soundreader.classpathSoundreader.project  Soundre.docxSoundreader.classpathSoundreader.project  Soundre.docx
Soundreader.classpathSoundreader.project Soundre.docx
whitneyleman54422
 
Kotlin For Android - Functions (part 3 of 7)
Kotlin For Android - Functions (part 3 of 7)Kotlin For Android - Functions (part 3 of 7)
Kotlin For Android - Functions (part 3 of 7)
Gesh Markov
 
K is for Kotlin
K is for KotlinK is for Kotlin
K is for Kotlin
TechMagic
 
golang_refcard.pdf
golang_refcard.pdfgolang_refcard.pdf
golang_refcard.pdf
Spam92
 
Impress Your Friends with EcmaScript 2015
Impress Your Friends with EcmaScript 2015Impress Your Friends with EcmaScript 2015
Impress Your Friends with EcmaScript 2015
Lukas Ruebbelke
 
Swift - the future of iOS app development
Swift - the future of iOS app developmentSwift - the future of iOS app development
Swift - the future of iOS app development
openak
 
java write a program to evaluate the postfix expressionthe program.pdf
java write a program to evaluate the postfix expressionthe program.pdfjava write a program to evaluate the postfix expressionthe program.pdf
java write a program to evaluate the postfix expressionthe program.pdf
arjuntelecom26
 
Ad

Recently uploaded (20)

Surveying through global positioning system
Surveying through global positioning systemSurveying through global positioning system
Surveying through global positioning system
opneptune5
 
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdfML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
rameshwarchintamani
 
Machine foundation notes for civil engineering students
Machine foundation notes for civil engineering studentsMachine foundation notes for civil engineering students
Machine foundation notes for civil engineering students
DYPCET
 
introduction technology technology tec.pptx
introduction technology technology tec.pptxintroduction technology technology tec.pptx
introduction technology technology tec.pptx
Iftikhar70
 
Interfacing PMW3901 Optical Flow Sensor with ESP32
Interfacing PMW3901 Optical Flow Sensor with ESP32Interfacing PMW3901 Optical Flow Sensor with ESP32
Interfacing PMW3901 Optical Flow Sensor with ESP32
CircuitDigest
 
Agents chapter of Artificial intelligence
Agents chapter of Artificial intelligenceAgents chapter of Artificial intelligence
Agents chapter of Artificial intelligence
DebdeepMukherjee9
 
最新版加拿大魁北克大学蒙特利尔分校毕业证(UQAM毕业证书)原版定制
最新版加拿大魁北克大学蒙特利尔分校毕业证(UQAM毕业证书)原版定制最新版加拿大魁北克大学蒙特利尔分校毕业证(UQAM毕业证书)原版定制
最新版加拿大魁北克大学蒙特利尔分校毕业证(UQAM毕业证书)原版定制
Taqyea
 
Dynamics of Structures with Uncertain Properties.pptx
Dynamics of Structures with Uncertain Properties.pptxDynamics of Structures with Uncertain Properties.pptx
Dynamics of Structures with Uncertain Properties.pptx
University of Glasgow
 
Mode-Wise Corridor Level Travel-Time Estimation Using Machine Learning Models
Mode-Wise Corridor Level Travel-Time Estimation Using Machine Learning ModelsMode-Wise Corridor Level Travel-Time Estimation Using Machine Learning Models
Mode-Wise Corridor Level Travel-Time Estimation Using Machine Learning Models
Journal of Soft Computing in Civil Engineering
 
Novel Plug Flow Reactor with Recycle For Growth Control
Novel Plug Flow Reactor with Recycle For Growth ControlNovel Plug Flow Reactor with Recycle For Growth Control
Novel Plug Flow Reactor with Recycle For Growth Control
Chris Harding
 
A Survey of Personalized Large Language Models.pptx
A Survey of Personalized Large Language Models.pptxA Survey of Personalized Large Language Models.pptx
A Survey of Personalized Large Language Models.pptx
rutujabhaskarraopati
 
twin tower attack 2001 new york city
twin  tower  attack  2001 new  york citytwin  tower  attack  2001 new  york city
twin tower attack 2001 new york city
harishreemavs
 
Computer Security Fundamentals Chapter 1
Computer Security Fundamentals Chapter 1Computer Security Fundamentals Chapter 1
Computer Security Fundamentals Chapter 1
remoteaimms
 
Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025
Antonin Danalet
 
Machine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATIONMachine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATION
DarrinBright1
 
JRR Tolkien’s Lord of the Rings: Was It Influenced by Nordic Mythology, Homer...
JRR Tolkien’s Lord of the Rings: Was It Influenced by Nordic Mythology, Homer...JRR Tolkien’s Lord of the Rings: Was It Influenced by Nordic Mythology, Homer...
JRR Tolkien’s Lord of the Rings: Was It Influenced by Nordic Mythology, Homer...
Reflections on Morality, Philosophy, and History
 
Efficient Algorithms for Isogeny Computation on Hyperelliptic Curves: Their A...
Efficient Algorithms for Isogeny Computation on Hyperelliptic Curves: Their A...Efficient Algorithms for Isogeny Computation on Hyperelliptic Curves: Their A...
Efficient Algorithms for Isogeny Computation on Hyperelliptic Curves: Their A...
IJCNCJournal
 
Parameter-Efficient Fine-Tuning (PEFT) techniques across language, vision, ge...
Parameter-Efficient Fine-Tuning (PEFT) techniques across language, vision, ge...Parameter-Efficient Fine-Tuning (PEFT) techniques across language, vision, ge...
Parameter-Efficient Fine-Tuning (PEFT) techniques across language, vision, ge...
roshinijoga
 
Nanometer Metal-Organic-Framework Literature Comparison
Nanometer Metal-Organic-Framework  Literature ComparisonNanometer Metal-Organic-Framework  Literature Comparison
Nanometer Metal-Organic-Framework Literature Comparison
Chris Harding
 
Modelling of Concrete Compressive Strength Admixed with GGBFS Using Gene Expr...
Modelling of Concrete Compressive Strength Admixed with GGBFS Using Gene Expr...Modelling of Concrete Compressive Strength Admixed with GGBFS Using Gene Expr...
Modelling of Concrete Compressive Strength Admixed with GGBFS Using Gene Expr...
Journal of Soft Computing in Civil Engineering
 
Surveying through global positioning system
Surveying through global positioning systemSurveying through global positioning system
Surveying through global positioning system
opneptune5
 
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdfML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
rameshwarchintamani
 
Machine foundation notes for civil engineering students
Machine foundation notes for civil engineering studentsMachine foundation notes for civil engineering students
Machine foundation notes for civil engineering students
DYPCET
 
introduction technology technology tec.pptx
introduction technology technology tec.pptxintroduction technology technology tec.pptx
introduction technology technology tec.pptx
Iftikhar70
 
Interfacing PMW3901 Optical Flow Sensor with ESP32
Interfacing PMW3901 Optical Flow Sensor with ESP32Interfacing PMW3901 Optical Flow Sensor with ESP32
Interfacing PMW3901 Optical Flow Sensor with ESP32
CircuitDigest
 
Agents chapter of Artificial intelligence
Agents chapter of Artificial intelligenceAgents chapter of Artificial intelligence
Agents chapter of Artificial intelligence
DebdeepMukherjee9
 
最新版加拿大魁北克大学蒙特利尔分校毕业证(UQAM毕业证书)原版定制
最新版加拿大魁北克大学蒙特利尔分校毕业证(UQAM毕业证书)原版定制最新版加拿大魁北克大学蒙特利尔分校毕业证(UQAM毕业证书)原版定制
最新版加拿大魁北克大学蒙特利尔分校毕业证(UQAM毕业证书)原版定制
Taqyea
 
Dynamics of Structures with Uncertain Properties.pptx
Dynamics of Structures with Uncertain Properties.pptxDynamics of Structures with Uncertain Properties.pptx
Dynamics of Structures with Uncertain Properties.pptx
University of Glasgow
 
Novel Plug Flow Reactor with Recycle For Growth Control
Novel Plug Flow Reactor with Recycle For Growth ControlNovel Plug Flow Reactor with Recycle For Growth Control
Novel Plug Flow Reactor with Recycle For Growth Control
Chris Harding
 
A Survey of Personalized Large Language Models.pptx
A Survey of Personalized Large Language Models.pptxA Survey of Personalized Large Language Models.pptx
A Survey of Personalized Large Language Models.pptx
rutujabhaskarraopati
 
twin tower attack 2001 new york city
twin  tower  attack  2001 new  york citytwin  tower  attack  2001 new  york city
twin tower attack 2001 new york city
harishreemavs
 
Computer Security Fundamentals Chapter 1
Computer Security Fundamentals Chapter 1Computer Security Fundamentals Chapter 1
Computer Security Fundamentals Chapter 1
remoteaimms
 
Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025
Antonin Danalet
 
Machine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATIONMachine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATION
DarrinBright1
 
Efficient Algorithms for Isogeny Computation on Hyperelliptic Curves: Their A...
Efficient Algorithms for Isogeny Computation on Hyperelliptic Curves: Their A...Efficient Algorithms for Isogeny Computation on Hyperelliptic Curves: Their A...
Efficient Algorithms for Isogeny Computation on Hyperelliptic Curves: Their A...
IJCNCJournal
 
Parameter-Efficient Fine-Tuning (PEFT) techniques across language, vision, ge...
Parameter-Efficient Fine-Tuning (PEFT) techniques across language, vision, ge...Parameter-Efficient Fine-Tuning (PEFT) techniques across language, vision, ge...
Parameter-Efficient Fine-Tuning (PEFT) techniques across language, vision, ge...
roshinijoga
 
Nanometer Metal-Organic-Framework Literature Comparison
Nanometer Metal-Organic-Framework  Literature ComparisonNanometer Metal-Organic-Framework  Literature Comparison
Nanometer Metal-Organic-Framework Literature Comparison
Chris Harding
 

Swift Programming Language

  • 2. Hello World println(“Hello World!”) //var using make a variable. var hello = “Hello” //let using make a constants. let world = “World!” println(“(hello) (world)”)
  • 3. Simple Values var name = “ANIL” //Weight type is Double. var weight: Double = 74.4 //Correct. var myVariable = 4 myVariable = 10 //Wrong, because myVariable type is Integer now. var myVariable = 4 myVariable = “Four”
  • 4. Simple Values var text = “ANIL” var number = 7 //Combining two variables to one variable. var textNumber = text + String(number) println(textNumber)
  • 5. For - If - Else - Else If //0,1,2,3,4,5,6,7,8,9 for var i = 0; i < 10; i++ { println(i) } //1,2,3,4,5 for i in 1…5 { println(i) } if condition { /* Codes */ } else if condition { /* Codes */ } else { /* Codes */ }
  • 6. Switch - Case var str = “Swift” //break is automatically in Swift switch str { case “Swift”, “swift”: println(“Swift”) case “Objective - C”: println(“Objective - C”) default: println(“Other Language”) }
  • 7. Switch - Case let somePoint = (2,0) //We can giving a label. mainSwitch: switch somePoint { case (2,0) where somePoint.0 == 2: println(“2,0”) //Second case working to. fallthrough //x value doesn’t matter. case (_,0): println(“_,0”) default: println(“Other Point”) }
  • 8. Array - Dictionary //Make an array. var cities = [“Istanbul”, “Sivas”, “San Francisco”, “Seul”] println(cities[0]) //Make a dictionary. var cityCodes = [ “Istanbul Anadolu” : “216”, “Istanbul Avrupa” : “212”, “Ankara” : ”312” ] println(cityCodes[“Istanbul Anadolu”]!)
  • 9. Array var stringArray = [“Hello”, “World”] //Add element into the array. stringArray.append(“Objective - C”) //Insert element into the array. stringArray.insert(“Apple”, atIndex: 2) //Remove element into the array. stringArray.removeAtIndex(3) //Remove last element into the array. stringArray.removeLast()
  • 10. //Get element into the array. stringArray[1] stringArray[1…3] //Get all elements into the array. for (index, value) in enumerate(stringArray) { println(“(index + 1). value is: (value)”) } //Get element count in the array. stringArray.count Array
  • 11. var airports = [“SAW” : “Sabiha Gokcen Havalimani”, “IST” : “Ataturk Havalimani”] //Add element in the dictionary. airports[“JFK”] = “John F Kennedy” //Get element count in the dictionary. airports.count //Update element in the dictionary. airports.updateValue(“John F Kennedy Terminal”, forKey: “JFK”) Dictionary
  • 12. Dictionary //Remove element in the dictionary. airports.removeValueForKey(“JFK”) //Get all elements into the dictionary. for (airportCode, airport) in airports { println(“Airport Code: (airportCode) Airport: (airport)”) } //Get all keys. var keysArray = airports.keys //Get all values. var valuesArray = airports.values
  • 13. Functions //Make a function. func hello(){ println(“Hello World!”) } //Call a function. hello() //personName is parameter tag name. func helloTo(personName name:String){ println(“Hello (name)”) }
  • 14. Functions /*#it works, same parameter name and parameter tag name. This function returned String value. */ func printName(#name: String) -> String{ return name } //This function returned Int value. func sum(#numberOne: Int numberTwo: Int) -> Int{ return numberOne + numberTwo }
  • 15. Functions //Tuple returns multiple value. func sumAndCeiling(#numberOne: Int numberTwo: Int) -> (sum: Int, ceiling: Int){ var ceiling = numberOne > numberTwo ? numberOne : numberTwo var sum = numberOne + numberTwo return (sum,ceiling) }
  • 16. Functions func double(number:Int) -> Int { return number * 2 } func triple(number:Int) -> Int { return number * 3 } func modifyInt(#number:Int modifier:Int -> Int) -> Int { return modifier(number) } //Call functions modifyInt(number: 4 modifier: double) modifyInt(number: 4 modifier: triple)
  • 17. Functions /* This function have inner function and returned function, buildIncrementor function returned function and incrementor function returned Int value. */ func buildIncrementor() -> () -> Int { var count = 0 func incrementor() -> Int{ count++ return count } return incrementor }
  • 18. Functions /* Take unlimited parameter functions */ func avarage(#numbers:Int…) -> Int { var total = 0; for n in numbers{ total += n; } return total / numbers.count; }
  • 19. Structs /* Creating Struct */ struct GeoPoint { //Swift doesn’t like empty values var latitude = 0.0 var longitude = 0.0 } /* Initialize Struct */ var geoPoint = GeoPoint() geoPoint.latitude = 44.444 geoPoint.longitude = 12.222
  • 20. Classes /* Creating Class */ class Person { var name:String var age:Int //nickname:String? is optional value. var nickname:String? init(name:String, age:Int, nickname:String? = nil){ self.name = name self.age = age self.nickname = nickname } }
  • 21. Classes /* Creating Sub Class */ class Class : SuperClass { var name:String init(name:String){ self.name = name super.init(age: age, nickname: nickname) } func printName(){ println(name) } }
  • 22. Classes /* Creating Class (Static) Method */ class MyClass { class func printWord(#word:String) { println(word) } } /* Calling Class (Static) Method */ MyClass.printWord(word: “Hello World!”)
  • 23. Enums /* Creating Enum */ enum Direction { case Left case Right case Up case Down } //Call Enum Value Direction.Right or var direction:Direction direction = .Up
  • 24. Enums /* Creating Enum with Parameter(s) */ enum Computer { //RAM, Processor case Desktop(Int,String) //Screen Size case Laptop(Int) } //Call Enum Value with Parameter(s) var computer = Computer.Desktop(16,”i7”)
  • 25. Enums /* Creating Enum with Int */ enum Planet:Int { case Mercury = 1, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune } /* Call Enum Value for Raw Value */ //Returns 3 Planet.Earth.toRaw() //Returns Mars (Optional Value) Planet.Earth.fromRaw(4)
  翻译: