Apple/Swift(9)
-
Macro 에 대해서 알아보자.
State 를 공부하다가, Observable() 의 정의를 또 타고들어가다가 이것이 Macro 타입이라는 걸 알게되었다. Share observable state objects with subviews 부분에서https://playground-coding.tistory.com/78 Macro 이게 무슨 역할을 하는 타입일까? Struct, Class, Instance Method, Properties, enum 등 이런 것들은 문법을 공부할 때 한번씩은 보던 것들인데, Macro 는 뭐지..State 에 저장된 Observable 객체를 하위 뷰와 공유하려면 객체 참조를 하위 뷰에 전달SwiftUI는 객체의 관찰 가능한 속성이 변경될 때마다 하위 뷰를 업데이트하지만 하위 뷰의 body가 속성을 읽을 ..
2023.11.12 -
[ 구조체와 클래스 ]
메소드와 프로퍼티 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