GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - sparrowcode/DiffableKit: Declarative wrapper for UIKit Diffable Data Source. Describe content, call set() — diffing and animations handled automatically.

BranchesTags
Open more actions menu

Latest commit

 

History

288 Commits
288 Commits

Folders and files

NameName
Last commit message
Last commit date
Sources/DiffableKit
Sources/DiffableKit
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
Package.swift
Package.swift
 
 
README.md
README.md
 
 

Repository files navigation

DiffableKit

Declarative wrapper around UITableViewDiffableDataSource and UICollectionViewDiffableDataSource. Describe sections and items, call set() — diffing, animations, and cell updates are handled automatically.

Installation

In Xcode: File → Add Package Dependencies → paste URL:

https://github.com/sparrowcode/DiffableKit

Usage

class SettingsController: DiffableTableController {

    override func viewDidLoad() {
        super.viewDidLoad()
        configureDiffable(
            sections: [
                DiffableSection(
                    id: "general",
                    header: DiffableTextHeaderFooter(text: "General"),
                    items: [
                        DiffableTableRow(text: "Theme", detail: "System", accessoryType: .disclosureIndicator)
                    ]
                )
            ],
            cellProviders: DiffableTableDataSource.CellProvider.default
        )
    }
}

List

// Same models in a UICollectionView list with the system Settings metrics
class SettingsController: DiffableListController {

    override func viewDidLoad() {
        super.viewDidLoad()
        configureDiffable(
            sections: [
                DiffableSection(
                    id: "general",
                    header: DiffableTextHeaderFooter(text: "General"),
                    items: [
                        DiffableTableRow(text: "Theme", detail: "System", accessoryType: .disclosureIndicator),
                        DiffableTableRowSwitch(text: "Sounds", isOn: true, action: { isOn in })
                    ]
                )
            ],
            cellProviders: DiffableListDataSource.CellProvider.default
        )
        // Header above the list instead of tableHeaderView
        headerView = UIView()
    }
}

// Context menu and swipes come through the delegate
diffableDataSource?.diffableDelegate = self

About

Declarative wrapper for UIKit Diffable Data Source. Describe content, call set() — diffing and animations handled automatically.

sparrowcode.io/frameworks

Topics

diffable-datasourceiosswiftswift-packageuicollectionviewuikituitableview

Resources

Readme
MIT license
Activity
Custom properties

Stars

134 stars

Watchers

4 watching

Forks

10 forks
Report repository

Releases

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.