lau acm - introduction to swift - dani arnaout

50
Introduction to Swift Dani Arnaout Systems Engineer at Lextech

Upload: dani-arnaout

Post on 17-Jul-2015

223 views

Category:

Education


1 download

TRANSCRIPT

Introduction to Swift

Dani ArnaoutSystems Engineer at Lextech

Introduction1

Introduction1Introduction to Swift

by Dani Arnaout

$

Introduction1Introduction to Swift

by Dani Arnaout

Introduction1Introduction to Swift

by Dani Arnaout

Introduction1Introduction to Swift

by Dani Arnaout

Introduction1Introduction to Swift

by Dani Arnaout

stack

queue

linked list

treegraph

Introduction1Introduction to Swift

by Dani Arnaout

Beirut Electricity

Introduction1Introduction to Swift

by Dani Arnaout

MacBook Pro Xcode iPhone+ +

Introduction1Introduction to Swift

by Dani Arnaout

Objective-C

Introduction1Introduction to Swift

by Dani Arnaout

Introduction1Introduction to Swift

by Dani Arnaout

Introduction1Introduction to Swift

by Dani Arnaout

Xcode

Introduction1Introduction to Swift

by Dani Arnaout

Xcode

Introduction1Introduction to Swift

by Dani Arnaout

stackoverflow.com

Introduction1Introduction to Swift

by Dani Arnaout

Silly Apps

Introduction1Introduction to Swift

by Dani Arnaout

Introduction1Introduction to Swift

by Dani Arnaout

1 year later…

Introduction1Introduction to Swift

by Dani Arnaout

Introduction1Introduction to Swift

by Dani Arnaout

Introduction1Introduction to Swift

by Dani Arnaout

Introduction1Introduction to Swift

by Dani Arnaout

Introduction1Introduction to Swift

by Dani Arnaout

Academic Industrial

Swift2

Swift2Introduction to Swift

by Dani Arnaout

;

Swift2Introduction to Swift

by Dani Arnaout

I. Data Types

var x = 3var speedOfCar = 84.6var orangesAreOrange = true

let maximumNumberOfSeasons = 4

Swift2Introduction to Swift

by Dani Arnaout

I. Data Types

let beeseh = "😻"let bobby = "🐶"

var x = 3var speedOfCar = 84.6var orangesAreOrange = true

let maximumNumberOfSeasons = 4

Swift2Introduction to Swift

by Dani Arnaout

unary: -abinary: a+bternary: a?b:c

2. Basic Operators

Swift2Introduction to Swift

by Dani Arnaout

var username = "Dani"let uselessString = "This is a totally useless string"

3. Strings

Swift2Introduction to Swift

by Dani Arnaout

Array:var shoppingList = ["Eggs", "Milk"]var firstItem = shoppingList[0] // Eggs

Dictionary:var userInfo = [“name”:”Dani", “age”:”24"]var username = userInfo["name"] // Dani

4. Collection Types

Swift2Introduction to Swift

by Dani Arnaout

For:for var i = 0; i < 3; i++ {

println("index is " + i)}

For-in:for i in 0...2 {

println("index is " + i)}

5. Control Flow

// index is 0// index is 1// index is 2

// index is 0// index is 1// index is 2

Swift2Introduction to Swift

by Dani Arnaout

While:var i = 0while i < 3 {

println("index is ”+i)i++

}

5. Control Flow

// index is 0// index is 1// index is 2

Swift2Introduction to Swift

by Dani Arnaout

If:if temperatureInCelsius < 15 {

println("It's very cold. Consider wearing a scarf.")} else {

println(“It's OK.”) }

5. Control Flow

Swift2Introduction to Swift

by Dani Arnaout

Switch:let temperatureInCelsius = 15switch temperatureInCelsius {

case 15:println(“Cold”)default:println(“Meh”)

}

5. Control Flow

Swift2Introduction to Swift

by Dani Arnaout

Define a function:func sayHelloWorld() { print(“Hello World”)}

Call a function:sayHelloWorld()

6. Functions

// Hello World

Swift2Introduction to Swift

by Dani Arnaout

Define a function:func sayHelloWorld() -> String { return “Hello World”}

Call a function:print(sayHelloWorld())

6. Functions

// Hello World

Swift2Introduction to Swift

by Dani Arnaout

Define a function:func sayHello(personName:String) -> String {

return "Hello " + personName + "!"}

Call a function:print(sayHello("Dani"))

6. Functions

// Hello Dani!

Swift2Introduction to Swift

by Dani Arnaout

class Rectangle { var width = 0 var height = 0 var hasBorders = false var color : String? }

7. Classes

Swift2Introduction to Swift

by Dani Arnaout

?

Start Coding3

Start Coding3Introduction to Swift

by Dani Arnaout

Xcode4

Xcode4Introduction to Swift

by Dani Arnaout

Conclusion5

Conclusion5Introduction to Swift

by Dani Arnaout

Reference

Conclusion5Introduction to Swift

by Dani Arnaout

Conclusion5Introduction to Swift

by Dani Arnaout

Q&A

Conclusion5Introduction to Swift

by Dani Arnaout

Resources

• https://developer.apple.com/library/mac/documentation/Swift/Conceptual/Swift_Programming_Language• http://raywenderlich.com• https://github.com/raywenderlich/swift-style-guide

Web Resources

• Personal pictures• All Googled images are under usage right: Labeled for reuse

Media Resources

• Keynote (6.5)• Xcode (6.1.1)• Reflector (1.6.5)

Software Used

Conclusion5Introduction to Swift

by Dani Arnaout

http://www.slideshare.net/DaniArnaout

Conclusion5Introduction to Swift

by Dani Arnaout

@dani_arnaout