From db12fca1c3ae141a3e45bd6bf057a220ae2e4730 Mon Sep 17 00:00:00 2001 From: cheykrym Date: Wed, 13 Aug 2025 01:11:14 +0300 Subject: [PATCH] topbar update --- Shared/Components/TopBarView.swift | 2 +- Shared/Views/Tab/MainView.swift | 49 +++++++++++-------- yobble.xcodeproj/project.pbxproj | 2 +- .../xcschemes/xcschememanagement.plist | 4 +- 4 files changed, 32 insertions(+), 25 deletions(-) diff --git a/Shared/Components/TopBarView.swift b/Shared/Components/TopBarView.swift index 4426740..c2c5f73 100644 --- a/Shared/Components/TopBarView.swift +++ b/Shared/Components/TopBarView.swift @@ -56,7 +56,7 @@ struct TopBarView: View { .padding() .frame(height: 50) // Стандартная высота для нав. бара - Divider() +// Divider() } .background(Color(UIColor.systemBackground)) } diff --git a/Shared/Views/Tab/MainView.swift b/Shared/Views/Tab/MainView.swift index 47630fd..758d715 100644 --- a/Shared/Views/Tab/MainView.swift +++ b/Shared/Views/Tab/MainView.swift @@ -38,15 +38,16 @@ struct MainView: View { var body: some View { NavigationView { VStack(spacing: 0) { - TopBarView( - title: tabTitle, - selectedAccount: $selectedAccount, - sheetType: $sheetType, - accounts: accounts, - viewModel: viewModel - ) - .offset(y: topBarVisible ? 0 : -100) - .animation(.spring(response: 0.4, dampingFraction: 0.8), value: topBarVisible) + if topBarVisible { + TopBarView( + title: tabTitle, + selectedAccount: $selectedAccount, + sheetType: $sheetType, + accounts: accounts, + viewModel: viewModel + ) + .transition(AnyTransition.move(edge: .top).combined(with: .opacity)) + } ZStack { switch selectedTab { @@ -69,10 +70,12 @@ struct MainView: View { } } .frame(maxWidth: .infinity, maxHeight: .infinity) - + + if topBarVisible { CustomTabBar(selectedTab: $selectedTab) { print("Create button tapped") } + } } .ignoresSafeArea(edges: .bottom) .navigationBarHidden(true) @@ -97,17 +100,21 @@ struct MainView: View { let currentY = offset.y // Показываем бар, если скроллим вверх или дошли до верха - if currentY < lastScrollY || currentY <= 0 { - if !topBarVisible { - topBarVisible = true - } - } - // Скрываем, если скроллим вниз и отступили от верха - else if currentY > lastScrollY && currentY > 50 { - if topBarVisible { - topBarVisible = false - } - } +// if currentY < lastScrollY || currentY <= 0 { +// if !topBarVisible { +// withAnimation(.default) { +// topBarVisible = true +// } +// } +// } +// // Скрываем, если скроллим вниз и отступили от верха +// else if currentY > lastScrollY && currentY > 50 { +// if topBarVisible { +// withAnimation(.default) { +// topBarVisible = false +// } +// } +// } lastScrollY = currentY } diff --git a/yobble.xcodeproj/project.pbxproj b/yobble.xcodeproj/project.pbxproj index c000660..18e29b2 100644 --- a/yobble.xcodeproj/project.pbxproj +++ b/yobble.xcodeproj/project.pbxproj @@ -66,7 +66,7 @@ 1A7940A52DF77DF5002569DA /* User.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = ""; }; 1A7940A92DF77E05002569DA /* LoginViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewModel.swift; sourceTree = ""; }; 1A7940AF2DF77E26002569DA /* LoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginView.swift; sourceTree = ""; }; - 1A7940B52DF77F21002569DA /* MainView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainView.swift; sourceTree = ""; }; + 1A7940B52DF77F21002569DA /* MainView.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = MainView.swift; sourceTree = ""; tabWidth = 4; }; 1A7940C52DF7A98E002569DA /* ContactsTab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactsTab.swift; sourceTree = ""; }; 1A7940C92DF7A99B002569DA /* ChatsTab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatsTab.swift; sourceTree = ""; }; 1A7940CD2DF7A9AA002569DA /* ProfileTab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileTab.swift; sourceTree = ""; }; diff --git a/yobble.xcodeproj/xcuserdata/cheykrym.xcuserdatad/xcschemes/xcschememanagement.plist b/yobble.xcodeproj/xcuserdata/cheykrym.xcuserdatad/xcschemes/xcschememanagement.plist index 2de711f..c9f74cd 100644 --- a/yobble.xcodeproj/xcuserdata/cheykrym.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/yobble.xcodeproj/xcuserdata/cheykrym.xcuserdatad/xcschemes/xcschememanagement.plist @@ -17,12 +17,12 @@ yobble (iOS).xcscheme_^#shared#^_ orderHint - 0 + 1 yobble (macOS).xcscheme_^#shared#^_ orderHint - 1 + 0