Код: Выделить всё
ScrollView {
VStack {
if showDivider {
Divider()
.offset(y: isSearching ? -26 : -14)
}
TabView(selection: $activeTab) {
SearchContentView(selectedTab: $selectedTab, category: PickerTab.all.rawValue)
.tag(PickerTab.all)
SearchContentView(selectedTab: $selectedTab, category: PickerTab.technology.rawValue)
.tag(PickerTab.technology)
SearchContentView(selectedTab: $selectedTab, category: PickerTab.sports.rawValue)
.tag(PickerTab.animals)
}
.tabViewStyle(.page(indexDisplayMode: .never))
}
.padding(.top, isSearching ? 0 : 30)
.safeAreaInset(edge: .top, spacing: 0) {
ExpandableNavigationBar()
}
.animation(.snappy(duration: 0.3, extraBounce: 0), value: isSearching)
}
.scrollTargetBehavior(CustomScrollTargetBehaviour())
.contentMargins(.top, 190, for: .scrollIndicators)
.onChange(of: isSearching) { oldValue, newValue in
if newValue {
withAnimation(.easeIn(duration: 1)) {
showDivider = false
}
} else {
withAnimation(.easeIn(duration: 1)) {
showDivider = true
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/793 ... scrollview