Search code examples
iosswiftswiftuixcode-storyboard

SwiftUI TabView image size does not match LaunchScreen.storyboard UITabBar, unable to fix


I'm configuring my launchscreen storyboard to show a UITabBar that corresponds to rest of my app, built using SwiftUI. I haven't worked with auto layout or storyboards much.

This is the code I'm using to structure my TabView for the rest of my app, once loaded:

TabView {
    View1()
        .tabItem {
            Image(systemName: "pin.fill")
            Text("Monkeys")
        }
    ...

I haven't configured the UITabBar in the StoryBoard other than the image and title values.

When the app is launching (using LaunchScreen.storyboard UITabBar) the bar looks like this:

Tab view with larger images

When the app has loaded (using SwiftUI TabView)

Tab view with smaller images

How can I adjust the size of the images in StoryBoard to fit the rest of my app?

I've tried messing with the size inspector, but it doesn't affect the image size. I also can't seem to change the Image size of the TabView in SwiftUI using .frame().


Solution

  • A workaround I'm using is to manually set the font size of the SF Symbols using:

    Image(systemName: "flag.fill")
        .font(.system(size: 20))