ARTICLE AD BOX
I'm working on a swiftui app that embeds a webview in a side-by-side resizable window with a preview in the other pane when the tablet is in landscape mode. The resizable pane works great, but I can't figure out how to get rid of this extra white space at the bottom of this view. I migrated the scrolling from the webview to swift in the preview just to get around this, because that view was having a similar issue, but that's a horrible hack which adds a lot of additional computation that wouldn't be needed if I could figure out how to get rid of this white space.
Also, I've tried applying a background to every view involved and I can't find which setting would even change the color of this extra space.
And when I hover over the webview in the safari dev tools it shows that the entire webview only goes to the point that the webview appears to end, the white space is not included.
This is what the split view looks like:
struct SplitViewEditorView: View { @StateObject private var previewContainer = MdxPreviewWebviewContainer( bounce: false, scrollEnabled: false ) @State private var shouldShowEditor: Bool = false @State private var previewHeight: CGFloat = 0 @State private var editorHeight: CGFloat = 0 @Environment(\.colorScheme) var colorScheme: ColorScheme @Binding var theme: WebViewTheme @Binding var editorThemeDark: CodeSyntaxTheme @Binding var editorThemeLight: CodeSyntaxTheme @Binding var editingNote: NoteModel? @Binding var editorKeymap: EditorKeymap let editorContainer: MdxEditorWebviewContainer init( theme: Binding<WebViewTheme>, editorThemeDark: Binding<CodeSyntaxTheme>, editorThemeLight: Binding<CodeSyntaxTheme>, editingNote: Binding<NoteModel?>, editorKeymap: Binding<EditorKeymap>, editorContainer: MdxEditorWebviewContainer ) { self._theme = theme self._editorThemeDark = editorThemeDark self._editorThemeLight = editorThemeLight self._editingNote = editingNote self._editorKeymap = editorKeymap self.editorContainer = editorContainer } var body: some View { GeometryReader { rect in SplitView( left: { MdxEditorWebview( url: Bundle.main.url( forResource: "index", withExtension: "html", subdirectory: "standalone_mdx_editor" )!, theme: $theme, editorThemeDark: $editorThemeDark, editorThemeLight: $editorThemeLight, editingNote: $editingNote, editorKeymap: $editorKeymap, viewportHeight: $editorHeight, container: editorContainer, ) .contentMargins(0) .padding(.bottom, 0) .ignoresSafeArea(edges: .bottom) // .onAppear { // editorContainer.requestDocumentSize() // } }, right: { ScrollView { MdxPreviewWebview( url: Bundle.main.url( forResource: "index", withExtension: "html", subdirectory: "standalone_mdx_preview" )!, theme: $theme, editorThemeDark: $editorThemeDark, editorThemeLight: $editorThemeLight, editingNote: $editingNote, editorKeymap: $editorKeymap, shouldShowEditor: $shouldShowEditor, viewportHeight: $previewHeight, container: previewContainer, ) .frame( height: previewHeight ) .padding(.bottom, 0) .ignoresSafeArea(edges: .bottom) } .frame( height: viewportHeight(rect: rect) ) }, onDragStart: { previewHeight = self.viewportHeight(rect: rect) previewContainer.setLoading(isLoading: true) editorContainer.setLoading(isLoading: true) }, onDragEnd: { previewContainer.setLoading(isLoading: false) editorContainer.setLoading(isLoading: false) previewContainer.requestDocumentSize() editorContainer.requestDocumentSize() } ) .onChange( of: editingNote, { if let note = editingNote { editorContainer.setInitialContent( note: note ) previewContainer.setInitialContent( note: note ) editorContainer.resetScrollPosition() } } ) .onChange( of: editorThemeDark, { editorContainer.emitEditorThemeEvent( theme: colorScheme == .dark ? editorThemeDark : editorThemeLight ) editorContainer.setEditorDarkTheme( theme: editorThemeDark ) } ) .onChange( of: editorThemeLight, { editorContainer.emitEditorThemeEvent( theme: colorScheme == .dark ? editorThemeDark : editorThemeLight ) editorContainer.setEditorLightTheme( theme: editorThemeLight ) } ) .onChange( of: editorKeymap, { editorContainer.setEditorKeymap( editorKeymap: editorKeymap ) } ) .disableAnimations() } } func viewportHeight(rect: GeometryProxy) -> CGFloat { if let h = UIScreen.current?.bounds.height { return h - rect.safeAreaInsets.top } else { return 0 } } }If anyone has any ideas, I'd be beyond grateful. I've spent two days migrating this from a single webview which was working flawlessly to this dual webview setup so I can parse the markdown text in swift instead of javascript for additional functionality that I intend to add, but this is really hanging me up.

