├── CGParllaxCollectionViewPoject ├── CGParllaxCollectionView-Final.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── CGParllaxCollectionView-Final.xccheckout │ │ └── xcuserdata │ │ │ └── Kneeraj.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── Kneeraj.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── CGParllaxCollectionView-Final.xcscheme │ │ └── xcschememanagement.plist ├── CGParllaxCollectionView-Final │ ├── AppDelegate.swift │ ├── Base.lproj │ │ └── Main.storyboard │ ├── Cells │ │ └── CGParallaxCollectionViewCell.swift │ ├── CollectionViewLayout │ │ └── CGParallaxFlowLayout.swift │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── LaunchImage.launchimage │ │ │ └── Contents.json │ ├── Info.plist │ ├── LayoutAttributes │ │ └── CGParallaxLayoutAttributes.swift │ ├── Photos │ │ ├── 01-mallorca.jpg │ │ ├── 02-fishing.jpg │ │ ├── 03-chili.jpg │ │ ├── 04-rice.jpg │ │ ├── 05-sweden.jpg │ │ ├── 06-magicforest.jpg │ │ ├── 07-bird.jpg │ │ ├── 08-iguana.jpg │ │ ├── 09-valley.jpg │ │ ├── 10-parrots.jpg │ │ └── Photos.plist │ └── ViewController.swift └── CGParllaxCollectionView-FinalTests │ ├── CGParllaxCollectionView_FinalTests.swift │ └── Info.plist ├── LICENSE ├── ParallaxScrollingViewGif.gif └── README.md /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | EA162163193F880400460C7E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA162162193F880400460C7E /* AppDelegate.swift */; }; 11 | EA162165193F880400460C7E /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA162164193F880400460C7E /* ViewController.swift */; }; 12 | EA162168193F880500460C7E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EA162166193F880500460C7E /* Main.storyboard */; }; 13 | EA16216A193F880500460C7E /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EA162169193F880500460C7E /* Images.xcassets */; }; 14 | EA162176193F880500460C7E /* CGParllaxCollectionView_FinalTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA162175193F880500460C7E /* CGParllaxCollectionView_FinalTests.swift */; }; 15 | EAA5F092193F89530018C932 /* 01-mallorca.jpg in Resources */ = {isa = PBXBuildFile; fileRef = EAA5F076193F89530018C932 /* 01-mallorca.jpg */; }; 16 | EAA5F093193F89530018C932 /* 02-fishing.jpg in Resources */ = {isa = PBXBuildFile; fileRef = EAA5F077193F89530018C932 /* 02-fishing.jpg */; }; 17 | EAA5F094193F89530018C932 /* 03-chili.jpg in Resources */ = {isa = PBXBuildFile; fileRef = EAA5F078193F89530018C932 /* 03-chili.jpg */; }; 18 | EAA5F095193F89530018C932 /* 04-rice.jpg in Resources */ = {isa = PBXBuildFile; fileRef = EAA5F079193F89530018C932 /* 04-rice.jpg */; }; 19 | EAA5F096193F89530018C932 /* 05-sweden.jpg in Resources */ = {isa = PBXBuildFile; fileRef = EAA5F07A193F89530018C932 /* 05-sweden.jpg */; }; 20 | EAA5F097193F89530018C932 /* 06-magicforest.jpg in Resources */ = {isa = PBXBuildFile; fileRef = EAA5F07B193F89530018C932 /* 06-magicforest.jpg */; }; 21 | EAA5F098193F89530018C932 /* 07-bird.jpg in Resources */ = {isa = PBXBuildFile; fileRef = EAA5F07C193F89530018C932 /* 07-bird.jpg */; }; 22 | EAA5F099193F89530018C932 /* 08-iguana.jpg in Resources */ = {isa = PBXBuildFile; fileRef = EAA5F07D193F89530018C932 /* 08-iguana.jpg */; }; 23 | EAA5F09A193F89530018C932 /* 09-valley.jpg in Resources */ = {isa = PBXBuildFile; fileRef = EAA5F07E193F89530018C932 /* 09-valley.jpg */; }; 24 | EAA5F09B193F89530018C932 /* 10-parrots.jpg in Resources */ = {isa = PBXBuildFile; fileRef = EAA5F07F193F89530018C932 /* 10-parrots.jpg */; }; 25 | EAA5F0AD193F89530018C932 /* Photos.plist in Resources */ = {isa = PBXBuildFile; fileRef = EAA5F091193F89530018C932 /* Photos.plist */; }; 26 | EAA5F0AF193F89760018C932 /* CGParallaxLayoutAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAA5F0AE193F89760018C932 /* CGParallaxLayoutAttributes.swift */; }; 27 | EAA5F0B1193F89B50018C932 /* CGParallaxCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAA5F0B0193F89B50018C932 /* CGParallaxCollectionViewCell.swift */; }; 28 | EAA5F0B3193F8A350018C932 /* CGParallaxFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAA5F0B2193F8A350018C932 /* CGParallaxFlowLayout.swift */; }; 29 | /* End PBXBuildFile section */ 30 | 31 | /* Begin PBXContainerItemProxy section */ 32 | EA162170193F880500460C7E /* PBXContainerItemProxy */ = { 33 | isa = PBXContainerItemProxy; 34 | containerPortal = EA162155193F880400460C7E /* Project object */; 35 | proxyType = 1; 36 | remoteGlobalIDString = EA16215C193F880400460C7E; 37 | remoteInfo = "CGParllaxCollectionView-Final"; 38 | }; 39 | /* End PBXContainerItemProxy section */ 40 | 41 | /* Begin PBXFileReference section */ 42 | EA16215D193F880400460C7E /* CGParllaxCollectionView-Final.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "CGParllaxCollectionView-Final.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | EA162161193F880400460C7E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 44 | EA162162193F880400460C7E /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 45 | EA162164193F880400460C7E /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 46 | EA162167193F880500460C7E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 47 | EA162169193F880500460C7E /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 48 | EA16216F193F880500460C7E /* CGParllaxCollectionView-FinalTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "CGParllaxCollectionView-FinalTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | EA162174193F880500460C7E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | EA162175193F880500460C7E /* CGParllaxCollectionView_FinalTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CGParllaxCollectionView_FinalTests.swift; sourceTree = ""; }; 51 | EAA5F076193F89530018C932 /* 01-mallorca.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "01-mallorca.jpg"; sourceTree = ""; }; 52 | EAA5F077193F89530018C932 /* 02-fishing.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "02-fishing.jpg"; sourceTree = ""; }; 53 | EAA5F078193F89530018C932 /* 03-chili.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "03-chili.jpg"; sourceTree = ""; }; 54 | EAA5F079193F89530018C932 /* 04-rice.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "04-rice.jpg"; sourceTree = ""; }; 55 | EAA5F07A193F89530018C932 /* 05-sweden.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "05-sweden.jpg"; sourceTree = ""; }; 56 | EAA5F07B193F89530018C932 /* 06-magicforest.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "06-magicforest.jpg"; sourceTree = ""; }; 57 | EAA5F07C193F89530018C932 /* 07-bird.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "07-bird.jpg"; sourceTree = ""; }; 58 | EAA5F07D193F89530018C932 /* 08-iguana.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "08-iguana.jpg"; sourceTree = ""; }; 59 | EAA5F07E193F89530018C932 /* 09-valley.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "09-valley.jpg"; sourceTree = ""; }; 60 | EAA5F07F193F89530018C932 /* 10-parrots.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "10-parrots.jpg"; sourceTree = ""; }; 61 | EAA5F091193F89530018C932 /* Photos.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Photos.plist; sourceTree = ""; }; 62 | EAA5F0AE193F89760018C932 /* CGParallaxLayoutAttributes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGParallaxLayoutAttributes.swift; sourceTree = ""; }; 63 | EAA5F0B0193F89B50018C932 /* CGParallaxCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGParallaxCollectionViewCell.swift; sourceTree = ""; }; 64 | EAA5F0B2193F8A350018C932 /* CGParallaxFlowLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGParallaxFlowLayout.swift; sourceTree = ""; }; 65 | /* End PBXFileReference section */ 66 | 67 | /* Begin PBXFrameworksBuildPhase section */ 68 | EA16215A193F880400460C7E /* Frameworks */ = { 69 | isa = PBXFrameworksBuildPhase; 70 | buildActionMask = 2147483647; 71 | files = ( 72 | ); 73 | runOnlyForDeploymentPostprocessing = 0; 74 | }; 75 | EA16216C193F880500460C7E /* Frameworks */ = { 76 | isa = PBXFrameworksBuildPhase; 77 | buildActionMask = 2147483647; 78 | files = ( 79 | ); 80 | runOnlyForDeploymentPostprocessing = 0; 81 | }; 82 | /* End PBXFrameworksBuildPhase section */ 83 | 84 | /* Begin PBXGroup section */ 85 | EA162154193F880400460C7E = { 86 | isa = PBXGroup; 87 | children = ( 88 | EA16215F193F880400460C7E /* CGParllaxCollectionView-Final */, 89 | EA162172193F880500460C7E /* CGParllaxCollectionView-FinalTests */, 90 | EA16215E193F880400460C7E /* Products */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | EA16215E193F880400460C7E /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | EA16215D193F880400460C7E /* CGParllaxCollectionView-Final.app */, 98 | EA16216F193F880500460C7E /* CGParllaxCollectionView-FinalTests.xctest */, 99 | ); 100 | name = Products; 101 | sourceTree = ""; 102 | }; 103 | EA16215F193F880400460C7E /* CGParllaxCollectionView-Final */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | EAA5F075193F89530018C932 /* Photos */, 107 | EAA5F072193F891E0018C932 /* Cells */, 108 | EAA5F073193F891E0018C932 /* CollectionViewLayout */, 109 | EAA5F074193F891E0018C932 /* LayoutAttributes */, 110 | EA162162193F880400460C7E /* AppDelegate.swift */, 111 | EA162164193F880400460C7E /* ViewController.swift */, 112 | EA162166193F880500460C7E /* Main.storyboard */, 113 | EA162169193F880500460C7E /* Images.xcassets */, 114 | EA162160193F880400460C7E /* Supporting Files */, 115 | ); 116 | path = "CGParllaxCollectionView-Final"; 117 | sourceTree = ""; 118 | }; 119 | EA162160193F880400460C7E /* Supporting Files */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | EA162161193F880400460C7E /* Info.plist */, 123 | ); 124 | name = "Supporting Files"; 125 | sourceTree = ""; 126 | }; 127 | EA162172193F880500460C7E /* CGParllaxCollectionView-FinalTests */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | EA162175193F880500460C7E /* CGParllaxCollectionView_FinalTests.swift */, 131 | EA162173193F880500460C7E /* Supporting Files */, 132 | ); 133 | path = "CGParllaxCollectionView-FinalTests"; 134 | sourceTree = ""; 135 | }; 136 | EA162173193F880500460C7E /* Supporting Files */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | EA162174193F880500460C7E /* Info.plist */, 140 | ); 141 | name = "Supporting Files"; 142 | sourceTree = ""; 143 | }; 144 | EAA5F072193F891E0018C932 /* Cells */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | EAA5F0B0193F89B50018C932 /* CGParallaxCollectionViewCell.swift */, 148 | ); 149 | path = Cells; 150 | sourceTree = ""; 151 | }; 152 | EAA5F073193F891E0018C932 /* CollectionViewLayout */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | EAA5F0B2193F8A350018C932 /* CGParallaxFlowLayout.swift */, 156 | ); 157 | path = CollectionViewLayout; 158 | sourceTree = ""; 159 | }; 160 | EAA5F074193F891E0018C932 /* LayoutAttributes */ = { 161 | isa = PBXGroup; 162 | children = ( 163 | EAA5F0AE193F89760018C932 /* CGParallaxLayoutAttributes.swift */, 164 | ); 165 | path = LayoutAttributes; 166 | sourceTree = ""; 167 | }; 168 | EAA5F075193F89530018C932 /* Photos */ = { 169 | isa = PBXGroup; 170 | children = ( 171 | EAA5F076193F89530018C932 /* 01-mallorca.jpg */, 172 | EAA5F077193F89530018C932 /* 02-fishing.jpg */, 173 | EAA5F078193F89530018C932 /* 03-chili.jpg */, 174 | EAA5F079193F89530018C932 /* 04-rice.jpg */, 175 | EAA5F07A193F89530018C932 /* 05-sweden.jpg */, 176 | EAA5F07B193F89530018C932 /* 06-magicforest.jpg */, 177 | EAA5F07C193F89530018C932 /* 07-bird.jpg */, 178 | EAA5F07D193F89530018C932 /* 08-iguana.jpg */, 179 | EAA5F07E193F89530018C932 /* 09-valley.jpg */, 180 | EAA5F07F193F89530018C932 /* 10-parrots.jpg */, 181 | EAA5F091193F89530018C932 /* Photos.plist */, 182 | ); 183 | path = Photos; 184 | sourceTree = ""; 185 | }; 186 | /* End PBXGroup section */ 187 | 188 | /* Begin PBXNativeTarget section */ 189 | EA16215C193F880400460C7E /* CGParllaxCollectionView-Final */ = { 190 | isa = PBXNativeTarget; 191 | buildConfigurationList = EA162179193F880500460C7E /* Build configuration list for PBXNativeTarget "CGParllaxCollectionView-Final" */; 192 | buildPhases = ( 193 | EA162159193F880400460C7E /* Sources */, 194 | EA16215A193F880400460C7E /* Frameworks */, 195 | EA16215B193F880400460C7E /* Resources */, 196 | ); 197 | buildRules = ( 198 | ); 199 | dependencies = ( 200 | ); 201 | name = "CGParllaxCollectionView-Final"; 202 | productName = "CGParllaxCollectionView-Final"; 203 | productReference = EA16215D193F880400460C7E /* CGParllaxCollectionView-Final.app */; 204 | productType = "com.apple.product-type.application"; 205 | }; 206 | EA16216E193F880500460C7E /* CGParllaxCollectionView-FinalTests */ = { 207 | isa = PBXNativeTarget; 208 | buildConfigurationList = EA16217C193F880500460C7E /* Build configuration list for PBXNativeTarget "CGParllaxCollectionView-FinalTests" */; 209 | buildPhases = ( 210 | EA16216B193F880500460C7E /* Sources */, 211 | EA16216C193F880500460C7E /* Frameworks */, 212 | EA16216D193F880500460C7E /* Resources */, 213 | ); 214 | buildRules = ( 215 | ); 216 | dependencies = ( 217 | EA162171193F880500460C7E /* PBXTargetDependency */, 218 | ); 219 | name = "CGParllaxCollectionView-FinalTests"; 220 | productName = "CGParllaxCollectionView-FinalTests"; 221 | productReference = EA16216F193F880500460C7E /* CGParllaxCollectionView-FinalTests.xctest */; 222 | productType = "com.apple.product-type.bundle.unit-test"; 223 | }; 224 | /* End PBXNativeTarget section */ 225 | 226 | /* Begin PBXProject section */ 227 | EA162155193F880400460C7E /* Project object */ = { 228 | isa = PBXProject; 229 | attributes = { 230 | LastUpgradeCheck = 0600; 231 | ORGANIZATIONNAME = CocoaGarage; 232 | TargetAttributes = { 233 | EA16215C193F880400460C7E = { 234 | CreatedOnToolsVersion = 6.0; 235 | }; 236 | EA16216E193F880500460C7E = { 237 | CreatedOnToolsVersion = 6.0; 238 | TestTargetID = EA16215C193F880400460C7E; 239 | }; 240 | }; 241 | }; 242 | buildConfigurationList = EA162158193F880400460C7E /* Build configuration list for PBXProject "CGParllaxCollectionView-Final" */; 243 | compatibilityVersion = "Xcode 3.2"; 244 | developmentRegion = English; 245 | hasScannedForEncodings = 0; 246 | knownRegions = ( 247 | en, 248 | Base, 249 | ); 250 | mainGroup = EA162154193F880400460C7E; 251 | productRefGroup = EA16215E193F880400460C7E /* Products */; 252 | projectDirPath = ""; 253 | projectRoot = ""; 254 | targets = ( 255 | EA16215C193F880400460C7E /* CGParllaxCollectionView-Final */, 256 | EA16216E193F880500460C7E /* CGParllaxCollectionView-FinalTests */, 257 | ); 258 | }; 259 | /* End PBXProject section */ 260 | 261 | /* Begin PBXResourcesBuildPhase section */ 262 | EA16215B193F880400460C7E /* Resources */ = { 263 | isa = PBXResourcesBuildPhase; 264 | buildActionMask = 2147483647; 265 | files = ( 266 | EAA5F09A193F89530018C932 /* 09-valley.jpg in Resources */, 267 | EAA5F099193F89530018C932 /* 08-iguana.jpg in Resources */, 268 | EAA5F097193F89530018C932 /* 06-magicforest.jpg in Resources */, 269 | EAA5F098193F89530018C932 /* 07-bird.jpg in Resources */, 270 | EAA5F095193F89530018C932 /* 04-rice.jpg in Resources */, 271 | EAA5F093193F89530018C932 /* 02-fishing.jpg in Resources */, 272 | EAA5F09B193F89530018C932 /* 10-parrots.jpg in Resources */, 273 | EAA5F096193F89530018C932 /* 05-sweden.jpg in Resources */, 274 | EA162168193F880500460C7E /* Main.storyboard in Resources */, 275 | EA16216A193F880500460C7E /* Images.xcassets in Resources */, 276 | EAA5F092193F89530018C932 /* 01-mallorca.jpg in Resources */, 277 | EAA5F094193F89530018C932 /* 03-chili.jpg in Resources */, 278 | EAA5F0AD193F89530018C932 /* Photos.plist in Resources */, 279 | ); 280 | runOnlyForDeploymentPostprocessing = 0; 281 | }; 282 | EA16216D193F880500460C7E /* Resources */ = { 283 | isa = PBXResourcesBuildPhase; 284 | buildActionMask = 2147483647; 285 | files = ( 286 | ); 287 | runOnlyForDeploymentPostprocessing = 0; 288 | }; 289 | /* End PBXResourcesBuildPhase section */ 290 | 291 | /* Begin PBXSourcesBuildPhase section */ 292 | EA162159193F880400460C7E /* Sources */ = { 293 | isa = PBXSourcesBuildPhase; 294 | buildActionMask = 2147483647; 295 | files = ( 296 | EA162165193F880400460C7E /* ViewController.swift in Sources */, 297 | EA162163193F880400460C7E /* AppDelegate.swift in Sources */, 298 | EAA5F0B3193F8A350018C932 /* CGParallaxFlowLayout.swift in Sources */, 299 | EAA5F0AF193F89760018C932 /* CGParallaxLayoutAttributes.swift in Sources */, 300 | EAA5F0B1193F89B50018C932 /* CGParallaxCollectionViewCell.swift in Sources */, 301 | ); 302 | runOnlyForDeploymentPostprocessing = 0; 303 | }; 304 | EA16216B193F880500460C7E /* Sources */ = { 305 | isa = PBXSourcesBuildPhase; 306 | buildActionMask = 2147483647; 307 | files = ( 308 | EA162176193F880500460C7E /* CGParllaxCollectionView_FinalTests.swift in Sources */, 309 | ); 310 | runOnlyForDeploymentPostprocessing = 0; 311 | }; 312 | /* End PBXSourcesBuildPhase section */ 313 | 314 | /* Begin PBXTargetDependency section */ 315 | EA162171193F880500460C7E /* PBXTargetDependency */ = { 316 | isa = PBXTargetDependency; 317 | target = EA16215C193F880400460C7E /* CGParllaxCollectionView-Final */; 318 | targetProxy = EA162170193F880500460C7E /* PBXContainerItemProxy */; 319 | }; 320 | /* End PBXTargetDependency section */ 321 | 322 | /* Begin PBXVariantGroup section */ 323 | EA162166193F880500460C7E /* Main.storyboard */ = { 324 | isa = PBXVariantGroup; 325 | children = ( 326 | EA162167193F880500460C7E /* Base */, 327 | ); 328 | name = Main.storyboard; 329 | sourceTree = ""; 330 | }; 331 | /* End PBXVariantGroup section */ 332 | 333 | /* Begin XCBuildConfiguration section */ 334 | EA162177193F880500460C7E /* Debug */ = { 335 | isa = XCBuildConfiguration; 336 | buildSettings = { 337 | ALWAYS_SEARCH_USER_PATHS = NO; 338 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 339 | CLANG_CXX_LIBRARY = "libc++"; 340 | CLANG_ENABLE_MODULES = YES; 341 | CLANG_ENABLE_OBJC_ARC = YES; 342 | CLANG_WARN_BOOL_CONVERSION = YES; 343 | CLANG_WARN_CONSTANT_CONVERSION = YES; 344 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 345 | CLANG_WARN_EMPTY_BODY = YES; 346 | CLANG_WARN_ENUM_CONVERSION = YES; 347 | CLANG_WARN_INT_CONVERSION = YES; 348 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 349 | CLANG_WARN_UNREACHABLE_CODE = YES; 350 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 351 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 352 | COPY_PHASE_STRIP = NO; 353 | ENABLE_STRICT_OBJC_MSGSEND = YES; 354 | GCC_C_LANGUAGE_STANDARD = gnu99; 355 | GCC_DYNAMIC_NO_PIC = NO; 356 | GCC_OPTIMIZATION_LEVEL = 0; 357 | GCC_PREPROCESSOR_DEFINITIONS = ( 358 | "DEBUG=1", 359 | "$(inherited)", 360 | ); 361 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 362 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 363 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 364 | GCC_WARN_UNDECLARED_SELECTOR = YES; 365 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 366 | GCC_WARN_UNUSED_FUNCTION = YES; 367 | GCC_WARN_UNUSED_VARIABLE = YES; 368 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 369 | METAL_ENABLE_DEBUG_INFO = YES; 370 | ONLY_ACTIVE_ARCH = YES; 371 | SDKROOT = iphoneos; 372 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 373 | }; 374 | name = Debug; 375 | }; 376 | EA162178193F880500460C7E /* Release */ = { 377 | isa = XCBuildConfiguration; 378 | buildSettings = { 379 | ALWAYS_SEARCH_USER_PATHS = NO; 380 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 381 | CLANG_CXX_LIBRARY = "libc++"; 382 | CLANG_ENABLE_MODULES = YES; 383 | CLANG_ENABLE_OBJC_ARC = YES; 384 | CLANG_WARN_BOOL_CONVERSION = YES; 385 | CLANG_WARN_CONSTANT_CONVERSION = YES; 386 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 387 | CLANG_WARN_EMPTY_BODY = YES; 388 | CLANG_WARN_ENUM_CONVERSION = YES; 389 | CLANG_WARN_INT_CONVERSION = YES; 390 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 391 | CLANG_WARN_UNREACHABLE_CODE = YES; 392 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 393 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 394 | COPY_PHASE_STRIP = YES; 395 | ENABLE_NS_ASSERTIONS = NO; 396 | ENABLE_STRICT_OBJC_MSGSEND = YES; 397 | GCC_C_LANGUAGE_STANDARD = gnu99; 398 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 399 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 400 | GCC_WARN_UNDECLARED_SELECTOR = YES; 401 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 402 | GCC_WARN_UNUSED_FUNCTION = YES; 403 | GCC_WARN_UNUSED_VARIABLE = YES; 404 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 405 | METAL_ENABLE_DEBUG_INFO = NO; 406 | SDKROOT = iphoneos; 407 | VALIDATE_PRODUCT = YES; 408 | }; 409 | name = Release; 410 | }; 411 | EA16217A193F880500460C7E /* Debug */ = { 412 | isa = XCBuildConfiguration; 413 | buildSettings = { 414 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 415 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 416 | INFOPLIST_FILE = "CGParllaxCollectionView-Final/Info.plist"; 417 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 418 | PRODUCT_NAME = "$(TARGET_NAME)"; 419 | }; 420 | name = Debug; 421 | }; 422 | EA16217B193F880500460C7E /* Release */ = { 423 | isa = XCBuildConfiguration; 424 | buildSettings = { 425 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 426 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 427 | INFOPLIST_FILE = "CGParllaxCollectionView-Final/Info.plist"; 428 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 429 | PRODUCT_NAME = "$(TARGET_NAME)"; 430 | }; 431 | name = Release; 432 | }; 433 | EA16217D193F880500460C7E /* Debug */ = { 434 | isa = XCBuildConfiguration; 435 | buildSettings = { 436 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CGParllaxCollectionView-Final.app/CGParllaxCollectionView-Final"; 437 | FRAMEWORK_SEARCH_PATHS = ( 438 | "$(SDKROOT)/Developer/Library/Frameworks", 439 | "$(inherited)", 440 | ); 441 | GCC_PREPROCESSOR_DEFINITIONS = ( 442 | "DEBUG=1", 443 | "$(inherited)", 444 | ); 445 | INFOPLIST_FILE = "CGParllaxCollectionView-FinalTests/Info.plist"; 446 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 447 | METAL_ENABLE_DEBUG_INFO = YES; 448 | PRODUCT_NAME = "$(TARGET_NAME)"; 449 | TEST_HOST = "$(BUNDLE_LOADER)"; 450 | }; 451 | name = Debug; 452 | }; 453 | EA16217E193F880500460C7E /* Release */ = { 454 | isa = XCBuildConfiguration; 455 | buildSettings = { 456 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CGParllaxCollectionView-Final.app/CGParllaxCollectionView-Final"; 457 | FRAMEWORK_SEARCH_PATHS = ( 458 | "$(SDKROOT)/Developer/Library/Frameworks", 459 | "$(inherited)", 460 | ); 461 | INFOPLIST_FILE = "CGParllaxCollectionView-FinalTests/Info.plist"; 462 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 463 | METAL_ENABLE_DEBUG_INFO = NO; 464 | PRODUCT_NAME = "$(TARGET_NAME)"; 465 | TEST_HOST = "$(BUNDLE_LOADER)"; 466 | }; 467 | name = Release; 468 | }; 469 | /* End XCBuildConfiguration section */ 470 | 471 | /* Begin XCConfigurationList section */ 472 | EA162158193F880400460C7E /* Build configuration list for PBXProject "CGParllaxCollectionView-Final" */ = { 473 | isa = XCConfigurationList; 474 | buildConfigurations = ( 475 | EA162177193F880500460C7E /* Debug */, 476 | EA162178193F880500460C7E /* Release */, 477 | ); 478 | defaultConfigurationIsVisible = 0; 479 | defaultConfigurationName = Release; 480 | }; 481 | EA162179193F880500460C7E /* Build configuration list for PBXNativeTarget "CGParllaxCollectionView-Final" */ = { 482 | isa = XCConfigurationList; 483 | buildConfigurations = ( 484 | EA16217A193F880500460C7E /* Debug */, 485 | EA16217B193F880500460C7E /* Release */, 486 | ); 487 | defaultConfigurationIsVisible = 0; 488 | defaultConfigurationName = Release; 489 | }; 490 | EA16217C193F880500460C7E /* Build configuration list for PBXNativeTarget "CGParllaxCollectionView-FinalTests" */ = { 491 | isa = XCConfigurationList; 492 | buildConfigurations = ( 493 | EA16217D193F880500460C7E /* Debug */, 494 | EA16217E193F880500460C7E /* Release */, 495 | ); 496 | defaultConfigurationIsVisible = 0; 497 | defaultConfigurationName = Release; 498 | }; 499 | /* End XCConfigurationList section */ 500 | }; 501 | rootObject = EA162155193F880400460C7E /* Project object */; 502 | } 503 | -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final.xcodeproj/project.xcworkspace/xcshareddata/CGParllaxCollectionView-Final.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | D2B5239A-ED68-4514-91D2-819FD78AE0E3 9 | IDESourceControlProjectName 10 | CGParllaxCollectionView-Final 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 6E94C11C1352F92E580C196378C7C771C9E17CE1 14 | https://github.com/kNeerajPro/CGParallaxCollectionView.git 15 | 16 | IDESourceControlProjectPath 17 | CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 6E94C11C1352F92E580C196378C7C771C9E17CE1 21 | ../../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/kNeerajPro/CGParallaxCollectionView.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 6E94C11C1352F92E580C196378C7C771C9E17CE1 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 6E94C11C1352F92E580C196378C7C771C9E17CE1 36 | IDESourceControlWCCName 37 | CGParallaxCollectionView 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final.xcodeproj/project.xcworkspace/xcuserdata/Kneeraj.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kn-neeraj/CGParallaxCollectionView/435b47f4896f61c8845be435f6ef05e1c8814481/CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final.xcodeproj/project.xcworkspace/xcuserdata/Kneeraj.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final.xcodeproj/xcuserdata/Kneeraj.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final.xcodeproj/xcuserdata/Kneeraj.xcuserdatad/xcschemes/CGParllaxCollectionView-Final.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final.xcodeproj/xcuserdata/Kneeraj.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CGParllaxCollectionView-Final.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | EA16215C193F880400460C7E 16 | 17 | primary 18 | 19 | 20 | EA16216E193F880500460C7E 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // CGParllaxCollectionView-Final 4 | // 5 | // Created by CocoaGarage on 04/06/14. 6 | // Copyright (c) 2014 CocoaGarage. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Cells/CGParallaxCollectionViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CGParallaxCollectionViewCell.swift 3 | // CGParllaxCollectionView-Final 4 | // 5 | // Created by CocoaGarage on 04/06/14. 6 | // Copyright (c) 2014 CocoaGarage. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | class CGParallaxCollectionViewCell : UICollectionViewCell { 13 | var imageView: UIImageView = UIImageView(frame: CGRectZero) 14 | var maxParallaxOffset: CGFloat = 30.0 15 | var imageViewHeightConstraint:NSLayoutConstraint = NSLayoutConstraint() 16 | var imageViewCenterYConstraint:NSLayoutConstraint = NSLayoutConstraint() 17 | 18 | override init(frame: CGRect) { 19 | super.init(frame: frame) 20 | self.clipsToBounds = true 21 | self.setupImageView() 22 | self.setupConstraints() 23 | self.setNeedsUpdateConstraints() 24 | } 25 | 26 | required init(coder aDecoder: NSCoder) { 27 | super.init(coder: aDecoder) 28 | } 29 | 30 | override func layoutSubviews() { 31 | self.imageView.frame = self.bounds 32 | } 33 | 34 | func setupImageView() { 35 | self.imageView.contentMode = UIViewContentMode.ScaleAspectFill 36 | self.imageView.image = nil 37 | self.contentView.addSubview(self.imageView) 38 | } 39 | 40 | func setupConstraints() { 41 | self.imageView.setTranslatesAutoresizingMaskIntoConstraints(false) 42 | 43 | var horzLayoutLeftConstraint: NSLayoutConstraint = NSLayoutConstraint(item: self.imageView, attribute: NSLayoutAttribute.Left, relatedBy: NSLayoutRelation.Equal, toItem: self.contentView, attribute: NSLayoutAttribute.Left, multiplier: 1, constant: 0) 44 | 45 | var horzLayoutRightConstraint: NSLayoutConstraint = NSLayoutConstraint(item: self.imageView, attribute: NSLayoutAttribute.Right, relatedBy: NSLayoutRelation.Equal, toItem: self.contentView, attribute: NSLayoutAttribute.Right, multiplier: 1, constant: 0) 46 | 47 | // Horizontal constraints 48 | self.contentView.addConstraint(horzLayoutLeftConstraint) 49 | self.contentView.addConstraint(horzLayoutRightConstraint) 50 | 51 | 52 | 53 | // Vertical constraints 54 | self.imageViewHeightConstraint = NSLayoutConstraint(item: self.imageView, attribute: NSLayoutAttribute.Height, relatedBy: NSLayoutRelation.Equal, toItem: self.contentView, attribute: NSLayoutAttribute.Height, multiplier: 1, constant: 0) 55 | self.imageViewCenterYConstraint = NSLayoutConstraint(item: self.imageView, attribute: NSLayoutAttribute.CenterY, relatedBy: NSLayoutRelation.Equal, toItem: self.contentView, attribute: NSLayoutAttribute.CenterY, multiplier: 1, constant: 0) 56 | 57 | self.contentView.addConstraint(self.imageViewHeightConstraint) 58 | self.contentView.addConstraint(self.imageViewCenterYConstraint) 59 | } 60 | 61 | override func updateConstraints() { 62 | super.updateConstraints() 63 | self.imageViewHeightConstraint.constant = 2 * self.maxParallaxOffset 64 | } 65 | 66 | override func applyLayoutAttributes(layoutAttributes: UICollectionViewLayoutAttributes!) { 67 | super.applyLayoutAttributes(layoutAttributes) 68 | if layoutAttributes == nil { 69 | return 70 | } 71 | if (!layoutAttributes.isKindOfClass(CGParallaxLayoutAttributes.self)) { 72 | return 73 | } 74 | var layoutAttr : CGParallaxLayoutAttributes = layoutAttributes as CGParallaxLayoutAttributes 75 | self.imageViewCenterYConstraint.constant = layoutAttr.parallaxOffset.y 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/CollectionViewLayout/CGParallaxFlowLayout.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CGParallaxFlowLayout.swift 3 | // CGParllaxCollectionView-Final 4 | // 5 | // Created by CocoaGarage on 04/06/14. 6 | // Copyright (c) 2014 CocoaGarage. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | class CGParallaxFlowLayout: UICollectionViewFlowLayout { 13 | 14 | let maxParallaxOffset : CGFloat = 30.0 // A constant 15 | 16 | // Overriden Methods 17 | override class func layoutAttributesClass() -> AnyClass { 18 | return CGParallaxLayoutAttributes.self 19 | } 20 | 21 | override func shouldInvalidateLayoutForBoundsChange(newBounds: CGRect) -> Bool { 22 | return true 23 | } 24 | 25 | override func layoutAttributesForElementsInRect(rect: CGRect) -> [AnyObject]? { 26 | var layoutAttrArr : Array = super.layoutAttributesForElementsInRect(rect)! 27 | for layoutAttr : AnyObject in layoutAttrArr { 28 | if layoutAttr.isKindOfClass(CGParallaxLayoutAttributes.self) { 29 | var paralaxLayoutAttr: CGParallaxLayoutAttributes = layoutAttr as CGParallaxLayoutAttributes 30 | if paralaxLayoutAttr.representedElementCategory == UICollectionElementCategory.Cell { 31 | paralaxLayoutAttr.parallaxOffset = self.parallaxOffsetForLayoutAttribtues(paralaxLayoutAttr) 32 | } 33 | } 34 | } 35 | return layoutAttrArr 36 | } 37 | 38 | override func layoutAttributesForItemAtIndexPath(indexPath: NSIndexPath) -> UICollectionViewLayoutAttributes! { 39 | var layoutAttributes : CGParallaxLayoutAttributes = super.layoutAttributesForItemAtIndexPath(indexPath) as CGParallaxLayoutAttributes 40 | 41 | layoutAttributes.parallaxOffset = self.parallaxOffsetForLayoutAttribtues(layoutAttributes) 42 | return layoutAttributes 43 | } 44 | 45 | func parallaxOffsetForLayoutAttribtues(layoutAttributes: CGParallaxLayoutAttributes) -> CGPoint { 46 | 47 | if (!layoutAttributes.isKindOfClass(CGParallaxLayoutAttributes.self)) { 48 | return CGPointZero 49 | } 50 | 51 | var bounds: CGRect? = self.collectionView?.bounds 52 | if let uwBounds = bounds { 53 | var boundsCenter : CGPoint = CGPointMake(CGRectGetMidX(uwBounds), CGRectGetMidY(uwBounds)) 54 | var cellCenter : CGPoint = layoutAttributes.center 55 | var offsetFromCenter : CGPoint = CGPointMake(boundsCenter.x - cellCenter.x, boundsCenter.y - cellCenter.y) 56 | var cellSize: CGSize = layoutAttributes.size 57 | 58 | var maxVerticalOffsetVisible: CGFloat = uwBounds.size.height/2 + cellSize.height/2 59 | var scaleFactor: CGFloat = self.maxParallaxOffset / maxVerticalOffsetVisible 60 | var parallaxOffset: CGPoint = CGPointMake(0.0, offsetFromCenter.y * scaleFactor) 61 | return parallaxOffset 62 | } 63 | else { 64 | return CGPointZero 65 | } 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cg.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/LayoutAttributes/CGParallaxLayoutAttributes.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CGParallaxLayoutAttributes.swift 3 | // CGParllaxCollectionView-Final 4 | // 5 | // Created by CocoaGarage on 04/06/14. 6 | // Copyright (c) 2014 CocoaGarage. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | class CGParallaxLayoutAttributes : UICollectionViewLayoutAttributes { 13 | var parallaxOffset : CGPoint 14 | override init() { 15 | self.parallaxOffset = CGPointZero 16 | super.init() 17 | } 18 | 19 | override func copyWithZone(zone: NSZone) -> AnyObject { 20 | var copy: CGParallaxLayoutAttributes = super.copyWithZone(zone) as CGParallaxLayoutAttributes 21 | copy.parallaxOffset = self.parallaxOffset 22 | return copy 23 | } 24 | 25 | override func isEqual(object: AnyObject!) -> Bool { 26 | 27 | if (!object.isKindOfClass(CGParallaxLayoutAttributes.self)) { 28 | return false 29 | } 30 | var otherObject: CGParallaxLayoutAttributes = object as CGParallaxLayoutAttributes 31 | 32 | if !CGPointEqualToPoint(otherObject.parallaxOffset, self.parallaxOffset) { 33 | return false 34 | } 35 | return super.isEqual(otherObject) 36 | } 37 | 38 | 39 | } 40 | 41 | -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Photos/01-mallorca.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kn-neeraj/CGParallaxCollectionView/435b47f4896f61c8845be435f6ef05e1c8814481/CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Photos/01-mallorca.jpg -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Photos/02-fishing.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kn-neeraj/CGParallaxCollectionView/435b47f4896f61c8845be435f6ef05e1c8814481/CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Photos/02-fishing.jpg -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Photos/03-chili.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kn-neeraj/CGParallaxCollectionView/435b47f4896f61c8845be435f6ef05e1c8814481/CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Photos/03-chili.jpg -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Photos/04-rice.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kn-neeraj/CGParallaxCollectionView/435b47f4896f61c8845be435f6ef05e1c8814481/CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Photos/04-rice.jpg -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Photos/05-sweden.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kn-neeraj/CGParallaxCollectionView/435b47f4896f61c8845be435f6ef05e1c8814481/CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Photos/05-sweden.jpg -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Photos/06-magicforest.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kn-neeraj/CGParallaxCollectionView/435b47f4896f61c8845be435f6ef05e1c8814481/CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Photos/06-magicforest.jpg -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Photos/07-bird.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kn-neeraj/CGParallaxCollectionView/435b47f4896f61c8845be435f6ef05e1c8814481/CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Photos/07-bird.jpg -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Photos/08-iguana.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kn-neeraj/CGParallaxCollectionView/435b47f4896f61c8845be435f6ef05e1c8814481/CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Photos/08-iguana.jpg -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Photos/09-valley.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kn-neeraj/CGParallaxCollectionView/435b47f4896f61c8845be435f6ef05e1c8814481/CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Photos/09-valley.jpg -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Photos/10-parrots.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kn-neeraj/CGParallaxCollectionView/435b47f4896f61c8845be435f6ef05e1c8814481/CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Photos/10-parrots.jpg -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/Photos/Photos.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | photos 6 | 7 | 8 | filename 9 | 01-mallorca.jpg 10 | height 11 | 480 12 | width 13 | 640 14 | 15 | 16 | filename 17 | 02-fishing.jpg 18 | height 19 | 480 20 | width 21 | 640 22 | 23 | 24 | filename 25 | 03-chili.jpg 26 | height 27 | 480 28 | width 29 | 640 30 | 31 | 32 | filename 33 | 04-rice.jpg 34 | height 35 | 480 36 | width 37 | 640 38 | 39 | 40 | filename 41 | 05-sweden.jpg 42 | height 43 | 308 44 | width 45 | 640 46 | 47 | 48 | filename 49 | 06-magicforest.jpg 50 | height 51 | 426 52 | width 53 | 640 54 | 55 | 56 | filename 57 | 07-bird.jpg 58 | height 59 | 426 60 | width 61 | 640 62 | 63 | 64 | filename 65 | 08-iguana.jpg 66 | height 67 | 426 68 | width 69 | 640 70 | 71 | 72 | filename 73 | 09-valley.jpg 74 | height 75 | 426 76 | width 77 | 640 78 | 79 | 80 | filename 81 | 10-parrots.jpg 82 | height 83 | 360 84 | width 85 | 640 86 | 87 | 88 | filename 89 | 11-lapaz.jpg 90 | height 91 | 426 92 | width 93 | 640 94 | 95 | 96 | filename 97 | 12-villarrica.jpg 98 | height 99 | 426 100 | width 101 | 640 102 | 103 | 104 | filename 105 | 13-lakevolcano.jpg 106 | height 107 | 411 108 | width 109 | 640 110 | 111 | 112 | filename 113 | 14-denseforest.jpg 114 | height 115 | 426 116 | width 117 | 640 118 | 119 | 120 | filename 121 | 15-glacier1.jpg 122 | height 123 | 426 124 | width 125 | 640 126 | 127 | 128 | filename 129 | 16-glacier2.jpg 130 | height 131 | 360 132 | width 133 | 640 134 | 135 | 136 | filename 137 | 17-torresdelpaine1.jpg 138 | height 139 | 360 140 | width 141 | 640 142 | 143 | 144 | filename 145 | 18-torresdelpaine2.jpg 146 | height 147 | 426 148 | width 149 | 640 150 | 151 | 152 | filename 153 | 19-cat.jpg 154 | height 155 | 426 156 | width 157 | 640 158 | 159 | 160 | filename 161 | 20-berlinskyline.jpg 162 | height 163 | 426 164 | width 165 | 640 166 | 167 | 168 | filename 169 | 21-potsdamerplatz.jpg 170 | height 171 | 400 172 | width 173 | 640 174 | 175 | 176 | filename 177 | 22-milchbar.jpg 178 | height 179 | 436 180 | width 181 | 640 182 | 183 | 184 | filename 185 | 23-berlinlights.jpg 186 | height 187 | 512 188 | width 189 | 640 190 | 191 | 192 | filename 193 | 24-tvtower.jpg 194 | height 195 | 320 196 | width 197 | 640 198 | 199 | 200 | filename 201 | 25-winter.jpg 202 | height 203 | 360 204 | width 205 | 640 206 | 207 | 208 | filename 209 | 26-tree.jpg 210 | height 211 | 478 212 | width 213 | 640 214 | 215 | 216 | filename 217 | 27-beach.jpg 218 | height 219 | 426 220 | width 221 | 640 222 | 223 | 224 | 225 | 226 | -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-Final/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // CGParllaxCollectionView-Final 4 | // 5 | // Created by CocoaGarage on 04/06/14. 6 | // Copyright (c) 2014 CocoaGarage. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout { 12 | // Array of images to show. 13 | let images = ["01-mallorca.jpg", "02-fishing.jpg", "03-chili.jpg", "04-rice.jpg", "05-sweden.jpg", "06-magicForest.jpg", "07-bird.jpg", "08-iguana.jpg", "09-valley.jpg", "10-parrots.jpg"] 14 | 15 | // CollectionView property 16 | let myCollectionView:UICollectionView = UICollectionView(frame: CGRectZero, collectionViewLayout: CGParallaxFlowLayout()) 17 | 18 | override func viewDidLoad() { 19 | super.viewDidLoad() 20 | // Setup flowLayout. 21 | var flowLayout:CGParallaxFlowLayout = self.myCollectionView.collectionViewLayout as CGParallaxFlowLayout 22 | flowLayout.minimumLineSpacing = 16.0 23 | flowLayout.sectionInset = UIEdgeInsetsMake(16, 16, 16, 16) 24 | 25 | // Setup CollectionView 26 | self.myCollectionView.delegate = self 27 | self.myCollectionView.dataSource = self 28 | self.view.addSubview(self.myCollectionView) 29 | self.myCollectionView.registerClass(CGParallaxCollectionViewCell.self, forCellWithReuseIdentifier: "cell") 30 | self.myCollectionView.backgroundColor = UIColor.whiteColor() 31 | self.myCollectionView.reloadData() 32 | } 33 | 34 | override func didReceiveMemoryWarning() { 35 | super.didReceiveMemoryWarning() 36 | // Dispose of any resources that can be recreated. 37 | } 38 | 39 | func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int 40 | { 41 | return images.count 42 | } 43 | 44 | func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell 45 | { 46 | var cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as CGParallaxCollectionViewCell 47 | var imageName: String = self.images[indexPath.row] as String 48 | cell.imageView.image = UIImage(named: imageName) as UIImage? 49 | 50 | return cell 51 | } 52 | 53 | func collectionView(collectionView: UICollectionView!, layout collectionViewLayout: UICollectionViewLayout!, sizeForItemAtIndexPath indexPath: NSIndexPath!) -> CGSize { 54 | var imageWidth:CGFloat = 640.0 55 | var imageHeight:CGFloat = 480.0 56 | var flowLayout:CGParallaxFlowLayout = self.myCollectionView.collectionViewLayout as CGParallaxFlowLayout 57 | var cellWidth:CGFloat = CGRectGetWidth(self.myCollectionView.bounds) - flowLayout.sectionInset.left - flowLayout.sectionInset.right 58 | // var cellHeight:CGFloat = floorf(cellWidth/imageWidth * imageHeight) - (2 * flowLayout.maxParallaxOffset) 59 | var cellHeight:CGFloat = (floor(cellWidth/imageWidth * imageHeight) - (2.0 as CGFloat * flowLayout.maxParallaxOffset)) as CGFloat 60 | return CGSizeMake(cellWidth, cellHeight) 61 | } 62 | 63 | override func viewWillLayoutSubviews() { 64 | self.myCollectionView.frame = self.view.bounds 65 | var size:CGSize = CGSizeMake(self.view.bounds.width, self.view.bounds.height) 66 | } 67 | 68 | } 69 | 70 | -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-FinalTests/CGParllaxCollectionView_FinalTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CGParllaxCollectionView_FinalTests.swift 3 | // CGParllaxCollectionView-FinalTests 4 | // 5 | // Created by CocoaGarage on 04/06/14. 6 | // Copyright (c) 2014 CocoaGarage. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class CGParllaxCollectionView_FinalTests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | super.tearDown() 21 | } 22 | 23 | func testExample() { 24 | // This is an example of a functional test case. 25 | XCTAssert(true, "Pass") 26 | } 27 | 28 | func testPerformanceExample() { 29 | // This is an example of a performance test case. 30 | self.measureBlock() { 31 | // Put the code you want to measure the time of here. 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /CGParllaxCollectionViewPoject/CGParllaxCollectionView-FinalTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cg.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 kNeerajPro 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /ParallaxScrollingViewGif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kn-neeraj/CGParallaxCollectionView/435b47f4896f61c8845be435f6ef05e1c8814481/ParallaxScrollingViewGif.gif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CGParallaxCollectionView 2 | ======================== 3 | 4 | Porting Ole Begemann CollectionViewParallaxScrolling to Swift. 5 | It will be extended to add more features. 6 | 7 | Please read Ole's blog post here 'http://oleb.net/blog/2014/04/parallax-scrolling-collectionview/) for more information. 8 | 9 | Checkout the gif here - 10 | 11 | https://github.com/kNeerajPro/CGParallaxCollectionView/blob/master/ParallaxScrollingViewGif.gif 12 | 13 | Checkout the library at http://www.learnswift.tips/ and https://www.cocoacontrols.com/controls/cgparallaxcollectionview. 14 | 15 | 16 | 17 | 18 | 19 | --------------------------------------------------------------------------------