Comments (11)
Issue persists on
swift-composable-architecture.git @ 1.5.0
swiftui-navigation.git @ 1.2.0
from swift-composable-architecture.
Hi @kdeda, can you please describe exactly what the problem is, and the steps to reproduce the problem. It is not clear right now.
Also, the project you have provided is quite complex. I would recommend trying to minimize it a great deal to make it easier for someone to help. Ideally it should be a project only involving legacyAlert
since that is what you are reporting a problem with.
from swift-composable-architecture.
Say you have a main FeatureA with a ViewA that has 2 child features (FeatureB and FeatureC)
FeatureA can trigger and handle its own .legacyAlert
Each child feature, FeatureB and FeatureC has its own view, ViewB and ViewC
Each child feature can trigger and handle their own .legacyAlert
When these 2 child features are integrated into the main FeatureA/ViewA
the management of .legacyAlert is interrupted.
The attached Xcode project should demonstrate the issue.
from swift-composable-architecture.
Also, the project you have provided is quite complex. I would recommend trying to minimize it a great deal to make it easier for someone to help. Ideally it should be a project only involving
legacyAlert
since that is what you are reporting a problem with.
I tried to make it as short as possible.
One Parent Feature with 2 Child Features using Switch and CaseLet to switch between features.
from swift-composable-architecture.
The top "Alert Me" Action goes to the FeatureA
The "Switch to Other" changes the current child view/feaure displayed
The bottom "Alert Me" Action goes to the FeatureB or FeatureC
from swift-composable-architecture.
@kdeda I'm pretty certain is a vanilla SwiftUI problem with the original iOS 13 alert
view modifier, which our library simply calls under the hood. One of the reasons why we have an "I have determined whether this bug is also reproducible in a vanilla SwiftUI project" checkbox for issues is that a lot of these bugs are not TCA-specific, and it's good to confirm that vanilla behavior works first.
If I recall, the general workaround is to throw alerts into parts of the view hierarchy where they are better behaved, e.g. inside a background
modifier, though you may want to search for vanilla solutions to the problem.
I'm going to close this for now, but if you do determine that the issue is reproducible only in TCA, please file a new issue that demonstrates it working in vanilla SwiftUI.
from swift-composable-architecture.
Thank you,
I forgot about the entire vanilla thing, since I rarely use it.
from swift-composable-architecture.
Also your previous code worked which lead me to believe these where related ...
from swift-composable-architecture.
Bingo moving around the location .legacyAlert is attached makes a difference.
So we have a workaround.
from swift-composable-architecture.
This is just a vanilla SwiftUI bug and is not related to TCA at all. Here is a simple reproduction of the problem in plain SwiftUI:
import SwiftUI
struct AppView: View {
@State var isAlertPresented = false
var body: some View {
VStack {
Button {
isAlertPresented = true
} label: {
Text("Alert Me")
}
Child1()
.border(.yellow)
}
.alert(isPresented: self.$isAlertPresented) {
Alert(title: Text("Hello"))
}
}
}
struct Child1: View {
@State var isAlertPresented = false
var body: some View {
VStack {
HStack {
Button {
self.isAlertPresented = true
} label: {
Text("Alert Me")
}
}
}
.alert(isPresented: self.$isAlertPresented) {
Alert(title: Text("Hello"))
}
}
}
The first alert button works but the second does not. But if you comment out the alert(isPresented:)
in the AppView
body then the second alert button will work, but of course the first will not.
It seems there is a SwiftUI bug on Mac that prevents multiple alert modifiers from working.
Since this is not an issue with our library I am going to convert it to a discussion.
from swift-composable-architecture.
Oh sorry, I didn't see @stephencelis's response!
from swift-composable-architecture.
Related Issues (20)
- Key path cannot refer to static member '....' Error HOT 1
- TCA holds on to state for longer than expected HOT 1
- Nested enum reducer error: cannot be constructed because it has no accessible initializers HOT 3
- ForEach<_StoreCollection<String, State, Action>, ObjectIdentifier, SingleTaskView>: the ID ObjectIdentifier(0x0000600003fe8b40) occurs multiple times within the collection, this will give undefined results! HOT 2
- Exhaustive testing @Shared variable mutating before action received HOT 2
- Extra Perception Warning HOT 1
- Non-main thread warning when calling using .refreshable from child @ViewBuilder property HOT 1
- Focus state doesn't work as described in the Building SyncUps Tutorial
- UUID creation not working as described in the SyncUps Tutorial HOT 2
- FileStorage persistence sometimes doesn't save data to disk. HOT 1
- Some texts not appearing correctly: body-8lumc
- SharedState with UserDefaults(suiteName:) not working properly HOT 3
- NSLock Memory leaks HOT 1
- CRASH: Could not cast value of type 'Observation.ObservationRegistrar' to 'Perception._PerceptionRegistrar' HOT 2
- SyncUps Tutorial: Removing attendee test does not pass HOT 1
- isPresented dependency: Incorrectly set to 'true' in tests. HOT 7
- Using both Sharing Data and backward-compatible NavigationLink seems to create some strange behaviors. HOT 1
- Incorrect Confirmation Dialog Presentation on iPad HOT 1
- Ios 17 TextField Binding Issue HOT 1
- Stack overflow crash on physical device HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swift-composable-architecture.