/PaginationService

A mock api to simulate pagination (for UITables etc)

Primary LanguageSwift

mit platform platform Lang Carthage compatible SwiftLint Sindre

PaginationService

img

What is it

  • A framework for mocking paginated calls.

Requirements:

  • Decodable struct
  • .json file
  • A subclass with Type and path to json file

How do I get it

  • Carthage github "eonist/PaginationService"
  • Manual Open .xcodeproj

Example:

JSON

["Sublime", "Dave Matthews", "Tom Petty"]

Swift

public class CustomPaginationService: PaginationService<String> {
   override open class var filePath: String { return Bundle.main.resourcePath! + "/assets.bundle/items.json" }
   private static var __items: [String]?
   override public class var _items: [String]? {
      get { return __items }
      set { __items = newValue }
   }
}
CustomPaginationService.getItems(index: 20, length: 50) { success, items in Swift.print("success: \(success) \(items.count)") } // 30

Todo:

  • Add github actions
  • Add spm