From 63d9ff12cd3217b24e10bff5f868873fef694bb4 Mon Sep 17 00:00:00 2001 From: Adam Lickel Date: Fri, 22 Oct 2021 11:50:42 -0700 Subject: [PATCH 1/3] Package + missing imports --- .../BlueprintHeaderFooterContent.swift | 1 + .../Sources/BlueprintItemContent.swift | 1 + BlueprintUILists/Sources/List.swift | 2 +- .../Sources/ListReorderGesture.swift | 1 + ListableUI/Sources/Appearance.swift | 2 + ListableUI/Sources/Behavior.swift | 1 + ListableUI/Sources/Content.swift | 1 + .../ContentBounds/ListContentBounds.swift | 1 + ListableUI/Sources/EmbeddedList.swift | 2 + .../HeaderFooter/AnyHeaderFooter.swift | 1 + .../Sources/HeaderFooter/HeaderFooter.swift | 2 + .../HeaderFooter/HeaderFooterContent.swift | 2 + ListableUI/Sources/Internal/CGSize.swift | 1 + .../PresentationState.HeaderFooterState.swift | 1 + .../PresentationState.ItemState.swift | 1 + .../PresentationState.RefreshControl.swift | 1 + .../PresentationState/PresentationState.swift | 2 + ListableUI/Sources/Internal/UIView.swift | 1 + ListableUI/Sources/Item/ItemContent.swift | 3 ++ .../Sources/Item/ItemContentCoordinator.swift | 2 + ListableUI/Sources/Item/ItemReordering.swift | 1 + ListableUI/Sources/Item/ItemState.swift | 1 + .../Sources/Layout/Grid/GridListLayout.swift | 2 + .../ListContentLayoutAttributes.swift | 2 + .../Layout/ListLayout/ListLayout.swift | 1 + .../ListLayout/ListLayoutAttributes.swift | 1 + .../Layout/ListLayout/ListLayoutContent.swift | 1 + .../Layout/ListLayout/ListLayoutValues.swift | 1 + .../Layout/Paged/PagedListLayout.swift | 2 + .../Retail Grid/RetailGridListLayout.swift | 2 + .../Layout/Table/TableListLayout.swift | 1 + ListableUI/Sources/LayoutDirection.swift | 2 + ListableUI/Sources/ListActions.swift | 1 + ListableUI/Sources/ListProperties.swift | 1 + .../Sources/ListScrollPositionInfo.swift | 1 + ListableUI/Sources/ListStateObserver.swift | 1 + .../ListView/ListView+ContentSize.swift | 2 + .../ListView/ListView.DataSource.swift | 2 + .../Sources/ListView/ListView.Delegate.swift | 2 + .../ListView/ListView.LayoutManager.swift | 1 + .../Sources/ListView/ListView.Storage.swift | 2 + .../Sources/ListView/UpdateCallbacks.swift | 1 + ListableUI/Sources/ListViewController.swift | 1 + ListableUI/Sources/ListViewSource.swift | 2 + ListableUI/Sources/RefreshControl.swift | 1 + ListableUI/Sources/ScrollPosition.swift | 3 ++ ListableUI/Sources/Sizing.swift | 1 + .../Sources/SwipeActionsConfiguration.swift | 1 + ListableUI/Sources/ViewAnimation.swift | 1 + Package.swift | 45 +++++++++++++++++++ 50 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 Package.swift diff --git a/BlueprintUILists/Sources/BlueprintHeaderFooterContent.swift b/BlueprintUILists/Sources/BlueprintHeaderFooterContent.swift index 75508bfa7..6dfcdee1d 100644 --- a/BlueprintUILists/Sources/BlueprintHeaderFooterContent.swift +++ b/BlueprintUILists/Sources/BlueprintHeaderFooterContent.swift @@ -7,6 +7,7 @@ import BlueprintUI import ListableUI +import UIKit /// Alias to allow less verbose creation of headers. diff --git a/BlueprintUILists/Sources/BlueprintItemContent.swift b/BlueprintUILists/Sources/BlueprintItemContent.swift index f1ccda58b..0e47dbad7 100644 --- a/BlueprintUILists/Sources/BlueprintItemContent.swift +++ b/BlueprintUILists/Sources/BlueprintItemContent.swift @@ -7,6 +7,7 @@ import BlueprintUI import ListableUI +import UIKit /// diff --git a/BlueprintUILists/Sources/List.swift b/BlueprintUILists/Sources/List.swift index 821156c21..978a0019e 100644 --- a/BlueprintUILists/Sources/List.swift +++ b/BlueprintUILists/Sources/List.swift @@ -6,8 +6,8 @@ // import BlueprintUI - import ListableUI +import UIKit /// diff --git a/BlueprintUILists/Sources/ListReorderGesture.swift b/BlueprintUILists/Sources/ListReorderGesture.swift index 9bc4ffed9..3b7cd9103 100644 --- a/BlueprintUILists/Sources/ListReorderGesture.swift +++ b/BlueprintUILists/Sources/ListReorderGesture.swift @@ -7,6 +7,7 @@ import BlueprintUI import ListableUI +import UIKit /// diff --git a/ListableUI/Sources/Appearance.swift b/ListableUI/Sources/Appearance.swift index c888083a9..4600d7e1e 100644 --- a/ListableUI/Sources/Appearance.swift +++ b/ListableUI/Sources/Appearance.swift @@ -5,6 +5,8 @@ // Created by Kyle Van Essen on 10/17/19. // +import UIKit + /// /// Contains all the properties which affect the appearance of all possible kinds of list layouts. diff --git a/ListableUI/Sources/Behavior.swift b/ListableUI/Sources/Behavior.swift index f1465fcc3..2f16a4df2 100644 --- a/ListableUI/Sources/Behavior.swift +++ b/ListableUI/Sources/Behavior.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit /// Controls various behaviors of the list view, such as keyboard dismissal, selection mode, and behavior diff --git a/ListableUI/Sources/Content.swift b/ListableUI/Sources/Content.swift index 8b4a96fdc..ac9d2ad05 100644 --- a/ListableUI/Sources/Content.swift +++ b/ListableUI/Sources/Content.swift @@ -5,6 +5,7 @@ // Created by Kyle Van Essen on 6/21/19. // +import UIKit public struct Content diff --git a/ListableUI/Sources/ContentBounds/ListContentBounds.swift b/ListableUI/Sources/ContentBounds/ListContentBounds.swift index 103e6864d..eedcecd37 100644 --- a/ListableUI/Sources/ContentBounds/ListContentBounds.swift +++ b/ListableUI/Sources/ContentBounds/ListContentBounds.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit /// For participating layouts; allows controlling the padding around and width of content when it is laid out. diff --git a/ListableUI/Sources/EmbeddedList.swift b/ListableUI/Sources/EmbeddedList.swift index 78bebcf10..82c2b9771 100644 --- a/ListableUI/Sources/EmbeddedList.swift +++ b/ListableUI/Sources/EmbeddedList.swift @@ -5,6 +5,8 @@ // Created by Kyle Van Essen on 11/10/19. // +import UIKit + public extension Item where Content == EmbeddedList { diff --git a/ListableUI/Sources/HeaderFooter/AnyHeaderFooter.swift b/ListableUI/Sources/HeaderFooter/AnyHeaderFooter.swift index 5dd9b86d6..e5256977b 100644 --- a/ListableUI/Sources/HeaderFooter/AnyHeaderFooter.swift +++ b/ListableUI/Sources/HeaderFooter/AnyHeaderFooter.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit public protocol AnyHeaderFooter : AnyHeaderFooterConvertible, AnyHeaderFooter_Internal diff --git a/ListableUI/Sources/HeaderFooter/HeaderFooter.swift b/ListableUI/Sources/HeaderFooter/HeaderFooter.swift index dfd95c8b0..01a7c58db 100644 --- a/ListableUI/Sources/HeaderFooter/HeaderFooter.swift +++ b/ListableUI/Sources/HeaderFooter/HeaderFooter.swift @@ -5,6 +5,8 @@ // Created by Kyle Van Essen on 8/10/19. // +import UIKit + public typealias Header = HeaderFooter public typealias Footer = HeaderFooter diff --git a/ListableUI/Sources/HeaderFooter/HeaderFooterContent.swift b/ListableUI/Sources/HeaderFooter/HeaderFooterContent.swift index 5f800f4ad..969deb84c 100644 --- a/ListableUI/Sources/HeaderFooter/HeaderFooterContent.swift +++ b/ListableUI/Sources/HeaderFooter/HeaderFooterContent.swift @@ -5,6 +5,8 @@ // Created by Kyle Van Essen on 8/10/19. // +import UIKit + public typealias HeaderContent = HeaderFooterContent public typealias FooterContent = HeaderFooterContent diff --git a/ListableUI/Sources/Internal/CGSize.swift b/ListableUI/Sources/Internal/CGSize.swift index 43add41c4..021b6b2b1 100644 --- a/ListableUI/Sources/Internal/CGSize.swift +++ b/ListableUI/Sources/Internal/CGSize.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit internal extension CGSize diff --git a/ListableUI/Sources/Internal/PresentationState/PresentationState.HeaderFooterState.swift b/ListableUI/Sources/Internal/PresentationState/PresentationState.HeaderFooterState.swift index ca3678982..c6a41859d 100644 --- a/ListableUI/Sources/Internal/PresentationState/PresentationState.HeaderFooterState.swift +++ b/ListableUI/Sources/Internal/PresentationState/PresentationState.HeaderFooterState.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit protocol AnyPresentationHeaderFooterState : AnyObject diff --git a/ListableUI/Sources/Internal/PresentationState/PresentationState.ItemState.swift b/ListableUI/Sources/Internal/PresentationState/PresentationState.ItemState.swift index 9e2ca07be..a4c1dfd02 100644 --- a/ListableUI/Sources/Internal/PresentationState/PresentationState.ItemState.swift +++ b/ListableUI/Sources/Internal/PresentationState/PresentationState.ItemState.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit protocol AnyPresentationItemState : AnyObject diff --git a/ListableUI/Sources/Internal/PresentationState/PresentationState.RefreshControl.swift b/ListableUI/Sources/Internal/PresentationState/PresentationState.RefreshControl.swift index 9cffabbcb..67c2eca19 100644 --- a/ListableUI/Sources/Internal/PresentationState/PresentationState.RefreshControl.swift +++ b/ListableUI/Sources/Internal/PresentationState/PresentationState.RefreshControl.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit extension PresentationState diff --git a/ListableUI/Sources/Internal/PresentationState/PresentationState.swift b/ListableUI/Sources/Internal/PresentationState/PresentationState.swift index 8a24d44e9..b004b5f2c 100644 --- a/ListableUI/Sources/Internal/PresentationState/PresentationState.swift +++ b/ListableUI/Sources/Internal/PresentationState/PresentationState.swift @@ -5,6 +5,8 @@ // Created by Kyle Van Essen on 7/22/19. // +import UIKit + /// A class used to manage the "live" / mutable state of the visible items in the list, /// which is persistent across diffs of content (instances are only created or destroyed when an item enters or leaves the list). diff --git a/ListableUI/Sources/Internal/UIView.swift b/ListableUI/Sources/Internal/UIView.swift index e1a0dc708..d686ce0de 100644 --- a/ListableUI/Sources/Internal/UIView.swift +++ b/ListableUI/Sources/Internal/UIView.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit extension UIView { diff --git a/ListableUI/Sources/Item/ItemContent.swift b/ListableUI/Sources/Item/ItemContent.swift index 27990aca7..2845ea55a 100644 --- a/ListableUI/Sources/Item/ItemContent.swift +++ b/ListableUI/Sources/Item/ItemContent.swift @@ -5,6 +5,9 @@ // Created by Kyle Van Essen on 8/10/19. // +import UIKit + + /// /// An `ItemContent` is a type used to provide the content of an `Item` in a list section. /// diff --git a/ListableUI/Sources/Item/ItemContentCoordinator.swift b/ListableUI/Sources/Item/ItemContentCoordinator.swift index 6a4a123c3..ab9df11f6 100644 --- a/ListableUI/Sources/Item/ItemContentCoordinator.swift +++ b/ListableUI/Sources/Item/ItemContentCoordinator.swift @@ -5,6 +5,8 @@ // Created by Kyle Van Essen on 5/19/20. // +import Foundation + /// /// A type which lets you interactively manage the contents of an `Item` or `ItemContent` diff --git a/ListableUI/Sources/Item/ItemReordering.swift b/ListableUI/Sources/Item/ItemReordering.swift index b5bf8e8b9..ae0220674 100644 --- a/ListableUI/Sources/Item/ItemReordering.swift +++ b/ListableUI/Sources/Item/ItemReordering.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit /// diff --git a/ListableUI/Sources/Item/ItemState.swift b/ListableUI/Sources/Item/ItemState.swift index 3c94a11ef..0fbe7e6e1 100644 --- a/ListableUI/Sources/Item/ItemState.swift +++ b/ListableUI/Sources/Item/ItemState.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit public struct ItemState : Hashable diff --git a/ListableUI/Sources/Layout/Grid/GridListLayout.swift b/ListableUI/Sources/Layout/Grid/GridListLayout.swift index b2bff4765..af7ba69da 100644 --- a/ListableUI/Sources/Layout/Grid/GridListLayout.swift +++ b/ListableUI/Sources/Layout/Grid/GridListLayout.swift @@ -6,6 +6,8 @@ // import Foundation +import UIKit + extension LayoutDescription { diff --git a/ListableUI/Sources/Layout/ListLayout/ListContentLayoutAttributes.swift b/ListableUI/Sources/Layout/ListLayout/ListContentLayoutAttributes.swift index 3129ae3d8..f50b93e5a 100644 --- a/ListableUI/Sources/Layout/ListLayout/ListContentLayoutAttributes.swift +++ b/ListableUI/Sources/Layout/ListLayout/ListContentLayoutAttributes.swift @@ -5,6 +5,8 @@ // Created by Kyle Van Essen on 6/9/21. // +import UIKit + /// /// A struct-based version of many of the properties available on `UICollectionViewLayoutAttributes`, diff --git a/ListableUI/Sources/Layout/ListLayout/ListLayout.swift b/ListableUI/Sources/Layout/ListLayout/ListLayout.swift index accfd44ca..d781dd354 100644 --- a/ListableUI/Sources/Layout/ListLayout/ListLayout.swift +++ b/ListableUI/Sources/Layout/ListLayout/ListLayout.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit public protocol ListLayout : AnyListLayout diff --git a/ListableUI/Sources/Layout/ListLayout/ListLayoutAttributes.swift b/ListableUI/Sources/Layout/ListLayout/ListLayoutAttributes.swift index 3baa8e7ca..2e5eb19a2 100644 --- a/ListableUI/Sources/Layout/ListLayout/ListLayoutAttributes.swift +++ b/ListableUI/Sources/Layout/ListLayout/ListLayoutAttributes.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit public struct ListLayoutAttributes : Equatable { diff --git a/ListableUI/Sources/Layout/ListLayout/ListLayoutContent.swift b/ListableUI/Sources/Layout/ListLayout/ListLayoutContent.swift index af852f7d3..5fc975317 100644 --- a/ListableUI/Sources/Layout/ListLayout/ListLayoutContent.swift +++ b/ListableUI/Sources/Layout/ListLayout/ListLayoutContent.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit public final class ListLayoutContent diff --git a/ListableUI/Sources/Layout/ListLayout/ListLayoutValues.swift b/ListableUI/Sources/Layout/ListLayout/ListLayoutValues.swift index 0c7eb6551..b57cef890 100644 --- a/ListableUI/Sources/Layout/ListLayout/ListLayoutValues.swift +++ b/ListableUI/Sources/Layout/ListLayout/ListLayoutValues.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit public struct ListLayoutPoint : Hashable { diff --git a/ListableUI/Sources/Layout/Paged/PagedListLayout.swift b/ListableUI/Sources/Layout/Paged/PagedListLayout.swift index 307a62d09..3d1df529e 100644 --- a/ListableUI/Sources/Layout/Paged/PagedListLayout.swift +++ b/ListableUI/Sources/Layout/Paged/PagedListLayout.swift @@ -5,6 +5,8 @@ // Created by Kyle Van Essen on 6/4/20. // +import UIKit + public extension LayoutDescription { diff --git a/ListableUI/Sources/Layout/Retail Grid/RetailGridListLayout.swift b/ListableUI/Sources/Layout/Retail Grid/RetailGridListLayout.swift index 37d6251a5..1025b99d2 100644 --- a/ListableUI/Sources/Layout/Retail Grid/RetailGridListLayout.swift +++ b/ListableUI/Sources/Layout/Retail Grid/RetailGridListLayout.swift @@ -6,6 +6,8 @@ // import Foundation +import UIKit + extension LayoutDescription { diff --git a/ListableUI/Sources/Layout/Table/TableListLayout.swift b/ListableUI/Sources/Layout/Table/TableListLayout.swift index 321a9ed97..e987935b2 100644 --- a/ListableUI/Sources/Layout/Table/TableListLayout.swift +++ b/ListableUI/Sources/Layout/Table/TableListLayout.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit public extension LayoutDescription diff --git a/ListableUI/Sources/LayoutDirection.swift b/ListableUI/Sources/LayoutDirection.swift index 00fae724c..cd325657e 100644 --- a/ListableUI/Sources/LayoutDirection.swift +++ b/ListableUI/Sources/LayoutDirection.swift @@ -5,6 +5,8 @@ // Created by Kyle Van Essen on 11/10/19. // +import UIKit + /// /// Describes the given direction / axis that a layout uses when flowing its content. diff --git a/ListableUI/Sources/ListActions.swift b/ListableUI/Sources/ListActions.swift index 52446fa22..cd3c9a49c 100644 --- a/ListableUI/Sources/ListActions.swift +++ b/ListableUI/Sources/ListActions.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit /// diff --git a/ListableUI/Sources/ListProperties.swift b/ListableUI/Sources/ListProperties.swift index 0a39d69e9..64b18bf38 100644 --- a/ListableUI/Sources/ListProperties.swift +++ b/ListableUI/Sources/ListProperties.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit /// diff --git a/ListableUI/Sources/ListScrollPositionInfo.swift b/ListableUI/Sources/ListScrollPositionInfo.swift index 102ad13fb..000fe33da 100644 --- a/ListableUI/Sources/ListScrollPositionInfo.swift +++ b/ListableUI/Sources/ListScrollPositionInfo.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit /// Information about the current scroll position of a list, diff --git a/ListableUI/Sources/ListStateObserver.swift b/ListableUI/Sources/ListStateObserver.swift index d2f2c95d0..945b918b9 100644 --- a/ListableUI/Sources/ListStateObserver.swift +++ b/ListableUI/Sources/ListStateObserver.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit /// Allows reading state and events based on state changes within the list view. diff --git a/ListableUI/Sources/ListView/ListView+ContentSize.swift b/ListableUI/Sources/ListView/ListView+ContentSize.swift index d2ad6c696..af5583056 100644 --- a/ListableUI/Sources/ListView/ListView+ContentSize.swift +++ b/ListableUI/Sources/ListView/ListView+ContentSize.swift @@ -5,6 +5,8 @@ // Created by Kyle Van Essen on 9/21/20. // +import UIKit + extension ListView { diff --git a/ListableUI/Sources/ListView/ListView.DataSource.swift b/ListableUI/Sources/ListView/ListView.DataSource.swift index 669a21934..e70ba417f 100644 --- a/ListableUI/Sources/ListView/ListView.DataSource.swift +++ b/ListableUI/Sources/ListView/ListView.DataSource.swift @@ -5,6 +5,8 @@ // Created by Kyle Van Essen on 11/19/19. // +import UIKit + internal extension ListView { diff --git a/ListableUI/Sources/ListView/ListView.Delegate.swift b/ListableUI/Sources/ListView/ListView.Delegate.swift index ba13c098f..d62a53314 100644 --- a/ListableUI/Sources/ListView/ListView.Delegate.swift +++ b/ListableUI/Sources/ListView/ListView.Delegate.swift @@ -5,6 +5,8 @@ // Created by Kyle Van Essen on 11/19/19. // +import UIKit + extension ListView { diff --git a/ListableUI/Sources/ListView/ListView.LayoutManager.swift b/ListableUI/Sources/ListView/ListView.LayoutManager.swift index ead7c324a..ce6fcca9e 100644 --- a/ListableUI/Sources/ListView/ListView.LayoutManager.swift +++ b/ListableUI/Sources/ListView/ListView.LayoutManager.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit extension ListView diff --git a/ListableUI/Sources/ListView/ListView.Storage.swift b/ListableUI/Sources/ListView/ListView.Storage.swift index 7a4fe59ff..874ed1bec 100644 --- a/ListableUI/Sources/ListView/ListView.Storage.swift +++ b/ListableUI/Sources/ListView/ListView.Storage.swift @@ -5,6 +5,8 @@ // Created by Kyle Van Essen on 11/19/19. // +import UIKit + internal extension ListView { diff --git a/ListableUI/Sources/ListView/UpdateCallbacks.swift b/ListableUI/Sources/ListView/UpdateCallbacks.swift index 2aacb836b..909523ef4 100644 --- a/ListableUI/Sources/ListView/UpdateCallbacks.swift +++ b/ListableUI/Sources/ListView/UpdateCallbacks.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit public final class UpdateCallbacks { diff --git a/ListableUI/Sources/ListViewController.swift b/ListableUI/Sources/ListViewController.swift index 0b57ee546..74b400bb8 100644 --- a/ListableUI/Sources/ListViewController.swift +++ b/ListableUI/Sources/ListViewController.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit /// diff --git a/ListableUI/Sources/ListViewSource.swift b/ListableUI/Sources/ListViewSource.swift index a47c7b94b..6399f8dc1 100644 --- a/ListableUI/Sources/ListViewSource.swift +++ b/ListableUI/Sources/ListViewSource.swift @@ -5,6 +5,8 @@ // Created by Kyle Van Essen on 8/4/19. // +import UIKit + // TODO: Rename this all to ContentProvider? diff --git a/ListableUI/Sources/RefreshControl.swift b/ListableUI/Sources/RefreshControl.swift index 6f54214c7..d2ac4c037 100644 --- a/ListableUI/Sources/RefreshControl.swift +++ b/ListableUI/Sources/RefreshControl.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit public struct RefreshControl diff --git a/ListableUI/Sources/ScrollPosition.swift b/ListableUI/Sources/ScrollPosition.swift index 046e6b1fe..031244c23 100644 --- a/ListableUI/Sources/ScrollPosition.swift +++ b/ListableUI/Sources/ScrollPosition.swift @@ -5,6 +5,9 @@ // Created by Kyle Van Essen on 11/5/19. // +import UIKit + + /// Specifies how to position an item in a list when requesting the list scrolls to it. /// /// You can specify a position (top, center, bottom), what to do if the diff --git a/ListableUI/Sources/Sizing.swift b/ListableUI/Sources/Sizing.swift index 12e0329dc..79c1222c7 100644 --- a/ListableUI/Sources/Sizing.swift +++ b/ListableUI/Sources/Sizing.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit /// diff --git a/ListableUI/Sources/SwipeActionsConfiguration.swift b/ListableUI/Sources/SwipeActionsConfiguration.swift index 656596ce8..8131f841e 100644 --- a/ListableUI/Sources/SwipeActionsConfiguration.swift +++ b/ListableUI/Sources/SwipeActionsConfiguration.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit /// Use SwipeActionsConfiguration to configure an item with SwipeActions. diff --git a/ListableUI/Sources/ViewAnimation.swift b/ListableUI/Sources/ViewAnimation.swift index e7204ee55..d056f1cf5 100644 --- a/ListableUI/Sources/ViewAnimation.swift +++ b/ListableUI/Sources/ViewAnimation.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit /// Specifies the kind of animation to use when updating various parts of a list, diff --git a/Package.swift b/Package.swift new file mode 100644 index 000000000..31490539c --- /dev/null +++ b/Package.swift @@ -0,0 +1,45 @@ +// swift-tools-version:5.3 + +import PackageDescription + +let package = Package( + name: "Listable", + defaultLocalization: "en", + platforms: [ + .iOS(.v12), + ], + products: [ + .library( + name: "ListableUI", + targets: ["ListableUI"] + ), + .library( + name: "BlueprintUILists", + targets: ["BlueprintUILists"] + ), + ], + dependencies: [ + .package(url: "https://github.com/square/Blueprint", from: "0.19.0"), + ], + targets: [ + .target( + name: "ListableUI", + path: "ListableUI/Sources", + exclude: [ + "Internal/KeyboardObserver/SetupKeyboardObserverOnAppStartup.m", + "Layout/Paged/PagedAppearance.monopic", + "ContentBounds/ListContentBounds.monopic", + "Layout/Table/TableAppearance.monopic", + ] + ), + .target( + name: "BlueprintUILists", + dependencies: [ + "ListableUI", + .product(name: "BlueprintUI", package: "Blueprint") + ], + path: "BlueprintUILists/Sources" + ), + ], + swiftLanguageVersions: [.v5] +) From 8219919041d2d3fc28233ff3c4ab05ee29200a9b Mon Sep 17 00:00:00 2001 From: Adam Lickel Date: Mon, 25 Oct 2021 14:20:07 -0700 Subject: [PATCH 2/3] SPM Test support --- .../Sources/EnglishDictionary.swift | 14 +++- Internal Pods/Snapshot/Sources/Snapshot.swift | 80 +++++++++---------- .../Tests/Internal/Diff/StableRNG.swift | 13 ++- Package.swift | 37 +++++++++ 4 files changed, 99 insertions(+), 45 deletions(-) diff --git a/Internal Pods/EnglishDictionary/Sources/EnglishDictionary.swift b/Internal Pods/EnglishDictionary/Sources/EnglishDictionary.swift index e1b036c33..41c5a45a2 100644 --- a/Internal Pods/EnglishDictionary/Sources/EnglishDictionary.swift +++ b/Internal Pods/EnglishDictionary/Sources/EnglishDictionary.swift @@ -8,7 +8,16 @@ import UIKit -class BundleFinder : NSObject {} +internal extension Bundle { + static var resources: Bundle { + #if SWIFT_PACKAGE + return .module + #else + let main = Bundle(for: EnglishDictionary.self) + return Bundle(url: main.url(forResource: "EnglishDictionaryResources", withExtension: "bundle")!)! + #endif + } +} public class EnglishDictionary { @@ -19,8 +28,7 @@ public class EnglishDictionary public init() { - let main = Bundle(for: EnglishDictionary.self) - let bundle = Bundle(url: main.url(forResource: "EnglishDictionaryResources", withExtension: "bundle")!)! + let bundle = Bundle.resources let stream = InputStream(url: bundle.url(forResource: "dictionary", withExtension: "json")!)! defer { stream.close() } diff --git a/Internal Pods/Snapshot/Sources/Snapshot.swift b/Internal Pods/Snapshot/Sources/Snapshot.swift index dd2b4b440..5afb50212 100644 --- a/Internal Pods/Snapshot/Sources/Snapshot.swift +++ b/Internal Pods/Snapshot/Sources/Snapshot.swift @@ -8,16 +8,16 @@ import XCTest public struct Snapshot -{ +{ public typealias Test = (Iteration) throws -> Iteration.RenderingFormat - + public let settings : SnapshotSettings public let iterations : [Iteration] public let test : Test - + internal typealias OnFail = (_ message : String, _ file : StaticString, _ line : UInt) -> () - internal var onFail : OnFail = XCTFail - + internal var onFail : OnFail = { message, file, line in XCTFail(message, file: file, line: line) } + public init( for iteration: Iteration , settings : SnapshotSettings = .init(), @@ -25,7 +25,7 @@ public struct Snapshot ) { self.init(for: [iteration], settings : settings) { _ in input } } - + public init( for iterations: [Iteration] , settings : SnapshotSettings = .init(), @@ -33,7 +33,7 @@ public struct Snapshot ) { self.init(for: iterations, settings : settings) { _ in input } } - + public init( for iterations : [Iteration], settings : SnapshotSettings = .init(), @@ -41,20 +41,20 @@ public struct Snapshot ) { let hasIterations = iterations.isEmpty == false precondition(hasIterations, "Must provide at least one iteration.") - + let allNames = iterations.map { $0.name } - + let allNamesUnique = Set(allNames).count == iterations.count precondition(allNamesUnique, "Must provide iterations with unique names.") - + let allNamesNonEmpty = allNames.allSatisfy { $0.isEmpty == false } precondition(allNamesNonEmpty, "Cannot provide an empty iteration name.") - + self.iterations = iterations.sorted { $0.name < $1.name } self.settings = settings self.test = test } - + public func test( output: OutputFormat.Type, testCase : String? = nil, @@ -72,16 +72,16 @@ public struct Snapshot functionName: functionName.description, iteration: iteration.name ) - + var onFailData : Data? = nil - + do { let rendering = iteration.prepare(render: try self.test(iteration)) let data = try OutputFormat.snapshotData(with: rendering) onFailData = data - + let existingData = try self.existingData(at: url) - + if let existingData = existingData { do { try OutputFormat.validate(render: rendering, existingData: existingData) @@ -100,35 +100,35 @@ public struct Snapshot return "Error generating snapshotData." } }() - + self.onFail( """ Snapshot test '\(iteration.name)' with format '\(OutputFormat.self)' failed. - + Error: \(error). - + File extension: '.\(output.outputInfo.fileExtension)'. - + Base64 Data (pass this to `Data.saveBase64(toPath: "~/Development/etc ...", content: "...")` to inspect locally): - + '\(data)'. - + """, testFilePath, line ) - } + } } } - + func existingData(at url : URL) throws -> Data? { guard FileManager.default.fileExists(atPath: url.path) else { return nil } - + return try Data(contentsOf: url) } - + static func outputUrl( with settings : SnapshotSettings, output: OutputFormat.Type, @@ -141,23 +141,23 @@ public struct Snapshot let testFileURL = URL(fileURLWithPath: testFilePath) let testFileName = testFileURL.lastPathComponent let testDirectory = testFileURL.deletingLastPathComponent() - + // For: ~/Development/Project/Tests/Tests.swift // We Provide: ~/Development/Project/Tests/Snapshot Results/Tests.swift/OSVersion/testFunctionName()/outputFormat/testCase/modifierName.extension - + var snapshotsDirectory = testDirectory .appendingPathComponent("Snapshot Results", isDirectory: true) .appendingPathComponent(testFileName, isDirectory: true) .appendingPathComponent(settings.savesBySystemVersion.systemVersionDirectory(), isDirectory: true) .appendingPathComponent(functionName, isDirectory: true) .appendingPathComponent(OutputFormat.outputInfo.directoryName, isDirectory: true) - + if let testCase = testCase { snapshotsDirectory = snapshotsDirectory.appendingPathComponent(testCase, isDirectory: true) } - + try! FileManager.default.createDirectory(at: snapshotsDirectory, withIntermediateDirectories: true, attributes: [:]) - + return snapshotsDirectory .appendingPathComponent(iteration) .appendingPathExtension(OutputFormat.outputInfo.fileExtension) @@ -170,19 +170,19 @@ public extension Data static func saveBase64(toPath path : String, content : String) -> Bool { let url = URL(fileURLWithPath: (path as NSString).expandingTildeInPath) - + guard let data = Data(base64Encoded: content) else { print("Could not create data from base64 string.") return false } - + do { try data.write(to: url) } catch { print("Could not write data to disk. Error: \(error)") return false } - + return true } } @@ -197,11 +197,11 @@ public enum SnapshotValidationError : Error public protocol SnapshotOutputFormat { associatedtype RenderingFormat - + static func snapshotData(with renderingFormat : RenderingFormat) throws -> Data - + static var outputInfo : SnapshotOutputInfo { get } - + static func validate(render: RenderingFormat, existingData : Data) throws } @@ -210,7 +210,7 @@ public struct SnapshotOutputInfo : Equatable { public var directoryName : String public var fileExtension : String - + public init( directoryName : String, fileExtension : String @@ -224,8 +224,8 @@ public struct SnapshotOutputInfo : Equatable public protocol SnapshotIteration { associatedtype RenderingFormat - + var name : String { get } - + func prepare(render : RenderingFormat) -> RenderingFormat } diff --git a/ListableUI/Tests/Internal/Diff/StableRNG.swift b/ListableUI/Tests/Internal/Diff/StableRNG.swift index 5e4be17d0..4627615e2 100644 --- a/ListableUI/Tests/Internal/Diff/StableRNG.swift +++ b/ListableUI/Tests/Internal/Diff/StableRNG.swift @@ -7,12 +7,21 @@ import Foundation +internal extension Bundle { + static var resources: Bundle { + #if SWIFT_PACKAGE + return .module + #else + let main = Bundle(for: ArrayDiffTests.self) + return Bundle(url: main.url(forResource: "ListableUITestsResources", withExtension: "bundle")!)! + #endif + } +} struct StableRNG : RandomNumberGenerator { private static let numbers : [UInt64] = { - let main = Bundle(for: ArrayDiffTests.self) - let bundle = Bundle(url: main.url(forResource: "ListableUITestsResources", withExtension: "bundle")!)! + let bundle = Bundle.resources let url = bundle.url(forResource: "random_numbers", withExtension: "json")! diff --git a/Package.swift b/Package.swift index 31490539c..e03f5a9bf 100644 --- a/Package.swift +++ b/Package.swift @@ -32,6 +32,38 @@ let package = Package( "Layout/Table/TableAppearance.monopic", ] ), + .target( + name: "EnglishDictionary", + path: "Internal Pods/EnglishDictionary", + exclude: ["EnglishDictionary.podspec"], + resources: [ + .process("Resources"), + ] + ), + .target( + name: "Snapshot", + path: "Internal Pods/Snapshot/Sources" + ), + .testTarget( + name: "SnapshotTests", + dependencies: ["Snapshot"], + path: "Internal Pods/Snapshot/Tests", + exclude: ["Snapshot Results"] + ), + .testTarget( + name: "ListableUITests", + dependencies: ["ListableUI", "EnglishDictionary", "Snapshot"], + path: "ListableUI/Tests", + exclude: [ + "Layout/Paged/Snapshot Results", + "Layout/Retail Grid/Snapshot Results", + "Layout/Table/Snapshot Results", + "Previews/Snapshot Results", + ], + resources: [ + .process("Resources"), + ] + ), .target( name: "BlueprintUILists", dependencies: [ @@ -40,6 +72,11 @@ let package = Package( ], path: "BlueprintUILists/Sources" ), + .testTarget( + name: "BlueprintUIListsTests", + dependencies: ["BlueprintUILists"], + path: "BlueprintUILists/Tests" + ), ], swiftLanguageVersions: [.v5] ) From 58cfae0c8c542b33c6549f665436da17b7325048 Mon Sep 17 00:00:00 2001 From: Adam Lickel Date: Mon, 25 Oct 2021 14:25:54 -0700 Subject: [PATCH 3/3] Revert file --- Internal Pods/Snapshot/Sources/Snapshot.swift | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/Internal Pods/Snapshot/Sources/Snapshot.swift b/Internal Pods/Snapshot/Sources/Snapshot.swift index 5afb50212..dd2b4b440 100644 --- a/Internal Pods/Snapshot/Sources/Snapshot.swift +++ b/Internal Pods/Snapshot/Sources/Snapshot.swift @@ -8,16 +8,16 @@ import XCTest public struct Snapshot -{ +{ public typealias Test = (Iteration) throws -> Iteration.RenderingFormat - + public let settings : SnapshotSettings public let iterations : [Iteration] public let test : Test - + internal typealias OnFail = (_ message : String, _ file : StaticString, _ line : UInt) -> () - internal var onFail : OnFail = { message, file, line in XCTFail(message, file: file, line: line) } - + internal var onFail : OnFail = XCTFail + public init( for iteration: Iteration , settings : SnapshotSettings = .init(), @@ -25,7 +25,7 @@ public struct Snapshot ) { self.init(for: [iteration], settings : settings) { _ in input } } - + public init( for iterations: [Iteration] , settings : SnapshotSettings = .init(), @@ -33,7 +33,7 @@ public struct Snapshot ) { self.init(for: iterations, settings : settings) { _ in input } } - + public init( for iterations : [Iteration], settings : SnapshotSettings = .init(), @@ -41,20 +41,20 @@ public struct Snapshot ) { let hasIterations = iterations.isEmpty == false precondition(hasIterations, "Must provide at least one iteration.") - + let allNames = iterations.map { $0.name } - + let allNamesUnique = Set(allNames).count == iterations.count precondition(allNamesUnique, "Must provide iterations with unique names.") - + let allNamesNonEmpty = allNames.allSatisfy { $0.isEmpty == false } precondition(allNamesNonEmpty, "Cannot provide an empty iteration name.") - + self.iterations = iterations.sorted { $0.name < $1.name } self.settings = settings self.test = test } - + public func test( output: OutputFormat.Type, testCase : String? = nil, @@ -72,16 +72,16 @@ public struct Snapshot functionName: functionName.description, iteration: iteration.name ) - + var onFailData : Data? = nil - + do { let rendering = iteration.prepare(render: try self.test(iteration)) let data = try OutputFormat.snapshotData(with: rendering) onFailData = data - + let existingData = try self.existingData(at: url) - + if let existingData = existingData { do { try OutputFormat.validate(render: rendering, existingData: existingData) @@ -100,35 +100,35 @@ public struct Snapshot return "Error generating snapshotData." } }() - + self.onFail( """ Snapshot test '\(iteration.name)' with format '\(OutputFormat.self)' failed. - + Error: \(error). - + File extension: '.\(output.outputInfo.fileExtension)'. - + Base64 Data (pass this to `Data.saveBase64(toPath: "~/Development/etc ...", content: "...")` to inspect locally): - + '\(data)'. - + """, testFilePath, line ) - } + } } } - + func existingData(at url : URL) throws -> Data? { guard FileManager.default.fileExists(atPath: url.path) else { return nil } - + return try Data(contentsOf: url) } - + static func outputUrl( with settings : SnapshotSettings, output: OutputFormat.Type, @@ -141,23 +141,23 @@ public struct Snapshot let testFileURL = URL(fileURLWithPath: testFilePath) let testFileName = testFileURL.lastPathComponent let testDirectory = testFileURL.deletingLastPathComponent() - + // For: ~/Development/Project/Tests/Tests.swift // We Provide: ~/Development/Project/Tests/Snapshot Results/Tests.swift/OSVersion/testFunctionName()/outputFormat/testCase/modifierName.extension - + var snapshotsDirectory = testDirectory .appendingPathComponent("Snapshot Results", isDirectory: true) .appendingPathComponent(testFileName, isDirectory: true) .appendingPathComponent(settings.savesBySystemVersion.systemVersionDirectory(), isDirectory: true) .appendingPathComponent(functionName, isDirectory: true) .appendingPathComponent(OutputFormat.outputInfo.directoryName, isDirectory: true) - + if let testCase = testCase { snapshotsDirectory = snapshotsDirectory.appendingPathComponent(testCase, isDirectory: true) } - + try! FileManager.default.createDirectory(at: snapshotsDirectory, withIntermediateDirectories: true, attributes: [:]) - + return snapshotsDirectory .appendingPathComponent(iteration) .appendingPathExtension(OutputFormat.outputInfo.fileExtension) @@ -170,19 +170,19 @@ public extension Data static func saveBase64(toPath path : String, content : String) -> Bool { let url = URL(fileURLWithPath: (path as NSString).expandingTildeInPath) - + guard let data = Data(base64Encoded: content) else { print("Could not create data from base64 string.") return false } - + do { try data.write(to: url) } catch { print("Could not write data to disk. Error: \(error)") return false } - + return true } } @@ -197,11 +197,11 @@ public enum SnapshotValidationError : Error public protocol SnapshotOutputFormat { associatedtype RenderingFormat - + static func snapshotData(with renderingFormat : RenderingFormat) throws -> Data - + static var outputInfo : SnapshotOutputInfo { get } - + static func validate(render: RenderingFormat, existingData : Data) throws } @@ -210,7 +210,7 @@ public struct SnapshotOutputInfo : Equatable { public var directoryName : String public var fileExtension : String - + public init( directoryName : String, fileExtension : String @@ -224,8 +224,8 @@ public struct SnapshotOutputInfo : Equatable public protocol SnapshotIteration { associatedtype RenderingFormat - + var name : String { get } - + func prepare(render : RenderingFormat) -> RenderingFormat }