Member-only story

Morphing Tab Bar

Jean-Marc Boullianne

Jean-Marc Boullianne
1 min readMar 7, 2020

Welcome

Thank you for stopping by! For our members of TrailingClosure, we’d like to specially provide you all with a custom TabBar we created. Feel free to use in your projects! If you do, tweet us @TrailingClosure to be featured on our feed!

Using It In Your Project

import SwiftUI

struct ContentView: View {

var body: some View {
MorphingTabBar(flipped: false) {[
AnyView(
Rectangle()
.foregroundColor(Color.white)
.morphTabItem(Image(systemName: "tv"))
),
AnyView(
Rectangle()
.foregroundColor(Color.white)
.morphTabItem(Image(systemName: "folder"))
),
AnyView(
Rectangle()
.foregroundColor(Color.white)
.morphTabItem(Image(systemName: "slider.horizontal.3"))
),
AnyView(
Rectangle()
.foregroundColor(Color.white)
.morphTabItem(Image(systemName: "lock"))
)
]}
.edgesIgnoringSafeArea(.top)
}
}

The MorphingTabBar accepts an array of AnyViews which is the content of your tabs. Provide the images to your tab bar by including the .morphTabItem(Image(systemName: "folder")) after a view, as shown above.

The code you need to include in your project is attached here for download!

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

No responses yet

Write a response