-
Notifications
You must be signed in to change notification settings - Fork 47
[chore]: move ViewEnvironment's EnvironmentValues key to the ViewEnvironment module #266
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
Conversation
|
||
import SwiftUI | ||
import WorkflowUI | ||
#if canImport(SwiftUI) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file move and the added canImport
here are the important bits—happy to revert the formatting changes if we'd prefer to avoid the churn!
Would |
I don't think so, but I might be missing something.
|
} | ||
import SwiftUI | ||
|
||
public extension EnvironmentValues { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hazy questions: will this impact clients that currently depend on both these targets? will the experimental library need to be bumped so it doesn't conflict with the newer ViewEnvironment implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this impact clients that currently depend on both these targets?
It seems unlikely since you'd already need to import ViewEnvironment
to work with the type of this environment value.
I think we should consider adding a @_exported import ViewEnvironment
to WorkflowSwiftUIExperimental
.
AFAIK the only client right now is MarketSwiftUI
and SquareDebugMenu
which I'm working with @square-tomb on and am happy to resolve an issues that come up in either repo as a result of this change! MarketSwiftUIExperimental
is still experimental so changes like this should be expected (right?).
will the experimental library need to be bumped so it doesn't conflict with the newer ViewEnvironment implementation?
Are these separate version numbers/releases?
I do think we'll want to bump both of them and update consumers of these frameworks together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these separate version numbers/releases?
Yep; details on that here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, that makes sense. because the definition of the extension moved but kept the same name, was just thinking whether both libraries would need a version bump to avoid ambiguous symbols (seems like they will, though perhaps it could be worked around with a module prefix).
|
||
public extension EnvironmentValues { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these separate version numbers/releases?
Yep; details on that here.
I talked to Westin out of band about this. The integration PR doesn't implement bridging so it's a little abstract to talk about. Realistically, there will be a need for bridging the I like the idea of keeping the |
Why?
Moving this environment value key to
ViewEnvironment
means that modules that aren't dependent on WorkflowUI (like MarketSwiftUI) are able to accessViewEnvironment
keys on the SwiftUIEnvironmentValues
. Market will use this key to access theMarketContext
on theViewEnvironment
which is bridged by either our Market SwiftUI Hosting Controller or the standard WorkflowUI SwiftUI Screen depending on context rather than having to manually bridge theMarketContext
in addition to theViewEnvironment
, and have the potential for theMarketContext
s in both environments to get out of sync.The integration in Market can be found here: https://github.com/squareup/market/pull/7763
Checklist
UI-5335