저장변수
-
Lazy Stored Properties카테고리 없음 2020. 5. 6. 23:28
A lazy stored property is a property whose initial value is not calculated until the first time it is used. You indicate a lazy stored property by writing the lazy modifier before its declaration. lazy 저장 프로퍼티의 값은 처음 사용되기 전까지는 계산되지 않습니다. lazy로 선언해주려면 "lazy var something " var(변수) 앞에 lazy를 선언해주면 됩니다. NOTE You must always declare a lazy property as a variable (with the var keyword), because its in..
-
저장 프로퍼티swift 2020. 3. 16. 23:22
프로퍼티란? -> 클래스, 구조체 또는 열거형 등에 관련된 값을 칭함. 프로퍼티의 종류 -> 저장 프로퍼티 -> 연산 프로퍼티 -> 타입 프로퍼티 오늘은 저장 프로퍼티에 대해서 알아보겠습니다. 저장 프로퍼티는 인스턴스 변수 또는 상수를 의미 (클래스,구조체서만!!) 저장 프로퍼티 -> 클래스 또는 구조체의 인스턴스와 연관된 값을 저장하는 가장 단순한 개념 -> var : 변수 저장 프로퍼티 -> let : 상수 저장 프로퍼티 struct Student { var name : String var school : String } let from_yagom : Student = Student(name : "john",school : "edgehill uni") Class User{ var name: Strin..