diff --git a/LazyCollectionViewApp/LazyCollectionViewApp.xcodeproj/project.pbxproj b/LazyCollectionViewApp/LazyCollectionViewApp.xcodeproj/project.pbxproj index b4c6bca..2861307 100644 --- a/LazyCollectionViewApp/LazyCollectionViewApp.xcodeproj/project.pbxproj +++ b/LazyCollectionViewApp/LazyCollectionViewApp.xcodeproj/project.pbxproj @@ -8,41 +8,23 @@ /* Begin PBXBuildFile section */ 0914BE502878C5920067D3E9 /* LazyCollectionViewApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0914BE402878C5910067D3E9 /* LazyCollectionViewApp.swift */; }; - 0914BE512878C5920067D3E9 /* LazyCollectionViewApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0914BE402878C5910067D3E9 /* LazyCollectionViewApp.swift */; }; 0914BE522878C5920067D3E9 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0914BE412878C5910067D3E9 /* ContentView.swift */; }; - 0914BE532878C5920067D3E9 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0914BE412878C5910067D3E9 /* ContentView.swift */; }; 0914BE542878C5920067D3E9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0914BE422878C5920067D3E9 /* Assets.xcassets */; }; - 0914BE552878C5920067D3E9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0914BE422878C5920067D3E9 /* Assets.xcassets */; }; 093CA583287F0B7F00413978 /* ItemCountStepper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 093CA582287F0B7F00413978 /* ItemCountStepper.swift */; }; - 093CA584287F0B7F00413978 /* ItemCountStepper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 093CA582287F0B7F00413978 /* ItemCountStepper.swift */; }; 093CA586287F64AC00413978 /* WarningView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 093CA585287F64AC00413978 /* WarningView.swift */; }; - 093CA587287F64AC00413978 /* WarningView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 093CA585287F64AC00413978 /* WarningView.swift */; }; 093CA589287F67A300413978 /* ColumnHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 093CA588287F67A300413978 /* ColumnHeaderView.swift */; }; - 093CA58A287F67A300413978 /* ColumnHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 093CA588287F67A300413978 /* ColumnHeaderView.swift */; }; 093CA58C2880527B00413978 /* ReadMeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 093CA58B2880527B00413978 /* ReadMeView.swift */; }; - 093CA5972880AAB900413978 /* ReadMeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 093CA58B2880527B00413978 /* ReadMeView.swift */; }; 09479A2428983923002A3060 /* LazyCollectionView in Frameworks */ = {isa = PBXBuildFile; productRef = 09479A2328983923002A3060 /* LazyCollectionView */; }; - 09479A2628983929002A3060 /* LazyCollectionView in Frameworks */ = {isa = PBXBuildFile; productRef = 09479A2528983929002A3060 /* LazyCollectionView */; }; 097988A2287DEE64001B7EA0 /* ListLayoutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097988A1287DEE64001B7EA0 /* ListLayoutView.swift */; }; - 097988A3287DEE64001B7EA0 /* ListLayoutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097988A1287DEE64001B7EA0 /* ListLayoutView.swift */; }; 097988A5287DEEE8001B7EA0 /* NamedColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097988A4287DEEE8001B7EA0 /* NamedColor.swift */; }; - 097988A6287DEEE8001B7EA0 /* NamedColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097988A4287DEEE8001B7EA0 /* NamedColor.swift */; }; 097988AB287DEFE4001B7EA0 /* NamedColorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097988AA287DEFE4001B7EA0 /* NamedColorView.swift */; }; - 097988AC287DEFE4001B7EA0 /* NamedColorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097988AA287DEFE4001B7EA0 /* NamedColorView.swift */; }; 097988AF287DF254001B7EA0 /* ListLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097988AE287DF254001B7EA0 /* ListLayout.swift */; }; - 097988B0287DF254001B7EA0 /* ListLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097988AE287DF254001B7EA0 /* ListLayout.swift */; }; 097988B8287DFEDD001B7EA0 /* GridLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097988B7287DFEDD001B7EA0 /* GridLayout.swift */; }; - 097988B9287DFEDD001B7EA0 /* GridLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097988B7287DFEDD001B7EA0 /* GridLayout.swift */; }; 097988BF287E0506001B7EA0 /* GridLayoutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097988BE287E0506001B7EA0 /* GridLayoutView.swift */; }; - 097988C0287E0506001B7EA0 /* GridLayoutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097988BE287E0506001B7EA0 /* GridLayoutView.swift */; }; 097988C3287E092E001B7EA0 /* ColumnLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097988C2287E092E001B7EA0 /* ColumnLayout.swift */; }; - 097988C4287E092E001B7EA0 /* ColumnLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097988C2287E092E001B7EA0 /* ColumnLayout.swift */; }; - 097988C6287E09A5001B7EA0 /* ColumnLayoutProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097988C5287E09A5001B7EA0 /* ColumnLayoutProperties.swift */; }; 097988C7287E09A5001B7EA0 /* ColumnLayoutProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097988C5287E09A5001B7EA0 /* ColumnLayoutProperties.swift */; }; 097988C9287E0B21001B7EA0 /* ColumnLayoutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097988C8287E0B21001B7EA0 /* ColumnLayoutView.swift */; }; - 097988CA287E0B21001B7EA0 /* ColumnLayoutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097988C8287E0B21001B7EA0 /* ColumnLayoutView.swift */; }; 097988CC287E0BAC001B7EA0 /* SizedNamedColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097988CB287E0BAC001B7EA0 /* SizedNamedColor.swift */; }; - 097988CD287E0BAC001B7EA0 /* SizedNamedColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097988CB287E0BAC001B7EA0 /* SizedNamedColor.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -50,7 +32,6 @@ 0914BE412878C5910067D3E9 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 0914BE422878C5920067D3E9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 0914BE472878C5920067D3E9 /* LazyCollectionViewApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LazyCollectionViewApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 0914BE4D2878C5920067D3E9 /* LazyCollectionViewApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LazyCollectionViewApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; 0914BE4F2878C5920067D3E9 /* macOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = macOS.entitlements; sourceTree = ""; }; 093CA582287F0B7F00413978 /* ItemCountStepper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemCountStepper.swift; sourceTree = ""; }; 093CA585287F64AC00413978 /* WarningView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WarningView.swift; sourceTree = ""; }; @@ -78,14 +59,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 0914BE4A2878C5920067D3E9 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 09479A2628983929002A3060 /* LazyCollectionView in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -123,7 +96,6 @@ isa = PBXGroup; children = ( 0914BE472878C5920067D3E9 /* LazyCollectionViewApp.app */, - 0914BE4D2878C5920067D3E9 /* LazyCollectionViewApp.app */, ); name = Products; sourceTree = ""; @@ -203,26 +175,6 @@ productReference = 0914BE472878C5920067D3E9 /* LazyCollectionViewApp.app */; productType = "com.apple.product-type.application"; }; - 0914BE4C2878C5920067D3E9 /* LazyCollectionViewApp (macOS) */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0914BE5B2878C5920067D3E9 /* Build configuration list for PBXNativeTarget "LazyCollectionViewApp (macOS)" */; - buildPhases = ( - 0914BE492878C5920067D3E9 /* Sources */, - 0914BE4A2878C5920067D3E9 /* Frameworks */, - 0914BE4B2878C5920067D3E9 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "LazyCollectionViewApp (macOS)"; - packageProductDependencies = ( - 09479A2528983929002A3060 /* LazyCollectionView */, - ); - productName = "LazyCollectionViewApp (macOS)"; - productReference = 0914BE4D2878C5920067D3E9 /* LazyCollectionViewApp.app */; - productType = "com.apple.product-type.application"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -231,15 +183,12 @@ attributes = { BuildIndependentTargetsInParallel = 1; LastSwiftUpdateCheck = 1340; - LastUpgradeCheck = 1340; + LastUpgradeCheck = 1530; ORGANIZATIONNAME = Unsplash; TargetAttributes = { 0914BE462878C5920067D3E9 = { CreatedOnToolsVersion = 13.4.1; }; - 0914BE4C2878C5920067D3E9 = { - CreatedOnToolsVersion = 13.4.1; - }; }; }; buildConfigurationList = 0914BE3E2878C5900067D3E9 /* Build configuration list for PBXProject "LazyCollectionViewApp" */; @@ -256,7 +205,6 @@ projectRoot = ""; targets = ( 0914BE462878C5920067D3E9 /* LazyCollectionViewApp (iOS) */, - 0914BE4C2878C5920067D3E9 /* LazyCollectionViewApp (macOS) */, ); }; /* End PBXProject section */ @@ -270,14 +218,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 0914BE4B2878C5920067D3E9 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0914BE552878C5920067D3E9 /* Assets.xcassets in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -304,29 +244,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 0914BE492878C5920067D3E9 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 097988AC287DEFE4001B7EA0 /* NamedColorView.swift in Sources */, - 097988A3287DEE64001B7EA0 /* ListLayoutView.swift in Sources */, - 0914BE532878C5920067D3E9 /* ContentView.swift in Sources */, - 097988B0287DF254001B7EA0 /* ListLayout.swift in Sources */, - 097988C6287E09A5001B7EA0 /* ColumnLayoutProperties.swift in Sources */, - 093CA58A287F67A300413978 /* ColumnHeaderView.swift in Sources */, - 0914BE512878C5920067D3E9 /* LazyCollectionViewApp.swift in Sources */, - 097988C4287E092E001B7EA0 /* ColumnLayout.swift in Sources */, - 097988B9287DFEDD001B7EA0 /* GridLayout.swift in Sources */, - 097988C0287E0506001B7EA0 /* GridLayoutView.swift in Sources */, - 097988CA287E0B21001B7EA0 /* ColumnLayoutView.swift in Sources */, - 093CA5972880AAB900413978 /* ReadMeView.swift in Sources */, - 097988A6287DEEE8001B7EA0 /* NamedColor.swift in Sources */, - 093CA587287F64AC00413978 /* WarningView.swift in Sources */, - 093CA584287F0B7F00413978 /* ItemCountStepper.swift in Sources */, - 097988CD287E0BAC001B7EA0 /* SizedNamedColor.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ @@ -363,9 +280,11 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -421,9 +340,11 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -459,13 +380,19 @@ "$(inherited)", "@executable_path/Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 12.0; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.Unsplash.LazyCollectionViewApp; PRODUCT_NAME = LazyCollectionViewApp; SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = "1,2,7"; + XROS_DEPLOYMENT_TARGET = 1.0; }; name = Debug; }; @@ -489,70 +416,20 @@ "$(inherited)", "@executable_path/Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 12.0; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.Unsplash.LazyCollectionViewApp; PRODUCT_NAME = LazyCollectionViewApp; SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = "1,2,7"; VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 0914BE5C2878C5920067D3E9 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CODE_SIGN_ENTITLEMENTS = macOS/macOS.entitlements; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = Z7GT6KUQ38; - ENABLE_HARDENED_RUNTIME = YES; - ENABLE_PREVIEWS = YES; - GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_KEY_NSHumanReadableCopyright = ""; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - MACOSX_DEPLOYMENT_TARGET = 12.3; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.Unsplash.LazyCollectionViewApp; - PRODUCT_NAME = LazyCollectionViewApp; - SDKROOT = macosx; - SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; - }; - name = Debug; - }; - 0914BE5D2878C5920067D3E9 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CODE_SIGN_ENTITLEMENTS = macOS/macOS.entitlements; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = Z7GT6KUQ38; - ENABLE_HARDENED_RUNTIME = YES; - ENABLE_PREVIEWS = YES; - GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_KEY_NSHumanReadableCopyright = ""; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - MACOSX_DEPLOYMENT_TARGET = 12.3; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.Unsplash.LazyCollectionViewApp; - PRODUCT_NAME = LazyCollectionViewApp; - SDKROOT = macosx; - SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; + XROS_DEPLOYMENT_TARGET = 1.0; }; name = Release; }; @@ -577,15 +454,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 0914BE5B2878C5920067D3E9 /* Build configuration list for PBXNativeTarget "LazyCollectionViewApp (macOS)" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0914BE5C2878C5920067D3E9 /* Debug */, - 0914BE5D2878C5920067D3E9 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; /* End XCConfigurationList section */ /* Begin XCSwiftPackageProductDependency section */ @@ -593,10 +461,6 @@ isa = XCSwiftPackageProductDependency; productName = LazyCollectionView; }; - 09479A2528983929002A3060 /* LazyCollectionView */ = { - isa = XCSwiftPackageProductDependency; - productName = LazyCollectionView; - }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 0914BE3B2878C5900067D3E9 /* Project object */; diff --git a/Package.swift b/Package.swift index e82fbdc..875b86e 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.6 +// swift-tools-version: 5.10 import PackageDescription @@ -6,7 +6,8 @@ let package = Package( name: "LazyCollectionView", platforms: [ .iOS(.v14), - .macOS(.v12) + .macOS(.v12), + .visionOS(.v1) ], products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. diff --git a/Sources/LazyCollectionView/LazyCollectionView.swift b/Sources/LazyCollectionView/LazyCollectionView.swift index 569f6f5..4f8255d 100644 --- a/Sources/LazyCollectionView/LazyCollectionView.swift +++ b/Sources/LazyCollectionView/LazyCollectionView.swift @@ -63,10 +63,22 @@ where Data: RandomAccessCollection & Equatable, layout.setParentSize(proxy.size) layout.prepare(withData: data) } + #if os(visionOS) + .onChange(of: self.parentFrame) { oldValue, newValue in + onParentFrameChanged(newValue) + } + #else .onChange(of: self.parentFrame, perform: onParentFrameChanged(_:)) + #endif } .frame(width: width, height: height) + #if os(visionOS) + .onChange(of: data) { _, newValue in + onDataChanged(newValue) + } + #else .onChange(of: data, perform: onDataChanged(_:)) + #endif } private func onParentFrameChanged(_ newValue: CGRect?) {