Created
April 5, 2020 13:16
-
-
Save lawreyios/147dac2056df87a5842ef93c97e69c52 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private var isLoadingPublisher: AnyPublisher<Bool, Never> { | |
loginHandler.$isLoading | |
.receive(on: RunLoop.main) | |
.map { $0 } | |
.eraseToAnyPublisher() | |
} | |
private var isAuthenticatedPublisher: AnyPublisher<String, Never> { | |
loginHandler.$woofResponse | |
.receive(on: RunLoop.main) | |
.map { response in | |
guard let response = response else { | |
return "" | |
} | |
return response.url ?? "" | |
} | |
.eraseToAnyPublisher() | |
} | |
init() { | |
isLoadingPublisher | |
.receive(on: RunLoop.main) | |
.assign(to: \.isLoading, on: self) | |
.store(in: &disposables) | |
isAuthenticatedPublisher | |
.receive(on: RunLoop.main) | |
.assign(to: \.woofUrl, on: self) | |
.store(in: &disposables) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment