Created
April 21, 2023 16:46
-
-
Save exceptionpilot/69d83a47bc6ad7823be9d6ab61ad49dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// TabBar.swift | |
// WhatsInMyBag | |
// | |
// Created by Sebastian Zängler on 21.04.23. | |
// | |
import SwiftUI | |
struct TabBar: View { | |
@State var selected = 0 | |
var body: some View { | |
HStack (spacing: 60) { | |
Image(systemName: "house") | |
.foregroundColor(.secondary) | |
.font(.system(size: selected == 0 ? 40 : 20)) | |
.shadow(radius: 100) | |
.onTapGesture { | |
selected = 0 | |
}.animation(.easeInOut) | |
Image(systemName: "magnifyingglass") | |
.foregroundColor(.secondary) | |
.font(.system(size: selected == 1 ? 40 : 20)) | |
.shadow(radius: 50) | |
.onTapGesture { | |
selected = 1 | |
}.animation(.easeInOut) | |
} | |
.frame(maxWidth: .infinity) | |
.frame(height: 80, alignment: .top) | |
.padding(.top, 40) | |
.frame(maxHeight: .infinity, alignment: .bottom) | |
.ignoresSafeArea() | |
} | |
} | |
struct TabBar_Previews: PreviewProvider { | |
static var previews: some View { | |
TabBar() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment