damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 2f81a144c110505694c18e6dcf42b1650d784edd
parent 4adb26e784b21f2d3ba53409d3af1ffd3e0b3f74
Author: Thomas Rademaker <thomas@sparrowtek.com>
Date:   Mon,  2 Jan 2023 08:42:03 -0800

ContentTimelineView inside a page tabView to get a nice swipe gesture

Changelog-Changed: Add swipe gesture to switch between tabs
Closes: #202

Diffstat:
Mdamus/ContentView.swift | 32+++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/damus/ContentView.swift b/damus/ContentView.swift @@ -82,17 +82,14 @@ struct ContentView: View { @Environment(\.colorScheme) var colorScheme var PostingTimelineView: some View { - VStack{ - ZStack { - if let damus = self.damus_state { - TimelineView(events: $home.events, loading: $home.loading, damus: damus, show_friend_icon: false, filter: filter_event) - } - if privkey != nil { - PostButtonContainer { - self.active_sheet = .post - } - } - }.ignoresSafeArea(.keyboard, edges: .bottom) + VStack { + TabView(selection: $filter_state) { + ContentTimelineView + .tag(FilterState.posts) + ContentTimelineView + .tag(FilterState.posts_and_replies) + } + .tabViewStyle(.page(indexDisplayMode: .never)) } .safeAreaInset(edge: .top) { VStack(spacing: 0) { @@ -106,6 +103,19 @@ struct ContentView: View { } } + var ContentTimelineView: some View { + ZStack { + if let damus = self.damus_state { + TimelineView(events: $home.events, loading: $home.loading, damus: damus, show_friend_icon: false, filter: filter_event) + } + if privkey != nil { + PostButtonContainer { + self.active_sheet = .post + } + } + } + } + var FiltersView: some View { VStack{ Picker("Filter State", selection: $filter_state) {