Compare commits
57 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a576a83530 | |||
| 4949a88839 | |||
| 11e0c80586 | |||
| 0037147caf | |||
| 35543f6b6c | |||
| 227269190f | |||
| 38f6b056f1 | |||
| 90a0ce56da | |||
| 0e9d75b59d | |||
| da9c8b1372 | |||
| 83960eb567 | |||
| cae11d5404 | |||
| ab7324dc5b | |||
| 8cd7e843af | |||
| 519d724e17 | |||
| d80114e454 | |||
| 1d4c698ab0 | |||
| 0ebf480310 | |||
| b178f69898 | |||
| 62782d83f9 | |||
| b3038a90ec | |||
| 03ba583c49 | |||
| f29e4b0716 | |||
| 41ce466ae3 | |||
| c3688a9e1d | |||
| 512885a166 | |||
| 8fad95711e | |||
| d6e792e3ec | |||
| fcea3c29e7 | |||
| 7eb29bd82a | |||
| a64002ef72 | |||
| d3d5136f3d | |||
| 8691a862bc | |||
| e4378462e2 | |||
| a8b2962c9b | |||
| 31f9b56b3a | |||
| 51473be4c7 | |||
| ee26e28d39 | |||
| f6b339ad96 | |||
| cc916ccd92 | |||
| ae1969e26f | |||
| 42e8d150a2 | |||
| b839a5af47 | |||
| a522cf0c36 | |||
| 294fd763f8 | |||
| 9468de35bd | |||
| e95b550962 | |||
| f8adf9c9a5 | |||
| 29de021e92 | |||
| e011a23f19 | |||
| 12f4c3e966 | |||
| af0c4598be | |||
| a446dc45ff | |||
| f9566b45bb | |||
| 6e74d52f42 | |||
| c125f52695 | |||
| 075fb6c75b |
@@ -33,3 +33,4 @@ Carthage
|
||||
# Pods/
|
||||
/Example/InfiniteLayout.xcworkspace
|
||||
/Example/Pods
|
||||
/Example/InfiniteLayout.xcodeproj/project.xcworkspace/xcshareddata
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
4.0
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
+7
-8
@@ -2,13 +2,12 @@
|
||||
# * http://www.objc.io/issue-6/travis-ci.html
|
||||
# * https://github.com/supermarin/xcpretty#usage
|
||||
|
||||
osx_image: xcode7.3
|
||||
language: objective-c
|
||||
# cache: cocoapods
|
||||
# podfile: Example/Podfile
|
||||
# before_install:
|
||||
# - gem install cocoapods # Since Travis is not always on latest version
|
||||
# - pod install --project-directory=Example
|
||||
osx_image: xcode10.2
|
||||
language: swift
|
||||
before_install:
|
||||
- gem install cocoapods # Since Travis is not always on latest version
|
||||
- pod repo update
|
||||
- pod install --project-directory=Example
|
||||
script:
|
||||
- set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/InfiniteLayout.xcworkspace -scheme InfiniteLayout-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty
|
||||
- set -o pipefail && xcodebuild -workspace Example/InfiniteLayout.xcworkspace -scheme InfiniteLayout-Example -sdk iphonesimulator build CODE_SIGNING_REQUIRED=NO | xcpretty -c
|
||||
- pod lib lint
|
||||
|
||||
@@ -9,12 +9,16 @@
|
||||
/* Begin PBXBuildFile section */
|
||||
5259B95F4E58F763F6C70333 /* Pods_InfiniteLayout_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A6830D8B970E919B725A0D5E /* Pods_InfiniteLayout_Example.framework */; };
|
||||
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; };
|
||||
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; };
|
||||
607FACD81AFB9204008FA782 /* CustomViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* CustomViewController.swift */; };
|
||||
607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; };
|
||||
607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; };
|
||||
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; };
|
||||
607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; };
|
||||
D403973F1FEBFA9D006C41D2 /* Cell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D403973E1FEBFA9D006C41D2 /* Cell.swift */; };
|
||||
D4162A391FF502A900AC2572 /* CustomLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4162A381FF502A900AC2572 /* CustomLayout.swift */; };
|
||||
D43362D11FF64B330040C679 /* BaseCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D43362CF1FF64B330040C679 /* BaseCollectionViewController.swift */; };
|
||||
D495544E1FFD3D920081225B /* RxBaseCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D495544D1FFD3D920081225B /* RxBaseCollectionViewController.swift */; };
|
||||
D4B9816E1FFCCC900016C676 /* PickerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4B9816D1FFCCC900016C676 /* PickerController.swift */; };
|
||||
E997A539C8278E7A661C9F91 /* Pods_InfiniteLayout_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C50F79B0DFFDE95D322480B2 /* Pods_InfiniteLayout_Tests.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
@@ -31,11 +35,11 @@
|
||||
/* Begin PBXFileReference section */
|
||||
17E9A86BF3432BF233E3D297 /* Pods-InfiniteLayout_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InfiniteLayout_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InfiniteLayout_Example/Pods-InfiniteLayout_Example.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
2E68337E21F08944069DC023 /* Pods-InfiniteLayout_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InfiniteLayout_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-InfiniteLayout_Tests/Pods-InfiniteLayout_Tests.release.xcconfig"; sourceTree = "<group>"; };
|
||||
5DA98D9A451E79A872E96E69 /* InfiniteLayout.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = InfiniteLayout.podspec; path = ../InfiniteLayout.podspec; sourceTree = "<group>"; };
|
||||
5DA98D9A451E79A872E96E69 /* InfiniteLayout.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = InfiniteLayout.podspec; path = ../InfiniteLayout.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
|
||||
607FACD01AFB9204008FA782 /* InfiniteLayout_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = InfiniteLayout_Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
607FACD71AFB9204008FA782 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
||||
607FACD71AFB9204008FA782 /* CustomViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomViewController.swift; sourceTree = "<group>"; };
|
||||
607FACDA1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
|
||||
607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
|
||||
@@ -46,6 +50,10 @@
|
||||
AD3D900D0067605DEAFF148B /* Pods-InfiniteLayout_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InfiniteLayout_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-InfiniteLayout_Example/Pods-InfiniteLayout_Example.release.xcconfig"; sourceTree = "<group>"; };
|
||||
C50F79B0DFFDE95D322480B2 /* Pods_InfiniteLayout_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_InfiniteLayout_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
D403973E1FEBFA9D006C41D2 /* Cell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Cell.swift; sourceTree = "<group>"; };
|
||||
D4162A381FF502A900AC2572 /* CustomLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomLayout.swift; sourceTree = "<group>"; };
|
||||
D43362CF1FF64B330040C679 /* BaseCollectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseCollectionViewController.swift; sourceTree = "<group>"; };
|
||||
D495544D1FFD3D920081225B /* RxBaseCollectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RxBaseCollectionViewController.swift; sourceTree = "<group>"; };
|
||||
D4B9816D1FFCCC900016C676 /* PickerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PickerController.swift; sourceTree = "<group>"; };
|
||||
EF577FD009F0E2F96F1CECC6 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
|
||||
F900DDE615FA1056EB58998B /* Pods-InfiniteLayout_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InfiniteLayout_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InfiniteLayout_Tests/Pods-InfiniteLayout_Tests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
FD6AC573B93C313B5BDFF3FE /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
|
||||
@@ -96,8 +104,8 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
607FACD51AFB9204008FA782 /* AppDelegate.swift */,
|
||||
607FACD71AFB9204008FA782 /* ViewController.swift */,
|
||||
D403973E1FEBFA9D006C41D2 /* Cell.swift */,
|
||||
D4B981781FFD1FEF0016C676 /* Swift */,
|
||||
D4B981791FFD1FF50016C676 /* Rx */,
|
||||
607FACD91AFB9204008FA782 /* Main.storyboard */,
|
||||
607FACDC1AFB9204008FA782 /* Images.xcassets */,
|
||||
607FACDE1AFB9204008FA782 /* LaunchScreen.xib */,
|
||||
@@ -151,6 +159,50 @@
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D43362CC1FF64AD30040C679 /* Custom */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
607FACD71AFB9204008FA782 /* CustomViewController.swift */,
|
||||
D4162A381FF502A900AC2572 /* CustomLayout.swift */,
|
||||
);
|
||||
name = Custom;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D43362D31FF64B9E0040C679 /* Base */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D403973E1FEBFA9D006C41D2 /* Cell.swift */,
|
||||
D43362CF1FF64B330040C679 /* BaseCollectionViewController.swift */,
|
||||
);
|
||||
name = Base;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D4B9816C1FFCCC5B0016C676 /* Picker */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D4B9816D1FFCCC900016C676 /* PickerController.swift */,
|
||||
);
|
||||
name = Picker;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D4B981781FFD1FEF0016C676 /* Swift */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D43362D31FF64B9E0040C679 /* Base */,
|
||||
D43362CC1FF64AD30040C679 /* Custom */,
|
||||
D4B9816C1FFCCC5B0016C676 /* Picker */,
|
||||
);
|
||||
name = Swift;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D4B981791FFD1FF50016C676 /* Rx */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D495544D1FFD3D920081225B /* RxBaseCollectionViewController.swift */,
|
||||
);
|
||||
name = Rx;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E938139B99B9D91C14707C07 /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -174,7 +226,6 @@
|
||||
607FACCD1AFB9204008FA782 /* Frameworks */,
|
||||
607FACCE1AFB9204008FA782 /* Resources */,
|
||||
36EEEA4F62F7A41DC7E00F9B /* [CP] Embed Pods Frameworks */,
|
||||
BF7EA699B063C96A45D69BF2 /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -193,8 +244,6 @@
|
||||
607FACE11AFB9204008FA782 /* Sources */,
|
||||
607FACE21AFB9204008FA782 /* Frameworks */,
|
||||
607FACE31AFB9204008FA782 /* Resources */,
|
||||
066936A649BBA50B7D22FE7E /* [CP] Embed Pods Frameworks */,
|
||||
56B85F2D241E5ED6DDCED73C /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -213,18 +262,18 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0830;
|
||||
LastUpgradeCheck = 0830;
|
||||
LastUpgradeCheck = 1020;
|
||||
ORGANIZATIONNAME = CocoaPods;
|
||||
TargetAttributes = {
|
||||
607FACCF1AFB9204008FA782 = {
|
||||
CreatedOnToolsVersion = 6.3.1;
|
||||
DevelopmentTeam = CPE39ZT2AY;
|
||||
LastSwiftMigration = 0900;
|
||||
LastSwiftMigration = 1020;
|
||||
};
|
||||
607FACE41AFB9204008FA782 = {
|
||||
CreatedOnToolsVersion = 6.3.1;
|
||||
DevelopmentTeam = CPE39ZT2AY;
|
||||
LastSwiftMigration = 0900;
|
||||
LastSwiftMigration = 1020;
|
||||
TestTargetID = 607FACCF1AFB9204008FA782;
|
||||
};
|
||||
};
|
||||
@@ -234,6 +283,7 @@
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
English,
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
@@ -269,54 +319,32 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
066936A649BBA50B7D22FE7E /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InfiniteLayout_Tests/Pods-InfiniteLayout_Tests-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
36EEEA4F62F7A41DC7E00F9B /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${SRCROOT}/Pods/Target Support Files/Pods-InfiniteLayout_Example/Pods-InfiniteLayout_Example-frameworks.sh",
|
||||
"${BUILT_PRODUCTS_DIR}/CocoaProxy/CocoaProxy.framework",
|
||||
"${PODS_ROOT}/Target Support Files/Pods-InfiniteLayout_Example/Pods-InfiniteLayout_Example-frameworks.sh",
|
||||
"${BUILT_PRODUCTS_DIR}/Differentiator/Differentiator.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/InfiniteLayout/InfiniteLayout.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/RxDataSources/RxDataSources.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/RxRelay/RxRelay.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CocoaProxy.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Differentiator.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/InfiniteLayout.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxCocoa.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxDataSources.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxRelay.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InfiniteLayout_Example/Pods-InfiniteLayout_Example-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
56B85F2D241E5ED6DDCED73C /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InfiniteLayout_Tests/Pods-InfiniteLayout_Tests-resources.sh\"\n";
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InfiniteLayout_Example/Pods-InfiniteLayout_Example-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
BB5E5FB53E7C451064DBC9A2 /* [CP] Check Pods Manifest.lock */ = {
|
||||
@@ -337,21 +365,6 @@
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
BF7EA699B063C96A45D69BF2 /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InfiniteLayout_Example/Pods-InfiniteLayout_Example-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
DF297DCD753BC67E73166377 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -377,9 +390,13 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */,
|
||||
607FACD81AFB9204008FA782 /* CustomViewController.swift in Sources */,
|
||||
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */,
|
||||
D495544E1FFD3D920081225B /* RxBaseCollectionViewController.swift in Sources */,
|
||||
D4162A391FF502A900AC2572 /* CustomLayout.swift in Sources */,
|
||||
D4B9816E1FFCCC900016C676 /* PickerController.swift in Sources */,
|
||||
D403973F1FEBFA9D006C41D2 /* Cell.swift in Sources */,
|
||||
D43362D11FF64B330040C679 /* BaseCollectionViewController.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -425,6 +442,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
@@ -433,12 +451,14 @@
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
@@ -471,6 +491,7 @@
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -478,6 +499,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
@@ -486,12 +508,14 @@
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
@@ -516,6 +540,7 @@
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
@@ -531,8 +556,8 @@
|
||||
MODULE_NAME = ExampleApp;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = 1;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -547,8 +572,8 @@
|
||||
MODULE_NAME = ExampleApp;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = 1;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -569,8 +594,7 @@
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -587,8 +611,7 @@
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
+1
-3
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0900"
|
||||
LastUpgradeVersion = "1020"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -40,7 +40,6 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
@@ -70,7 +69,6 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
||||
@@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
var window: UIWindow?
|
||||
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
// Override point for customization after application launch.
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207"/>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
|
||||
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
@@ -24,7 +29,7 @@
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
|
||||
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="yGQ-hH-2v6">
|
||||
<device id="retina5_9" orientation="portrait">
|
||||
<device id="retina4_0" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
|
||||
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
|
||||
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
@@ -13,53 +15,414 @@
|
||||
<scene sceneID="l4I-9G-XdF">
|
||||
<objects>
|
||||
<navigationController id="yGQ-hH-2v6" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="IdE-R7-9TG">
|
||||
<rect key="frame" x="0.0" y="44" width="375" height="44"/>
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" largeTitles="YES" id="IdE-R7-9TG">
|
||||
<rect key="frame" x="0.0" y="20" width="320" height="96"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<connections>
|
||||
<segue destination="sSL-wr-E9v" kind="relationship" relationship="rootViewController" id="6hU-n3-d5H"/>
|
||||
<segue destination="pMz-7t-sA5" kind="relationship" relationship="rootViewController" id="AAf-BN-dLc"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="0uD-Xz-jjT" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-988" y="37"/>
|
||||
<point key="canvasLocation" x="-1644" y="61"/>
|
||||
</scene>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="Tsa-GF-Rqw">
|
||||
<!--InfiniteLayout-->
|
||||
<scene sceneID="fMt-PB-wyT">
|
||||
<objects>
|
||||
<collectionViewController id="sSL-wr-E9v" customClass="ViewController" customModule="InfiniteLayout_Example" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<collectionView key="view" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" id="BuB-JB-b15" customClass="InfiniteCollectionView" customModule="InfiniteLayout">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
|
||||
<tableViewController id="pMz-7t-sA5" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="YNN-Jo-hL3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<collectionViewFlowLayout key="collectionViewLayout" scrollDirection="horizontal" minimumLineSpacing="10" minimumInteritemSpacing="10" id="Tcc-xt-sXE">
|
||||
<size key="itemSize" width="150" height="100"/>
|
||||
<sections>
|
||||
<tableViewSection id="wLh-Qy-wV4">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" textLabel="VSq-Pr-6ay" style="IBUITableViewCellStyleDefault" id="Ave-Hr-Gmz">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Ave-Hr-Gmz" id="Fri-pG-UG3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Horizontal Layout" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="VSq-Pr-6ay">
|
||||
<rect key="frame" x="16" y="0.0" width="288" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<segue destination="CU7-Hg-6kG" kind="show" id="yzb-gl-6Xz"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" textLabel="Efh-hp-Yw4" style="IBUITableViewCellStyleDefault" id="e4W-KK-bkI">
|
||||
<rect key="frame" x="0.0" y="44" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="e4W-KK-bkI" id="WDz-rM-Z2L">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Vertical Layout" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Efh-hp-Yw4">
|
||||
<rect key="frame" x="16" y="0.0" width="288" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<segue destination="9P2-Ud-D2M" kind="show" id="H8w-EO-laS"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" textLabel="9We-VT-VYi" style="IBUITableViewCellStyleDefault" id="5Ku-tY-Gtv">
|
||||
<rect key="frame" x="0.0" y="88" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="5Ku-tY-Gtv" id="M7f-Mo-aWc">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Custom Layout" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="9We-VT-VYi">
|
||||
<rect key="frame" x="16" y="0.0" width="288" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<segue destination="ctO-Ld-yhL" kind="show" id="qss-AL-dgi"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
<tableViewSection headerTitle="Delegate" id="lpd-Xl-djA">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" textLabel="c9c-gc-NDL" style="IBUITableViewCellStyleDefault" id="7Dq-og-5lN">
|
||||
<rect key="frame" x="0.0" y="160" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="7Dq-og-5lN" id="XGb-gg-zbn">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Horizontal Picker" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="c9c-gc-NDL">
|
||||
<rect key="frame" x="16" y="0.0" width="288" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<segue destination="nUW-3u-2O9" kind="show" id="SPm-WC-Yf4"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
<tableViewSection headerTitle="Rx" id="l6q-RG-uyY">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" textLabel="i8W-08-UPB" style="IBUITableViewCellStyleDefault" id="1E8-fo-BBx">
|
||||
<rect key="frame" x="0.0" y="232" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="1E8-fo-BBx" id="NMq-kd-IrV">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Vertical Layout" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="i8W-08-UPB">
|
||||
<rect key="frame" x="16" y="0.0" width="288" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<segue destination="LXZ-Bh-cft" kind="show" id="IlB-ib-PBy"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
</sections>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="pMz-7t-sA5" id="OC9-mx-dmD"/>
|
||||
<outlet property="delegate" destination="pMz-7t-sA5" id="nwI-aQ-G7d"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<navigationItem key="navigationItem" title="InfiniteLayout" id="6dR-xO-LQz"/>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="N5O-nh-h2i" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-770" y="61"/>
|
||||
</scene>
|
||||
<!--Custom Layout-->
|
||||
<scene sceneID="Nwi-KZ-nuX">
|
||||
<objects>
|
||||
<viewController id="ctO-Ld-yhL" customClass="CustomViewController" customModule="InfiniteLayout_Example" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="pkO-J5-FlB"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="q9H-d0-4cm"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="C5p-bu-Djh">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="enX-ef-ELn" customClass="InfiniteCollectionView" customModule="InfiniteLayout">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<collectionViewLayout key="collectionViewLayout" id="ZR7-Jn-ewG" customClass="CustomLayout" customModule="InfiniteLayout_Example" customModuleProvider="target"/>
|
||||
<cells>
|
||||
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="cell" id="w1M-Ws-9fK" customClass="Cell" customModule="InfiniteLayout_Example" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO">
|
||||
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gVT-2b-OS8" customClass="CellView" customModule="InfiniteLayout_Example" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="styleIndex">
|
||||
<integer key="value" value="2"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
</subviews>
|
||||
</view>
|
||||
<constraints>
|
||||
<constraint firstItem="gVT-2b-OS8" firstAttribute="top" secondItem="w1M-Ws-9fK" secondAttribute="top" id="9qG-Sx-gVG"/>
|
||||
<constraint firstAttribute="bottom" secondItem="gVT-2b-OS8" secondAttribute="bottom" id="BOm-tM-pkP"/>
|
||||
<constraint firstAttribute="trailing" secondItem="gVT-2b-OS8" secondAttribute="trailing" id="HC4-Mv-T4P"/>
|
||||
<constraint firstItem="gVT-2b-OS8" firstAttribute="leading" secondItem="w1M-Ws-9fK" secondAttribute="leading" id="jH9-f5-fxA"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="cellView" destination="gVT-2b-OS8" id="Em8-Ah-Jzb"/>
|
||||
</connections>
|
||||
</collectionViewCell>
|
||||
</cells>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="isItemPagingEnabled" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="velocityMultiplier">
|
||||
<real key="value" value="500"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="ctO-Ld-yhL" id="bXu-Jz-K7t"/>
|
||||
<outlet property="delegate" destination="ctO-Ld-yhL" id="Vz4-5J-frZ"/>
|
||||
</connections>
|
||||
</collectionView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="enX-ef-ELn" firstAttribute="top" secondItem="C5p-bu-Djh" secondAttribute="top" id="2nB-Om-PsD"/>
|
||||
<constraint firstAttribute="bottom" secondItem="enX-ef-ELn" secondAttribute="bottom" id="Tdv-eb-r3X"/>
|
||||
<constraint firstAttribute="trailing" secondItem="enX-ef-ELn" secondAttribute="trailing" id="ZM0-nc-pUD"/>
|
||||
<constraint firstItem="enX-ef-ELn" firstAttribute="leading" secondItem="C5p-bu-Djh" secondAttribute="leading" id="uX4-ox-gnL"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" title="Custom Layout" largeTitleDisplayMode="never" id="hZl-1w-5Nq"/>
|
||||
<connections>
|
||||
<outlet property="infiniteCollectionView" destination="enX-ef-ELn" id="jKo-DT-4uH"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="4s9-AY-FII" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="21" y="788"/>
|
||||
</scene>
|
||||
<!--Infinite Delegate-->
|
||||
<scene sceneID="HqS-9O-oG4">
|
||||
<objects>
|
||||
<viewController automaticallyAdjustsScrollViewInsets="NO" id="nUW-3u-2O9" customClass="PickerController" customModule="InfiniteLayout_Example" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="zFz-ZQ-lzW"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="ZuO-bs-QWL"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Vhd-CK-34X">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="Yg1-5Z-6FI" customClass="InfiniteCollectionView" customModule="InfiniteLayout">
|
||||
<rect key="frame" x="0.0" y="341" width="320" height="227"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<collectionViewFlowLayout key="collectionViewLayout" scrollDirection="horizontal" minimumLineSpacing="10" minimumInteritemSpacing="1000" id="PTo-iT-zZX">
|
||||
<size key="itemSize" width="200" height="150"/>
|
||||
<size key="headerReferenceSize" width="0.0" height="0.0"/>
|
||||
<size key="footerReferenceSize" width="0.0" height="0.0"/>
|
||||
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="10" maxY="0.0"/>
|
||||
</collectionViewFlowLayout>
|
||||
<cells>
|
||||
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="cell" id="7Np-kQ-f93" customClass="Cell" customModule="InfiniteLayout_Example" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="38.5" width="200" height="150"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO">
|
||||
<rect key="frame" x="0.0" y="0.0" width="200" height="150"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Uz9-xR-d0L" customClass="CellView" customModule="InfiniteLayout_Example" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="200" height="150"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="styleIndex">
|
||||
<integer key="value" value="1"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
</subviews>
|
||||
</view>
|
||||
<constraints>
|
||||
<constraint firstItem="Uz9-xR-d0L" firstAttribute="top" secondItem="7Np-kQ-f93" secondAttribute="top" id="2lt-hb-Zl9"/>
|
||||
<constraint firstItem="Uz9-xR-d0L" firstAttribute="leading" secondItem="7Np-kQ-f93" secondAttribute="leading" id="Hj7-OH-iis"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Uz9-xR-d0L" secondAttribute="trailing" id="mr0-wj-ftP"/>
|
||||
<constraint firstAttribute="bottom" secondItem="Uz9-xR-d0L" secondAttribute="bottom" id="t8H-tx-AHw"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="cellView" destination="Uz9-xR-d0L" id="Q84-nb-acR"/>
|
||||
</connections>
|
||||
</collectionViewCell>
|
||||
</cells>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="isItemPagingEnabled" value="YES"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="nUW-3u-2O9" id="vHT-UO-3ny"/>
|
||||
<outlet property="delegate" destination="nUW-3u-2O9" id="cXx-OK-csN"/>
|
||||
<outlet property="infiniteDelegate" destination="nUW-3u-2O9" id="FQk-xA-mjb"/>
|
||||
</connections>
|
||||
</collectionView>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="n2a-eR-E9T" customClass="CellView" customModule="InfiniteLayout_Example" customModuleProvider="target">
|
||||
<rect key="frame" x="26.5" y="98" width="267" height="213.5"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="n2a-eR-E9T" secondAttribute="height" multiplier="1.25" id="qUW-wU-jQk"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="n2a-eR-E9T" firstAttribute="height" secondItem="Vhd-CK-34X" secondAttribute="width" multiplier="2:3" id="15l-Xa-cgF"/>
|
||||
<constraint firstItem="n2a-eR-E9T" firstAttribute="centerY" secondItem="Yg1-5Z-6FI" secondAttribute="top" multiplier="0.6" id="831-T2-ANf"/>
|
||||
<constraint firstItem="Yg1-5Z-6FI" firstAttribute="height" secondItem="Vhd-CK-34X" secondAttribute="height" multiplier="0.4" id="A7s-lr-k2k"/>
|
||||
<constraint firstItem="ZuO-bs-QWL" firstAttribute="top" secondItem="Yg1-5Z-6FI" secondAttribute="bottom" id="GmZ-Db-ynH"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Yg1-5Z-6FI" secondAttribute="trailing" id="PSV-WU-ltt"/>
|
||||
<constraint firstItem="Yg1-5Z-6FI" firstAttribute="leading" secondItem="Vhd-CK-34X" secondAttribute="leading" id="UQ7-m3-LKy"/>
|
||||
<constraint firstItem="n2a-eR-E9T" firstAttribute="centerX" secondItem="Vhd-CK-34X" secondAttribute="centerX" id="hN7-qa-9iE"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" title="Picker" id="Op4-F3-Cvs"/>
|
||||
<connections>
|
||||
<outlet property="infiniteCollectionView" destination="Yg1-5Z-6FI" id="dYW-hl-GxB"/>
|
||||
<outlet property="selectedView" destination="n2a-eR-E9T" id="kE8-NA-C2Q"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="jlK-LR-KNy" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="784" y="-664"/>
|
||||
</scene>
|
||||
<!--Rx-->
|
||||
<scene sceneID="w7X-Gq-cbX">
|
||||
<objects>
|
||||
<viewController id="LXZ-Bh-cft" customClass="RxBaseCollectionViewController" customModule="InfiniteLayout_Example" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="LXw-fB-orN"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="QOu-Qv-Lfh"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="zqI-fb-q5e">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="ci9-0n-fka" customClass="RxInfiniteCollectionView" customModule="InfiniteLayout">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="1000" id="mgE-mI-m4m">
|
||||
<size key="itemSize" width="200" height="125"/>
|
||||
<size key="headerReferenceSize" width="0.0" height="0.0"/>
|
||||
<size key="footerReferenceSize" width="0.0" height="0.0"/>
|
||||
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="10"/>
|
||||
</collectionViewFlowLayout>
|
||||
<cells>
|
||||
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="cell" id="T9n-br-7do" customClass="Cell" customModule="InfiniteLayout_Example" customModuleProvider="target">
|
||||
<rect key="frame" x="60" y="0.0" width="200" height="125"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO">
|
||||
<rect key="frame" x="0.0" y="0.0" width="200" height="125"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jBQ-Rn-0uJ" customClass="CellView" customModule="InfiniteLayout_Example" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="200" height="125"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</view>
|
||||
</subviews>
|
||||
</view>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="jBQ-Rn-0uJ" secondAttribute="trailing" id="82l-QQ-iZ6"/>
|
||||
<constraint firstItem="jBQ-Rn-0uJ" firstAttribute="top" secondItem="T9n-br-7do" secondAttribute="top" id="qFb-og-mcO"/>
|
||||
<constraint firstAttribute="bottom" secondItem="jBQ-Rn-0uJ" secondAttribute="bottom" id="rGV-tl-lnS"/>
|
||||
<constraint firstItem="jBQ-Rn-0uJ" firstAttribute="leading" secondItem="T9n-br-7do" secondAttribute="leading" id="ugu-X8-5hQ"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="cellView" destination="jBQ-Rn-0uJ" id="kQb-9f-ey8"/>
|
||||
</connections>
|
||||
</collectionViewCell>
|
||||
</cells>
|
||||
</collectionView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="ci9-0n-fka" firstAttribute="top" secondItem="zqI-fb-q5e" secondAttribute="top" id="C5M-bI-V1A"/>
|
||||
<constraint firstItem="ci9-0n-fka" firstAttribute="leading" secondItem="zqI-fb-q5e" secondAttribute="leading" id="ftH-Ue-rBH"/>
|
||||
<constraint firstItem="ci9-0n-fka" firstAttribute="trailing" secondItem="zqI-fb-q5e" secondAttribute="trailing" id="wy7-Ci-NVK"/>
|
||||
<constraint firstAttribute="bottom" secondItem="ci9-0n-fka" secondAttribute="bottom" id="yOo-Td-V0c"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" title="Rx" largeTitleDisplayMode="never" id="BMY-0d-YCj"/>
|
||||
<connections>
|
||||
<outlet property="infiniteCollectionView" destination="ci9-0n-fka" id="fSY-Qh-bhA"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="TkU-4C-L7I" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="784" y="60"/>
|
||||
</scene>
|
||||
<!--Horizontal Layout-->
|
||||
<scene sceneID="0Xz-LA-moA">
|
||||
<objects>
|
||||
<collectionViewController id="CU7-Hg-6kG" customClass="BaseCollectionViewController" customModule="InfiniteLayout_Example" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<collectionView key="view" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" id="Iuy-Ov-jLz" customClass="InfiniteCollectionView" customModule="InfiniteLayout">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<collectionViewFlowLayout key="collectionViewLayout" scrollDirection="horizontal" minimumLineSpacing="10" minimumInteritemSpacing="1000" id="i7U-Tf-kfd">
|
||||
<size key="itemSize" width="250" height="150"/>
|
||||
<size key="headerReferenceSize" width="0.0" height="0.0"/>
|
||||
<size key="footerReferenceSize" width="0.0" height="0.0"/>
|
||||
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="10" maxY="0.0"/>
|
||||
</collectionViewFlowLayout>
|
||||
<cells>
|
||||
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="cell" id="Vf0-ro-DM5" customClass="Cell" customModule="InfiniteLayout_Example" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="150" height="100"/>
|
||||
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="cell" id="BVQ-cb-bj4" customClass="Cell" customModule="InfiniteLayout_Example" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="151" width="250" height="150"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO">
|
||||
<rect key="frame" x="0.0" y="0.0" width="150" height="100"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="250" height="150"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="SWd-w1-K3N" customClass="CellView" customModule="InfiniteLayout_Example" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="150" height="100"/>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1wM-ge-YKX" customClass="CellView" customModule="InfiniteLayout_Example" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="250" height="150"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</view>
|
||||
</subviews>
|
||||
</view>
|
||||
<constraints>
|
||||
<constraint firstItem="SWd-w1-K3N" firstAttribute="leading" secondItem="Vf0-ro-DM5" secondAttribute="leading" id="HM6-Rd-74h"/>
|
||||
<constraint firstItem="SWd-w1-K3N" firstAttribute="top" secondItem="Vf0-ro-DM5" secondAttribute="top" id="jJh-U5-WWC"/>
|
||||
<constraint firstAttribute="bottom" secondItem="SWd-w1-K3N" secondAttribute="bottom" id="n3V-C9-rAP"/>
|
||||
<constraint firstAttribute="trailing" secondItem="SWd-w1-K3N" secondAttribute="trailing" id="oPa-mO-RJ6"/>
|
||||
<constraint firstAttribute="bottom" secondItem="1wM-ge-YKX" secondAttribute="bottom" id="44V-6k-Vxi"/>
|
||||
<constraint firstAttribute="trailing" secondItem="1wM-ge-YKX" secondAttribute="trailing" id="BO0-dS-ek7"/>
|
||||
<constraint firstItem="1wM-ge-YKX" firstAttribute="leading" secondItem="BVQ-cb-bj4" secondAttribute="leading" id="O2r-kl-QZo"/>
|
||||
<constraint firstItem="1wM-ge-YKX" firstAttribute="top" secondItem="BVQ-cb-bj4" secondAttribute="top" id="kT9-T5-w19"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="cellView" destination="SWd-w1-K3N" id="2A6-17-L1b"/>
|
||||
<outlet property="cellView" destination="1wM-ge-YKX" id="BFc-xc-0VL"/>
|
||||
</connections>
|
||||
</collectionViewCell>
|
||||
</cells>
|
||||
@@ -67,15 +430,68 @@
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="isItemPagingEnabled" value="YES"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="sSL-wr-E9v" id="weE-ef-YRt"/>
|
||||
<outlet property="delegate" destination="sSL-wr-E9v" id="hva-cg-vBg"/>
|
||||
<outlet property="dataSource" destination="CU7-Hg-6kG" id="BOZ-dL-WLG"/>
|
||||
<outlet property="delegate" destination="CU7-Hg-6kG" id="NKU-4F-wIF"/>
|
||||
</connections>
|
||||
</collectionView>
|
||||
<navigationItem key="navigationItem" id="qS4-kF-4vO"/>
|
||||
<navigationItem key="navigationItem" title="Horizontal Layout" id="AaD-SQ-gYu"/>
|
||||
</collectionViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="bMF-CJ-xJ6" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Dsp-JP-Q6i" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-68" y="36.945812807881772"/>
|
||||
<point key="canvasLocation" x="21" y="-664"/>
|
||||
</scene>
|
||||
<!--Vertical Layout-->
|
||||
<scene sceneID="ccn-9j-1sQ">
|
||||
<objects>
|
||||
<collectionViewController id="9P2-Ud-D2M" customClass="BaseCollectionViewController" customModule="InfiniteLayout_Example" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<collectionView key="view" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" id="iW9-Tg-dTG" customClass="InfiniteCollectionView" customModule="InfiniteLayout">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="1000" id="t85-Nu-Mt1">
|
||||
<size key="itemSize" width="150" height="100"/>
|
||||
<size key="headerReferenceSize" width="0.0" height="0.0"/>
|
||||
<size key="footerReferenceSize" width="0.0" height="0.0"/>
|
||||
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="10"/>
|
||||
</collectionViewFlowLayout>
|
||||
<cells>
|
||||
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="cell" id="OtA-Vt-ejC" customClass="Cell" customModule="InfiniteLayout_Example" customModuleProvider="target">
|
||||
<rect key="frame" x="85" y="0.0" width="150" height="100"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO">
|
||||
<rect key="frame" x="0.0" y="0.0" width="150" height="100"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fuL-Uj-Mda" customClass="CellView" customModule="InfiniteLayout_Example" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="150" height="100"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</view>
|
||||
</subviews>
|
||||
</view>
|
||||
<constraints>
|
||||
<constraint firstItem="fuL-Uj-Mda" firstAttribute="leading" secondItem="OtA-Vt-ejC" secondAttribute="leading" id="KLH-6Z-vhB"/>
|
||||
<constraint firstAttribute="trailing" secondItem="fuL-Uj-Mda" secondAttribute="trailing" id="bzB-oG-udJ"/>
|
||||
<constraint firstAttribute="bottom" secondItem="fuL-Uj-Mda" secondAttribute="bottom" id="fgE-nQ-BGU"/>
|
||||
<constraint firstItem="fuL-Uj-Mda" firstAttribute="top" secondItem="OtA-Vt-ejC" secondAttribute="top" id="t4I-qE-DtN"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="cellView" destination="fuL-Uj-Mda" id="AN4-RB-ul0"/>
|
||||
</connections>
|
||||
</collectionViewCell>
|
||||
</cells>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="isItemPagingEnabled" value="NO"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="9P2-Ud-D2M" id="juO-P6-XzS"/>
|
||||
<outlet property="delegate" destination="9P2-Ud-D2M" id="ns0-fe-DSq"/>
|
||||
</connections>
|
||||
</collectionView>
|
||||
<navigationItem key="navigationItem" title="Vertical Layout" largeTitleDisplayMode="never" id="2E2-oh-ELb"/>
|
||||
</collectionViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Lvb-qy-gZV" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="22" y="61"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// BaseCollectionViewController.swift
|
||||
// InfiniteLayout_Example
|
||||
//
|
||||
// Created by Arnaud Dorgans on 29/12/2017.
|
||||
// Copyright © 2017 CocoaPods. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import InfiniteLayout
|
||||
|
||||
class BaseCollectionViewController: InfiniteCollectionViewController {
|
||||
|
||||
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||
guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as? Cell else {
|
||||
fatalError()
|
||||
}
|
||||
cell.update(index: self.infiniteCollectionView!.indexPath(from: indexPath).row)
|
||||
return cell
|
||||
}
|
||||
|
||||
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
return 20
|
||||
}
|
||||
|
||||
override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||
collectionView.scrollToItem(at: indexPath, at: self.infiniteCollectionView!.infiniteLayout.scrollDirection == .vertical ? .centeredVertically : .centeredHorizontally, animated: true)
|
||||
}
|
||||
}
|
||||
@@ -17,12 +17,30 @@ class Cell: UICollectionViewCell {
|
||||
}
|
||||
}
|
||||
|
||||
enum CellStyle {
|
||||
case circular
|
||||
case `default`
|
||||
|
||||
static let all = [circular, `default`]
|
||||
}
|
||||
|
||||
@IBDesignable class CellView: UIView {
|
||||
|
||||
let titleLabel = UILabel()
|
||||
|
||||
let colors = [#colorLiteral(red: 0.5254901961, green: 0.6901960784, blue: 0.9137254902, alpha: 1), #colorLiteral(red: 0.5254901961, green: 0.6196078431, blue: 0.9137254902, alpha: 1), #colorLiteral(red: 0.6078431373, green: 0.5254901961, blue: 0.9137254902, alpha: 1), #colorLiteral(red: 0.9137254902, green: 0.5254901961, blue: 0.8392156863, alpha: 1), #colorLiteral(red: 0.9137254902, green: 0.5254901961, blue: 0.6, alpha: 1), #colorLiteral(red: 0.9137254902, green: 0.6784313725, blue: 0.5254901961, alpha: 1), #colorLiteral(red: 0.9137254902, green: 0.9058823529, blue: 0.5254901961, alpha: 1), #colorLiteral(red: 0.5254901961, green: 0.9137254902, blue: 0.5921568627, alpha: 1), #colorLiteral(red: 0.5254901961, green: 0.8, blue: 0.9137254902, alpha: 1)]
|
||||
|
||||
@IBInspectable var styleIndex: Int {
|
||||
get { return CellStyle.all.firstIndex(of: style)! }
|
||||
set { style = CellStyle.all[newValue % CellStyle.all.count] }
|
||||
}
|
||||
|
||||
var style: CellStyle = .default {
|
||||
didSet {
|
||||
updateStyle()
|
||||
}
|
||||
}
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
sharedInit()
|
||||
@@ -45,14 +63,26 @@ class Cell: UICollectionViewCell {
|
||||
self.addSubview(titleLabel)
|
||||
titleLabel.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true
|
||||
titleLabel.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
|
||||
|
||||
self.layer.cornerRadius = 8
|
||||
}
|
||||
|
||||
func update(index: Int) {
|
||||
self.titleLabel.text = String(index + 1)
|
||||
self.backgroundColor = colors[index % colors.count]
|
||||
}
|
||||
|
||||
func updateStyle() {
|
||||
switch style {
|
||||
case .default:
|
||||
self.layer.cornerRadius = 8
|
||||
case .circular:
|
||||
self.layer.cornerRadius = self.frame.height / 2
|
||||
}
|
||||
}
|
||||
|
||||
override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
updateStyle()
|
||||
}
|
||||
|
||||
override func prepareForInterfaceBuilder() {
|
||||
self.update(index: 0)
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// CustomLayout.swift
|
||||
// InfiniteLayout_Example
|
||||
//
|
||||
// Created by Arnaud Dorgans on 28/12/2017.
|
||||
// Copyright © 2017 CocoaPods. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import InfiniteLayout
|
||||
|
||||
class CustomLayout: InfiniteLayout {
|
||||
|
||||
let minimumScale: CGFloat = 0.75
|
||||
let rangeRatio: CGFloat = 1
|
||||
|
||||
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
|
||||
let attributes = super.layoutAttributesForElements(in: rect).flatMap {
|
||||
self.copyLayoutAttributes(from: $0)
|
||||
}
|
||||
guard let visibleRect = self.visibleCollectionViewRect() else {
|
||||
return attributes
|
||||
}
|
||||
let centeredOffset = CGPoint(x: visibleRect.midX, y: visibleRect.midY)
|
||||
for attributes in attributes ?? [] {
|
||||
let diff = self.scrollDirection == .horizontal ? centeredOffset.x - attributes.center.x : centeredOffset.y - attributes.center.y
|
||||
let scale = max(min(diff / (min(visibleRect.width, visibleRect.height) * rangeRatio), 1), -1)
|
||||
attributes.transform = attributes.transform.translatedBy(x: abs(scale * (visibleRect.width / 2)), y: 0)
|
||||
attributes.transform = attributes.transform.rotated(by: scale * (CGFloat.pi / 2))
|
||||
}
|
||||
return attributes
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// CustomViewController.swift
|
||||
// InfiniteLayout
|
||||
//
|
||||
// Created by Arnoymous on 12/20/2017.
|
||||
// Copyright (c) 2017 Arnoymous. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import InfiniteLayout
|
||||
|
||||
class CustomViewController: UIViewController {
|
||||
|
||||
@IBOutlet weak var infiniteCollectionView: InfiniteCollectionView!
|
||||
|
||||
}
|
||||
|
||||
extension CustomViewController: UICollectionViewDataSource {
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
return 20
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! Cell
|
||||
cell.update(index: self.infiniteCollectionView!.indexPath(from: indexPath).row)
|
||||
return cell
|
||||
}
|
||||
}
|
||||
|
||||
extension CustomViewController: UICollectionViewDelegate {
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||
collectionView.scrollToItem(at: indexPath, at: .centeredVertically, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
extension CustomViewController: UICollectionViewDelegateFlowLayout {
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
|
||||
return CGSize(width: 100, height: 100)
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
|
||||
return collectionView.frame.height
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
|
||||
return 10
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
|
||||
return UIEdgeInsets(top: 0, left: 0, bottom: 10, right: 0)
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,6 @@
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// PickerController.swift
|
||||
// InfiniteLayout_Example
|
||||
//
|
||||
// Created by Arnaud Dorgans on 03/01/2018.
|
||||
// Copyright © 2018 CocoaPods. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import InfiniteLayout
|
||||
|
||||
class PickerController: UIViewController {
|
||||
|
||||
@IBOutlet weak var selectedView: CellView!
|
||||
@IBOutlet weak var infiniteCollectionView: InfiniteCollectionView!
|
||||
}
|
||||
|
||||
extension PickerController: UICollectionViewDataSource {
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
return 20
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||
guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as? Cell else {
|
||||
fatalError()
|
||||
}
|
||||
cell.update(index: self.infiniteCollectionView.indexPath(from: indexPath).row)
|
||||
return cell
|
||||
}
|
||||
}
|
||||
|
||||
extension PickerController: UICollectionViewDelegate {
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||
collectionView.scrollToItem(at: indexPath, at: .centeredHorizontally, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
extension PickerController: InfiniteCollectionViewDelegate {
|
||||
|
||||
func infiniteCollectionView(_ infiniteCollectionView: InfiniteCollectionView, didChangeCenteredIndexPath centeredIndexPath: IndexPath?) {
|
||||
guard let indexPath = centeredIndexPath else {
|
||||
return
|
||||
}
|
||||
self.selectedView.update(index: self.infiniteCollectionView.indexPath(from: indexPath).row)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// RxBaseCollectionViewController.swift
|
||||
// InfiniteLayout_Example
|
||||
//
|
||||
// Created by Arnaud Dorgans on 03/01/2018.
|
||||
// Copyright © 2018 CocoaPods. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import RxSwift
|
||||
import RxCocoa
|
||||
import RxDataSources
|
||||
import InfiniteLayout
|
||||
|
||||
class RxBaseCollectionViewController: UIViewController {
|
||||
|
||||
@IBOutlet weak var infiniteCollectionView: RxInfiniteCollectionView!
|
||||
|
||||
let disposeBag = DisposeBag()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
Observable.just(Array(0..<20))
|
||||
.bind(to: infiniteCollectionView.rx.items(cellIdentifier: "cell", cellType: Cell.self, infinite: true)) { _, index, cell in
|
||||
cell.update(index: index)
|
||||
}.disposed(by: disposeBag)
|
||||
|
||||
infiniteCollectionView.rx.modelCentered(Int.self)
|
||||
.asDriver()
|
||||
.drive(onNext: { current in
|
||||
print("centered: \(current + 1)")
|
||||
}).disposed(by: disposeBag)
|
||||
|
||||
infiniteCollectionView.rx.itemSelected
|
||||
.asDriver()
|
||||
.drive(onNext: { [unowned self] indexPath in
|
||||
self.infiniteCollectionView.scrollToItem(at: indexPath, at: .centeredVertically, animated: true)
|
||||
}).disposed(by: disposeBag)
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
//
|
||||
// ViewController.swift
|
||||
// InfiniteLayout
|
||||
//
|
||||
// Created by Arnoymous on 12/20/2017.
|
||||
// Copyright (c) 2017 Arnoymous. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import InfiniteLayout
|
||||
|
||||
class ViewController: InfiniteCollectionViewController {
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
|
||||
guard let collectionView = self.collectionView else {
|
||||
return
|
||||
}
|
||||
|
||||
let cells = collectionView.indexPathsForVisibleItems.sorted()
|
||||
for i in 0..<cells.count {
|
||||
guard let cell = collectionView.cellForItem(at: cells[i]) else {
|
||||
return
|
||||
}
|
||||
cell.alpha = 0
|
||||
UIView.animate(withDuration: 0.3, delay: TimeInterval(i) * 0.05, options: [], animations: {
|
||||
cell.alpha = 1
|
||||
}, completion: nil)
|
||||
}
|
||||
}
|
||||
|
||||
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
return 14
|
||||
}
|
||||
|
||||
override func numberOfSections(in collectionView: UICollectionView) -> Int {
|
||||
return 1
|
||||
}
|
||||
|
||||
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! Cell
|
||||
cell.update(index: self.infiniteCollectionView!.indexPath(from: indexPath).row)
|
||||
return cell
|
||||
}
|
||||
}
|
||||
|
||||
extension ViewController: UICollectionViewDelegateFlowLayout {
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
|
||||
let height: CGFloat = 100
|
||||
let width: CGFloat = height * 2
|
||||
return CGSize(width: width, height: height)
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
use_frameworks!
|
||||
platform :ios, '10.0'
|
||||
|
||||
target 'InfiniteLayout_Example' do
|
||||
pod 'InfiniteLayout', :path => '../'
|
||||
pod 'InfiniteLayout/Rx', :path => '../'
|
||||
|
||||
target 'InfiniteLayout_Tests' do
|
||||
inherit! :search_paths
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
+39
-8
@@ -1,19 +1,50 @@
|
||||
PODS:
|
||||
- CocoaProxy (0.1.1)
|
||||
- InfiniteLayout (0.1.3):
|
||||
- CocoaProxy (~> 0.1)
|
||||
- Differentiator (5.0.0)
|
||||
- InfiniteLayout (0.5):
|
||||
- InfiniteLayout/Core (= 0.5)
|
||||
- InfiniteLayout/CocoaProxy (0.5)
|
||||
- InfiniteLayout/Core (0.5):
|
||||
- InfiniteLayout/CocoaProxy
|
||||
- InfiniteLayout/Rx (0.5):
|
||||
- InfiniteLayout/Core
|
||||
- RxCocoa (~> 6)
|
||||
- RxDataSources (~> 5)
|
||||
- RxSwift (~> 6)
|
||||
- RxCocoa (6.2.0):
|
||||
- RxRelay (= 6.2.0)
|
||||
- RxSwift (= 6.2.0)
|
||||
- RxDataSources (5.0.0):
|
||||
- Differentiator (~> 5.0)
|
||||
- RxCocoa (~> 6.0)
|
||||
- RxSwift (~> 6.0)
|
||||
- RxRelay (6.2.0):
|
||||
- RxSwift (= 6.2.0)
|
||||
- RxSwift (6.2.0)
|
||||
|
||||
DEPENDENCIES:
|
||||
- InfiniteLayout (from `../`)
|
||||
- InfiniteLayout/Rx (from `../`)
|
||||
|
||||
SPEC REPOS:
|
||||
trunk:
|
||||
- Differentiator
|
||||
- RxCocoa
|
||||
- RxDataSources
|
||||
- RxRelay
|
||||
- RxSwift
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
InfiniteLayout:
|
||||
:path: ../
|
||||
:path: "../"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
CocoaProxy: 35ab81e24325b33834cffe45a3d1fd48ca67ef3a
|
||||
InfiniteLayout: 0ab39bf2a4d9ce5c473ebccfc0d3b7278de18ac9
|
||||
Differentiator: e8497ceab83c1b10ca233716d547b9af21b9344d
|
||||
InfiniteLayout: 2c55b0fc14b6a9d924fbe13c0e2d88b1cbf5423d
|
||||
RxCocoa: 4baf94bb35f2c0ab31bc0cb9f1900155f646ba42
|
||||
RxDataSources: aa47cc1ed6c500fa0dfecac5c979b723542d79cf
|
||||
RxRelay: e72dbfd157807478401ef1982e1c61c945c94b2f
|
||||
RxSwift: d356ab7bee873611322f134c5f9ef379fa183d8f
|
||||
|
||||
PODFILE CHECKSUM: 3a658536624f41ec07c5a7a2c55407b9b8f48528
|
||||
PODFILE CHECKSUM: 0dc7a9b37f9b7c5d5266beaab9e94861b80aa80f
|
||||
|
||||
COCOAPODS: 1.4.0.beta.2
|
||||
COCOAPODS: 1.10.1
|
||||
|
||||
+29
-12
@@ -8,8 +8,8 @@
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'InfiniteLayout'
|
||||
s.version = '0.1.4'
|
||||
s.summary = 'Horizontal and Vertical infinite scrolling feature for UICollectionView'
|
||||
s.version = '0.5'
|
||||
s.summary = 'Horizontal and Vertical infinite scrolling feature for UICollectionView with Paging, NSProxy delegate, Reactive extension'
|
||||
|
||||
# This description is used to generate tags and improve search results.
|
||||
# * Think: What does it do? Why did you write it? What is the focus?
|
||||
@@ -18,21 +18,20 @@ Pod::Spec.new do |s|
|
||||
# * Finally, don't worry about the indent, CocoaPods strips it!
|
||||
|
||||
s.description = <<-DESC
|
||||
Horizontal and Vertical infinite scrolling feature for UICollectionView with Paging and NSProxy delegate
|
||||
Horizontal and Vertical infinite scrolling feature for UICollectionView with Paging, NSProxy delegate, Reactive extension, SectionModel & AnimatableSectionModel support
|
||||
DESC
|
||||
|
||||
s.homepage = 'https://github.com/Arnoymous/InfiniteLayout'
|
||||
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
|
||||
s.homepage = 'https://github.com/arnauddorgans/InfiniteLayout'
|
||||
s.screenshots = 'https://github.com/arnauddorgans/InfiniteLayout/raw/master/horizontal.gif', 'https://github.com/arnauddorgans/InfiniteLayout/raw/master/vertical.gif', 'https://github.com/arnauddorgans/InfiniteLayout/raw/master/custom.gif', 'https://github.com/arnauddorgans/InfiniteLayout/raw/master/delegate.gif'
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
s.author = { 'Arnoymous' => 'ineox@me.com' }
|
||||
s.source = { :git => 'https://github.com/Arnoymous/InfiniteLayout.git', :tag => s.version.to_s }
|
||||
s.author = { 'Arnaud Dorgans' => 'ineox@me.com' }
|
||||
s.source = { :git => 'https://github.com/arnauddorgans/InfiniteLayout.git', :tag => s.version.to_s }
|
||||
s.social_media_url = 'https://twitter.com/arnauddorgans'
|
||||
|
||||
s.ios.deployment_target = '8.0'
|
||||
s.ios.deployment_target = '9.0'
|
||||
s.tvos.deployment_target = '9.0'
|
||||
|
||||
s.source_files = 'InfiniteLayout/Classes/**/*'
|
||||
#s.xcconfig = { 'SWIFT_OBJC_BRIDGING_HEADER' => '${POD_ROOT}/InfiniteLayout/BridgeHeader.h' }
|
||||
|
||||
#s.xcconfig = { 'SWIFT_OBJC_BRIDGING_HEADER' => '${POD_ROOT}/InfiniteLayout/BridgeHeader.h' }
|
||||
|
||||
# s.resource_bundles = {
|
||||
# 'InfiniteLayout' => ['InfiniteLayout/Assets/*.png']
|
||||
@@ -40,5 +39,23 @@ Horizontal and Vertical infinite scrolling feature for UICollectionView with Pag
|
||||
|
||||
# s.public_header_files = 'Pod/Classes/**/*.h'
|
||||
# s.frameworks = 'UIKit', 'MapKit'
|
||||
s.dependency 'CocoaProxy', '~> 0.1'
|
||||
s.swift_versions = ['5.0', '5.1']
|
||||
|
||||
|
||||
s.default_subspec = 'Core'
|
||||
s.subspec 'Core' do |core|
|
||||
core.source_files = 'Sources/InfiniteLayout/**/*'
|
||||
core.dependency 'InfiniteLayout/CocoaProxy'
|
||||
core.exclude_files = '**/*/SPMBridge.swift'
|
||||
end
|
||||
s.subspec 'CocoaProxy' do |core|
|
||||
core.source_files = 'Sources/CocoaProxy/**/*'
|
||||
end
|
||||
s.subspec 'Rx' do |rx|
|
||||
rx.dependency 'InfiniteLayout/Core'
|
||||
rx.dependency 'RxSwift', '~> 6'
|
||||
rx.dependency 'RxCocoa', '~> 6'
|
||||
rx.dependency 'RxDataSources', '~> 5'
|
||||
rx.source_files = 'Sources/Rx/**/*'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
// swift-tools-version:5.0
|
||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "InfiniteLayout",
|
||||
platforms: [.iOS(.v9), .tvOS(.v9)],
|
||||
products: [
|
||||
.library(
|
||||
name: "InfiniteLayout",
|
||||
targets: ["InfiniteLayout"]),
|
||||
.library(
|
||||
name: "RxInfiniteLayout",
|
||||
targets: ["RxInfiniteLayout"]),
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "6.0.0")),
|
||||
.package(url: "https://github.com/RxSwiftCommunity/RxDataSources.git", .upToNextMajor(from: "5.0.0")),
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "CocoaProxy",
|
||||
dependencies: [],
|
||||
publicHeadersPath: "./"
|
||||
),
|
||||
.target(
|
||||
name: "InfiniteLayout",
|
||||
dependencies: ["CocoaProxy"]
|
||||
),
|
||||
.target(
|
||||
name: "RxInfiniteLayout",
|
||||
dependencies: ["InfiniteLayout", "RxSwift", "RxCocoa", "RxDataSources"],
|
||||
path: "Sources/Rx"
|
||||
),
|
||||
]
|
||||
)
|
||||
@@ -1,18 +1,22 @@
|
||||
# InfiniteLayout
|
||||
|
||||
[](https://travis-ci.org/Arnoymous/InfiniteLayout)
|
||||
[](http://cocoapods.org/pods/InfiniteLayout)
|
||||
[](https://travis-ci.org/arnauddorgans/InfiniteLayout)
|
||||
[](http://cocoapods.org/pods/InfiniteLayout)
|
||||
[](http://cocoapods.org/pods/InfiniteLayout)
|
||||
[](http://cocoapods.org/pods/InfiniteLayout)
|
||||
[](https://github.com/apple/swift-package-manager)
|
||||
|
||||
<img src="https://github.com/arnauddorgans/InfiniteLayout/raw/master/horizontal.gif" width="250" height="540"><img src="https://github.com/arnauddorgans/InfiniteLayout/raw/master/vertical.gif" width="250" height="540"><img src="https://github.com/arnauddorgans/InfiniteLayout/raw/master/custom.gif" width="250" height="540">
|
||||
|
||||
|
||||
## Example
|
||||
|
||||
To run the example project, clone the repo, and run `pod install` from the Example directory first.
|
||||
|
||||
## Requirements
|
||||
|
||||
## Installation
|
||||
|
||||
### [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html)
|
||||
|
||||
InfiniteLayout is available through [CocoaPods](http://cocoapods.org). To install
|
||||
it, simply add the following line to your Podfile:
|
||||
|
||||
@@ -20,6 +24,27 @@ it, simply add the following line to your Podfile:
|
||||
pod 'InfiniteLayout'
|
||||
```
|
||||
|
||||
|
||||
### [Swift Package Manager](https://github.com/apple/swift-package-manager)
|
||||
|
||||
Create a `Package.swift` file.
|
||||
|
||||
```swift
|
||||
// swift-tools-version:5.0
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "InfiniteLayoutTestProject",
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/arnauddorgans/InfiniteLayout.git", from: "0.4.2")
|
||||
],
|
||||
targets: [
|
||||
.target(name: "InfiniteLayoutTestProject", dependencies: ["InfiniteLayout"])
|
||||
]
|
||||
)
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```swift
|
||||
@@ -55,13 +80,113 @@ func section(from infiniteSection: Int) -> Int
|
||||
|
||||
### Paging
|
||||
|
||||
InfiniteCollectionView provide a paging functionality, you can enable it by setting the **isItemPagingEnabled** flag to **true**,
|
||||
InfiniteCollectionView provide a paging functionality, you can enable it by setting the **isItemPagingEnabled** flag to **true**
|
||||
|
||||
```swift
|
||||
self.infiniteCollectionView.isItemPagingEnabled = true
|
||||
```
|
||||
|
||||
When the **isItemPagingEnabled** flag is enabled you can adjust the deceleration rate by setting the **velocityMultiplier**, the more the value is high, the more the deceleration is long
|
||||
|
||||
```swift
|
||||
self.infiniteCollectionView.velocityMultiplier = 1 // like scrollView with paging (default value)
|
||||
self.infiniteCollectionView.velocityMultiplier = 500 // like scrollView without paging
|
||||
```
|
||||
|
||||
When the **isItemPagingEnabled** flag is enabled you can set a **preferredCenteredIndexPath**, this value is used to calculate the preferred visible cell to center each time the collectionView will change its contentSize
|
||||
|
||||
```swift
|
||||
self.infiniteCollectionView.preferredCenteredIndexPath = [0, 0] // center the cell at [0, 0] if visible (default value)
|
||||
self.infiniteCollectionView.preferredCenteredIndexPath = nil // center the closest cell from center
|
||||
```
|
||||
|
||||
### Delegate
|
||||
|
||||
<img src="https://github.com/arnauddorgans/InfiniteLayout/raw/master/delegate.gif" width="250" height="540">
|
||||
|
||||
InfiniteCollectionView provide an **infiniteDelegate** protocol used to get the centered IndexPath, usefull if you want to use an InfiniteCollectionView like a Picker.
|
||||
|
||||
```swift
|
||||
func infiniteCollectionView(_ infiniteCollectionView: InfiniteCollectionView, didChangeCenteredIndexPath from: IndexPath?, to: IndexPath?)
|
||||
```
|
||||
|
||||
### Rx
|
||||
|
||||
InfiniteCollectionView provide a subspec **InfiniteLayout/Rx**
|
||||
```ruby
|
||||
pod 'InfiniteLayout/Rx'
|
||||
```
|
||||
|
||||
To use InfiniteCollectionView with RxSwift without conflicts between NSProxy
|
||||
|
||||
Use **RxInfiniteCollectionView** instead of **InfiniteCollectionView**
|
||||
|
||||
```swift
|
||||
@IBOutlet weak var collectionView: RxInfiniteCollectionView!
|
||||
```
|
||||
|
||||
RxInfiniteCollectionView provides 2 dataSources for SectionModel:
|
||||
|
||||
**RxInfiniteCollectionViewSectionedReloadDataSource** and **RxInfiniteCollectionViewSectionedAnimatedDataSource**
|
||||
|
||||
#### Binding:
|
||||
|
||||
Without sections:
|
||||
```swift
|
||||
// automatic cell dequeue
|
||||
Observable.just(Array(0..<2))
|
||||
.bind(to: infiniteCollectionView.rx.items(cellIdentifier: "cell", cellType: Cell.self, infinite: true)) { row, element, cell in
|
||||
cell.update(index: row) // update your cell
|
||||
}.disposed(by: disposeBag)
|
||||
|
||||
// custom cell dequeue
|
||||
Observable.just(Array(0..<2))
|
||||
.bind(to: infiniteCollectionView.rx.items(infinite: true)) { collectionView, row, element in
|
||||
let indexPath = IndexPath(row: row, section: 0)
|
||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! Cell // dequeue your cell
|
||||
cell.update(index: row) // update your cell
|
||||
return cell
|
||||
}.disposed(by: disposeBag)
|
||||
```
|
||||
|
||||
With sections:
|
||||
```swift
|
||||
let dataSource = RxInfiniteCollectionViewSectionedReloadDataSource<SectionModel<Int, Int>>(configureCell: { dataSource, collectionView, indexPath, element in
|
||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! Cell // dequeue your cell
|
||||
cell.update(index: indexPath.row) // update your cell
|
||||
return cell
|
||||
})
|
||||
|
||||
Observable.just([
|
||||
SectionModel(model: 0, items: Array(0..<2)),
|
||||
SectionModel(model: 1, items: Array(0..<10))
|
||||
])
|
||||
.bind(to: infiniteCollectionView.rx.items(dataSource: dataSource))
|
||||
.disposed(by: disposeBag)
|
||||
```
|
||||
|
||||
for animations just use **RxInfiniteCollectionViewSectionedAnimatedDataSource** & **AnimatableSectionModel**
|
||||
|
||||
#### Centered IndexPath:
|
||||
|
||||
RxInfiniteCollectionView provide Reactive extension for **itemCentered** & **modelCentered**
|
||||
```swift
|
||||
infiniteCollectionView.rx.itemCentered
|
||||
.asDriver()
|
||||
.drive(onNext: { [unowned self] indexPath in
|
||||
self.selectedView.update(index: indexPath.row) // update interface with indexPath
|
||||
}).disposed(by: disposeBag)
|
||||
|
||||
infiniteCollectionView.rx.modelCentered(Int.self)
|
||||
.asDriver()
|
||||
.drive(onNext: { [unowned self] element in
|
||||
self.selectedView.update(index: element) // update interface with model
|
||||
}).disposed(by: disposeBag)
|
||||
```
|
||||
|
||||
## Author
|
||||
|
||||
Arnoymous, ineox@me.com
|
||||
Arnaud Dorgans, arnaud.dorgans@gmail.com
|
||||
|
||||
## License
|
||||
|
||||
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// CocoaProxy.h
|
||||
// CocoaProxy
|
||||
//
|
||||
// Created by Arnaud Dorgans on 27/12/2017.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface CocoaProxy : NSProxy
|
||||
|
||||
- (instancetype _Nonnull)init;
|
||||
- (instancetype _Nonnull)initWithProxies:(nonnull NSArray<id<NSObject>>*)proxies;
|
||||
|
||||
- (NSArray<id<NSObject>> *_Nonnull)proxiesForSelector:(SEL _Nonnull )aSelector;
|
||||
|
||||
@property (nonatomic, strong) NSArray<id<NSObject>>* _Nonnull proxies;
|
||||
@property (nonatomic, copy) BOOL (^ _Nullable proxyFilter)(id<NSObject> _Nonnull proxy, SEL _Nonnull selector);
|
||||
|
||||
@end
|
||||
Executable
+80
@@ -0,0 +1,80 @@
|
||||
//
|
||||
// CocoaProxy.m
|
||||
// CocoaProxy
|
||||
//
|
||||
// Created by Arnaud Dorgans on 27/12/2017.
|
||||
//
|
||||
|
||||
#import "CocoaProxy.h"
|
||||
|
||||
@interface CocoaProxy () { }
|
||||
|
||||
@property (nonatomic, strong) NSPointerArray *pointerArray;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CocoaProxy
|
||||
|
||||
- (instancetype _Nonnull)initWithProxies:(nonnull NSArray<NSObject*>*)proxies {
|
||||
[self setProxies: proxies];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype _Nonnull)init {
|
||||
return [self initWithProxies: @[]];
|
||||
}
|
||||
|
||||
- (BOOL)respondsToSelector:(SEL)aSelector
|
||||
{
|
||||
return ([self methodSignatureForSelector: aSelector] != nil);
|
||||
}
|
||||
|
||||
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
|
||||
{
|
||||
for (NSObject* proxy in [self proxiesForSelector: aSelector]) {
|
||||
if ([proxy respondsToSelector: aSelector]) {
|
||||
return [proxy methodSignatureForSelector: aSelector];
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSArray<id<NSObject>> *_Nonnull)proxiesForSelector:(SEL _Nonnull )aSelector
|
||||
{
|
||||
if (self.proxyFilter) {
|
||||
NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(id _Nullable evaluatedObject, NSDictionary<NSString *,id> * _Nullable bindings) {
|
||||
return self.proxyFilter(evaluatedObject, aSelector);
|
||||
}];
|
||||
return [self.proxies filteredArrayUsingPredicate: predicate];
|
||||
}
|
||||
return self.proxies;
|
||||
}
|
||||
|
||||
- (void)forwardInvocation:(NSInvocation *)invocation
|
||||
{
|
||||
for (NSObject* proxy in [self proxiesForSelector: invocation.selector]) {
|
||||
[self invokeInvocation: invocation onProxy: proxy];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)invokeInvocation:(NSInvocation *)invocation onProxy:(id<NSObject>)proxy
|
||||
{
|
||||
if ([proxy respondsToSelector: invocation.selector]) {
|
||||
[invocation invokeWithTarget: proxy];
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)setProxies:(NSArray<id<NSObject>> *)proxies {
|
||||
self.pointerArray = [NSPointerArray weakObjectsPointerArray];
|
||||
for (NSObject* proxy in proxies) {
|
||||
[self.pointerArray addPointer: (void *)proxy];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSArray<id<NSObject>> *)proxies {
|
||||
return self.pointerArray.allObjects;
|
||||
}
|
||||
|
||||
@end
|
||||
+109
-60
@@ -7,21 +7,31 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
@objc public protocol InfiniteCollectionViewDelegate {
|
||||
|
||||
@objc optional func infiniteCollectionView(_ infiniteCollectionView: InfiniteCollectionView, didChangeCenteredIndexPath from: IndexPath?, to: IndexPath?)
|
||||
}
|
||||
|
||||
open class InfiniteCollectionView: UICollectionView {
|
||||
|
||||
lazy var delegateProxy = InfiniteCollectionViewDelegateProxy(collectionView: self)
|
||||
lazy var dataSourceProxy = InfiniteCollectionViewDataSourceProxy(collectionView: self)
|
||||
lazy var delegateProxy = InfiniteCollectionViewDelegateProxy(collectionView: self)
|
||||
|
||||
@IBInspectable var isItemPagingEnabled: Bool = false
|
||||
@IBInspectable var velocityMultiplier: CGFloat = 500 {
|
||||
didSet {
|
||||
self.infiniteLayout.velocityMultiplier = velocityMultiplier
|
||||
}
|
||||
}
|
||||
@IBOutlet open weak var infiniteDelegate: InfiniteCollectionViewDelegate?
|
||||
|
||||
override open var delegate: UICollectionViewDelegate? {
|
||||
open private(set) var centeredIndexPath: IndexPath?
|
||||
open var preferredCenteredIndexPath: IndexPath? = IndexPath(item: 0, section: 0)
|
||||
|
||||
open var forwardDelegate: Bool { return true }
|
||||
var _contentSize: CGSize?
|
||||
|
||||
override open weak var delegate: UICollectionViewDelegate? {
|
||||
get { return super.delegate }
|
||||
set {
|
||||
guard forwardDelegate else {
|
||||
super.delegate = newValue
|
||||
return
|
||||
}
|
||||
guard let newValue = newValue else {
|
||||
super.delegate = nil
|
||||
return
|
||||
@@ -34,9 +44,14 @@ open class InfiniteCollectionView: UICollectionView {
|
||||
super.delegate = delegate
|
||||
}
|
||||
}
|
||||
override open var dataSource: UICollectionViewDataSource? {
|
||||
|
||||
override open weak var dataSource: UICollectionViewDataSource? {
|
||||
get { return super.dataSource }
|
||||
set {
|
||||
guard forwardDelegate else {
|
||||
super.dataSource = newValue
|
||||
return
|
||||
}
|
||||
guard let newValue = newValue else {
|
||||
super.dataSource = nil
|
||||
return
|
||||
@@ -50,63 +65,54 @@ open class InfiniteCollectionView: UICollectionView {
|
||||
}
|
||||
}
|
||||
|
||||
@IBInspectable open var isItemPagingEnabled: Bool = false
|
||||
@IBInspectable open var velocityMultiplier: CGFloat = 1 {
|
||||
didSet {
|
||||
self.infiniteLayout.velocityMultiplier = velocityMultiplier
|
||||
}
|
||||
}
|
||||
|
||||
public var infiniteLayout: InfiniteLayout! {
|
||||
return self.collectionViewLayout as? InfiniteLayout
|
||||
}
|
||||
|
||||
private static func infiniteLayout(layout: UICollectionViewLayout) -> InfiniteLayout {
|
||||
guard let infiniteLayout = layout as? InfiniteLayout else {
|
||||
return InfiniteLayout(layout: layout)
|
||||
}
|
||||
return infiniteLayout
|
||||
}
|
||||
|
||||
public override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) {
|
||||
super.init(frame: frame, collectionViewLayout: InfiniteLayout(layout: layout))
|
||||
super.init(frame: frame, collectionViewLayout: InfiniteCollectionView.infiniteLayout(layout: layout))
|
||||
sharedInit()
|
||||
}
|
||||
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
|
||||
let layout = self.collectionViewLayout
|
||||
if !(layout is InfiniteLayout) {
|
||||
self.collectionViewLayout = InfiniteLayout(layout: layout)
|
||||
let infiniteLayout = InfiniteCollectionView.infiniteLayout(layout: self.collectionViewLayout)
|
||||
if self.collectionViewLayout != infiniteLayout {
|
||||
self.collectionViewLayout = infiniteLayout
|
||||
}
|
||||
}
|
||||
|
||||
open override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
sharedInit()
|
||||
}
|
||||
|
||||
private func sharedInit() {
|
||||
delegateProxy.collectionView = self
|
||||
dataSourceProxy.collectionView = self
|
||||
self.showsVerticalScrollIndicator = false
|
||||
self.showsHorizontalScrollIndicator = false
|
||||
#if os(iOS)
|
||||
self.scrollsToTop = false
|
||||
#endif
|
||||
}
|
||||
|
||||
open override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
|
||||
self.centerCollectionViewIfNeeded()
|
||||
self.loopCollectionViewIfNeeded()
|
||||
}
|
||||
}
|
||||
|
||||
extension InfiniteCollectionView: UICollectionViewDelegate {
|
||||
|
||||
// MARK: Loop
|
||||
func loopCollectionViewIfNeeded() {
|
||||
self.infiniteLayout.loopCollectionViewIfNeeded()
|
||||
}
|
||||
|
||||
public func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
delegateProxy.delegate?.scrollViewDidScroll?(scrollView)
|
||||
self.loopCollectionViewIfNeeded()
|
||||
}
|
||||
|
||||
// MARK: Paging
|
||||
func centerCollectionViewIfNeeded() {
|
||||
guard isItemPagingEnabled,
|
||||
!self.isDragging && !self.isDecelerating else {
|
||||
return
|
||||
}
|
||||
self.infiniteLayout.centerCollectionViewIfNeeded()
|
||||
}
|
||||
|
||||
public func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
|
||||
if isItemPagingEnabled {
|
||||
self.infiniteLayout.centerCollectionView(withVelocity: velocity, targetContentOffset: targetContentOffset)
|
||||
}
|
||||
self.updateLayoutIfNeeded()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,33 +133,76 @@ extension InfiniteCollectionView: UICollectionViewDataSource {
|
||||
return items
|
||||
}
|
||||
|
||||
private var multiplier: Int {
|
||||
return InfiniteDataSources.multiplier(estimatedItemSize: self.infiniteLayout.itemSize, enabled: self.infiniteLayout.isEnabled)
|
||||
}
|
||||
|
||||
public func section(from infiniteSection: Int) -> Int {
|
||||
return infiniteSection % delegateNumberOfSections
|
||||
return InfiniteDataSources.section(from: infiniteSection, numberOfSections: delegateNumberOfSections)
|
||||
}
|
||||
|
||||
public func indexPath(from infiniteIndexPath: IndexPath) -> IndexPath {
|
||||
let items = delegateNumberOfItems(in: infiniteIndexPath.section)
|
||||
return IndexPath(item: infiniteIndexPath.item % items, section: self.section(from: infiniteIndexPath.section))
|
||||
}
|
||||
|
||||
private var multiplier: Int {
|
||||
let min = Swift.min(self.infiniteLayout.itemSize.width, self.infiniteLayout.itemSize.height)
|
||||
let count = ceil(InfiniteLayout.minimumContentSize.width / min)
|
||||
return Int(count) * delegateNumberOfSections
|
||||
return InfiniteDataSources.indexPath(from: infiniteIndexPath,
|
||||
numberOfSections: delegateNumberOfSections,
|
||||
numberOfItems: delegateNumberOfItems(in: infiniteIndexPath.section))
|
||||
}
|
||||
|
||||
public func numberOfSections(in collectionView: UICollectionView) -> Int {
|
||||
let delegateNumberOfSections = self.delegateNumberOfSections
|
||||
return delegateNumberOfSections > 1 ? delegateNumberOfSections * multiplier : delegateNumberOfSections
|
||||
return InfiniteDataSources.numberOfSections(numberOfSections: delegateNumberOfSections, multiplier: multiplier)
|
||||
}
|
||||
|
||||
public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
let delegateNumberOfSections = self.delegateNumberOfSections
|
||||
let delegateNumberOfItems = self.delegateNumberOfItems(in: section)
|
||||
return delegateNumberOfSections > 1 ? delegateNumberOfItems : delegateNumberOfItems * multiplier
|
||||
return InfiniteDataSources.numberOfItemsInSection(numberOfItemsInSection: delegateNumberOfItems(in: section),
|
||||
numberOfSections: delegateNumberOfSections,
|
||||
multiplier: multiplier)
|
||||
}
|
||||
|
||||
public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||
fatalError("collectionView dataSource is required")
|
||||
}
|
||||
}
|
||||
|
||||
extension InfiniteCollectionView: UICollectionViewDelegate {
|
||||
|
||||
func updateLayoutIfNeeded() {
|
||||
self.loopCollectionViewIfNeeded()
|
||||
self.centerCollectionViewIfNeeded()
|
||||
|
||||
let preferredVisibleIndexPath = infiniteLayout.preferredVisibleLayoutAttributes()?.indexPath
|
||||
if self.centeredIndexPath != preferredVisibleIndexPath {
|
||||
let previousCenteredIndexPath = self.centeredIndexPath
|
||||
self.centeredIndexPath = preferredVisibleIndexPath
|
||||
self.infiniteDelegate?.infiniteCollectionView?(self, didChangeCenteredIndexPath: previousCenteredIndexPath, to: self.centeredIndexPath)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Loop
|
||||
func loopCollectionViewIfNeeded() {
|
||||
self.infiniteLayout.loopCollectionViewIfNeeded()
|
||||
}
|
||||
|
||||
public func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
delegateProxy.delegate?.scrollViewDidScroll?(scrollView)
|
||||
self.updateLayoutIfNeeded()
|
||||
}
|
||||
|
||||
// MARK: Paging
|
||||
func centerCollectionViewIfNeeded() {
|
||||
guard isItemPagingEnabled,
|
||||
!self.isDragging && !self.isDecelerating else {
|
||||
return
|
||||
}
|
||||
guard self._contentSize != self.contentSize else {
|
||||
return
|
||||
}
|
||||
self._contentSize = self.contentSize
|
||||
self.infiniteLayout.centerCollectionViewIfNeeded(indexPath: self.preferredCenteredIndexPath)
|
||||
}
|
||||
|
||||
public func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
|
||||
if isItemPagingEnabled {
|
||||
self.infiniteLayout.centerCollectionView(withVelocity: velocity, targetContentOffset: targetContentOffset)
|
||||
}
|
||||
self.delegateProxy.delegate?.scrollViewWillEndDragging?(scrollView, withVelocity: velocity, targetContentOffset: targetContentOffset)
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -6,7 +6,6 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import CocoaProxy
|
||||
|
||||
class InfiniteCollectionViewProxy<T: NSObjectProtocol>: CocoaProxy {
|
||||
|
||||
@@ -45,6 +44,10 @@ class InfiniteCollectionViewProxy<T: NSObjectProtocol>: CocoaProxy {
|
||||
super.init(proxies: [])
|
||||
self.collectionView = collectionView
|
||||
}
|
||||
|
||||
deinit {
|
||||
self.proxies.removeAll()
|
||||
}
|
||||
}
|
||||
|
||||
class InfiniteCollectionViewDelegateProxy: InfiniteCollectionViewProxy<UICollectionViewDelegate>, UICollectionViewDelegate {
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// InfiniteDataSources.swift
|
||||
// InfiniteLayout
|
||||
//
|
||||
// Created by Arnaud Dorgans on 03/01/2018.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
open class InfiniteDataSources {
|
||||
public static var originCount: Int = 0
|
||||
public static func section(from infiniteSection: Int, numberOfSections: Int) -> Int {
|
||||
return infiniteSection % numberOfSections
|
||||
}
|
||||
|
||||
public static func indexPath(from infiniteIndexPath: IndexPath, numberOfSections: Int, numberOfItems: Int) -> IndexPath {
|
||||
return IndexPath(item: infiniteIndexPath.item % numberOfItems, section: self.section(from: infiniteIndexPath.section, numberOfSections: numberOfSections))
|
||||
}
|
||||
|
||||
public static func multiplier(estimatedItemSize: CGSize, enabled: Bool) -> Int {
|
||||
guard enabled else {
|
||||
return 1
|
||||
}
|
||||
let min = Swift.min(estimatedItemSize.width, estimatedItemSize.height)
|
||||
let count = ceil(InfiniteLayout.minimumContentSize / min)
|
||||
return Int(count)
|
||||
}
|
||||
|
||||
public static func numberOfSections(numberOfSections: Int, multiplier: Int) -> Int {
|
||||
return numberOfSections > 1 ? numberOfSections * multiplier : numberOfSections
|
||||
}
|
||||
|
||||
public static func numberOfItemsInSection(numberOfItemsInSection: Int, numberOfSections: Int, multiplier: Int) -> Int {
|
||||
originCount = numberOfItemsInSection
|
||||
return numberOfSections > 1 ? numberOfItemsInSection : numberOfItemsInSection * multiplier
|
||||
}
|
||||
}
|
||||
+76
-33
@@ -9,13 +9,26 @@ import UIKit
|
||||
|
||||
open class InfiniteLayout: UICollectionViewFlowLayout {
|
||||
|
||||
public var velocityMultiplier: CGFloat = 500 // used to simulate paging
|
||||
public var velocityMultiplier: CGFloat = 1 // used to simulate paging
|
||||
|
||||
private let multiplier: CGFloat = 100 // contentOffset multiplier
|
||||
private let multiplier: CGFloat = 500 // contentOffset multiplier
|
||||
|
||||
private var contentSize: CGSize = .zero
|
||||
|
||||
private (set) var isEnabled: Bool = false
|
||||
private var hasValidLayout: Bool = false
|
||||
|
||||
@IBInspectable public var isEnabled: Bool = true {
|
||||
didSet {
|
||||
self.invalidateLayout()
|
||||
}
|
||||
}
|
||||
|
||||
public var currentPage: CGPoint {
|
||||
guard let collectionView = self.collectionView else {
|
||||
return .zero
|
||||
}
|
||||
return self.page(for: collectionView.contentOffset)
|
||||
}
|
||||
|
||||
open override func shouldInvalidateLayout(forBoundsChange newBounds: CGRect) -> Bool {
|
||||
return true
|
||||
@@ -35,29 +48,40 @@ open class InfiniteLayout: UICollectionViewFlowLayout {
|
||||
self.footerReferenceSize = layout.footerReferenceSize
|
||||
}
|
||||
|
||||
static var minimumContentSize: CGSize {
|
||||
let max = Swift.max(UIScreen.main.bounds.width, UIScreen.main.bounds.height) * 4
|
||||
return CGSize(width: max, height: max)
|
||||
static var minimumContentSize: CGFloat {
|
||||
return max(UIScreen.main.bounds.width, UIScreen.main.bounds.height) * 4
|
||||
}
|
||||
|
||||
override open func prepare() {
|
||||
let collectionViewContentSize = super.collectionViewContentSize
|
||||
self.contentSize = CGSize(width: collectionViewContentSize.width, height: collectionViewContentSize.height)
|
||||
self.isEnabled = (scrollDirection == .horizontal ? self.contentSize.width : self.contentSize.height) >=
|
||||
InfiniteLayout.minimumContentSize.width
|
||||
self.hasValidLayout = {
|
||||
guard let collectionView = self.collectionView, collectionView.bounds != .zero, self.isEnabled else {
|
||||
return false
|
||||
}
|
||||
return (scrollDirection == .horizontal ? self.contentSize.width : self.contentSize.height) >=
|
||||
InfiniteLayout.minimumContentSize
|
||||
}()
|
||||
super.prepare()
|
||||
}
|
||||
|
||||
override open var collectionViewContentSize: CGSize {
|
||||
guard isEnabled else {
|
||||
return super.collectionViewContentSize
|
||||
guard hasValidLayout else {
|
||||
return self.contentSize
|
||||
}
|
||||
return CGSize(width: scrollDirection == .horizontal ? self.contentSize.width * multiplier : self.contentSize.width,
|
||||
height: scrollDirection == .vertical ? self.contentSize.height * multiplier : self.contentSize.height)
|
||||
}
|
||||
|
||||
open override func layoutAttributesForItem(at indexPath: IndexPath) -> UICollectionViewLayoutAttributes? {
|
||||
guard let attributes = super.layoutAttributesForItem(at: indexPath) else {
|
||||
return nil
|
||||
}
|
||||
return self.layoutAttributes(from: attributes, page: currentPage)
|
||||
}
|
||||
|
||||
override open func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
|
||||
guard isEnabled else {
|
||||
guard hasValidLayout else {
|
||||
return super.layoutAttributesForElements(in: rect)
|
||||
}
|
||||
let page = self.page(for: rect.origin)
|
||||
@@ -119,7 +143,7 @@ open class InfiniteLayout: UICollectionViewFlowLayout {
|
||||
}
|
||||
|
||||
private func layoutAttributes(from layoutAttributes: UICollectionViewLayoutAttributes, page: CGPoint) -> UICollectionViewLayoutAttributes! {
|
||||
guard let attributes = layoutAttributes.copy() as? UICollectionViewLayoutAttributes else {
|
||||
guard let attributes = self.copyLayoutAttributes(layoutAttributes) else {
|
||||
return nil
|
||||
}
|
||||
attributes.frame = rect(from: attributes.frame, page: page)
|
||||
@@ -127,25 +151,30 @@ open class InfiniteLayout: UICollectionViewFlowLayout {
|
||||
}
|
||||
|
||||
// MARK: Loop
|
||||
private func updateContentOffset(_ offset: CGPoint) {
|
||||
guard let collectionView = self.collectionView else {
|
||||
return
|
||||
}
|
||||
collectionView.contentOffset = offset
|
||||
collectionView.layoutIfNeeded()
|
||||
}
|
||||
private func preferredContentOffset(forContentOffset contentOffset: CGPoint) -> CGPoint {
|
||||
return rect(from: CGRect(origin: contentOffset, size: .zero), page: self.page(from: .zero, offset: multiplier / 2)).origin
|
||||
}
|
||||
|
||||
public func loopCollectionViewIfNeeded() {
|
||||
guard let collectionView = self.collectionView, self.isEnabled else {
|
||||
guard let collectionView = self.collectionView, self.hasValidLayout else {
|
||||
return
|
||||
}
|
||||
let page = self.pageIndex(from: self.page(for: collectionView.contentOffset))
|
||||
let offset = self.preferredContentOffset(forContentOffset: collectionView.contentOffset)
|
||||
if (page < 2 || page > self.multiplier - 2) && collectionView.contentOffset != offset {
|
||||
DispatchQueue.main.async {
|
||||
collectionView.contentOffset = offset
|
||||
}
|
||||
self.updateContentOffset(offset)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Paging
|
||||
func collectionViewRect() -> CGRect? {
|
||||
public func collectionViewRect() -> CGRect? {
|
||||
guard let collectionView = self.collectionView else {
|
||||
return nil
|
||||
}
|
||||
@@ -162,7 +191,7 @@ open class InfiniteLayout: UICollectionViewFlowLayout {
|
||||
return visibleRect
|
||||
}
|
||||
|
||||
func visibleCollectionViewRect() -> CGRect? {
|
||||
public func visibleCollectionViewRect() -> CGRect? {
|
||||
guard let collectionView = self.collectionView,
|
||||
var collectionViewRect = self.collectionViewRect() else {
|
||||
return nil
|
||||
@@ -178,10 +207,10 @@ open class InfiniteLayout: UICollectionViewFlowLayout {
|
||||
}
|
||||
return (self.layoutAttributesForElements(in: CGRect(origin: offset ?? collectionView.contentOffset, size: collectionView.frame.size)) ?? [])
|
||||
.sorted(by: { lhs, rhs in
|
||||
guard let lhs = self.centerredContentOffset(forRect: lhs.frame) else {
|
||||
guard let lhs = self.centeredContentOffset(forRect: lhs.frame) else {
|
||||
return false
|
||||
}
|
||||
guard let rhs = self.centerredContentOffset(forRect: rhs.frame) else {
|
||||
guard let rhs = self.centeredContentOffset(forRect: rhs.frame) else {
|
||||
return true
|
||||
}
|
||||
let value: (CGPoint)->CGFloat = {
|
||||
@@ -191,7 +220,7 @@ open class InfiniteLayout: UICollectionViewFlowLayout {
|
||||
})
|
||||
}
|
||||
|
||||
public func preferredVisibleLayoutAttributes(at offset: CGPoint? = nil, velocity: CGPoint = .zero, targetOffset: CGPoint? = nil) -> UICollectionViewLayoutAttributes? {
|
||||
public func preferredVisibleLayoutAttributes(at offset: CGPoint? = nil, velocity: CGPoint = .zero, targetOffset: CGPoint? = nil, indexPath: IndexPath? = nil) -> UICollectionViewLayoutAttributes? {
|
||||
guard let currentOffset = self.collectionView?.contentOffset else {
|
||||
return nil
|
||||
}
|
||||
@@ -200,16 +229,21 @@ open class InfiniteLayout: UICollectionViewFlowLayout {
|
||||
}
|
||||
let velocity = self.scrollDirection == .horizontal ? velocity.x : velocity.y
|
||||
let targetDirection = direction(targetOffset ?? currentOffset)
|
||||
return self.visibleLayoutAttributes(at: offset)
|
||||
let attributes = self.visibleLayoutAttributes(at: offset)
|
||||
if let indexPath = indexPath,
|
||||
let attributes = attributes.first(where: { $0.indexPath == indexPath }) {
|
||||
return attributes
|
||||
}
|
||||
return attributes
|
||||
.first { attributes in
|
||||
guard let offset = self.centerredContentOffset(forRect: attributes.frame) else {
|
||||
guard let offset = self.centeredContentOffset(forRect: attributes.frame) else {
|
||||
return false
|
||||
}
|
||||
return direction(offset) == targetDirection || velocity == 0
|
||||
}
|
||||
}
|
||||
|
||||
func centerredContentOffset(forRect rect: CGRect) -> CGPoint? {
|
||||
func centeredContentOffset(forRect rect: CGRect) -> CGPoint? {
|
||||
guard let collectionView = self.collectionView,
|
||||
let collectionRect = self.collectionViewRect() else {
|
||||
return nil
|
||||
@@ -219,30 +253,39 @@ open class InfiniteLayout: UICollectionViewFlowLayout {
|
||||
}
|
||||
|
||||
public func centerCollectionView(withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
|
||||
guard let collectionView = self.collectionView, self.isEnabled else {
|
||||
guard let collectionView = self.collectionView, self.hasValidLayout else {
|
||||
return
|
||||
}
|
||||
let newTarget = CGPoint(x: self.scrollDirection == .horizontal ? collectionView.contentOffset.x + velocity.x * velocityMultiplier : targetContentOffset.pointee.x,
|
||||
y: self.scrollDirection == .vertical ? collectionView.contentOffset.y + velocity.y * velocityMultiplier : targetContentOffset.pointee.y)
|
||||
|
||||
guard let preferredAttributes = self.preferredVisibleLayoutAttributes(at: newTarget, velocity: velocity, targetOffset: targetContentOffset.pointee),
|
||||
let offset = self.centerredContentOffset(forRect: preferredAttributes.frame) else {
|
||||
let offset = self.centeredContentOffset(forRect: preferredAttributes.frame) else {
|
||||
return
|
||||
}
|
||||
targetContentOffset.pointee = offset
|
||||
}
|
||||
|
||||
public func centerCollectionViewIfNeeded() {
|
||||
guard let collectionView = self.collectionView, self.isEnabled else {
|
||||
public func centerCollectionViewIfNeeded(indexPath: IndexPath? = nil) {
|
||||
guard let collectionView = self.collectionView, self.hasValidLayout else {
|
||||
return
|
||||
}
|
||||
guard let preferredAttributes = self.preferredVisibleLayoutAttributes(),
|
||||
let offset = self.centerredContentOffset(forRect: preferredAttributes.frame),
|
||||
guard let preferredAttributes = self.preferredVisibleLayoutAttributes(indexPath: indexPath),
|
||||
let offset = self.centeredContentOffset(forRect: preferredAttributes.frame),
|
||||
collectionView.contentOffset != offset else {
|
||||
return
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
collectionView.contentOffset = offset
|
||||
}
|
||||
self.updateContentOffset(offset)
|
||||
}
|
||||
|
||||
// MARK: Copy
|
||||
public func copyLayoutAttributes(_ attributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes? {
|
||||
return attributes.copy() as? UICollectionViewLayoutAttributes
|
||||
}
|
||||
|
||||
public func copyLayoutAttributes(from array: [UICollectionViewLayoutAttributes]) -> [UICollectionViewLayoutAttributes] {
|
||||
return array.map { self.copyLayoutAttributes($0) }
|
||||
.filter { $0 != nil }
|
||||
.map { $0! }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
//
|
||||
// InfiniteCollectionView.swift
|
||||
// InfiniteLayout
|
||||
//
|
||||
// Created by Arnaud Dorgans on 05/09/2019.
|
||||
//
|
||||
|
||||
@_exported import CocoaProxy
|
||||
@@ -0,0 +1,116 @@
|
||||
//
|
||||
// InfiniteCollectionView+Rx.swift
|
||||
// InfiniteLayout
|
||||
//
|
||||
// Created by Arnaud Dorgans on 03/01/2018.
|
||||
//
|
||||
|
||||
#if canImport(InfiniteLayout)
|
||||
import InfiniteLayout
|
||||
#endif
|
||||
|
||||
import UIKit
|
||||
import RxSwift
|
||||
import RxCocoa
|
||||
import RxDataSources
|
||||
|
||||
class RxInfiniteCollectionViewDelegate: DelegateProxy<InfiniteCollectionView, InfiniteCollectionViewDelegate>, DelegateProxyType, InfiniteCollectionViewDelegate {
|
||||
|
||||
init(infiniteCollectionView: InfiniteCollectionView) {
|
||||
super.init(parentObject: infiniteCollectionView, delegateProxy: RxInfiniteCollectionViewDelegate.self)
|
||||
}
|
||||
|
||||
static func registerKnownImplementations() {
|
||||
RxInfiniteCollectionViewDelegate.register {
|
||||
RxInfiniteCollectionViewDelegate(infiniteCollectionView: $0)
|
||||
}
|
||||
}
|
||||
|
||||
static func currentDelegate(for object: InfiniteCollectionView) -> InfiniteCollectionViewDelegate? {
|
||||
return object.infiniteDelegate
|
||||
}
|
||||
|
||||
static func setCurrentDelegate(_ delegate: InfiniteCollectionViewDelegate?, to object: InfiniteCollectionView) {
|
||||
object.infiniteDelegate = delegate
|
||||
}
|
||||
}
|
||||
|
||||
extension Reactive where Base: InfiniteCollectionView {
|
||||
|
||||
private var infiniteDelegate: RxInfiniteCollectionViewDelegate {
|
||||
return RxInfiniteCollectionViewDelegate.proxy(for: self.base)
|
||||
}
|
||||
|
||||
public var itemCentered: ControlEvent<IndexPath?> {
|
||||
let source = infiniteDelegate.sentMessage(#selector(InfiniteCollectionViewDelegate.infiniteCollectionView(_:didChangeCenteredIndexPath:to:)))
|
||||
.map { $0.last as? IndexPath }
|
||||
return ControlEvent(events: source)
|
||||
}
|
||||
|
||||
public func modelCentered<T>(_ type: T.Type) -> ControlEvent<T> {
|
||||
let source: Observable<T> = itemCentered.flatMap { [weak view = self.base as InfiniteCollectionView] indexPath -> Observable<T> in
|
||||
guard let view = view, var indexPath = indexPath else {
|
||||
return Observable.empty()
|
||||
}
|
||||
|
||||
indexPath.row %= InfiniteDataSources.originCount
|
||||
return Observable.just(try view.rx.model(at: indexPath))
|
||||
}
|
||||
return ControlEvent(events: source)
|
||||
}
|
||||
|
||||
public func modelSelected<T>(_ modelType: T.Type) -> ControlEvent<T> {
|
||||
let source: Observable<T> = itemSelected.flatMap { [weak view = self.base as InfiniteCollectionView] indexPath -> Observable<T> in
|
||||
guard let view = view else {
|
||||
return Observable.empty()
|
||||
}
|
||||
|
||||
var indexPath = indexPath
|
||||
indexPath.row %= InfiniteDataSources.originCount
|
||||
return Observable.just(try view.rx.model(at: indexPath))
|
||||
}
|
||||
|
||||
return ControlEvent(events: source)
|
||||
}
|
||||
}
|
||||
|
||||
extension Reactive where Base: RxInfiniteCollectionView {
|
||||
|
||||
public func items<S: Sequence, O: ObservableType>
|
||||
(infinite: Bool)
|
||||
-> (_ source: O)
|
||||
-> (_ cellFactory: @escaping (UICollectionView, Int, S.Iterator.Element) -> UICollectionViewCell)
|
||||
-> Disposable where O.Element == S {
|
||||
return { source in
|
||||
guard infinite else {
|
||||
return self.items(source)
|
||||
}
|
||||
return { cellFactory in
|
||||
let dataSource = RxInfiniteCollectionViewSectionedReloadDataSource<SectionModel<Int, S.Iterator.Element>>(configureCell: { _, collectionView, indexPath, element in
|
||||
return cellFactory(collectionView, indexPath.item, element)
|
||||
})
|
||||
return self.items(dataSource: dataSource)(source.map { [SectionModel(model: 0, items: $0.map { $0 })] })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func items<S: Sequence, Cell: UICollectionViewCell, O : ObservableType>
|
||||
(cellIdentifier: String, cellType: Cell.Type = Cell.self, infinite: Bool)
|
||||
-> (_ source: O)
|
||||
-> (_ configureCell: @escaping (Int, S.Iterator.Element, Cell) -> Void)
|
||||
-> Disposable where O.Element == S {
|
||||
guard infinite else {
|
||||
return self.items(cellIdentifier: cellIdentifier, cellType: cellType)
|
||||
}
|
||||
return { source in
|
||||
return { configureCell in
|
||||
let dataSource = RxInfiniteCollectionViewSectionedReloadDataSource<SectionModel<Int, S.Iterator.Element>>(configureCell: { _, collectionView, indexPath, element in
|
||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cellIdentifier, for: indexPath) as! Cell
|
||||
configureCell(indexPath.item, element, cell)
|
||||
return cell
|
||||
})
|
||||
return self.items(dataSource: dataSource)(source.map { [SectionModel(model: 0, items: $0.map { $0 })] })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// RxInfiniteCollectionView.swift
|
||||
// InfiniteLayout
|
||||
//
|
||||
// Created by Arnaud Dorgans on 03/01/2018.
|
||||
//
|
||||
|
||||
#if canImport(InfiniteLayout)
|
||||
import InfiniteLayout
|
||||
#endif
|
||||
|
||||
import UIKit
|
||||
import RxSwift
|
||||
import RxCocoa
|
||||
|
||||
open class RxInfiniteCollectionView: InfiniteCollectionView {
|
||||
|
||||
let disposeBag = DisposeBag()
|
||||
|
||||
override open var forwardDelegate: Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
public override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) {
|
||||
super.init(frame: frame, collectionViewLayout: layout)
|
||||
setupRx()
|
||||
}
|
||||
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
}
|
||||
|
||||
open override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
setupRx()
|
||||
}
|
||||
|
||||
func setupRx() {
|
||||
|
||||
self.rx.setDelegate(self)
|
||||
.disposed(by: disposeBag)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
//
|
||||
// RxInfiniteCollectionViewDelegate.swift
|
||||
// InfiniteLayout
|
||||
//
|
||||
// Created by Arnaud Dorgans on 03/01/2018.
|
||||
//
|
||||
|
||||
#if canImport(InfiniteLayout)
|
||||
import InfiniteLayout
|
||||
#endif
|
||||
|
||||
import UIKit
|
||||
import RxDataSources
|
||||
|
||||
open class RxInfiniteCollectionViewSectionedReloadDataSource<S: SectionModelType>: RxCollectionViewSectionedReloadDataSource<S> {
|
||||
|
||||
public var isEnabled: Bool = true
|
||||
|
||||
open override subscript(section: Int) -> S {
|
||||
let section = InfiniteDataSources.section(from: section, numberOfSections: sectionModels.count)
|
||||
return self.sectionModels[section]
|
||||
}
|
||||
|
||||
open override subscript(indexPath: IndexPath) -> Item {
|
||||
get {
|
||||
let indexPath = InfiniteDataSources.indexPath(from: indexPath,
|
||||
numberOfSections: sectionModels.count,
|
||||
numberOfItems: self[indexPath.section].items.count)
|
||||
return super[indexPath]
|
||||
} set {
|
||||
let indexPath = InfiniteDataSources.indexPath(from: indexPath,
|
||||
numberOfSections: sectionModels.count,
|
||||
numberOfItems: self[indexPath.section].items.count)
|
||||
super[indexPath] = newValue
|
||||
}
|
||||
}
|
||||
|
||||
private func multiplier(for collectionView: UICollectionView) -> Int {
|
||||
guard let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout else {
|
||||
fatalError()
|
||||
}
|
||||
return InfiniteDataSources.multiplier(estimatedItemSize: layout.itemSize, enabled: isEnabled)
|
||||
}
|
||||
|
||||
open override func numberOfSections(in collectionView: UICollectionView) -> Int {
|
||||
return InfiniteDataSources.numberOfSections(numberOfSections: self.sectionModels.count,
|
||||
multiplier: self.multiplier(for: collectionView))
|
||||
}
|
||||
|
||||
open override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
return InfiniteDataSources.numberOfItemsInSection(numberOfItemsInSection: self[section].items.count,
|
||||
numberOfSections: self.sectionModels.count,
|
||||
multiplier: self.multiplier(for: collectionView))
|
||||
}
|
||||
|
||||
open override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||
return configureCell(self, collectionView, indexPath, self[indexPath])
|
||||
}
|
||||
}
|
||||
|
||||
open class RxInfiniteCollectionViewSectionedAnimatedDataSource<S: AnimatableSectionModelType>: RxCollectionViewSectionedAnimatedDataSource<S> {
|
||||
|
||||
public var isEnabled: Bool = true
|
||||
|
||||
open override subscript(section: Int) -> S {
|
||||
let section = InfiniteDataSources.section(from: section, numberOfSections: sectionModels.count)
|
||||
return self.sectionModels[section]
|
||||
}
|
||||
|
||||
open override subscript(indexPath: IndexPath) -> Item {
|
||||
get {
|
||||
let indexPath = InfiniteDataSources.indexPath(from: indexPath,
|
||||
numberOfSections: sectionModels.count,
|
||||
numberOfItems: self[indexPath.section].items.count)
|
||||
return super[indexPath]
|
||||
} set {
|
||||
let indexPath = InfiniteDataSources.indexPath(from: indexPath,
|
||||
numberOfSections: sectionModels.count,
|
||||
numberOfItems: self[indexPath.section].items.count)
|
||||
super[indexPath] = newValue
|
||||
}
|
||||
}
|
||||
|
||||
private func multiplier(for collectionView: UICollectionView) -> Int {
|
||||
guard let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout else {
|
||||
fatalError()
|
||||
}
|
||||
return InfiniteDataSources.multiplier(estimatedItemSize: layout.itemSize, enabled: isEnabled)
|
||||
}
|
||||
|
||||
open override func numberOfSections(in collectionView: UICollectionView) -> Int {
|
||||
return InfiniteDataSources.numberOfSections(numberOfSections: self.sectionModels.count,
|
||||
multiplier: self.multiplier(for: collectionView))
|
||||
}
|
||||
|
||||
open override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
return InfiniteDataSources.numberOfItemsInSection(numberOfItemsInSection: self[section].items.count,
|
||||
numberOfSections: self.sectionModels.count,
|
||||
multiplier: self.multiplier(for: collectionView))
|
||||
}
|
||||
|
||||
open override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||
return configureCell(self, collectionView, indexPath, self[indexPath])
|
||||
}
|
||||
}
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 2.6 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 572 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 688 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.8 MiB |
Reference in New Issue
Block a user