Skip to content

Add Create effect that creates an asynchronous stream #71

New issue

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

Merged
merged 1 commit into from
Jan 16, 2024
Merged

Conversation

DevYeom
Copy link
Owner

@DevYeom DevYeom commented Jan 16, 2024

Related Issues 💭

Resolves #69

Description 📝

  • Add Create effect that creates an asynchronous stream.
  • Add unit tests for Create effect.

Additional Notes 📚

func reduce(state: inout State, action: Action) -> AnyEffect<Action> {
    switch action {
// ...
        case .twice:
            return .create { continuation in
                continuation.yield(.increment)
                continuation.yield(.increment)
                continuation.finish()
            }
// ...
    }
}

Checklist ✅

  • If it's a new feature, have appropriate unit tests been added?
  • If the changes affect existing functionality, please verify whether the above information has been appropriately described.

@DevYeom DevYeom self-assigned this Jan 16, 2024
@DevYeom
Copy link
Owner Author

DevYeom commented Jan 16, 2024

@sobabear

It would be good to refer to the test_createAsynchronouslyWithCompletionHandler case.

@DevYeom DevYeom merged commit 7db913f into main Jan 16, 2024
@DevYeom DevYeom deleted the create-effect branch January 16, 2024 14:17
@sobabear
Copy link
Contributor

sobabear commented Jan 17, 2024

@DevYeom Thank you for your quick fixs!
To be honest, create syntax is what I wanted mostly. Very brilliant decision!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sequence Finished unintentionally
2 participants