Giter VIP home page Giter VIP logo

Comments (6)

johnpatrickmorgan avatar johnpatrickmorgan commented on June 29, 2024 3

Unfortunately I hit issues when trying to work around this issue. For example, I tried variations on this theme to avoid chaining cover and sheet on the same view:

.cover(
  isPresented: coverBinding,
  onDismiss: nil,
  content: { next }
)
.background(
  Text("").hidden()
    .sheet(
      isPresented: sheetBinding,
      onDismiss: nil,
      content: { next }
    )
)

That works around the issue on iOS 14.4 and below, but introduces a bug (even on iOS 15), where presenting a screen five layers of presentation deep fails with this error:

Attempt to present <_TtGC7SwiftUI29PresentationHostingControllerVS_7AnyView_: 0x7f9f3ef6c7d0> on <_TtGC7SwiftUI29PresentationHostingControllerVS_7AnyView_: 0x7f9f3f91af40> (from <_TtGC7SwiftUI19UIHostingControllerGVS_15ModifiedContentVVS_22_VariadicView_Children7ElementVS_24NavigationColumnModifier__: 0x7f9f3ef489d0>) which is already presenting <_TtGC7SwiftUI29PresentationHostingControllerVS_7AnyView_: 0x7f9f3ef5a6f0>

Instead, conditionally applying only one of the modifiers (#13) seems to work around the issue without introducing any regressions. Sadly, on iOS 14.4 and below, the Attempt to present error still occurs when the number of presentation layers reaches five, but I think that may be a limitation/bug of SwiftUI.

I'll continue to check the solution works well before merging...

from flowstacks.

tscdl avatar tscdl commented on June 29, 2024 2

Thanks for solving it!

from flowstacks.

johnpatrickmorgan avatar johnpatrickmorgan commented on June 29, 2024 1

Thanks for raising this issue, I'm glad you like the library. I understand there was a bug in SwiftUI in iOS 14 that is fixed in iOS 14.5 upwards:

Resolved Issues

  • You can now apply multiple sheet(isPresented:onDismiss:content:) and fullScreenCover(item:onDismiss:content:) modifiers in the same view hierarchy. (74246633)

I think it makes sense for this library to work around the issue; I'll have a look. Thanks!

from flowstacks.

zntfdr avatar zntfdr commented on June 29, 2024 1

Thank you for the investigation @johnpatrickmorgan 🙏🏻

from flowstacks.

johnpatrickmorgan avatar johnpatrickmorgan commented on June 29, 2024 1

The workaround #12 is now merged in v0.1.4, so both presentation styles should now work as expected on iOS versions below 14.5. I added availability checks to only employ the workaround when the iOS version was less than iOS 14.5. Thanks for raising this issue @tscdl!

from flowstacks.

tscdl avatar tscdl commented on June 29, 2024

Thanks for the quick reply!

Interesting. I just downloaded the 14.5 simulator runtime. In fact the problem disappears.

from flowstacks.

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.