Add page descriphion

This commit is contained in:
Aiden Vigue 2021-05-29 14:17:12 -04:00
parent 04936e75af
commit 82c0474662
No known key found for this signature in database
GPG Key ID: E7570472648F4544
2 changed files with 7 additions and 1 deletions

View File

@ -73,7 +73,7 @@ struct LibraryView: View {
} label: {
Image(systemName: "chevron.left").font(.system(size: 25))
}.disabled(viewModel.isHiddenPreviousButton)
Spacer()
Text("\(viewModel.page) of \(viewModel.totalPages)")
Button {
viewModel.requestNextPage()
} label: {

View File

@ -28,7 +28,11 @@ final class LibraryViewModel: ObservableObject {
var isHiddenPreviousButton = true
@Published
var isHiddenNextButton = true
@Published
var totalPages = 1
@Published
var page = 1
var globalData = GlobalData() {
@ -125,6 +129,8 @@ final class LibraryViewModel: ObservableObject {
print(items.count)
print(self.page)
self.totalPages = Int(Float(Double(count)/100.0).rounded(.up))
if(count > 100) {
self.isHiddenPreviousButton = true
self.isHiddenNextButton = true