Comments (2)
I came to a partial solution for this an PRed it with #73, but that strictly supports cases where the view that's presented in the popover has its own properties defined with @State
, @StateObject
, @Binding
, @ObservedObject
, @Environment
, or @EnvironmentObject
properties
It seems that supporting the specific case originally laid out in this issue is pretty non-trivial, because the popover is rendered in its own UIHostingController
, which means it's effectively an entirely different context from the code that presents the popover. This means that even though the code that presents the popover knows that the popover's view needs to be updated, the hosting controller that actually renders the popover has no clue
That has proved a rather difficult challenge to overcome. I've tried to no avail:
- Hiding and re-presenting the popover on every render
- Forcing the
PopoverGestureContainer
to re-lay out its subviews on every render - Creating a new
PopoverGestureContainer
and re-setting the popover'sUIHostingController
'srootView
on every render
It seems that SwiftUI needs to expose an API for updating a UIHostingController
whenever a related SwiftUI host re-renders its view, which doesn't seem to currently be possible. I wonder if it might be possible if we add the popover's hosting controller as a child of the source hosting controller, but that would require SwiftUI exposing a proper way to get a reference to the source hosting controller. Would love to see someone prove me wrong on either of those, though
from popovers.
I wonder if it might be possible if we add the popover's hosting controller as a child of the source hosting controller, but that would require SwiftUI exposing a proper way to get a reference to the source hosting controller.
Presenting the popover has been one of the hardest challenges since the start of this library. At first I was adding a new UIWindow
, but that stole the status bar color (#5). And now it's been so long since I edited the code that I forgot what exactly I'm doing... so I'm working on a complete refactor right now
from popovers.
Related Issues (20)
- How to make tap outside only dismiss the popover? HOT 1
- Example: Conflict with `UIKit` Name with Xcode 15/iOS 17
- Scroll not supported inside Templates.Menu?
- Is it possible to disable the ability to drag the popover on the screen? HOT 1
- Create reusable Attributes
- Support watchOS
- iPad SwiftUI Scrollview Row
- Support MacOS
- Update popover position when keyboard is shown HOT 1
- Arrow seperated from bubble -> arrowSide: .bottom(.mostCounterClockwise) HOT 1
- New release date
- How to show popover within the View not Window ? HOT 1
- مهم نمط المطور
- Popover doesn't show sometime in LazyVstack or LazyVGrid
- how to dismiss popover when parent view will disappear HOT 3
- check mark in uikit
- want to use Templates.BackgroundWithArrow but can't because its initializer is internal
- Problem using a custom number picker as a .popover HOT 1
- Download Examples
- Download Examples on iPad
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 popovers.