Skip to content

Commit 84670b7

Browse files
committed
Finish ScreenLoading basic implementation
1 parent 82e836f commit 84670b7

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

Sources/ScreenDataNavigation/ScreenDataNavigation.swift

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,21 @@ public protocol ScreenLoading {
149149
func load(withProvider provider: ScreenProviding) -> AnyPublisher<[SomeScreen], Error>
150150
}
151151

152-
//// MARK: ScreenLoading Basic Implementation [WIP]
153-
//@available(iOS 13.0, OSX 10.15, *)
154-
//extension SomeScreen: ScreenLoading {
155-
//
156-
// public func load(withProvider provider: ScreenProviding) -> AnyPublisher<[SomeScreen], Error> {
157-
// Publishers.MergeMany(
158-
// destinations
159-
// .filter { $0.type == .screen }
160-
// .map { destination in
161-
// provider.screen(forID: destination.toID)
162-
// }
163-
// )
164-
// }
165-
//}
152+
// MARK: ScreenLoading Basic Implementation
153+
@available(iOS 13.0, OSX 10.15, *)
154+
extension SomeScreen: ScreenLoading {
155+
156+
public func load(withProvider provider: ScreenProviding) -> AnyPublisher<[SomeScreen], Error> {
157+
Publishers.MergeMany(
158+
destinations.filter { $0.type == .screen }
159+
.map { destination in
160+
provider.screen(forID: destination.toID)
161+
}
162+
)
163+
.collect()
164+
.eraseToAnyPublisher()
165+
}
166+
}
166167

167168
public extension SomeView {
168169
var destinations: [Destination] {

0 commit comments

Comments
 (0)