-
(Swift) Type Properties & MethodsiOS💖 2024. 9. 3. 16:13
- Type Properties (타입 프로퍼티) : 해당 Struct 타입 자체에 종속된 property
- Type Methods (타입 메소드) : 해당 Struct 타입 자체에 종속된 Method
struct FCLecture { static var academyName: String = "Fast Campus" // ⭐️Type Property⭐️ var name: String } var iOSLecture = FCLecture(name: "iOS 강의") var backendLecture = FCLecture(name: "백엔드 강의") print(iOSLecture.name) // iOS 강의 print(backendLecture.name) // 백엔드 강의 print(FCLecture.academyName) // Fast Campuscode ) academyName property는, 만들어질 객체에 종속되어있지 않고, 해당 Struct 타입 자체의 property이다.
'iOS💖' 카테고리의 다른 글
(Swift) deinitializer (3) 2024.09.03 (Swift) Access Control (2) 2024.09.03 (Swift) Lazy Properties (0) 2024.09.03 (iOS) UICollectionViewCell의 awakeFromlib() 는? (1) 2023.01.05 (iOS) UserInterfaceState.xcuserstate, 커밋 해야할까? (1) 2022.12.22