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 |
Tags
- Protocol
- combine
- HIG
- ios
- rxswift
- ribs
- Refactoring
- Clean Code
- 스위프트
- clean architecture
- UITextView
- uiscrollview
- 애니메이션
- RxCocoa
- 리펙토링
- tableView
- swiftUI
- 리펙터링
- UICollectionView
- MVVM
- 리팩토링
- swift documentation
- Human interface guide
- Observable
- uitableview
- map
- Xcode
- collectionview
- 클린 코드
- SWIFT
Archives
- Today
- Total
목록mutating 없이 (1)
김종권의 iOS 앱 개발 알아가기
[iOS - SwiftUI] @State를 사용하면 mutating 없이도 수정이 가능한 원리 (@State 직접 구현해보기)
@State를 사용하면 mutating 없이도 사용이 가능아래처럼 @State를 프로퍼티에 붙여서 사용하면 change()함수에서 mutating 키워드가 없더라도 문제없이 동작struct MyStruct { @State var val = 0 func change() { val = 0 }}struct이기 때문에 값을 변경하려면 원래 mutating키워드가 필요하지만 @State를 사용하면 mutating 없이 사용이 가능struct MyStruct { var a1 = 0 func change() { a1 = 2 // Cannot assign to property: 'self' is immutable }}computed property..
iOS 응용 (SwiftUI)
2024. 7. 19. 01:32