Skip to content

Commit

Permalink
add swipe disabled to example app (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
cecipirotto authored Dec 9, 2021
1 parent d455293 commit 5ef962d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ struct ContentView: View {
Text("Bar style")
.font(.body)
}
NavigationLink(destination: TwitterView(swipeGestureEnabled: false)) {
VStack(alignment: .leading) {
Text("Scrollable style, swipe disabled")
.font(.body)
.padding(.bottom, 1)
Text("Only label")
.font(.subheadline)
}
}
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion Example/Shared/TwitterView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import SwiftUI
import PagerTabStripView

struct TwitterView: View {
private var swipeGestureEnabled: Bool
@State var selection = 2

@ObservedObject var firstModel = TweetsModel()
Expand All @@ -18,8 +19,12 @@ struct TwitterView: View {
@ObservedObject var fifthModel = MediaModel()
@ObservedObject var sixthModel = LikesModel()

public init(swipeGestureEnabled: Bool = true) {
self.swipeGestureEnabled = swipeGestureEnabled
}

var body: some View {
PagerTabStripView(swipeGestureEnabled: false, selection: $selection) {
PagerTabStripView(swipeGestureEnabled: swipeGestureEnabled, selection: $selection) {
PostsList(isLoading: $firstModel.isLoading, items: firstModel.posts).pagerTabItem {
TwitterNavBarItem(title: "First big width")
}
Expand Down

0 comments on commit 5ef962d

Please sign in to comment.