{"id":15527123,"url":"https://github.com/space-code/blade","last_synced_at":"2025-07-13T09:33:50.060Z","repository":{"id":219160990,"uuid":"743450870","full_name":"space-code/blade","owner":"space-code","description":"Blade is a pagination framework that simplifies the integration of pagination into the application.","archived":false,"fork":false,"pushed_at":"2024-12-26T05:59:33.000Z","size":324,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"dev","last_synced_at":"2025-07-02T02:02:19.682Z","etag":null,"topics":["composable-architecture","pagination","swift","swiftui","tca"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/space-code.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-15T09:10:25.000Z","updated_at":"2024-10-31T14:01:03.000Z","dependencies_parsed_at":"2024-02-04T20:16:11.132Z","dependency_job_id":"e5659c38-9fb4-4a1c-a585-f6257f08ee04","html_url":"https://github.com/space-code/blade","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"f8ff627ab3044d982f98e852d12afa1735dfe3fd"},"previous_names":["space-code/blade"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/space-code/blade","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/space-code%2Fblade","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/space-code%2Fblade/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/space-code%2Fblade/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/space-code%2Fblade/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/space-code","download_url":"https://codeload.github.com/space-code/blade/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/space-code%2Fblade/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265120111,"owners_count":23714488,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["composable-architecture","pagination","swift","swiftui","tca"],"created_at":"2024-10-02T11:04:32.987Z","updated_at":"2025-07-13T09:33:50.045Z","avatar_url":"https://github.com/space-code.png","language":"Swift","readme":"![Blade: a pagination framework that simplifies the integration of pagination into the application](https://raw.githubusercontent.com/space-code/blade/dev/Resources/blade.png)\n\n\u003ch1 align=\"center\" style=\"margin-top: 0px;\"\u003eblade\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/space-code/blade/blob/main/LICENSE\"\u003e\u003cimg alt=\"License\" src=\"https://img.shields.io/github/license/space-code/blade?style=flat\"\u003e\u003c/a\u003e \n  \u003ca href=\"https://swiftpackageindex.com/space-code/blade\"\u003e\u003cimg alt=\"Swift Compatibility\" src=\"https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fspace-code%2Fblade%2Fbadge%3Ftype%3Dswift-versions\"/\u003e\u003c/a\u003e \n  \u003ca href=\"https://swiftpackageindex.com/space-code/blade\"\u003e\u003cimg alt=\"Platform Compatibility\" src=\"https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fspace-code%2Fblade%2Fbadge%3Ftype%3Dplatforms\"/\u003e\u003c/a\u003e \n  \u003ca href=\"https://github.com/space-code/blade\"\u003e\u003cimg alt=\"CI\" src=\"https://github.com/space-code/Blade/actions/workflows/ci.yml/badge.svg?branch=main\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/space-code/blade\"\u003e\u003cimg alt=\"CodeCov\" src=\"https://codecov.io/gh/space-code/flare/graph/badge.svg?token=0N0jMJnozP\"\u003e\u003c/a\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n  \u003ca href=\"https://github.com/space-code/blade\"\u003e\u003cimg alt=\"Number of GitHub contributors\" src=\"https://img.shields.io/github/issues/space-code/blade\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/space-code/blade\"\u003e\u003cimg alt=\"Number of GitHub issues that are open\" src=\"https://img.shields.io/github/stars/space-code/blade\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/space-code/blade\"\u003e\u003cimg alt=\"Number of GitHub closed issues\" src=\"https://img.shields.io/github/issues-closed/space-code/blade\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/space-code/blade\"\u003e\u003cimg alt=\"Number of GitHub stars\" src=\"https://img.shields.io/github/contributors/space-code/blade\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/space-code/blade\"\u003e\u003cimg alt=\"Number of GitHub pull requests that are open\" src=\"https://img.shields.io/github/issues-pr-raw/space-code/blade\"\u003e\u003c/a\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n  \u003ca href=\"https://github.com/space-code/blade\"\u003e\u003cimg alt=\"GitHub release; latest by date\" src=\"https://img.shields.io/github/v/release/space-code/blade\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/apple/swift-package-manager\" alt=\"blade on Swift Package Manager\" title=\"blade on Swift Package Manager\"\u003e\u003cimg src=\"https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Description\n`Blade` is a pagination framework that simplifies the integration of pagination into the application.\n\n- [Usage](#usage)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Communication](#communication)\n- [Contributing](#contributing)\n- [Author](#author)\n- [License](#license)\n\n## Usage\n\nBlade provides two libraries for working with pagination: `Blade` and `BladeTCA`. `BladeTCA` is an extension designed for working with [Composable Architecture](https://github.com/pointfreeco/swift-composable-architecture). Both support working with offset and cursor-based paginations.\n\n### Basic Usage\n\nFirst, you need to implement page loader for whether cursor or offset based pagination:\n\n```swift\nimport Blade\n\n/// Offset pagination loader\n\nfinal class OffsetPageLoader\u003cElement: Equatable \u0026 Decodable\u003e: IOffsetPageLoader {\n  func loadPage(request: OffsetPaginationRequest) async throws -\u003e Page\u003cElement\u003e {\n    // Implementation here\n  }\n}\n\n/// Cursor pagination loader\n\nfinal class CursorPageLoader\u003cElement: Equatable \u0026 Decodable \u0026 Identifiable\u003e: ICursorPageLoader {\n  func loadPage(request: CursorPaginationRequest\u003cElement\u003e) async throws -\u003e Page\u003cElement\u003e {\n    // Implementation here\n  }\n}\n```\n\nSecond, create a `Paginator` instance:\n\n```swift\nimport Blade\n\n/// Offset-based pagination\nlet paginator = Paginator(configuration: PaginationLimitOffset(firstPage: .zero, limit: 20), offsetPageLoader: OffsetPageLoader())\n\n/// Cursor-based pagination\nlet paginator = Paginator(configuration: PaginationCursorSeek(id: #id_here), offsetPageLoader: CursorPageLoader())\n```\n\nThird, the paginator is capable of requesting the first page, the next page, and resetting its state, like this:\n\n```swift\n/// Request an initial page\nlet page = try await paginator.refresh()\n\n/// Request next page\nlet nextPage = try await paginator.nextPage()\n\n/// Reset state\nawait paginator.reset()\n```\n\n### TCA Usage\n\nIf your app uses the [Composable Architecture](https://github.com/pointfreeco/swift-composable-architecture), `Blade` can be easily integrated. \n\n```swift\nimport BladeTCA\n\n// MARK: Reducer\n\n@Reducer\nstruct SomeFeature {\n    // MARK: Types\n\n    struct State: Equatable {\n        var paginator: PaginatorState\u003cArticleView.ViewModel\u003e\n    }\n\n    enum Action {\n        case child(PaginatorAction\u003cArticleView.ViewModel, Never\u003e)\n    }\n\n    // MARK: Reducer\n\n    var body: some ReducerOf\u003cSelf\u003e {\n        Reduce { state, action in \n          switch state {\n            case .clild:\n              return .none\n          }\n        }\n        .paginator(\n            state: \\SomeFeature.State.paginator,\n            action: /SomeFeature.Action.child,\n            loadPage: { request, state in\n                // Load page here\n            }\n        )\n    }\n}\n\n// MARK: View\n\nimport ComposableArchitecture\nimport SwiftUI\n\n// MARK: - SomeView\n\nstruct SomeView: View {\n    // MARK: Properties\n\n    private let store: StoreOf\u003cSomeFeature\u003e\n\n    // MARK: Initialization\n\n    init(store: StoreOf\u003cSomeFeature\u003e) {\n        self.store = store\n    }\n\n    // MARK: View\n\n    var body: some View {\n      PaginatorListView(\n        store: store.scope(state: \\.paginator, action: { .child($0) })\n      ) { state in \n        // Implement UI here\n      }\n    }\n```\n\n## Requirements\n\n- iOS 13.0+ / macOS 10.15+ / tvOS 13.0+ / watchOS 7.0+ / visionOS 1.0+\n- Xcode 15.0\n- Swift 5.7\n\n## Installation\n### Swift Package Manager\n\nThe [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. It is in early development, but `blade` does support its use on supported platforms.\n\nOnce you have your Swift package set up, adding `blade` as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/space-code/blade.git\", .upToNextMajor(from: \"1.0.0\"))\n]\n```\n\n## Communication\n- If you **found a bug**, open an issue.\n- If you **have a feature request**, open an issue.\n- If you **want to contribute**, submit a pull request.\n\n## Contributing\nBootstrapping development environment\n\n```\nmake bootstrap\n```\n\nPlease feel free to help out with this project! If you see something that could be made better or want a new feature, open up an issue or send a Pull Request!\n\n## Author\nNikita Vasilev, nv3212@gmail.com\n\n## License\nblade is available under the MIT license. See the LICENSE file for more info.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspace-code%2Fblade","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspace-code%2Fblade","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspace-code%2Fblade/lists"}