Skip to content

Commit 4028319

Browse files
authoredApr 6, 2024
Add isDirectionalLockEnabled property (#288)
1 parent 31eda06 commit 4028319

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed
 

‎Sources/Pageboy/PageboyViewController+Management.swift

+1
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ internal extension PageboyViewController {
211211
pageViewController.view.backgroundColor = .clear
212212
pageViewController.scrollView?.delaysContentTouches = delaysContentTouches
213213
pageViewController.scrollView?.isScrollEnabled = isScrollEnabled
214+
pageViewController.scrollView?.isDirectionalLockEnabled = isDirectionalLockEnabled
214215
pageViewController.scrollView?.isUserInteractionEnabled = isUserInteractionEnabled
215216

216217
reloadData(reloadViewControllers: reloadViewControllers)

‎Sources/Pageboy/PageboyViewController.swift

+8
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ open class PageboyViewController: UIViewController {
134134
pageViewController?.scrollView?.isScrollEnabled = isScrollEnabled
135135
}
136136
}
137+
/// Whether scrolling is disabled in a particular direction.
138+
///
139+
/// Default is FALSE.
140+
open var isDirectionalLockEnabled: Bool = false {
141+
didSet {
142+
pageViewController?.scrollView?.isDirectionalLockEnabled = isDirectionalLockEnabled
143+
}
144+
}
137145
/// Whether the page view controller should infinitely scroll at the end of page ranges.
138146
///
139147
/// Default is FALSE.

0 commit comments

Comments
 (0)