Skip to content

Commit

Permalink
Add completion closure to deletePage() (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
abbassabeti authored Sep 10, 2024
1 parent e00e4b7 commit 9c258b2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Sources/Pageboy/PageboyViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,11 @@ open class PageboyViewController: UIViewController {
/// - Parameters:
/// - index: The index to delete the page from.
/// - updateBehavior: Behavior to execute after the page was deleted.
open func deletePage(at index: PageIndex,
then updateBehavior: PageUpdateBehavior = .doNothing) {
open func deletePage(
at index: PageIndex,
then updateBehavior: PageUpdateBehavior = .doNothing,
completion: @escaping () -> Void = {}
) {
verifyNewPageCount(then: { (oldPageCount, newPageCount) in
assert(index < oldPageCount,
"Attempting to delete page at \(index) but there were only \(oldPageCount) pages before the update")
Expand Down Expand Up @@ -349,6 +352,7 @@ open class PageboyViewController: UIViewController {
}},
completion: { (_) in
self.view.isUserInteractionEnabled = true
completion()
})
})
}
Expand Down

0 comments on commit 9c258b2

Please sign in to comment.