Skip to content

Commit

Permalink
Fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
msaps committed May 4, 2020
1 parent 0830acd commit c32a8e5
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions Sources/Pageboy/PageboyViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -276,28 +276,29 @@ open class PageboyViewController: UIViewController {
/// - updateBehavior: Behavior to execute after the page was inserted.
open func insertPage(at index: PageIndex,
then updateBehavior: PageUpdateBehavior = .scrollToUpdate) {
verifyNewPageCount(then: { (oldPageCount, newPageCount) in

verifyNewPageCount(then: { (oldPageCount, newPageCount) in
assert(newPageCount > oldPageCount,
"Attempt to insert page at \(index) but there are only \(newPageCount) pages after the update")
"Attempt to insert page at \(index) but there are only \(newPageCount) pages after the update")

guard let newViewController = dataSource?.viewController(for: self, at: index) else {
assertionFailure("Expected to find inserted UIViewController at page \(index)")
return
}
guard let newViewController = dataSource?.viewController(for: self, at: index) else {
assertionFailure("Expected to find inserted UIViewController at page \(index)")
return
}

viewControllerCount = newPageCount
viewControllerIndexMap.removeAll()
viewControllerCount = newPageCount
viewControllerIndexMap.removeAll()

performUpdates(for: index,
viewController: newViewController,
update: (operation: .insert, behavior: updateBehavior),
indexOperation: { (index, newIndex) in
performUpdates(for: index,
viewController: newViewController,
update: (operation: .insert, behavior: updateBehavior),
indexOperation: { (index, newIndex) in

if index >= newIndex {
currentIndex = index + 1
}
if index >= newIndex {
currentIndex = index + 1
}
})
})
})
}

/// Delete an existing page from the page view controller.
Expand Down

0 comments on commit c32a8e5

Please sign in to comment.