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
- KeyPath
- Swift Tuist
- uitableviewdiffabledatasource
- SeSAC
- 네트워크 통신
- swift database
- Tuist
- 카카오뱅크 ios
- GCD
- Subscribe
- Firebase Analytics
- swift db
- Tuist Swift
- xcode
- swift
- realm
- observable
- Subject
- JSON
- ribs
- ios
- Combine
- SwiftUI
- swift 5.9
- Firebase
- ios database
- arc
- swift 6
- combinecocoa
- RxSwift
Archives
- Today
- Total
천원의 개발
IOS ObservableObject 본문
오늘은 ObservableObject 를 공부해 보았다
https://developer.apple.com/documentation/combine/observableobject/
Apple Developer Documentation
developer.apple.com
class Manager: ObservableObject { // 프로토콜 채택
@Published var hello : String = "" // 변경을 감지할 변수 앞에 @Published 붙여준다
DispatchQueue.main.async { // main스레드 에서 동작하도로 해준다
self.hello = "Hello"
}
}
struct ContentView: View {
@ObservedObject var manager = Manager() // 객체 생성시 앞에 @ObservedObject를 붙여준다
}
'iOS&Swift🍎' 카테고리의 다른 글
Swift Builder 패턴 정리 (0) | 2024.06.04 |
---|---|
iOS Privacy Manifest (1) | 2024.04.29 |
IOS Firebase에서 데이터 가져오기 (0) | 2022.04.04 |
IOS Firebase에 데이터 추가 하기 (0) | 2022.04.02 |
IOS TableView 커스텀 (0) | 2022.03.31 |