jessesquires / ReactiveCollectionsKit

Data-driven, declarative, reactive, diffable collections (and lists!) for iOS. A modern, fast, and flexible library for UICollectionView done right.
https://jessesquires.github.io/ReactiveCollectionsKit/
MIT License
68 stars 3 forks source link

Support for macOS? #4

Open jessesquires opened 4 years ago

jessesquires commented 4 years ago

⚠️ This is a very large task. Please coordinate here before doing any work.

ℹ️ I don't have a need for this yet, but might in the future.

ToDo

Here's a rough, high-level outline of what needs to be done.

Resources

jessesquires commented 3 years ago

Actually, macOS might need all of its own infra to make this work... I'm not sure how much we can reuse.

Especially with the new design here that uses associatedTypes for CellViewModel, etc.

But, "cells" on macOS are actually NSViewControllers, which is... weird. https://developer.apple.com/documentation/appkit/nscollectionviewitem

Maybe something like this:

public protocol CellViewModel: DiffableViewModel, ViewRegistrationProvider {

    #if os(iOS)
        associatedtype CellType: UICollectionViewCell
    #elseif os(macOS)
        associatedtype CellType: NSCollectionViewItem
    #endif

    // ....

}

However... I think this could get ugly very quickly.

In any case, this is a significant undertaking.