workshop ios

23
iOS Development with Swift

Upload: bob-carvalho

Post on 20-Feb-2017

64 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Workshop iOS

iOS Developmentwith Swift

Page 2: Workshop iOS

print("SWIFT")

Page 3: Workshop iOS

What?

Multi-paradigm

Designed by Apple

First Appeared in June, 2014

Page 4: Workshop iOS

Why?

Productivity

Inter-operability

Apple’s Language of choice

Page 5: Workshop iOS

Who?

Page 6: Workshop iOS

Playground

Page 7: Workshop iOS

Syntax

Page 8: Workshop iOS

Constants and Variables

let place: String = "Pace"

let year: Int = 2015

let isHavingFun: Bool = true

var version: Double = 1.0

version = 2.1

Page 9: Workshop iOS

Type Inference

let place = "Pace"

let year = 2015

let isHavingFun = true

var version = 1.0

version = 2.1

Page 10: Workshop iOS

Most awesome feature

Page 11: Workshop iOS

Strings

Concatenation

Type Cast

Format

Page 12: Workshop iOS

Arrays and Dictionaries

var emptyArray = [String]()

emptyArray.append("foo")

let someNumbers = [1, 2, 3]

var majors = Dictionary<String, String>()majors["John"] = "Computer Science"majors.removeValueForKey("John")

let schedule = [ "morning": "classes", "afternoon": "awesome workshop", "night": "party",]

Page 13: Workshop iOS

Optionals

let numberOfLegs = ["ant": 6, "snake": 0, "cheetah": 4]

let possibleLegCount: Int? = numberOfLegs["aardvark"]

Page 14: Workshop iOS

Flow Control

If / Else

For / While

Switch

Page 15: Workshop iOS

Functions

func hello(name: String = “world”){ print (“Hello \(name)”)}

func add(n1: Int, n2: Int) -> Int { return n1 + n2}

add(1, n2: 2)

Page 16: Workshop iOS

Classes

Class DeclarationInheritanceInitializationMethod overriding

Page 17: Workshop iOS

Creating an iOS Project

Page 18: Workshop iOS

App Lifecycle

Page 19: Workshop iOS

ViewController Lifecycle

Page 20: Workshop iOS

UIKit and Interface Builder

UIViewControllerUIViewUILabelUIButtonUIImageViewUITableViewUITextField

Page 21: Workshop iOS

Importing Assets

Page 22: Workshop iOS

Let’s Do Something!

Page 23: Workshop iOS

Thanks!

Ian CarvalhoTwitter: @ian.carv