전체 글 (10) 썸네일형 리스트형 RxSwift.Single 구현에서의 `stopped` 변수의 의미 - RxSwift 6.6.0 기준으로 작성된 글입니다. RxSwift 구현을 살펴보던 도중 이해하기 힘들었던 로직에대한 기록. 문제: /** Subscribes `observer` to receive events for this sequence. - returns: Subscription for `observer` that can be used to cancel production of sequence elements and free resources. */ public func subscribe(_ observer: @escaping (SingleEvent) -> Void) -> Disposable { var stopped = false return self.primitiveSequence.asObse.. Test Double 특징 다음과 같이 구조체와 프로토콜이 존재할 때, struct Post { let id: UUID let title: String } protocol PostRepositoryProtocol { var postCount: Int { get } func savePost(_ post: Post) throws -> Bool func getPost(by id: UUID) throws -> Post } Dummy - 매개변수 목록을 채우기 위한 빈 객체 - 사용되지 않을것이므로 프로토콜 요구 사항만 충족 final class PostRepositoryDummy: PostRepositoryProtocol { var postCount: Int = 0 // 사용되지 않음 // 호출되지 않음 func savePost(_ po.. 이전 1 2 다음