Apple/Swift(8)
-
[ 구조체와 클래스 ]
메소드와 프로퍼티 struct Resolution { var width = 0 var height = 0 func desc() -> String { return "Return 구조체" } } class VideoMode { var interlaced = false var frameRate = 0.0 var name: String func desc() -> String { return "VideoMode 클래스" } } Resolution 구조체 픽셀 기반 디스플레이의 해상도 정보를 관리하기 위한 목적, width 랑 height 라는 두 개의 저장 프로퍼티가 있음. 저장 프로퍼티: 특정 값을 저장하기 위해 클래스나 구조체의 내부에 정의된 변수나 상수 두 프로퍼티는 초기값이 0 대입 -> 타입 추론 규칙에..
2022.12.02 -
[Swift ] Escape Sequence - 문자열처리
Extended String Delimiters You can place a string literal within extended delimiters to include special characters in a string without invoking their effect. You place your string within quotation marks (") and surround that with number signs (#). For example, printing the string literal #"Line 1\nLine 2"# prints the line feed escape sequence (\n) rather than printing the string across two lines..
2022.05.21