IBOutlet and IBAction

IBOutlet and IBAction

  • IBOutlet : Code -> Design 방향으로 흐른다. 즉, View Controller 의 코드가 Storyboard 를 조작한다.
  • IBAction : Design -> Code 방향으로 흐른다. 즉, Storyboard 에서 화면 상 어떠한 조작이 발생할 경우 해당 element 에 연결된 Code block, 즉, 메서드를 호출한다. 이후 해당 메서드는 내부 블럭에 사전에 정의된 비즈니스 로직을 수행하여 또 다른 Code, Design 등에 영향을 줄 수 있다.

Naming Conventions

  • camelCase
  • PascalCase
  • kebab-case
  • snake_case

Swift 는 camelCase 를 사용한다‼️


Commenting

  • Single line comment
    // This line is commented
    
  • Multiple lines comment
    /*
    These lines are commented
    commented
    commented
    */
    

String

String Interpolation

JavaScript 의 Template literals 와 같다. 다만 표현 방식이 다르다.

  • JavaScript
    `3 + 5 = ${3 + 5}`
    
  • Swift
    "3 + 5 = \(3 + 5)"
    

String Concatenation

문자열을 연결한다.

var concatenatedString = "I like " + "swift."

print(concatenatedString)   // "I like swift."

Range Operator

lower ... upper

lowerupper를 포함한다. lower 이상, upper 이하.

lower ..< upper

lower는 포함하지만 upper는 포함하지 않는다. lower 이상, upper 미만.




Reference

  1. Angela Yu, “iOS & Swift - The Complete iOS App Development Bootcamp, Section 4.” Udemy.com. last modified Nov. 2021, https://www.udemy.com/course/ios-13-app-development-bootcamp/.