Giter Club home page Giter Club logo

Comments (5)

A320Peter avatar A320Peter commented on July 28, 2024

I did some experiment in a short trial and I have no idea why, but in the first 0-2.4 seconds it's possible to dismiss the alert however later it is not. I tested and it is receiving the onTapGesture event and the isPresenting changes to false but the alert stays on the screen no matter what regardless isPresenting false or true. If I tap or set isPresenting withing 2.4 seconds it works as expected.

from alerttoast.

A320Peter avatar A320Peter commented on July 28, 2024

In a new project I can not reproduce this behaviour so I am looking deeper into it.

from alerttoast.

elai950 avatar elai950 commented on July 28, 2024

It seems to works great on my side. Can you please submit the ObservableObject you're using?
I think that is where the problem.
Also, if RM is an ObservableObject, so the implementation should look like this:

Read this article about how to implement Alert Toast with ObservableObject correctly (the Bonus section):
How to toast an alert in SwiftUI

//Notice the dollar sign
.toast(isPresenting: $RM.pendingNotifications, duration: 3.0) {
   AlertToast(displayMode: .hud, type: .systemImage("exclamationmark.triangle.fill", Color.orange), title: "alert alert alert")
}

from alerttoast.

A320Peter avatar A320Peter commented on July 28, 2024

Thanks I have it now. Nothing is wrong with your code. In my case it's a complicated project and the observable object @Published variable was indirectly connected to a custom property wrapper. For some reason this value is not updating if the new value source is outside of the object.

I could reproduce it in a more simple way with an @AppStorage wrapper in iOS14. I don't have much experience with @AppStorage so probably it's a normal behaviour but modifying this from outside of the observable object also preventing the alert to disappear. Probably the change is not pushed down the hierarchy.

Thanks again for this framework, it's awesome.

from alerttoast.

elai950 avatar elai950 commented on July 28, 2024

Glad you found a solution 😊

from alerttoast.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.