1

I have just started experimenting with SwiftUI and might still be thinking too much in terms of UIKit.

I would like to use a ScrollView for my content and put a toolbar on top of it. The ScrollView should cover the whole screen and its contents should shine through the toolbar's visual effect view.

I managed to get the basic toolbar working, including the blur effect. However, as I am using DynamicType, the height of the toolbar is only known at runtime. So I need to pass the current height of the toolbar view as the bottom edge inset of my ScrollView in order to be able to see all of the content of the ScrollView.

This is what I have so far:

ZStack {
    ScollView {
        Text("Some very long text that does not fit onto the screen…")
    }
    Toolbar()
        .edgesIgnoringSafeArea(.bottom)
}

How can I get the height of the toolbar and pass it to the bottom padding of the scroll view?

Paul
  • 999
  • 1
  • 12
  • 29
  • 1
    see https://stackoverflow.com/questions/59969911/programmatically-detect-tab-bar-or-tabview-height-in-swiftui/60136275#60136275 you can use the same approach for toolbar – user3441734 Feb 23 '20 at 21:35

0 Answers0