DynamicOverlay
DynamicOverlay copied to clipboard
Side attached overlays
A common use case for overlays is to have them have a fixed width and be attached to the side on a regular-width device, such as an iPad or landscape iPhone. This is true for Apple Maps.
Does this library currently support this configuration?
Very impressed with the library 👍🏻
I know the question is a few months old, but I was able to achieve this by getting the current size class from the environment, and then adding padding to the overlay view. Here's a very basic example, but I can expand on it a little more if that would be helpful.
struct MyOverlayView: View {
@Environment(\.horizontalSizeClass) var horizontalSizeClass
var items = Item.makeItems(50)
var body: some View {
GeometryReader { geometry in
VStack {
Text("Header")
List {
ForEach(items) {
Text($0.title)
}
}
.drivingScrollView()
}
.padding(.trailing, horizontalSizeClass == .regular ? geometry.size.width-375 : 0)
}
}
}