Comments (16)
@wangchaodong I see. With config.presentationContext = .window(windowLevel: .normal)
, I would say that SwiftMessages is working as designed. The global SwiftMessages instance has no way of knowing your intentions, so it would not dismiss the message on your behalf. What you can do is use a local SwiftMessages instance in your view controller. When it gets deinit
ed, it will automatically dismiss.
See here:
from swiftmessages.
This isn't a problem other people are having, so my initial guess is you're doing something unusual in your code. However, since I don't have your code, there's not much I can do. Is there any way you could attach a sample project that reproduces the problem?
Otherwise, I can help you step through the SwiftMessages code on your end to understand what is happening. My first suggestion is to put a break point on line 607 of SwiftMessages.swift
:
try current.show { completed in
If this line is not being reached, it means that SwiftMessages decided not to display your message, maybe due to de-duplication logic. Otherwise, something is going wrong with the view presentation in Presenter.swift
. Either way, we should be able to step through the code and get to the line of code where something goes wrong.
Hope that helps.
from swiftmessages.
Okay Thank you for your reply. I will Check
from swiftmessages.
This isn't a problem other people are having, so my initial guess is you're doing something unusual in your code. However, since I don't have your code, there's not much I can do. Is there any way you could attach a sample project that reproduces the problem?
Otherwise, I can help you step through the SwiftMessages code on your end to understand what is happening. My first suggestion is to put a break point on line 607 of
SwiftMessages.swift
:try current.show { completed inIf this line is not being reached, it means that SwiftMessages decided not to display your message, maybe due to de-duplication logic. Otherwise, something is going wrong with the view presentation in
Presenter.swift
. Either way, we should be able to step through the code and get to the line of code where something goes wrong.Hope that helps.
I got the same issue here.
the first time I call SwiftMessages.show to show a view, it works perfectly,
After I hide this view with SwiftMessages.hideAll(), I change the rootViewController of the Window. and then I go back to call SwiftMessages.show to show my view, it does't work.
I had try with config.ignoreDuplicates = false , it does't work.
I debug and found that the self._current == nil is false. I'm not sure how to figure out.
from swiftmessages.
This isn't a problem other people are having, so my initial guess is you're doing something unusual in your code. However, since I don't have your code, there's not much I can do. Is there any way you could attach a sample project that reproduces the problem?
Otherwise, I can help you step through the SwiftMessages code on your end to understand what is happening. My first suggestion is to put a break point on line 607 ofSwiftMessages.swift
:try current.show { completed inIf this line is not being reached, it means that SwiftMessages decided not to display your message, maybe due to de-duplication logic. Otherwise, something is going wrong with the view presentation in
Presenter.swift
. Either way, we should be able to step through the code and get to the line of code where something goes wrong.
Hope that helps.I got the same issue here. the first time I call SwiftMessages.show to show a view, it works perfectly, After I hide this view with SwiftMessages.hideAll(), I change the rootViewController of the Window. and then I go back to call SwiftMessages.show to show my view, it does't work.
I had try with config.ignoreDuplicates = false , it does't work.
I debug and found that the self._current == nil is false. I'm not sure how to figure out.
I found my bug and solve it, I didnot hidAll SwiftMessage show's view befour change the rootViewController of the Window, and the view show by SwiftMessage cannot see because rootVC of window changed, and that's need to be carefully. But after SwiftMessage hide all and then to change rootVC of window, SwiftMessage works well.
from swiftmessages.
@wangchaodong you're right. Orphaned message views can block the queue. This can happen if you remove the view hierarchy before the message is hidden. It is uncommon and hasn't come up in a long time, so I'd forgotten about it. I put together a PR that attempts to prevent orphaned message views from blocking the queue.
@wangchaodong @keshavgesu1 please try the changes in #517 and let me know if it resolves the issue.
from swiftmessages.
I had try with #517, and it work no different with master branch.
if I did not hide swiftmessage shows view before I change rootVC of Window, it still not work.
I think you should catch it in a demo. easily show a swiftmessage view, and the change rootVC of Window, and try show swiftmessage view again. hope it can help you.
from swiftmessages.
@wangchaodong well, I think it makes more sense for you to supply a sample project since you are the one experiencing the issue and I only have a vague description of the steps. In any case, I put one together that replaces the root view controller and it is working correctly. Maybe you could modify this project to reproduce your issue?
from swiftmessages.
@wangchaodong well, I think it makes more sense for you to supply a sample project since you are the one experiencing the issue and I only have a vague description of the steps. In any case, I put one together that replaces the root view controller and it is working correctly. Maybe you could modify this project to reproduce your issue?
In your demo, it works, but not such perfect.
In my project , my presentationContext is set to .window, So I try to replace
config.presentationContext = .viewController(self)
with
config.presentationContext = .window(windowLevel: .normal)
and then the cardView will not hide. So maybe that's the point you need to take care.
hope it can help you.
from swiftmessages.
Closing due to no response from OP
from swiftmessages.
Hi, I am getting the same issue after updating the pods, Swift message with configuration is in the memory, however, not showing, Attaching a screenshot, and this is also happening after changing the root view controller.
Basically, the swift message window is beneath the UIWindow
from swiftmessages.
Hi, I am getting the same issue after updating the pods, Swift message with configuration is in the memory, however, not showing, Attaching a screenshot, and this is also happening after changing the root view controller.
Basically, the swift message window is beneath the UIWindow
Is my above reply missing something?
from swiftmessages.
Yes, it is not mentioned why on changing root vc the presenter is not showing. it's hiding beneath the window, please check above attached screenshot.
from swiftmessages.
You have to hide the message before changing the root view controller
from swiftmessages.
Yes I am hiding the message
from swiftmessages.
This isn't a normal issue and I don't quite understand what you're doing to get into this state. I need detailed reproduction steps or a sample project. Maybe you could take the sample project I attached above modify it to reproduce your issue?
from swiftmessages.
Related Issues (20)
- Signing for "SwiftMessages-SwiftMessages" requires a development team HOT 2
- Cannot find type 'WindowScene' in scope HOT 5
- SwiftMessages disable buttons tap event when show with presented view HOT 3
- How to send swift email
- Crash during animation HOT 2
- Can you add a function to display priority based on weight? HOT 5
- Identifiable collision HOT 1
- No such module 'SwiftMessages' HOT 2
- Crash while clicking two times to hide the presenting controller HOT 3
- SwiftUI View ignoresSafeArea HOT 4
- SwiftMessages custom CenteredView extends to the screen's full height HOT 3
- How can I show multiple alert? HOT 2
- Safe area insets are not respected when setting overrideUserInterfaceStyle on a MessageView in iOS 17 HOT 3
- How do I show a message that appears above the keyboard, when the keyboard is already visible? HOT 5
- Xcode warnings in two swift files HOT 2
- window being accessed from background thread when dequeueNext is called HOT 12
- EventListeners not called ? HOT 5
- Support for SwiftUI Mac OS HOT 1
- SwiftUI message shown under navigation bar is clipped at top 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 swiftmessages.