0

i am new in swiftUI and i want to make custom tab bar.I need to do this

I created this

Let's ignore effects and icons. I create new struct struct BottomPoligon: Shape for draw this Shape and after this i create new view TabBarView:

struct TabBarView: View {
  var body: some View {
    Spacer()

    Button {
        print("tap")
    } label: {
        ZStack {
            Circle()
                .fill(.clear)
                .border(.red, width: 2)
            Image(systemName: "barcode.viewfinder")
        }
    }
    .frame(width: 50, height: 50)

    HStack(alignment: VerticalAlignment.center) {
        Button {
            print("tap")
        } label: {
            Image(systemName: "person")
        }
        .frame(maxWidth: .infinity)

        Button {
            print("tap")
        } label: {
            Image(systemName: "list.bullet.circle.fill")
        }
        .frame(maxWidth: .infinity)
    }
    .frame(height: 50)

    .background(
        BottomPoligon(height: 50, cornerRadius: 15)
            // .fill(.gray)
            .stroke(Color.gray)
    )
}

}

But I don't know how to position the button in the middle. Do you have any idea how I can make this or maybe another approach to make this? Is my overall idea good or bad?

Stefan
  • 55
  • 8

0 Answers0