Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleve committed Mar 4, 2024
1 parent 0e03e66 commit 2e3f97c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 17 deletions.
8 changes: 7 additions & 1 deletion ListableUI/Sources/CollectionView/CollectionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation


final class LSTCollectionView : UIView {
final class LSTCollectionView : UIScrollView {

private let queue : ListChangesQueue

Expand All @@ -32,6 +32,12 @@ final class LSTCollectionView : UIView {
self.addSubview(self.view)
}

// MARK: UIScrollView

override func setContentOffset(_ contentOffset: CGPoint, animated: Bool) {
super.setContentOffset(contentOffset, animated: animated)
}

// MARK: UIView

override func layoutSubviews() {
Expand Down
16 changes: 0 additions & 16 deletions ListableUI/Sources/ListView/ListView+FeatureFlag.swift

This file was deleted.

28 changes: 28 additions & 0 deletions ListableUI/Sources/ListView/ListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,34 @@ public final class ListView : UIView
self.updateCollectionViewWithCurrentLayoutProperties()
}

//
// MARK: Replace UICollectionView Feature Flag
//

public static var isNewBackingViewEnabled : Bool {
get {
UserDefaults.standard.bool(forKey: "Listable.isNewBackingViewEnabled")
}

set {
UserDefaults.standard.setValue(newValue, forKey: "Listable.isNewBackingViewEnabled")
}
}

public let isNewBackingViewEnabled : Bool = ListView.isNewBackingViewEnabled

public func ifNew<Output>(
_ ifNew : () throws -> Output,
ifOld : () throws -> Output
) rethrows -> Output {

if Self.isNewBackingViewEnabled {
try ifNew()
} else {
try ifOld()
}
}

//
// MARK: Layout
//
Expand Down

0 comments on commit 2e3f97c

Please sign in to comment.