Skip to content

Commit

Permalink
Make completion closure optional
Browse files Browse the repository at this point in the history
  • Loading branch information
msaps committed Sep 10, 2024
1 parent 9c258b2 commit 3f4df3c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Sources/Pageboy/PageboyViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,11 @@ open class PageboyViewController: UIViewController {
/// - Parameters:
/// - index: The index to delete the page from.
/// - updateBehavior: Behavior to execute after the page was deleted.
/// - completion: Closure to execute on completion.
open func deletePage(
at index: PageIndex,
then updateBehavior: PageUpdateBehavior = .doNothing,
completion: @escaping () -> Void = {}
completion: (() -> Void)? = nil
) {
verifyNewPageCount(then: { (oldPageCount, newPageCount) in
assert(index < oldPageCount,
Expand Down Expand Up @@ -352,7 +353,7 @@ open class PageboyViewController: UIViewController {
}},
completion: { (_) in
self.view.isUserInteractionEnabled = true
completion()
completion?()
})
})
}
Expand Down

0 comments on commit 3f4df3c

Please sign in to comment.