Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

RF-9688 - [refactor]: Remove ReactiveSwift from Workflow public interface#360

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
mjohnson12 wants to merge1 commit intomain
base:main
Choose a base branch
Loading
frommarkj/reactive_swift_removal

Conversation

@mjohnson12
Copy link
Collaborator

@mjohnson12mjohnson12 commentedJul 17, 2025
edited
Loading

This is a breaking change to Workflow that removes ReactiveSwift from the public interface of Workflow and Workflow UI.
There are 3 changes:

  1. InWorkflowHostrendering is now a read only property of the latest rendering.
  2. InWorkflowHostrenderingPublisher is a Combine publisher that publishes renderings. In searching the register code base there were very few places we were using aSignal/SignalProducer from therendering property. The plan would be to change those consumers to userenderingPublisher andsink.
  3. InWorkflowHostoutput has been renamed tooutputPublisher. It is now a CombinePublisher that can be used to subscribe to Workflow output. Per Andrew's suggestion I added a new protocolWorkflowOutputPubisher that exposes theoutputPublisher. Theoutput property is used in a lot of places in register. To fix those places I added an extension onWorkflowOutputPubisher in WorkflowReactiveSwift that re-exposesoutput as aSignal. All the places that useoutput will just need to import WorkflowReactiveSwift and they will continue to work.
  4. WorkflowHostingController in WorkflowUI now implementsWorkflowOutputPublisher. Consumers usingoutput will just need to import WorkflowReactiveSwift to continue to work.

Note: Even though this removes ReactiveSwift as a dependency from the Workflow and WorkflowUI targets the Workflow Package has to continue to have ReactiveSwift as a dependency since it's used by WorkflowReactiveSwift. But because register uses bazel if you import Workflow/WorkflowUI in your module it does not import (directly or transitively) ReactiveSwift.

Checklist

  • Unit Tests
  • UI Tests
  • Snapshot Tests (iOS only)
  • I have made corresponding changes to the documentation

@mjohnson12mjohnson12force-pushed themarkj/reactive_swift_removal branch 8 times, most recently frombd84d2e to13f4761CompareJuly 17, 2025 18:11
@mjohnson12mjohnson12 marked this pull request as ready for reviewJuly 31, 2025 14:19
@mjohnson12mjohnson12 requested review froma team ascode ownersJuly 31, 2025 14:20
@mjohnson12mjohnson12 changed the titleRemove ReactiveSwift from Workflow public interfaceRF-9688 - Remove ReactiveSwift from Workflow public interfaceJul 31, 2025
@mjohnson12mjohnson12force-pushed themarkj/reactive_swift_removal branch 2 times, most recently fromf7e5fc3 to59bcc8bCompareAugust 19, 2025 19:03
Comment on lines 33 to 38
publicprotocolWorkflowOutputPublisher{
associatedtypeOutput

varoutputPublisher:AnyPublisher<Output,Never>{get}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

is this protocol necessary? what's the benefit over just extending the concrete type directly?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

It allows us to add the output signal on bothWorkflowHost andWorkflowHostingController by just extending the protocol in WorkflowReactiveSwift. This was a suggestion in Andrew's feedback.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah gotcha (sorry i missed the existing convo). so the tradeoff here is adding a 'public' protocol to which we really only want 2 specific things to conform so that we don't need to makeWorkflow orWorkflowUI depend onReactiveSwift – is that right? mostly out of curiosity – is it possible to define the protocol withpackage visibility? that seems like it might be a slightly more accurate definition (assuming it works and integrates successfully into the monorepo).

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Before I had extensions onWorkflowHost andWorkflowHostingController which required a new module just to put the extension onWorkflowHostingController since I could not put it inWorkflowReactiveSwift since it does not know aboutWorkflowUI. Andrew's idea was use a protocol and drop the extension inWorkflowReactiveSwift so we don't need to have an additional module and the reactive swift stuff stays inWorkflowReactiveSwift.
I can look into thepackage visibility to see if that is possible.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

If I make the protocolpackage visibility then theoutput property can't be public:
Property cannot be declared public because its type uses a package type

Copy link
Contributor

@jamieQjamieQAug 25, 2025
edited
Loading

Choose a reason for hiding this comment

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

ah, makes sense – thanks for checking. maybe just as a matter of hygiene we should make the protocol underscored (_WorkflowOutputPublisher) and add comments regarding its purpose, since it doesn't seem like it's actually intended to be 'really' public.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Sounds good.

Copy link
CollaboratorAuthor

@mjohnson12mjohnson12Aug 25, 2025
edited
Loading

Choose a reason for hiding this comment

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

Pushed up the added underscore.

@mjohnson12mjohnson12force-pushed themarkj/reactive_swift_removal branch from96bbd04 to7ce7d31CompareAugust 21, 2025 14:16
letrootNode:WorkflowNode<WorkflowType>

privateletmutableRendering:MutableProperty<WorkflowType.Rendering>
privateletrenderingSubject:CurrentValueSubject<WorkflowType.Rendering,Never>
Copy link
Contributor

Choose a reason for hiding this comment

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

slightly inclined to split the storage for the property vs the observer, since that will give us the most control over when the 'outside world' sees the update. e.g.

var rendering: Renderinglet renderingSubject = PassThroughSubject<Rendering, Never>()

any thoughts on that? i guess one thing that would be different is that the old way (and presumably using a CVS) would have some baked-in synchronization mechanism over the underlying value. in theory this stuff should be main-thread-only though.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

We currently are using a ReactiveSwift MutableProperty which does have an internal lock. Yes CurrentValueSubject does have some baked in serialization mechanism albeit without Apple documentation on what that is. Since we can't enforce someone reading the rendering value on the main thread I'm inclined to use the CurrentValueSubject since it's about as close as we can get as a Combine version of what we have now.
If we split the storage for the property out we could always lock around getting/setting it so I'm not against doing that but I think CurrentValueSubject should work for how we are using it.

Comment on lines 6 to 25
publicvaroutput:Signal<Output,Never>{
Signal.unserialized{ observer, lifetimein
letcancellable= outputPublisher.sink(
receiveCompletion:{ completionin
switch completion{
case.finished:
observer.sendCompleted()

case.failure(let error):
observer.send(error: error)
}
},
receiveValue:{ valuein
observer.send(value: value)
}
)
lifetime.observeEnded{
cancellable.cancel()
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

let's plan on testing this fairly thoroughly. i'm never certain what the exact lifetime semantics are for the ReactiveSwift stuff personally...

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Agreed. This has been in use in the ReactiveSwift bridging module for a while.

Comment on lines 33 to 38
publicprotocolWorkflowOutputPublisher{
associatedtypeOutput

varoutputPublisher:AnyPublisher<Output,Never>{get}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

ah gotcha (sorry i missed the existing convo). so the tradeoff here is adding a 'public' protocol to which we really only want 2 specific things to conform so that we don't need to makeWorkflow orWorkflowUI depend onReactiveSwift – is that right? mostly out of curiosity – is it possible to define the protocol withpackage visibility? that seems like it might be a slightly more accurate definition (assuming it works and integrates successfully into the monorepo).

@jamieQ
Copy link
Contributor

let's also include in the commit message something that clearly indicates this is a breaking change to the public API, a la the guidelines specified via 'conventional commits'

mjohnson12 reacted with thumbs up emoji

@mjohnson12mjohnson12force-pushed themarkj/reactive_swift_removal branch from7ce7d31 to99238f0CompareAugust 22, 2025 15:25
@mjohnson12mjohnson12 changed the titleRF-9688 - Remove ReactiveSwift from Workflow public interfaceRF-9688 - [refactor]: Remove ReactiveSwift from Workflow public interfaceAug 22, 2025
@mjohnson12
Copy link
CollaboratorAuthor

let's also include in the commit message something that clearly indicates this is a breaking change to the public API, a la the guidelines specified via 'conventional commits'

I've updated the commit message

@mjohnson12mjohnson12force-pushed themarkj/reactive_swift_removal branch from99238f0 tof9c40fdCompareAugust 25, 2025 17:01
@mjohnson12mjohnson12force-pushed themarkj/reactive_swift_removal branch fromf9c40fd to2fee5aaCompareSeptember 11, 2025 16:46
@mjohnson12mjohnson12force-pushed themarkj/reactive_swift_removal branch from2fee5aa to101286aCompareSeptember 30, 2025 14:34
@robmaceachern
Copy link
Member

@mjohnson12 (PR cleanup) Does this need fresh reviews from folks, or should it be converted to a draft for now?

@mjohnson12
Copy link
CollaboratorAuthor

@mjohnson12 (PR cleanup) Does this need fresh reviews from folks, or should it be converted to a draft for now?

I need to rebase this to pickup Jamie's latest changes and then add some more tests but after the rebase I would like reviews on the changes

@mjohnson12mjohnson12force-pushed themarkj/reactive_swift_removal branch 2 times, most recently from1ff4a45 tod8f8562CompareOctober 15, 2025 19:26
@watt
Copy link
Collaborator

watt commentedDec 8, 2025

Doing some housekeeping, converting this back to draft to clear it out of review queues for now. Feel free to move it out of draft when you're ready for reviews again!

@wattwatt marked this pull request as draftDecember 8, 2025 22:30
BREAKING CHANGE: This changes the public interface of WorkflowHost and WorkflowHostingController.The rendering property is now a read only property of the RenderingThere is a new renderingPublisher property for a Combine publisher for renderingsThe output Signal property has been removed and moved to an extension in WorkflowReactiveSwiftThere is a new outputPublisher property for a Combine publisher for output
@mjohnson12mjohnson12force-pushed themarkj/reactive_swift_removal branch fromd8f8562 toeb185a5CompareDecember 18, 2025 17:49
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@wattwattwatt left review comments

@jamieQjamieQjamieQ left review comments

+1 more reviewer

@blevasseur-blockblevasseur-blockblevasseur-block left review comments

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@mjohnson12@jamieQ@robmaceachern@watt@blevasseur-block

[8]ページ先頭

©2009-2025 Movatter.jp