We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
At this moment for creating your own Observer you need to subclass Context and then implement your own logic, bit I think that it's bad approach.
Context
We need redesign this system's part to composition of objects. We should use type erasure technic and replace all classes with boxed structs.
For example like this:
public protocol AsyncIterator { associatedtype Value func next() -> Value } public struct AnyAsyncIterator<Value>: AsyncIterator { private let nested: BaseAsyncPager<Value> public init<Nested>(nested: Nested) where Nested: AsyncIterator, Nested.Value == Value { self.nested = AsyncPagerBox(nested: nested) } public func next() -> Value { return self.nested.next() } } private class AsyncPagerBox<Value, Nested>: BaseAsyncPager<Value> where Nested: AsyncIterator, Nested.Value == Value { let nested: Nested init(nested: Nested) { self.nested = nested } override func next() ->Value { return self.nested.next() } } private class BaseAsyncPager<Value>: AsyncIterator { func next() -> Value { preconditionFailure("\(self.self) \(#function) not implemented") } }
And then we will use observers like this:
func makeProcessing() -> AnyObserver<T> { let yourOwn = YourOwnObserver() return .init(nested: yourOwn) }
The text was updated successfully, but these errors were encountered:
avsmirnov567
No branches or pull requests
At this moment for creating your own Observer you need to subclass
Context
and then implement your own logic, bit I think that it's bad approach.We need redesign this system's part to composition of objects.
We should use type erasure technic and replace all classes with boxed structs.
For example like this:
And then we will use observers like this:
The text was updated successfully, but these errors were encountered: