Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
Tags
- swift documentation
- combine
- 리펙터링
- Human interface guide
- Refactoring
- tableView
- collectionview
- 애니메이션
- ribs
- MVVM
- Observable
- Clean Code
- uiscrollview
- swiftUI
- Protocol
- 리펙토링
- Xcode
- ios
- 스위프트
- 클린 코드
- UITextView
- rxswift
- map
- HIG
- 리팩토링
- uitableview
- RxCocoa
- UICollectionView
- clean architecture
- SWIFT
Archives
- Today
- Total
목록달러 prefix (1)
김종권의 iOS 앱 개발 알아가기
[iOS - SwiftUI] 튜토리얼 - 10. @State (달러 prefix), ObservableObject, @Published, @EnvironmentObject
@State View를 상속받는 뷰에서, 값을 변경할때 사용하는 프로퍼티 어노테이션 @State var n = 0 내부 구현부는 propertyWrapper를 사용한 형태 ex) @State를 붙이지 않은 경우 컴파일 에러 발생 struct ContentView: View { var n = 0 var body: some View { VStack { Text("\(n)") Button("Tap!!") { n += 1 // Error: Left side of mutating operator isn't mutable: 'self' is immutable } } } } ex) @State를 프로퍼티 앞에 붙일 경우 컴파일 에러 해결 struct ContentView: View { @State var n = 0 //
iOS 튜토리얼 (SwiftUI)
2022. 7. 12. 21:46