updated Pagination to a Control
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
35036ca804
commit
c76d3e7b76
@ -13,7 +13,7 @@ import Combine
|
|||||||
///Pagination is a control that enables customers to navigate multiple pages of content by selecting either a specific page or the next or previous set of four pages.
|
///Pagination is a control that enables customers to navigate multiple pages of content by selecting either a specific page or the next or previous set of four pages.
|
||||||
@objcMembers
|
@objcMembers
|
||||||
@objc(VDSPagination)
|
@objc(VDSPagination)
|
||||||
open class Pagination: View {
|
open class Pagination: Control, Changeable {
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Properties
|
// MARK: - Private Properties
|
||||||
@ -52,6 +52,8 @@ open class Pagination: View {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
public var onChangeSubscriber: AnyCancellable?
|
||||||
|
|
||||||
///Previous button to select previous page
|
///Previous button to select previous page
|
||||||
public let previousButton: PaginationButton = .init(type: .previous)
|
public let previousButton: PaginationButton = .init(type: .previous)
|
||||||
///Next button to select next page
|
///Next button to select next page
|
||||||
@ -195,6 +197,8 @@ open class Pagination: View {
|
|||||||
let isNextAction = sender == nextButton
|
let isNextAction = sender == nextButton
|
||||||
_selectedPageIndex = if isNextAction { _selectedPageIndex + 1 } else { _selectedPageIndex - 1 }
|
_selectedPageIndex = if isNextAction { _selectedPageIndex + 1 } else { _selectedPageIndex - 1 }
|
||||||
updateSelection()
|
updateSelection()
|
||||||
|
onPageDidSelect?(selectedPage)
|
||||||
|
sendActions(for: .valueChanged)
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1) { [weak self] in
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1) { [weak self] in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
UIAccessibility.post(notification: .announcement, argument: paginationDescription)
|
UIAccessibility.post(notification: .announcement, argument: paginationDescription)
|
||||||
@ -250,6 +254,7 @@ extension Pagination: UICollectionViewDelegate, UICollectionViewDataSource, UICo
|
|||||||
_selectedPageIndex = indexPath.row
|
_selectedPageIndex = indexPath.row
|
||||||
updateSelection()
|
updateSelection()
|
||||||
onPageDidSelect?(selectedPage)
|
onPageDidSelect?(selectedPage)
|
||||||
|
sendActions(for: .valueChanged)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user