목차 Functions (함수) Return Values (리턴 값) Parameters (매개변수) Argument Label In-Out Parameters (입출력 매개변수) Function Notation (함수 표기법) Discardable Result (버릴 수 있는 결과) Implicit Return Functions (함수) 함수는 특정 기능을 수행하는 코드 조각이다. Functions (함수) 종류 Calling Functions (함수 호출) Swift에는 Swift Standard Library라는 게 내장되어 있는데, 다양한 기본 함수가 구현되어 있어서 편하게 함수를 가져와서 사용할 수 있다. Defining Functions (함수 정의) 필요한 함수를 직접 만드는 방법이다. Ca..
목차 Optionals (옵셔널) Optionals (옵셔널) Unwrapping (언래핑) Forced Unwrapping! (강제추출!) Optional 특징 Optional Binding (옵셔널 바인딩) If let / while let / guard let Implicitly Unwrapped Optionals (IUO, 암시적 추출 옵셔널!) Nil-Coalescing Operator (Nil 병합 연산자, ??) Optionals (옵셔널) Optionals은 값이 없다는 뜻으로 nil로 표기한다. Optionals 선언 및 예시 let optionalNum: Int? = nil // 자료형 뒤에 공백없이 '?'을 붙이면 옵셔널이 된다. let optionalNum = nil // error..
목차 Control Transfer Statements (흐름 제어 구문) break Statement continue Statement Labeled Statement (구문 이름표) Control Transfer Statements (흐름 제어 구문) 제어를 전달한다는 것은 현재 실행중인 scope 중에서 break, continue, Labeled 등을 통해 코드의 흐름을 제어하여 바로 다음 코드를 실행하게 하는 것이다. break Statement let num = 1 // switch문에서 break switch num { case 1...100: print("num은 \(num)이다.") // num은 1이다. if num % 2 != 0 { // num = 1이므로 break break } ..
목차 For-In Loops (for문) for문 이중 for문 Wildcard Pattern while Loop (while문) while repeat-while While Loop 특징 For-In Loops (for문) for문 이중 for문 '_' (underbar) Wildcard Pattern for문 for loopConstant in Range { statements } 예시 for index in 1 ... 3 { print("Hello, World") } /* Hello, World Hello, World Hello, World */ for index in 1 ... 3 { print(index) } /* 1 2 3 */ for num in stride(from: 0, to: 5, by..
목차 if Statement (if문) if else else-if switch Statements switch case switch case where guard Statements if Statement (if문) if else else-if If if condition { statements } let id = "patrick" let password = "1234" if id == "patrick" { print("valid id") // vaild id } if password == "1234" { print("vaile password") // vaild password } else if condition { statements } else { statements } if id == "patr..
목차 Operator Basics (연산자 기초) Arithmetic Operators (산술 연산자) Overflow Operators (오버플로우 연산자) Comparison Operators (비교 연산자) Logical Operators (논리 연산자) Ternary Conditional Operator (삼항 연산자) Assignment Operators (할당 연산자) Range Operators (범위 연산자) Operator Basics (연산자 기초) Operator (연산자), Operand (피연산자), Whitespaces (공백) Unary Operator (단항 연산자) Binary Operator (이항 연산자) Ternary Operator (삼항 연산자) Prefix Ope..
목차 Data Types with Memory Data Types Memory Overflow Numbers Number Literals (숫자 리터럴) Integer Types Signed vs Unsigned Int & UInt Floating-point Types Boolean Strings and Characters (문자열과 문자) Bool, Int, UInt, Float, Double, Charcter, String 비교 Type Inference (형식 추론) Type Inference Rules Type Annotation (형식 주석) Type Safety (형식 안전성) Type Conversion (형 변환) Type Alias (타입 알리아스) Data Types with Memor..
Variables and Constants (변수와 상수) 코드를 작성할 때 변수(Variables)나 상수(Contants)를 사용하여 데이터를 저장할 수 있다. 변수는 계속 변하는 값이며, 상수는 한 번 지정하면 변하지 않는 값을 의미한다. Variables 변수 계속 변하는 값이면서, 그 값을 저장하는 공간 변수의 선언 및 사용 변수를 선언할 때는 var 키워드를 사용한다. var variableName = initialValue // var [변수명] : [데이터 타입] = [값] 사용 예시 // 선언 예시 var name = "bono" var age = 17 var temp = false // 값 변경 name = "spongebob" name = "patrick" age = 19 age = ..
- Total
- Today
- Yesterday
- datatypes
- 옵셔널
- optional
- 전산구문 기초용어
- 삼항연산자
- 산술연산자
- RawValues
- Constants
- 오버플로우연산자
- conditional
- enumerations
- 세자리수마다 콤마넣기
- 범위연산자
- playground
- 구문이름표
- 객체지향 생활체조
- overflow
- scope
- 비트연산자
- 결합성
- labeled
- 오토레이아웃
- Functions
- swift
- variables
- iOS View Life Cycle
- 훈련법
- continue
- 반복문
- 흐름제어구문
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |