Skip to content
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

[feat]: give AnyWorkflow a Workflow conformance #184

Merged
merged 7 commits into from
Mar 7, 2023

Conversation

jamieQ
Copy link
Contributor

@jamieQ jamieQ commented Jan 24, 2023

Motivation

the fact that AnyWorkflow is not itself a Workflow creates confusion, and some awkwardness in some of our testing facilities. we'd like to add such a conformance to address these issues, and prevent consumers from having to write such type-erasing wrappers themselves.

Changes

  • add a Workflow conformance to AnyWorkflow
  • replace RootWorkflow with AnyWorkflow in WorkflowHostingController
  • expose the wrapped workflow for use in observability code
  • add/update tests

Checklist

  • Unit Tests
    - [ ] UI Tests n/a
    - [ ] Snapshot Tests (iOS only) n/a
    - [ ] I have made corresponding changes to the documentation n/a

@kyleve
Copy link
Contributor

kyleve commented Jan 25, 2023

cc @bencochran probably something you have opinions on

…ow-workflow-conformance

* origin/main:
  Expose AnyScreen.wrappedScreen for inspection (#193)
  Improve introspection for SignalProducerWorkflow actions (#192)
  [release]: bump version to 2.2.0 & remove separate concurrency version (#191)
  [feat]: add runtime observation API (#168)
  [chore]: refactor some internal actions to use existential any (#190)
  [fix]: use weak reference to internal sinks when vending to clients (#189)
  [feat]: add primary associated types to more protocols (#188)
  [chore]: pre major version bump cleanup (#187)
  [chore]: bump minimum deployment & swift versions (#186)
  Abstract ViewEnvironment to shared framework (#185)
renderingTransform: { $0 },
outputTransform: { $0 }
))
if let workflow = workflow as? AnyWorkflow<Rendering, Output> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to get the compiler to do this without having to perform the runtime check?

/// Wrapper around an AnyWorkflow that allows us to have a concrete
/// WorkflowHost without WorkflowHostingController itself being generic
/// around a Workflow.
fileprivate struct RootWorkflow<Rendering, Output>: Workflow {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no longer necessary

@jamieQ jamieQ marked this pull request as ready for review February 28, 2023 20:41
@jamieQ jamieQ requested a review from a team as a code owner February 28, 2023 20:41
@jamieQ jamieQ changed the title [wip]: give AnyWorkflow a Workflow conformance [feat]: give AnyWorkflow a Workflow conformance Feb 28, 2023
Copy link
Collaborator

@mjohnson12 mjohnson12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@jamieQ jamieQ merged commit b2b0790 into main Mar 7, 2023
@jamieQ jamieQ deleted the jquadri/exp-anyworkflow-workflow-conformance branch March 7, 2023 18:05
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.

3 participants