# 5분만에 보는 Swift 인트로

Udacity의 강좌 Intro to iOS App Development with Swift 내용중 Swift에 대한 내용을 정리함



# 목차

1. 변수

2. 조건문

3. 클래스

4. 함수



1. 변수

// Variables

let y = 100             // 상수


var x1:Int = 42         // Int 변수

var x2 = 42             // Int 생략할 있다.


var myString = "Hello"  // string 객체 변수



2. 조건문

// Control Flow

if x < 50 {

    print("x is", x, "and less then 50")

} else {

    print("x is", x, "and greater then or equal to 50")

}



3. 클래스

// Classes

class ViewController : UIViewController {   // class [클래스명] : [상속받을 클래스명]

    // Instance Variables go here

    // Class functions go here

}



4. 함수

// Functions

func printMessage(message : String) {       // func [함수명]([인자명]: [인자타입]) { // 구현부 }

    print(message)

}

printMessage(message: "Oi!")                // 함수명([인자명]: [인자값])



더 많은 Swift 관련 강의가 필요하면

Learn Swift Programming Syntax

를 참조해주세요. (물론 다른강의도 많습니다.)



================================

Reference

- https://www.udacity.com/course/intro-to-ios-app-development-with-swift--ud585


+ Recent posts