세상을 더 편리하게
article thumbnail
[iOS / SwiftUI] Combine - CurrentValueSubject, PassthroughSubject
Swift/Apple Framework 2023. 5. 2. 17:29

저번 글에서 가볍게 Combine을 맛봤다. 이제는 실전으로 이것저것 써보자 Combine에서 쉽게 Publisher를 만드는 방법 중 하나는 CurrentValueSubject와 PassthroughSubject 이다. CurrentValueSubjcet Single Value를 감싸고 있는 Subject로써 Value 값이 변화면 Publish 한다! import Combine import SwiftUI struct CombineView: View { var vm = CombineViewModel() @State var anyCancellable = Set() @State var number = 0 var body: some View { VStack { Text("\(number)") .padding..

article thumbnail
[iOS / SwiftUI] Combine - 맛보기
Swift/Apple Framework 2023. 4. 21. 02:29

잡담 면접관) 컴바인 아세요? 나) 콤바인 타봤습니다. 면접관 ) 아니... Combine.... 요새 콤바인이 모르는 사람도 많을 것이다. 하지만 iOS 개발자로서 Combine에 대해서 알아보자. SwiftUI에 대해서 필수이기에!! (써놓고 무슨 개그인지 나도 모르겠다.) Combine 언제나 그랬든 우선 WWDC 소개 영상을 보고오는 것을 추천한다. Combine이 나온 이유는 데이터의 동기화가 주 목적이다. 그래서 그런지 속속 RxSwift의 빈자리를 대체하고 있다. 예제로 살펴보기 import Combine import SwiftUI struct CombineView: View { var vm = CombineViewModel() @State var anyCancellable = Set() @..

article thumbnail
[swift] Combine - Publisher & Subscriber
Swift/Swift 2022. 6. 26. 00:20

0. Combine이란? 애플에서 만든 Rxswift 같은 느낌? 손쉽게 설명하면 API통신 이걸로해야 손쉽게 가능하다? 한 번쯤은 시간이 들더라도 직접 설명을 듣고 오는게 좋긴합니다. Introducing Combine - WWDC19 - Videos - Apple Developer Combine is a unified declarative framework for processing values over time. Learn how it can simplify asynchronous code like networking,... developer.apple.com 1. Combine 프로토콜 Combine은 프레임워크이고 크게 5가지의 프로토콜이 있지만 이번에는 크게 2가지만 봅시다. - Publish..