Advertisement
andreashorberg

RefreshButtonModel take 1

Oct 15th, 2019
1,316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.38 KB | None | 0 0
  1. import Combine
  2.  
  3. class RefreshButtonModel: ObservableObject {
  4.     @Published var isRotating: Bool = false
  5.     private var subscriptions: Set<AnyCancellable> = []
  6.  
  7.     init(loadingPublisher: AnyPublisher<Bool, Never>) {
  8.         loadingPublisher
  9.             .sink { isLoading in
  10.                 self.isRotating = isLoading
  11.         }
  12.         .store(in: &subscriptions)
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement