Replies: 2 comments 3 replies
-
I believe that using CaseLet requires that all such views are CaseLets. |
Beta Was this translation helpful? Give feedback.
2 replies
-
Ha, I finally figured out what the problem was. IfLetStore(store.scope(state: \.$destination, action: Action.destination)) { store in
SwitchStore(store) { state in
switch state {
case .passcodeRequestAlert:
CaseLet(
state: /Destination.State.passcodeRequestAlert,
action: Destination.Action.passcodeRequestAlert,
content: TextFieldAlert.View.init
)
case .emailRequestAlert:
CaseLet(
state: /Destination.State.emailRequestAlert,
action: Destination.Action.emailRequestAlert,
content: TextFieldAlert.View.init
)
default:
EmptyView()
}
}
} doesn't compile but this, the correct syntax, naturally does: IfLetStore(store.scope(state: \.$destination, action: Action.destination)) { store in
SwitchStore(store) { state in
switch state {
case .passcodeRequestAlert:
CaseLet(
state: /Destination.State.passcodeRequestAlert,
action: Destination.Action.passcodeRequestAlert,
then: TextFieldAlert.View.init
)
case .emailRequestAlert:
CaseLet(
state: /Destination.State.emailRequestAlert,
action: Destination.Action.emailRequestAlert,
then: TextFieldAlert.View.init
)
default:
EmptyView()
}
}
} I wish Xcode/the Swift compiler had better error reporting. I wasted a lot of time and effort on this. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello :)
I have a custom view (
TextFieldAlert
) that behaves like an alert and participates in presentation like an alert but I can't use the.alert
view modifier for it because it's not driven byAlertState
. Since it participates in presentation like other presentations, it's part of theDestination
enum:MyScene
has the expected structure:This all compiles fine. Now, the view. This is what I think I should have:
but the compiler complains that it can't type-check the code in reasonable time so I tried to give it a little help to narrow down the source of the problem, like so:
This still baffles the compiler. I know the problem is with the
CaseLet
because commenting them all out and replacing them withEmptyView()
, as incompiles fine.
Can anyone please shed some light on what I'm doing wrong? As far as I can tell, all the types are correct.
Many thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions