본문 바로가기

seong_hye, the developer

검색하기
seong_hye, the developer
프로필사진 seong_hye

  • My P_Life (115)
    • JAVA (3)
    • 알고리즘 코드 (3)
    • IOS (95) N
      • SwiftUI (23) N
      • UIKit (12)
      • Error (6)
    • Infomation (6)
      • Firebase (1)
      • Git (1)
    • Daily Life (3)
Guestbook
Notice
Recent Posts
Recent Comments
Link
«   2025/08   »
일 월 화 수 목 금 토
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
31
Tags
  • 고차함수
  • protocol
  • IOS
  • class
  • 화면전환
  • list
  • mvvm
  • uikit
  • segue
  • array
  • struct
  • Git
  • PushNotification
  • apns
  • escaping
  • Refresh
  • http
  • SWIFT
  • ScrollView
  • self
  • Animation
  • viewlifecycle
  • singleton
  • Switch
  • SWIFTUI
  • Observer
  • NotificationCenter
  • calendar
  • error
  • 글또
more
Archives
Today
Total
관리 메뉴
  • 글쓰기
  • 방명록
  • RSS
  • 관리

목록stateobject (1)

seong_hye, the developer

Swift) StateObject, ObservableObject, EnvironmentObject

모두 데이터와 뷰 상태를 연결하기 위한 속성 래퍼이다이들은 각각의 역할과 적용 범위, 생명주기가 다르기 때문에 구분해서 사용하는 것이 중요하다 📘 ObservableObjectSwiftUI에서 클래스 기반 상태를 뷰와 연결해주는 핵심 프로토콜뷰가 해당 객체를 구독하고 내부 값이 바뀌면 뷰가 자동으로 업데이트됨주로 크래스를 기반으로하는 뷰모델을 만들 때 사용함 🔹예시// 상태 객체 선언class CounterModel: OBsrvableObject { @Published var count = 0}// 뷰에서 연결struct TestView: View { @ObservedObject var viewModel: CounterModel var body: some View { VStack { ..

IOS 2022. 11. 2.
Prev 1 Next

Blog is powered by kakao / Designed by Tistory

티스토리툴바