-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
150 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
// | ||
// CollectionView.swift | ||
// ListableUI | ||
// | ||
// Created by Kyle Van Essen on 11/29/23. | ||
// | ||
|
||
import Foundation | ||
|
||
|
||
final class LSTCollectionView : UIView { | ||
|
||
private let queue : ListChangesQueue | ||
|
||
private(set) var content : Content | ||
|
||
private var reuseCache : ReusableViewCache | ||
|
||
private let view : ContentView | ||
|
||
// MARK: Initialization | ||
|
||
override init(frame: CGRect) { | ||
|
||
self.queue = .init() | ||
self.content = .empty | ||
self.reuseCache = .init() | ||
self.view = .init(frame: .init(origin: .zero, size: frame.size)) | ||
|
||
super.init(frame: frame) | ||
|
||
self.addSubview(self.view) | ||
} | ||
|
||
// MARK: UIView | ||
|
||
override func layoutSubviews() { | ||
super.layoutSubviews() | ||
|
||
self.view.frame = bounds | ||
} | ||
|
||
required init?(coder: NSCoder) { fatalError() } | ||
|
||
func set( | ||
content : Content, | ||
changes: SectionedDiff<Section, | ||
AnyIdentifier, | ||
AnyItem, | ||
AnyIdentifier>, | ||
completion : @escaping () -> () | ||
) { | ||
queue.add { | ||
|
||
} | ||
} | ||
|
||
} | ||
|
||
extension LSTCollectionView { | ||
final class ContentView : UIScrollView { | ||
|
||
} | ||
} | ||
|
||
open class LSTCollectionReusableView : UIView { | ||
|
||
} | ||
|
||
open class LSTCollectionSupplementaryView : LSTCollectionReusableView { | ||
|
||
} | ||
|
||
open class LSTCollectionItemView : LSTCollectionReusableView { | ||
|
||
} | ||
|
||
|
||
extension LSTCollectionView { | ||
|
||
struct Content { | ||
|
||
static var empty : Self { | ||
fatalError() | ||
} | ||
|
||
var supplementaries : Supplementaries | ||
|
||
var sections : [Section] | ||
} | ||
|
||
struct Section { | ||
var supplementaries : Supplementaries | ||
|
||
var items : [Item] | ||
} | ||
|
||
struct Item { | ||
var value : AnyItem | ||
|
||
var state : State | ||
|
||
final class State { | ||
|
||
} | ||
} | ||
|
||
struct Supplementaries { | ||
|
||
private var byType : [ObjectIdentifier:Supplementary] | ||
|
||
} | ||
|
||
struct Supplementary { | ||
var value : AnyHeaderFooter | ||
|
||
var state : State | ||
|
||
final class State { | ||
|
||
} | ||
} | ||
} | ||
|
||
protocol SupplementaryTypeKey { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// ListView+FeatureFlag.swift | ||
// ListableUI | ||
// | ||
// Created by Kyle Van Essen on 11/29/23. | ||
// | ||
|
||
import Foundation | ||
|
||
|
||
extension ListView { | ||
|
||
public static let isNewBackingViewEnabled : Bool = { | ||
UserDefaults.standard.bool(forKey: "Listable.isNewBackingViewEnabled") | ||
}() | ||
} |