Skip to content

Commit 9c258b2

Browse files
authoredSep 10, 2024··
Add completion closure to deletePage() (#293)
1 parent e00e4b7 commit 9c258b2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
 

‎Sources/Pageboy/PageboyViewController.swift

+6-2
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,11 @@ open class PageboyViewController: UIViewController {
316316
/// - Parameters:
317317
/// - index: The index to delete the page from.
318318
/// - updateBehavior: Behavior to execute after the page was deleted.
319-
open func deletePage(at index: PageIndex,
320-
then updateBehavior: PageUpdateBehavior = .doNothing) {
319+
open func deletePage(
320+
at index: PageIndex,
321+
then updateBehavior: PageUpdateBehavior = .doNothing,
322+
completion: @escaping () -> Void = {}
323+
) {
321324
verifyNewPageCount(then: { (oldPageCount, newPageCount) in
322325
assert(index < oldPageCount,
323326
"Attempting to delete page at \(index) but there were only \(oldPageCount) pages before the update")
@@ -349,6 +352,7 @@ open class PageboyViewController: UIViewController {
349352
}},
350353
completion: { (_) in
351354
self.view.isUserInteractionEnabled = true
355+
completion()
352356
})
353357
})
354358
}

0 commit comments

Comments
 (0)
Please sign in to comment.