Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions FakeNFT/Models/Network/Nft.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import Foundation
import SwiftUI

struct Nft: Decodable {
struct Nft: Identifiable, Hashable, Codable {
let id: String
let images: [URL]
let name: String
let images: [String]
let description: String
let rating: Int
let price: Double
let author: String
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "6ae4f0cf45e2cd5c9240b70315e8ba1b67613527.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
30 changes: 16 additions & 14 deletions FakeNFT/Scenes /ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,26 @@ import SwiftUI

struct ContentView: View {

@State private var isTabBarHidden = false
@State private var selectedTab = Tab.profile
@StateObject private var cartViewModel = CartViewViewModel()

var body: some View {
ZStack(alignment: .bottom) {
NavigationStack {
TabView(selection: $selectedTab) {
Text("Profile")
.tag(Tab.profile)
Text("Catalog")
.tag(Tab.catalog)
Text("Cart")
.tag(Tab.cart)
Text("Statistics")
.tag(Tab.statistics)
}
TabView(selection: $selectedTab) {
Text("Profile")
.tag(Tab.profile)

Text("Catalog")
.tag(Tab.catalog)

Text("Cart")
.tag(Tab.catalog)

Text("Statistics")
.tag(Tab.statistics)
}
if !isTabBarHidden {
TabBarView(selectedTab: $selectedTab)
}
}
Expand Down
9 changes: 9 additions & 0 deletions FakeNFT/Scenes /TabBar/TabBarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ struct TabBarView: View {
}
}
.padding(.horizontal)
.onAppear {
setupTabBarAppearance()
}
}

private func tabItemView(for tab: Tab) -> some View {
Expand All @@ -35,6 +38,12 @@ struct TabBarView: View {
}
.frame(maxWidth: .infinity)
}
private func setupTabBarAppearance() {
let tabBarAppearance = UITabBarAppearance()
tabBarAppearance.configureWithOpaqueBackground()
tabBarAppearance.shadowColor = .clear
UITabBar.appearance().standardAppearance = tabBarAppearance
}
}

#Preview {
Expand Down
4 changes: 4 additions & 0 deletions FakeNFT/Scenes /ViewModifier/NavigationBarStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,21 @@ struct NavigationBarStyle: ViewModifier {
let title: String?
let backButtonHidden: Bool
let filterButtonHidden: Bool
let isTabBarHidden: Binding<Bool>?
var filterButtonTapHandler: () -> Void?

// MARK: - Initializers

init(title: String?,
backButtonHidden: Bool,
filterButtonHidden: Bool,
isTabBarHidden: Binding<Bool>? = nil,
filterButtonTapHandler: @escaping () -> Void?
) {
self.title = title
self.backButtonHidden = backButtonHidden
self.filterButtonHidden = filterButtonHidden
self.isTabBarHidden = isTabBarHidden
self.filterButtonTapHandler = filterButtonTapHandler
setupNavigationBarAppearance()
}
Expand Down Expand Up @@ -55,6 +58,7 @@ struct NavigationBarStyle: ViewModifier {

private var backButton: some View {
Button {
isTabBarHidden?.wrappedValue = false
dismiss()
} label: {
Image("backButton")
Expand Down