├── .gitignore ├── ATTRIBUTION.md ├── GreedoLayout.podspec ├── GreedoLayout ├── GreedoCollectionViewLayout.h ├── GreedoCollectionViewLayout.m ├── GreedoSizeCalculator.h └── GreedoSizeCalculator.m ├── GreedoLayoutExample ├── GreedoLayoutExample.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── GreedoLayoutExample.xcworkspace │ └── contents.xcworkspacedata ├── GreedoLayoutExample │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Controllers │ │ ├── HomeTableViewController.h │ │ ├── HomeTableViewController.m │ │ ├── ImageCollectionViewController.h │ │ └── ImageCollectionViewController.m │ ├── Info.plist │ ├── Views │ │ ├── ImageCollectionViewCell.h │ │ └── ImageCollectionViewCell.m │ └── main.m ├── GreedoLayoutExampleTests │ ├── GreedoLayoutExampleTests.m │ └── Info.plist └── Podfile ├── LICENSE ├── README.md └── screenshot.png /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/swift,osx,objective-c 3 | 4 | ### Swift ### 5 | # Xcode 6 | # 7 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 8 | 9 | ## Build generated 10 | build/ 11 | DerivedData 12 | 13 | ## Various settings 14 | *.pbxuser 15 | !default.pbxuser 16 | *.mode1v3 17 | !default.mode1v3 18 | *.mode2v3 19 | !default.mode2v3 20 | *.perspectivev3 21 | !default.perspectivev3 22 | xcuserdata 23 | 24 | ## Other 25 | *.xccheckout 26 | *.moved-aside 27 | *.xcuserstate 28 | *.xcscmblueprint 29 | 30 | ## Obj-C/Swift specific 31 | *.hmap 32 | *.ipa 33 | 34 | ## Playgrounds 35 | timeline.xctimeline 36 | playground.xcworkspace 37 | 38 | # Swift Package Manager 39 | # 40 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 41 | # Packages/ 42 | .build/ 43 | 44 | # CocoaPods 45 | # 46 | # We recommend against adding the Pods directory to your .gitignore. However 47 | # you should judge for yourself, the pros and cons are mentioned at: 48 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 49 | # 50 | # Pods/ 51 | 52 | # Carthage 53 | # 54 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 55 | # Carthage/Checkouts 56 | 57 | Carthage/Build 58 | 59 | # fastlane 60 | # 61 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 62 | # screenshots whenever they are needed. 63 | # For more information about the recommended setup visit: 64 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 65 | 66 | fastlane/report.xml 67 | fastlane/screenshots 68 | 69 | 70 | ### OSX ### 71 | .DS_Store 72 | .AppleDouble 73 | .LSOverride 74 | 75 | # Icon must end with two \r 76 | Icon 77 | 78 | 79 | # Thumbnails 80 | ._* 81 | 82 | # Files that might appear in the root of a volume 83 | .DocumentRevisions-V100 84 | .fseventsd 85 | .Spotlight-V100 86 | .TemporaryItems 87 | .Trashes 88 | .VolumeIcon.icns 89 | 90 | # Directories potentially created on remote AFP share 91 | .AppleDB 92 | .AppleDesktop 93 | Network Trash Folder 94 | Temporary Items 95 | .apdisk 96 | 97 | 98 | ### Objective-C ### 99 | # Xcode 100 | # 101 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 102 | 103 | ## Build generated 104 | build/ 105 | DerivedData 106 | 107 | ## Various settings 108 | *.pbxuser 109 | !default.pbxuser 110 | *.mode1v3 111 | !default.mode1v3 112 | *.mode2v3 113 | !default.mode2v3 114 | *.perspectivev3 115 | !default.perspectivev3 116 | xcuserdata 117 | 118 | ## Other 119 | *.xccheckout 120 | *.moved-aside 121 | *.xcuserstate 122 | *.xcscmblueprint 123 | 124 | ## Obj-C/Swift specific 125 | *.hmap 126 | *.ipa 127 | 128 | # CocoaPods 129 | # 130 | # We recommend against adding the Pods directory to your .gitignore. However 131 | # you should judge for yourself, the pros and cons are mentioned at: 132 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 133 | # 134 | # Pods/ 135 | 136 | # Carthage 137 | # 138 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 139 | # Carthage/Checkouts 140 | 141 | Carthage/Build 142 | 143 | # fastlane 144 | # 145 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 146 | # screenshots whenever they are needed. 147 | # For more information about the recommended setup visit: 148 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 149 | 150 | fastlane/report.xml 151 | fastlane/screenshots 152 | 153 | ### Objective-C Patch ### 154 | *.xcscmblueprint 155 | 156 | */Podfile.lock 157 | */Pods/* 158 | -------------------------------------------------------------------------------- /ATTRIBUTION.md: -------------------------------------------------------------------------------- 1 | The photos used in the screenshot of the sample application are licensed under the Creative Commons and are listed below. 2 | 3 | * [Head V Heart by Minh Bui](https://500px.com/photo/140742805/head-v-heart-by-minh-bui) 4 | * [Portfolio Work For Patrik by David Tannfors](https://500px.com/photo/139686767/portfolio-work-for-patrik-by-david-tannfors) 5 | * [Iceland by Florian Wenzel](https://500px.com/photo/136514703/iceland-by-florian-wenzel) 6 | * [Fearless by Florian Wenzel](https://500px.com/photo/133322731/fearless-by-florian-wenzel) 7 | * [Natalie by Mike Monaghan](https://500px.com/photo/137787113/natalie-by-mike-monaghan) 8 | * [Thick Matcha Icecream by Miki Fujii](https://500px.com/photo/131508565/thick-matcha-icecream-by-miki-fujii) 9 | * [Ximena by Agata Serge](https://500px.com/photo/137918877/ximena-by-agata-serge) 10 | * [Gesa by Florian Wenzel](https://500px.com/photo/138014491/gesa-by-florian-wenzel) 11 | -------------------------------------------------------------------------------- /GreedoLayout.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "GreedoLayout" 3 | s.version = "1.2.0" 4 | s.summary = "Full Aspect Ratio UICollectionView layout" 5 | s.description = "Computes what size the UICollectionView cells should be to display images in a variable height fixed aspect ratio grid." 6 | s.homepage = "https://github.com/500px/greedo-layout-for-ios" 7 | s.license = 'MIT' 8 | s.author = { "David Charlec" => "david@500px.com" } 9 | s.source = { :git => "https://github.com/500px/greedo-layout-for-ios.git", :tag => s.version } 10 | s.platform = :ios, '6.0' 11 | s.source_files = 'GreedoLayout/*.{h,m}' 12 | s.requires_arc = true 13 | end 14 | -------------------------------------------------------------------------------- /GreedoLayout/GreedoCollectionViewLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // GreedoCollectionViewLayout.h 3 | // 500px 4 | // Copyright (c) 2016 500px. All rights reserved. 5 | // 6 | 7 | #import 8 | #import 9 | 10 | 11 | @protocol GreedoCollectionViewLayoutDataSource; 12 | 13 | @interface GreedoCollectionViewLayout : NSObject 14 | 15 | @property (nonatomic, weak) id dataSource; 16 | @property CGFloat rowMaximumHeight; 17 | @property BOOL fixedHeight; 18 | 19 | - (instancetype)initWithCollectionView:(UICollectionView *)collectionView; 20 | - (CGSize)sizeForPhotoAtIndexPath:(NSIndexPath *)indexPath; 21 | - (void)clearCache; 22 | - (void)clearCacheAfterIndexPath:(NSIndexPath *)indexPath; 23 | 24 | @end 25 | 26 | @protocol GreedoCollectionViewLayoutDataSource 27 | 28 | - (CGSize)greedoCollectionViewLayout:(GreedoCollectionViewLayout *)layout originalImageSizeAtIndexPath:(NSIndexPath *)indexPath; 29 | 30 | @end -------------------------------------------------------------------------------- /GreedoLayout/GreedoCollectionViewLayout.m: -------------------------------------------------------------------------------- 1 | // 2 | // GreedoCollectionViewLayout.h 3 | // 500px 4 | // Copyright (c) 2015 500px. All rights reserved. 5 | // 6 | 7 | #import "GreedoCollectionViewLayout.h" 8 | #import "GreedoSizeCalculator.h" 9 | 10 | @interface GreedoCollectionViewLayout () 11 | 12 | @property (nonatomic, strong) UICollectionView *collectionView; 13 | @property (nonatomic, strong) GreedoSizeCalculator *greedo; 14 | 15 | @end 16 | 17 | @implementation GreedoCollectionViewLayout 18 | 19 | - (instancetype)initWithCollectionView:(UICollectionView *)collectionView 20 | { 21 | self = [super init]; 22 | if (self) { 23 | _collectionView = collectionView; 24 | } 25 | return self; 26 | } 27 | 28 | - (CGSize)sizeForPhotoAtIndexPath:(NSIndexPath *)indexPath 29 | { 30 | CGFloat contentWidth = self.collectionView.bounds.size.width; 31 | CGFloat interitemSpacing = 0.0; 32 | 33 | UICollectionViewFlowLayout *layout = (UICollectionViewFlowLayout *)self.collectionView.collectionViewLayout; 34 | if (layout) { 35 | contentWidth -= (layout.sectionInset.left + layout.sectionInset.right); 36 | interitemSpacing = layout.minimumInteritemSpacing; 37 | } 38 | 39 | self.greedo.contentWidth = contentWidth; 40 | self.greedo.interItemSpacing = interitemSpacing; 41 | 42 | return [self.greedo sizeForPhotoAtIndexPath:indexPath]; 43 | } 44 | 45 | - (void)clearCache 46 | { 47 | [self.greedo clearCache]; 48 | } 49 | 50 | - (void)clearCacheAfterIndexPath:(NSIndexPath *)indexPath 51 | { 52 | [self.greedo clearCacheAfterIndexPath:indexPath]; 53 | } 54 | 55 | - (CGFloat)rowMaximumHeight 56 | { 57 | return self.greedo.rowMaximumHeight; 58 | } 59 | 60 | - (void)setRowMaximumHeight:(CGFloat)rowMaximumHeight 61 | { 62 | self.greedo.rowMaximumHeight = rowMaximumHeight; 63 | } 64 | 65 | - (BOOL)fixedHeight 66 | { 67 | return self.greedo.fixedHeight; 68 | } 69 | 70 | - (void)setFixedHeight:(BOOL)fixedHeight 71 | { 72 | self.greedo.fixedHeight = fixedHeight; 73 | } 74 | 75 | - (CGSize)greedoSizeCalculator:(GreedoSizeCalculator *)layout originalImageSizeAtIndexPath:(NSIndexPath *)indexPath 76 | { 77 | return [self.dataSource greedoCollectionViewLayout:self originalImageSizeAtIndexPath:indexPath]; 78 | } 79 | 80 | #pragma mark - Lazy Loading 81 | 82 | - (GreedoSizeCalculator *)greedo 83 | { 84 | if (!_greedo) { 85 | _greedo = [[GreedoSizeCalculator alloc] init]; 86 | _greedo.rowMaximumHeight = 100; 87 | _greedo.fixedHeight = NO; 88 | _greedo.dataSource = self; 89 | } 90 | return _greedo; 91 | } 92 | 93 | @end -------------------------------------------------------------------------------- /GreedoLayout/GreedoSizeCalculator.h: -------------------------------------------------------------------------------- 1 | // 2 | // GreedoSizeCalculator.h 3 | // Pods 4 | // 5 | // Created by David Charlec on 2016-04-21. 6 | // 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @protocol GreedoSizeCalculatorDataSource; 13 | 14 | @interface GreedoSizeCalculator : NSObject 15 | 16 | @property (nonatomic, weak) id dataSource; 17 | @property CGFloat rowMaximumHeight; 18 | @property BOOL fixedHeight; 19 | @property CGFloat contentWidth; 20 | @property CGFloat interItemSpacing; 21 | 22 | - (CGSize)sizeForPhotoAtIndexPath:(NSIndexPath *)indexPath; 23 | - (void)clearCache; 24 | - (void)clearCacheAfterIndexPath:(NSIndexPath *)indexPath; 25 | 26 | @end 27 | 28 | @protocol GreedoSizeCalculatorDataSource 29 | - (CGSize)greedoSizeCalculator:(GreedoSizeCalculator *)layout originalImageSizeAtIndexPath:(NSIndexPath *)indexPath; 30 | @end -------------------------------------------------------------------------------- /GreedoLayout/GreedoSizeCalculator.m: -------------------------------------------------------------------------------- 1 | // 2 | // GreedoSizeCalculator.m 3 | // Pods 4 | // 5 | // Created by David Charlec on 2016-04-21. 6 | // 7 | // 8 | 9 | #import "GreedoSizeCalculator.h" 10 | 11 | @interface GreedoSizeCalculator () 12 | 13 | @property (nonatomic, strong) NSMutableDictionary *sizeCache; 14 | @property (nonatomic, strong) NSMutableArray *leftOvers; 15 | @property (nonatomic, strong) NSIndexPath *lastIndexPathAdded; 16 | 17 | @end 18 | 19 | @implementation GreedoSizeCalculator 20 | 21 | - (CGSize)sizeForPhotoAtIndexPath:(NSIndexPath *)indexPath 22 | { 23 | if (!self.sizeCache[indexPath]) { 24 | self.lastIndexPathAdded = indexPath; 25 | [self computeSizesAtIndexPath:indexPath]; 26 | } 27 | CGSize size = [[self.sizeCache objectForKey:indexPath] CGSizeValue]; 28 | if (size.width < 0.0 || size.height < 0.0) { 29 | size = CGSizeZero; 30 | } 31 | return size; 32 | } 33 | 34 | - (void)clearCache 35 | { 36 | [self.sizeCache removeAllObjects]; 37 | } 38 | 39 | - (void)clearCacheAfterIndexPath:(NSIndexPath *)indexPath 40 | { 41 | // Remove the indexPath 42 | [self.sizeCache removeObjectForKey:indexPath]; 43 | 44 | // Remove the indexPath for anything after 45 | for (NSIndexPath *existingIndexPath in [self.sizeCache allKeys]) { 46 | if ([indexPath compare:existingIndexPath] == NSOrderedDescending) { 47 | [self.sizeCache removeObjectForKey:existingIndexPath]; 48 | } 49 | } 50 | } 51 | 52 | #pragma mark - Private methods 53 | 54 | - (void)computeSizesAtIndexPath:(NSIndexPath *)indexPath 55 | { 56 | CGSize photoSize = [self.dataSource greedoSizeCalculator:self originalImageSizeAtIndexPath:indexPath]; 57 | 58 | if (photoSize.width < 1 || photoSize.height < 1) { 59 | // Photo with no height or width 60 | photoSize.width = self.rowMaximumHeight; 61 | photoSize.height = self.rowMaximumHeight; 62 | } 63 | 64 | [self.leftOvers addObject:[NSValue valueWithCGSize:photoSize]]; 65 | 66 | BOOL enoughContentForTheRow = NO; 67 | CGFloat rowHeight = self.rowMaximumHeight; 68 | CGFloat widthMultiplier = 1.0; 69 | 70 | // Calculations for variable height grid 71 | if (self.fixedHeight) { 72 | CGFloat totalWidth = 0; 73 | NSInteger index = 0; 74 | for (NSValue *leftOver in self.leftOvers) { 75 | CGSize leftOverSize = [leftOver CGSizeValue]; 76 | CGFloat scaledWidth = ceil((rowHeight * leftOverSize.width) / leftOverSize.height); 77 | scaledWidth += self.interItemSpacing; 78 | 79 | if ((totalWidth + (scaledWidth * 0.66)) > self.contentWidth) { 80 | // Adding this photo would mean less than 2/3 of it would be visible 81 | enoughContentForTheRow = YES; 82 | [self.leftOvers removeObjectAtIndex:index]; 83 | break; 84 | } 85 | 86 | totalWidth += scaledWidth; 87 | enoughContentForTheRow = (totalWidth > self.contentWidth); 88 | index++; 89 | } 90 | 91 | if (enoughContentForTheRow) { 92 | widthMultiplier = totalWidth / self.contentWidth; 93 | } 94 | 95 | } else { 96 | CGFloat totalAspectRatio = 0.0; 97 | 98 | for (NSValue *leftOver in self.leftOvers) { 99 | CGSize leftOverSize = [leftOver CGSizeValue]; 100 | totalAspectRatio += (leftOverSize.width / leftOverSize.height); 101 | } 102 | 103 | rowHeight = self.contentWidth / totalAspectRatio; 104 | enoughContentForTheRow = rowHeight < self.rowMaximumHeight; 105 | } 106 | 107 | if (enoughContentForTheRow) { 108 | // The line is full! 109 | 110 | CGFloat availableSpace = self.contentWidth; 111 | NSInteger index = 0; 112 | for (NSValue *leftOver in self.leftOvers) { 113 | 114 | CGSize leftOverSize = [leftOver CGSizeValue]; 115 | 116 | CGFloat newWidth = floor((rowHeight * leftOverSize.width) / leftOverSize.height); 117 | 118 | if (self.fixedHeight) { 119 | if (index == self.leftOvers.count - 1) { 120 | newWidth = availableSpace; 121 | } else { 122 | newWidth = floor(newWidth * widthMultiplier); 123 | } 124 | } else { 125 | newWidth = MIN(availableSpace, newWidth); 126 | } 127 | 128 | // Add the size in the cache 129 | [self.sizeCache setObject:[NSValue valueWithCGSize:CGSizeMake(newWidth, rowHeight)] forKey:self.lastIndexPathAdded]; 130 | 131 | availableSpace -= newWidth; 132 | availableSpace -= self.interItemSpacing; 133 | 134 | // We need to keep track of the last index path added 135 | self.lastIndexPathAdded = [NSIndexPath indexPathForItem:(self.lastIndexPathAdded.item + 1) inSection:self.lastIndexPathAdded.section]; 136 | index++; 137 | } 138 | 139 | [self.leftOvers removeAllObjects]; 140 | } else { 141 | // The line is not full, let's ask the next photo and try to fill up the line 142 | [self computeSizesAtIndexPath:[NSIndexPath indexPathForItem:(indexPath.item + 1) inSection:indexPath.section]]; 143 | } 144 | } 145 | 146 | #pragma mark - Custom accessors 147 | 148 | - (NSMutableArray *)leftOvers 149 | { 150 | if (!_leftOvers) { 151 | _leftOvers = [NSMutableArray array]; 152 | } 153 | 154 | return _leftOvers; 155 | } 156 | 157 | - (NSMutableDictionary *)sizeCache 158 | { 159 | if (!_sizeCache) { 160 | _sizeCache = [NSMutableDictionary dictionary]; 161 | } 162 | return _sizeCache; 163 | } 164 | 165 | 166 | 167 | @end 168 | -------------------------------------------------------------------------------- /GreedoLayoutExample/GreedoLayoutExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 603A3C6176698A5EE3C9D1EA /* libPods-GreedoLayoutExampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F256541851E1E5A7CA4CB6B /* libPods-GreedoLayoutExampleTests.a */; }; 11 | AB7E9F340C0C172531863B2B /* libPods-GreedoLayoutExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 69D85517E02FA6FCE8F56C9B /* libPods-GreedoLayoutExample.a */; }; 12 | B02A1EA51CBC36F900048359 /* HomeTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B02A1EA41CBC36F900048359 /* HomeTableViewController.m */; }; 13 | B063FC211C6BECD9004924A3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B063FC201C6BECD9004924A3 /* main.m */; }; 14 | B063FC241C6BECD9004924A3 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B063FC231C6BECD9004924A3 /* AppDelegate.m */; }; 15 | B063FC2A1C6BECD9004924A3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B063FC281C6BECD9004924A3 /* Main.storyboard */; }; 16 | B063FC2C1C6BECD9004924A3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B063FC2B1C6BECD9004924A3 /* Assets.xcassets */; }; 17 | B063FC2F1C6BECD9004924A3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B063FC2D1C6BECD9004924A3 /* LaunchScreen.storyboard */; }; 18 | B063FC3A1C6BECD9004924A3 /* GreedoLayoutExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B063FC391C6BECD9004924A3 /* GreedoLayoutExampleTests.m */; }; 19 | B063FC481C6CD634004924A3 /* ImageCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B063FC471C6CD634004924A3 /* ImageCollectionViewCell.m */; }; 20 | B063FC4B1C6CD74C004924A3 /* ImageCollectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B063FC4A1C6CD74C004924A3 /* ImageCollectionViewController.m */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXContainerItemProxy section */ 24 | B063FC361C6BECD9004924A3 /* PBXContainerItemProxy */ = { 25 | isa = PBXContainerItemProxy; 26 | containerPortal = B063FC141C6BECD9004924A3 /* Project object */; 27 | proxyType = 1; 28 | remoteGlobalIDString = B063FC1B1C6BECD9004924A3; 29 | remoteInfo = GreedoLayoutExample; 30 | }; 31 | /* End PBXContainerItemProxy section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | 2465C3D46C94C4FF4670E762 /* Pods-GreedoLayoutExampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GreedoLayoutExampleTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-GreedoLayoutExampleTests/Pods-GreedoLayoutExampleTests.debug.xcconfig"; sourceTree = ""; }; 35 | 4F256541851E1E5A7CA4CB6B /* libPods-GreedoLayoutExampleTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-GreedoLayoutExampleTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | 68C21EC2C03E508F042D5203 /* Pods-GreedoLayoutExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GreedoLayoutExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-GreedoLayoutExample/Pods-GreedoLayoutExample.release.xcconfig"; sourceTree = ""; }; 37 | 69D85517E02FA6FCE8F56C9B /* libPods-GreedoLayoutExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-GreedoLayoutExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | 9BDC07C71139D6B0C2885077 /* Pods-GreedoLayoutExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GreedoLayoutExampleTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-GreedoLayoutExampleTests/Pods-GreedoLayoutExampleTests.release.xcconfig"; sourceTree = ""; }; 39 | B02A1EA31CBC36F900048359 /* HomeTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HomeTableViewController.h; path = Controllers/HomeTableViewController.h; sourceTree = ""; }; 40 | B02A1EA41CBC36F900048359 /* HomeTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HomeTableViewController.m; path = Controllers/HomeTableViewController.m; sourceTree = ""; }; 41 | B063FC1C1C6BECD9004924A3 /* GreedoLayoutExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GreedoLayoutExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | B063FC201C6BECD9004924A3 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 43 | B063FC221C6BECD9004924A3 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 44 | B063FC231C6BECD9004924A3 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 45 | B063FC291C6BECD9004924A3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 46 | B063FC2B1C6BECD9004924A3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 47 | B063FC2E1C6BECD9004924A3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 48 | B063FC301C6BECD9004924A3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | B063FC351C6BECD9004924A3 /* GreedoLayoutExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GreedoLayoutExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | B063FC391C6BECD9004924A3 /* GreedoLayoutExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GreedoLayoutExampleTests.m; sourceTree = ""; }; 51 | B063FC3B1C6BECD9004924A3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | B063FC461C6CD634004924A3 /* ImageCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ImageCollectionViewCell.h; path = Views/ImageCollectionViewCell.h; sourceTree = ""; }; 53 | B063FC471C6CD634004924A3 /* ImageCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ImageCollectionViewCell.m; path = Views/ImageCollectionViewCell.m; sourceTree = ""; }; 54 | B063FC491C6CD74C004924A3 /* ImageCollectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ImageCollectionViewController.h; path = Controllers/ImageCollectionViewController.h; sourceTree = ""; }; 55 | B063FC4A1C6CD74C004924A3 /* ImageCollectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ImageCollectionViewController.m; path = Controllers/ImageCollectionViewController.m; sourceTree = ""; }; 56 | B52F4DACA0BF737B474659E5 /* Pods-GreedoLayoutExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GreedoLayoutExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-GreedoLayoutExample/Pods-GreedoLayoutExample.debug.xcconfig"; sourceTree = ""; }; 57 | /* End PBXFileReference section */ 58 | 59 | /* Begin PBXFrameworksBuildPhase section */ 60 | B063FC191C6BECD9004924A3 /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | AB7E9F340C0C172531863B2B /* libPods-GreedoLayoutExample.a in Frameworks */, 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | B063FC321C6BECD9004924A3 /* Frameworks */ = { 69 | isa = PBXFrameworksBuildPhase; 70 | buildActionMask = 2147483647; 71 | files = ( 72 | 603A3C6176698A5EE3C9D1EA /* libPods-GreedoLayoutExampleTests.a in Frameworks */, 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | /* End PBXFrameworksBuildPhase section */ 77 | 78 | /* Begin PBXGroup section */ 79 | 6FABC148B89D2AC028E218D6 /* Pods */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | B52F4DACA0BF737B474659E5 /* Pods-GreedoLayoutExample.debug.xcconfig */, 83 | 68C21EC2C03E508F042D5203 /* Pods-GreedoLayoutExample.release.xcconfig */, 84 | 2465C3D46C94C4FF4670E762 /* Pods-GreedoLayoutExampleTests.debug.xcconfig */, 85 | 9BDC07C71139D6B0C2885077 /* Pods-GreedoLayoutExampleTests.release.xcconfig */, 86 | ); 87 | name = Pods; 88 | sourceTree = ""; 89 | }; 90 | A13BEE7C12999B506BB2B469 /* Frameworks */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 69D85517E02FA6FCE8F56C9B /* libPods-GreedoLayoutExample.a */, 94 | 4F256541851E1E5A7CA4CB6B /* libPods-GreedoLayoutExampleTests.a */, 95 | ); 96 | name = Frameworks; 97 | sourceTree = ""; 98 | }; 99 | B063FC131C6BECD9004924A3 = { 100 | isa = PBXGroup; 101 | children = ( 102 | B063FC1E1C6BECD9004924A3 /* GreedoLayoutExample */, 103 | B063FC381C6BECD9004924A3 /* GreedoLayoutExampleTests */, 104 | B063FC1D1C6BECD9004924A3 /* Products */, 105 | 6FABC148B89D2AC028E218D6 /* Pods */, 106 | A13BEE7C12999B506BB2B469 /* Frameworks */, 107 | ); 108 | sourceTree = ""; 109 | }; 110 | B063FC1D1C6BECD9004924A3 /* Products */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | B063FC1C1C6BECD9004924A3 /* GreedoLayoutExample.app */, 114 | B063FC351C6BECD9004924A3 /* GreedoLayoutExampleTests.xctest */, 115 | ); 116 | name = Products; 117 | sourceTree = ""; 118 | }; 119 | B063FC1E1C6BECD9004924A3 /* GreedoLayoutExample */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | B063FC441C6CD5FA004924A3 /* Controllers */, 123 | B063FC451C6CD605004924A3 /* Views */, 124 | B063FC221C6BECD9004924A3 /* AppDelegate.h */, 125 | B063FC231C6BECD9004924A3 /* AppDelegate.m */, 126 | B063FC281C6BECD9004924A3 /* Main.storyboard */, 127 | B063FC2B1C6BECD9004924A3 /* Assets.xcassets */, 128 | B063FC2D1C6BECD9004924A3 /* LaunchScreen.storyboard */, 129 | B063FC301C6BECD9004924A3 /* Info.plist */, 130 | B063FC1F1C6BECD9004924A3 /* Supporting Files */, 131 | ); 132 | path = GreedoLayoutExample; 133 | sourceTree = ""; 134 | }; 135 | B063FC1F1C6BECD9004924A3 /* Supporting Files */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | B063FC201C6BECD9004924A3 /* main.m */, 139 | ); 140 | name = "Supporting Files"; 141 | sourceTree = ""; 142 | }; 143 | B063FC381C6BECD9004924A3 /* GreedoLayoutExampleTests */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | B063FC391C6BECD9004924A3 /* GreedoLayoutExampleTests.m */, 147 | B063FC3B1C6BECD9004924A3 /* Info.plist */, 148 | ); 149 | path = GreedoLayoutExampleTests; 150 | sourceTree = ""; 151 | }; 152 | B063FC441C6CD5FA004924A3 /* Controllers */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | B063FC491C6CD74C004924A3 /* ImageCollectionViewController.h */, 156 | B063FC4A1C6CD74C004924A3 /* ImageCollectionViewController.m */, 157 | B02A1EA31CBC36F900048359 /* HomeTableViewController.h */, 158 | B02A1EA41CBC36F900048359 /* HomeTableViewController.m */, 159 | ); 160 | name = Controllers; 161 | sourceTree = ""; 162 | }; 163 | B063FC451C6CD605004924A3 /* Views */ = { 164 | isa = PBXGroup; 165 | children = ( 166 | B063FC461C6CD634004924A3 /* ImageCollectionViewCell.h */, 167 | B063FC471C6CD634004924A3 /* ImageCollectionViewCell.m */, 168 | ); 169 | name = Views; 170 | sourceTree = ""; 171 | }; 172 | /* End PBXGroup section */ 173 | 174 | /* Begin PBXNativeTarget section */ 175 | B063FC1B1C6BECD9004924A3 /* GreedoLayoutExample */ = { 176 | isa = PBXNativeTarget; 177 | buildConfigurationList = B063FC3E1C6BECD9004924A3 /* Build configuration list for PBXNativeTarget "GreedoLayoutExample" */; 178 | buildPhases = ( 179 | FB3C7339AC601A87B633AD29 /* Check Pods Manifest.lock */, 180 | B063FC181C6BECD9004924A3 /* Sources */, 181 | B063FC191C6BECD9004924A3 /* Frameworks */, 182 | B063FC1A1C6BECD9004924A3 /* Resources */, 183 | CABA559B8C5CD41B93A35BDA /* Embed Pods Frameworks */, 184 | B8D887751F86C60763C58491 /* Copy Pods Resources */, 185 | ); 186 | buildRules = ( 187 | ); 188 | dependencies = ( 189 | ); 190 | name = GreedoLayoutExample; 191 | productName = GreedoLayoutExample; 192 | productReference = B063FC1C1C6BECD9004924A3 /* GreedoLayoutExample.app */; 193 | productType = "com.apple.product-type.application"; 194 | }; 195 | B063FC341C6BECD9004924A3 /* GreedoLayoutExampleTests */ = { 196 | isa = PBXNativeTarget; 197 | buildConfigurationList = B063FC411C6BECD9004924A3 /* Build configuration list for PBXNativeTarget "GreedoLayoutExampleTests" */; 198 | buildPhases = ( 199 | DE09E455449A81D54CF1814E /* Check Pods Manifest.lock */, 200 | B063FC311C6BECD9004924A3 /* Sources */, 201 | B063FC321C6BECD9004924A3 /* Frameworks */, 202 | B063FC331C6BECD9004924A3 /* Resources */, 203 | 2FD8A42338C8B3E10B2067E5 /* Embed Pods Frameworks */, 204 | A99597D0606908EC3169B359 /* Copy Pods Resources */, 205 | ); 206 | buildRules = ( 207 | ); 208 | dependencies = ( 209 | B063FC371C6BECD9004924A3 /* PBXTargetDependency */, 210 | ); 211 | name = GreedoLayoutExampleTests; 212 | productName = GreedoLayoutExampleTests; 213 | productReference = B063FC351C6BECD9004924A3 /* GreedoLayoutExampleTests.xctest */; 214 | productType = "com.apple.product-type.bundle.unit-test"; 215 | }; 216 | /* End PBXNativeTarget section */ 217 | 218 | /* Begin PBXProject section */ 219 | B063FC141C6BECD9004924A3 /* Project object */ = { 220 | isa = PBXProject; 221 | attributes = { 222 | LastUpgradeCheck = 0720; 223 | ORGANIZATIONNAME = 500px; 224 | TargetAttributes = { 225 | B063FC1B1C6BECD9004924A3 = { 226 | CreatedOnToolsVersion = 7.2; 227 | }; 228 | B063FC341C6BECD9004924A3 = { 229 | CreatedOnToolsVersion = 7.2; 230 | TestTargetID = B063FC1B1C6BECD9004924A3; 231 | }; 232 | }; 233 | }; 234 | buildConfigurationList = B063FC171C6BECD9004924A3 /* Build configuration list for PBXProject "GreedoLayoutExample" */; 235 | compatibilityVersion = "Xcode 3.2"; 236 | developmentRegion = English; 237 | hasScannedForEncodings = 0; 238 | knownRegions = ( 239 | en, 240 | Base, 241 | ); 242 | mainGroup = B063FC131C6BECD9004924A3; 243 | productRefGroup = B063FC1D1C6BECD9004924A3 /* Products */; 244 | projectDirPath = ""; 245 | projectRoot = ""; 246 | targets = ( 247 | B063FC1B1C6BECD9004924A3 /* GreedoLayoutExample */, 248 | B063FC341C6BECD9004924A3 /* GreedoLayoutExampleTests */, 249 | ); 250 | }; 251 | /* End PBXProject section */ 252 | 253 | /* Begin PBXResourcesBuildPhase section */ 254 | B063FC1A1C6BECD9004924A3 /* Resources */ = { 255 | isa = PBXResourcesBuildPhase; 256 | buildActionMask = 2147483647; 257 | files = ( 258 | B063FC2F1C6BECD9004924A3 /* LaunchScreen.storyboard in Resources */, 259 | B063FC2C1C6BECD9004924A3 /* Assets.xcassets in Resources */, 260 | B063FC2A1C6BECD9004924A3 /* Main.storyboard in Resources */, 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | }; 264 | B063FC331C6BECD9004924A3 /* Resources */ = { 265 | isa = PBXResourcesBuildPhase; 266 | buildActionMask = 2147483647; 267 | files = ( 268 | ); 269 | runOnlyForDeploymentPostprocessing = 0; 270 | }; 271 | /* End PBXResourcesBuildPhase section */ 272 | 273 | /* Begin PBXShellScriptBuildPhase section */ 274 | 2FD8A42338C8B3E10B2067E5 /* Embed Pods Frameworks */ = { 275 | isa = PBXShellScriptBuildPhase; 276 | buildActionMask = 2147483647; 277 | files = ( 278 | ); 279 | inputPaths = ( 280 | ); 281 | name = "Embed Pods Frameworks"; 282 | outputPaths = ( 283 | ); 284 | runOnlyForDeploymentPostprocessing = 0; 285 | shellPath = /bin/sh; 286 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-GreedoLayoutExampleTests/Pods-GreedoLayoutExampleTests-frameworks.sh\"\n"; 287 | showEnvVarsInLog = 0; 288 | }; 289 | A99597D0606908EC3169B359 /* Copy Pods Resources */ = { 290 | isa = PBXShellScriptBuildPhase; 291 | buildActionMask = 2147483647; 292 | files = ( 293 | ); 294 | inputPaths = ( 295 | ); 296 | name = "Copy Pods Resources"; 297 | outputPaths = ( 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | shellPath = /bin/sh; 301 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-GreedoLayoutExampleTests/Pods-GreedoLayoutExampleTests-resources.sh\"\n"; 302 | showEnvVarsInLog = 0; 303 | }; 304 | B8D887751F86C60763C58491 /* Copy Pods Resources */ = { 305 | isa = PBXShellScriptBuildPhase; 306 | buildActionMask = 2147483647; 307 | files = ( 308 | ); 309 | inputPaths = ( 310 | ); 311 | name = "Copy Pods Resources"; 312 | outputPaths = ( 313 | ); 314 | runOnlyForDeploymentPostprocessing = 0; 315 | shellPath = /bin/sh; 316 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-GreedoLayoutExample/Pods-GreedoLayoutExample-resources.sh\"\n"; 317 | showEnvVarsInLog = 0; 318 | }; 319 | CABA559B8C5CD41B93A35BDA /* Embed Pods Frameworks */ = { 320 | isa = PBXShellScriptBuildPhase; 321 | buildActionMask = 2147483647; 322 | files = ( 323 | ); 324 | inputPaths = ( 325 | ); 326 | name = "Embed Pods Frameworks"; 327 | outputPaths = ( 328 | ); 329 | runOnlyForDeploymentPostprocessing = 0; 330 | shellPath = /bin/sh; 331 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-GreedoLayoutExample/Pods-GreedoLayoutExample-frameworks.sh\"\n"; 332 | showEnvVarsInLog = 0; 333 | }; 334 | DE09E455449A81D54CF1814E /* Check Pods Manifest.lock */ = { 335 | isa = PBXShellScriptBuildPhase; 336 | buildActionMask = 2147483647; 337 | files = ( 338 | ); 339 | inputPaths = ( 340 | ); 341 | name = "Check Pods Manifest.lock"; 342 | outputPaths = ( 343 | ); 344 | runOnlyForDeploymentPostprocessing = 0; 345 | shellPath = /bin/sh; 346 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 347 | showEnvVarsInLog = 0; 348 | }; 349 | FB3C7339AC601A87B633AD29 /* Check Pods Manifest.lock */ = { 350 | isa = PBXShellScriptBuildPhase; 351 | buildActionMask = 2147483647; 352 | files = ( 353 | ); 354 | inputPaths = ( 355 | ); 356 | name = "Check Pods Manifest.lock"; 357 | outputPaths = ( 358 | ); 359 | runOnlyForDeploymentPostprocessing = 0; 360 | shellPath = /bin/sh; 361 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 362 | showEnvVarsInLog = 0; 363 | }; 364 | /* End PBXShellScriptBuildPhase section */ 365 | 366 | /* Begin PBXSourcesBuildPhase section */ 367 | B063FC181C6BECD9004924A3 /* Sources */ = { 368 | isa = PBXSourcesBuildPhase; 369 | buildActionMask = 2147483647; 370 | files = ( 371 | B063FC4B1C6CD74C004924A3 /* ImageCollectionViewController.m in Sources */, 372 | B063FC241C6BECD9004924A3 /* AppDelegate.m in Sources */, 373 | B063FC481C6CD634004924A3 /* ImageCollectionViewCell.m in Sources */, 374 | B02A1EA51CBC36F900048359 /* HomeTableViewController.m in Sources */, 375 | B063FC211C6BECD9004924A3 /* main.m in Sources */, 376 | ); 377 | runOnlyForDeploymentPostprocessing = 0; 378 | }; 379 | B063FC311C6BECD9004924A3 /* Sources */ = { 380 | isa = PBXSourcesBuildPhase; 381 | buildActionMask = 2147483647; 382 | files = ( 383 | B063FC3A1C6BECD9004924A3 /* GreedoLayoutExampleTests.m in Sources */, 384 | ); 385 | runOnlyForDeploymentPostprocessing = 0; 386 | }; 387 | /* End PBXSourcesBuildPhase section */ 388 | 389 | /* Begin PBXTargetDependency section */ 390 | B063FC371C6BECD9004924A3 /* PBXTargetDependency */ = { 391 | isa = PBXTargetDependency; 392 | target = B063FC1B1C6BECD9004924A3 /* GreedoLayoutExample */; 393 | targetProxy = B063FC361C6BECD9004924A3 /* PBXContainerItemProxy */; 394 | }; 395 | /* End PBXTargetDependency section */ 396 | 397 | /* Begin PBXVariantGroup section */ 398 | B063FC281C6BECD9004924A3 /* Main.storyboard */ = { 399 | isa = PBXVariantGroup; 400 | children = ( 401 | B063FC291C6BECD9004924A3 /* Base */, 402 | ); 403 | name = Main.storyboard; 404 | sourceTree = ""; 405 | }; 406 | B063FC2D1C6BECD9004924A3 /* LaunchScreen.storyboard */ = { 407 | isa = PBXVariantGroup; 408 | children = ( 409 | B063FC2E1C6BECD9004924A3 /* Base */, 410 | ); 411 | name = LaunchScreen.storyboard; 412 | sourceTree = ""; 413 | }; 414 | /* End PBXVariantGroup section */ 415 | 416 | /* Begin XCBuildConfiguration section */ 417 | B063FC3C1C6BECD9004924A3 /* Debug */ = { 418 | isa = XCBuildConfiguration; 419 | buildSettings = { 420 | ALWAYS_SEARCH_USER_PATHS = NO; 421 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 422 | CLANG_CXX_LIBRARY = "libc++"; 423 | CLANG_ENABLE_MODULES = YES; 424 | CLANG_ENABLE_OBJC_ARC = YES; 425 | CLANG_WARN_BOOL_CONVERSION = YES; 426 | CLANG_WARN_CONSTANT_CONVERSION = YES; 427 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 428 | CLANG_WARN_EMPTY_BODY = YES; 429 | CLANG_WARN_ENUM_CONVERSION = YES; 430 | CLANG_WARN_INT_CONVERSION = YES; 431 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 432 | CLANG_WARN_UNREACHABLE_CODE = YES; 433 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 434 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 435 | COPY_PHASE_STRIP = NO; 436 | DEBUG_INFORMATION_FORMAT = dwarf; 437 | ENABLE_STRICT_OBJC_MSGSEND = YES; 438 | ENABLE_TESTABILITY = YES; 439 | GCC_C_LANGUAGE_STANDARD = gnu99; 440 | GCC_DYNAMIC_NO_PIC = NO; 441 | GCC_NO_COMMON_BLOCKS = YES; 442 | GCC_OPTIMIZATION_LEVEL = 0; 443 | GCC_PREPROCESSOR_DEFINITIONS = ( 444 | "DEBUG=1", 445 | "$(inherited)", 446 | ); 447 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 448 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 449 | GCC_WARN_UNDECLARED_SELECTOR = YES; 450 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 451 | GCC_WARN_UNUSED_FUNCTION = YES; 452 | GCC_WARN_UNUSED_VARIABLE = YES; 453 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 454 | MTL_ENABLE_DEBUG_INFO = YES; 455 | ONLY_ACTIVE_ARCH = YES; 456 | SDKROOT = iphoneos; 457 | TARGETED_DEVICE_FAMILY = "1,2"; 458 | }; 459 | name = Debug; 460 | }; 461 | B063FC3D1C6BECD9004924A3 /* Release */ = { 462 | isa = XCBuildConfiguration; 463 | buildSettings = { 464 | ALWAYS_SEARCH_USER_PATHS = NO; 465 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 466 | CLANG_CXX_LIBRARY = "libc++"; 467 | CLANG_ENABLE_MODULES = YES; 468 | CLANG_ENABLE_OBJC_ARC = YES; 469 | CLANG_WARN_BOOL_CONVERSION = YES; 470 | CLANG_WARN_CONSTANT_CONVERSION = YES; 471 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 472 | CLANG_WARN_EMPTY_BODY = YES; 473 | CLANG_WARN_ENUM_CONVERSION = YES; 474 | CLANG_WARN_INT_CONVERSION = YES; 475 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 476 | CLANG_WARN_UNREACHABLE_CODE = YES; 477 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 478 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 479 | COPY_PHASE_STRIP = NO; 480 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 481 | ENABLE_NS_ASSERTIONS = NO; 482 | ENABLE_STRICT_OBJC_MSGSEND = YES; 483 | GCC_C_LANGUAGE_STANDARD = gnu99; 484 | GCC_NO_COMMON_BLOCKS = YES; 485 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 486 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 487 | GCC_WARN_UNDECLARED_SELECTOR = YES; 488 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 489 | GCC_WARN_UNUSED_FUNCTION = YES; 490 | GCC_WARN_UNUSED_VARIABLE = YES; 491 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 492 | MTL_ENABLE_DEBUG_INFO = NO; 493 | SDKROOT = iphoneos; 494 | TARGETED_DEVICE_FAMILY = "1,2"; 495 | VALIDATE_PRODUCT = YES; 496 | }; 497 | name = Release; 498 | }; 499 | B063FC3F1C6BECD9004924A3 /* Debug */ = { 500 | isa = XCBuildConfiguration; 501 | baseConfigurationReference = B52F4DACA0BF737B474659E5 /* Pods-GreedoLayoutExample.debug.xcconfig */; 502 | buildSettings = { 503 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 504 | INFOPLIST_FILE = GreedoLayoutExample/Info.plist; 505 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 506 | PRODUCT_BUNDLE_IDENTIFIER = "-00px.GreedoLayoutExample"; 507 | PRODUCT_NAME = "$(TARGET_NAME)"; 508 | }; 509 | name = Debug; 510 | }; 511 | B063FC401C6BECD9004924A3 /* Release */ = { 512 | isa = XCBuildConfiguration; 513 | baseConfigurationReference = 68C21EC2C03E508F042D5203 /* Pods-GreedoLayoutExample.release.xcconfig */; 514 | buildSettings = { 515 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 516 | INFOPLIST_FILE = GreedoLayoutExample/Info.plist; 517 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 518 | PRODUCT_BUNDLE_IDENTIFIER = "-00px.GreedoLayoutExample"; 519 | PRODUCT_NAME = "$(TARGET_NAME)"; 520 | }; 521 | name = Release; 522 | }; 523 | B063FC421C6BECD9004924A3 /* Debug */ = { 524 | isa = XCBuildConfiguration; 525 | baseConfigurationReference = 2465C3D46C94C4FF4670E762 /* Pods-GreedoLayoutExampleTests.debug.xcconfig */; 526 | buildSettings = { 527 | BUNDLE_LOADER = "$(TEST_HOST)"; 528 | INFOPLIST_FILE = GreedoLayoutExampleTests/Info.plist; 529 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 530 | PRODUCT_BUNDLE_IDENTIFIER = "-00px.GreedoLayoutExampleTests"; 531 | PRODUCT_NAME = "$(TARGET_NAME)"; 532 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GreedoLayoutExample.app/GreedoLayoutExample"; 533 | }; 534 | name = Debug; 535 | }; 536 | B063FC431C6BECD9004924A3 /* Release */ = { 537 | isa = XCBuildConfiguration; 538 | baseConfigurationReference = 9BDC07C71139D6B0C2885077 /* Pods-GreedoLayoutExampleTests.release.xcconfig */; 539 | buildSettings = { 540 | BUNDLE_LOADER = "$(TEST_HOST)"; 541 | INFOPLIST_FILE = GreedoLayoutExampleTests/Info.plist; 542 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 543 | PRODUCT_BUNDLE_IDENTIFIER = "-00px.GreedoLayoutExampleTests"; 544 | PRODUCT_NAME = "$(TARGET_NAME)"; 545 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GreedoLayoutExample.app/GreedoLayoutExample"; 546 | }; 547 | name = Release; 548 | }; 549 | /* End XCBuildConfiguration section */ 550 | 551 | /* Begin XCConfigurationList section */ 552 | B063FC171C6BECD9004924A3 /* Build configuration list for PBXProject "GreedoLayoutExample" */ = { 553 | isa = XCConfigurationList; 554 | buildConfigurations = ( 555 | B063FC3C1C6BECD9004924A3 /* Debug */, 556 | B063FC3D1C6BECD9004924A3 /* Release */, 557 | ); 558 | defaultConfigurationIsVisible = 0; 559 | defaultConfigurationName = Release; 560 | }; 561 | B063FC3E1C6BECD9004924A3 /* Build configuration list for PBXNativeTarget "GreedoLayoutExample" */ = { 562 | isa = XCConfigurationList; 563 | buildConfigurations = ( 564 | B063FC3F1C6BECD9004924A3 /* Debug */, 565 | B063FC401C6BECD9004924A3 /* Release */, 566 | ); 567 | defaultConfigurationIsVisible = 0; 568 | defaultConfigurationName = Release; 569 | }; 570 | B063FC411C6BECD9004924A3 /* Build configuration list for PBXNativeTarget "GreedoLayoutExampleTests" */ = { 571 | isa = XCConfigurationList; 572 | buildConfigurations = ( 573 | B063FC421C6BECD9004924A3 /* Debug */, 574 | B063FC431C6BECD9004924A3 /* Release */, 575 | ); 576 | defaultConfigurationIsVisible = 0; 577 | defaultConfigurationName = Release; 578 | }; 579 | /* End XCConfigurationList section */ 580 | }; 581 | rootObject = B063FC141C6BECD9004924A3 /* Project object */; 582 | } 583 | -------------------------------------------------------------------------------- /GreedoLayoutExample/GreedoLayoutExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /GreedoLayoutExample/GreedoLayoutExample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /GreedoLayoutExample/GreedoLayoutExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // GreedoLayoutExample 4 | // 5 | // Created by Denny Hoang on 2016-02-10. 6 | // Copyright © 2016 500px. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /GreedoLayoutExample/GreedoLayoutExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // GreedoLayoutExample 4 | // 5 | // Created by Denny Hoang on 2016-02-10. 6 | // Copyright © 2016 500px. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // 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. 25 | // 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. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // 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. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // 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. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /GreedoLayoutExample/GreedoLayoutExample/Assets.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" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /GreedoLayoutExample/GreedoLayoutExample/Base.lproj/LaunchScreen.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 | 27 | 28 | -------------------------------------------------------------------------------- /GreedoLayoutExample/GreedoLayoutExample/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 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | -------------------------------------------------------------------------------- /GreedoLayoutExample/GreedoLayoutExample/Controllers/HomeTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HomeTableViewController.h 3 | // GreedoLayoutExample 4 | // 5 | // Created by Denny Hoang on 2016-04-11. 6 | // Copyright © 2016 500px. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HomeTableViewController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /GreedoLayoutExample/GreedoLayoutExample/Controllers/HomeTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // HomeTableViewController.m 3 | // GreedoLayoutExample 4 | // 5 | // Created by Denny Hoang on 2016-04-11. 6 | // Copyright © 2016 500px. All rights reserved. 7 | // 8 | 9 | #import "HomeTableViewController.h" 10 | #import "ImageCollectionViewController.h" 11 | 12 | @implementation HomeTableViewController 13 | 14 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 15 | { 16 | if ([segue.identifier isEqualToString:@"fixedHeight"]) { 17 | ((ImageCollectionViewController *)segue.destinationViewController).hasFixedHeight = YES; 18 | } 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /GreedoLayoutExample/GreedoLayoutExample/Controllers/ImageCollectionViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ImageCollectionViewController.h 3 | // GreedoLayoutExample 4 | // 5 | // Created by Denny Hoang on 2016-02-10. 6 | // Copyright © 2016 500px. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GreedoCollectionViewLayout.h" 11 | 12 | @interface ImageCollectionViewController : UIViewController 13 | 14 | @property (assign, nonatomic) BOOL hasFixedHeight; 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /GreedoLayoutExample/GreedoLayoutExample/Controllers/ImageCollectionViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ImageCollectionViewController.m 3 | // GreedoLayoutExample 4 | // 5 | // Created by Denny Hoang on 2016-02-10. 6 | // Copyright © 2016 500px. All rights reserved. 7 | // 8 | 9 | @import Photos; 10 | 11 | #import "ImageCollectionViewController.h" 12 | #import "ImageCollectionViewCell.h" 13 | 14 | @interface ImageCollectionViewController () 15 | 16 | @property (weak, nonatomic) IBOutlet UICollectionView *collectionView; 17 | @property (strong, nonatomic) GreedoCollectionViewLayout *collectionViewSizeCalculator; 18 | @property (strong, nonatomic) PHFetchResult *assetFetchResults; 19 | 20 | @end 21 | 22 | @implementation ImageCollectionViewController 23 | 24 | - (void)viewDidLoad 25 | { 26 | [super viewDidLoad]; 27 | 28 | self.collectionViewSizeCalculator.rowMaximumHeight = CGRectGetHeight(self.collectionView.bounds) / 3; 29 | self.collectionViewSizeCalculator.fixedHeight = self.hasFixedHeight; 30 | 31 | self.automaticallyAdjustsScrollViewInsets = NO; 32 | 33 | self.collectionView.backgroundColor = [UIColor whiteColor]; 34 | 35 | // Configure spacing between cells 36 | UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; 37 | layout.minimumInteritemSpacing = 5.0f; 38 | layout.minimumLineSpacing = 5.0f; 39 | layout.sectionInset = UIEdgeInsetsMake(10.0f, 5.0f, 5.0f, 5.0f); 40 | 41 | self.collectionView.collectionViewLayout = layout; 42 | 43 | [self retrieveImagesFromDevice]; 44 | } 45 | 46 | - (void)retrieveImagesFromDevice 47 | { 48 | PHFetchOptions *allPhotosOptions = [[PHFetchOptions alloc] init]; 49 | allPhotosOptions.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:YES]]; 50 | self.assetFetchResults = [PHAsset fetchAssetsWithOptions:allPhotosOptions]; 51 | [self.collectionView reloadData]; 52 | } 53 | 54 | #pragma mark - 55 | 56 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 57 | { 58 | PHAsset *asset = self.assetFetchResults[indexPath.item]; 59 | 60 | ImageCollectionViewCell *cell = (ImageCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([ImageCollectionViewCell class]) forIndexPath:indexPath]; 61 | cell.backgroundColor = [UIColor clearColor]; 62 | 63 | PHImageRequestOptions *options = [PHImageRequestOptions new]; 64 | options.resizeMode = PHImageRequestOptionsResizeModeFast; 65 | options.deliveryMode = PHImageRequestOptionsDeliveryModeOpportunistic; 66 | options.version = PHImageRequestOptionsVersionCurrent; 67 | options.synchronous = NO; 68 | 69 | CGFloat scale = MIN(2.0, [[UIScreen mainScreen] scale]); 70 | CGSize requestImageSize = CGSizeMake(CGRectGetWidth(cell.bounds) * scale, CGRectGetHeight(cell.bounds) * scale); 71 | [[PHCachingImageManager defaultManager] requestImageForAsset:asset 72 | targetSize:requestImageSize 73 | contentMode:PHImageContentModeAspectFit 74 | options:options 75 | resultHandler:^(UIImage *result, NSDictionary *info) { 76 | cell.imageView.image = result; 77 | }]; 78 | 79 | return cell; 80 | } 81 | 82 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section 83 | { 84 | return self.assetFetchResults.count; 85 | } 86 | 87 | #pragma mark - 88 | 89 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath 90 | { 91 | return [self.collectionViewSizeCalculator sizeForPhotoAtIndexPath:indexPath]; 92 | } 93 | 94 | #pragma mark - 95 | 96 | - (CGSize)greedoCollectionViewLayout:(GreedoCollectionViewLayout *)layout originalImageSizeAtIndexPath:(NSIndexPath *)indexPath 97 | { 98 | // Return the image size to GreedoCollectionViewLayout 99 | if (indexPath.item < self.assetFetchResults.count) { 100 | PHAsset *asset = self.assetFetchResults[indexPath.item]; 101 | return CGSizeMake(asset.pixelWidth, asset.pixelHeight); 102 | } 103 | 104 | return CGSizeMake(0.1, 0.1); 105 | } 106 | 107 | #pragma mark - Lazy Loading 108 | 109 | - (GreedoCollectionViewLayout *)collectionViewSizeCalculator 110 | { 111 | if (!_collectionViewSizeCalculator) { 112 | _collectionViewSizeCalculator = [[GreedoCollectionViewLayout alloc] initWithCollectionView:self.collectionView]; 113 | _collectionViewSizeCalculator.dataSource = self; 114 | } 115 | 116 | return _collectionViewSizeCalculator; 117 | } 118 | 119 | @end 120 | -------------------------------------------------------------------------------- /GreedoLayoutExample/GreedoLayoutExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 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 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /GreedoLayoutExample/GreedoLayoutExample/Views/ImageCollectionViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // ImageCollectionViewCell.h 3 | // GreedoLayoutExample 4 | // 5 | // Created by Denny Hoang on 2016-02-11. 6 | // Copyright © 2016 500px. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ImageCollectionViewCell : UICollectionViewCell 12 | 13 | @property (weak, nonatomic) IBOutlet UIImageView *imageView; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /GreedoLayoutExample/GreedoLayoutExample/Views/ImageCollectionViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // ImageCollectionViewCell.m 3 | // GreedoLayoutExample 4 | // 5 | // Created by Denny Hoang on 2016-02-11. 6 | // Copyright © 2016 500px. All rights reserved. 7 | // 8 | 9 | #import "ImageCollectionViewCell.h" 10 | 11 | @implementation ImageCollectionViewCell 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /GreedoLayoutExample/GreedoLayoutExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GreedoLayoutExample 4 | // 5 | // Created by Denny Hoang on 2016-02-10. 6 | // Copyright © 2016 500px. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /GreedoLayoutExample/GreedoLayoutExampleTests/GreedoLayoutExampleTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // GreedoLayoutExampleTests.m 3 | // GreedoLayoutExampleTests 4 | // 5 | // Created by Denny Hoang on 2016-02-10. 6 | // Copyright © 2016 500px. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GreedoLayoutExampleTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation GreedoLayoutExampleTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /GreedoLayoutExample/GreedoLayoutExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 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 | -------------------------------------------------------------------------------- /GreedoLayoutExample/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '8.0' 3 | # Uncomment this line if you're using Swift 4 | # use_frameworks! 5 | 6 | target 'GreedoLayoutExample' do 7 | # Normal usage 8 | # pod 'GreedoLayout' 9 | 10 | # Use the GreedoLayout pod associated to the commit 11 | pod 'GreedoLayout', path: '../' 12 | end 13 | 14 | target 'GreedoLayoutExampleTests' do 15 | # Normal usage 16 | # pod 'GreedoLayout' 17 | 18 | # Use the GreedoLayout pod associated to the commit 19 | pod 'GreedoLayout', path: '../' 20 | end 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 500px 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. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Greedo Layout for iOS 2 | 3 | [![Version](https://img.shields.io/cocoapods/v/GreedoLayout.svg?style=flat)](https://cocoapods.org/pods/GreedoLayout) 4 | [![License](https://img.shields.io/cocoapods/l/GreedoLayout.svg?style=flat)](https://cocoapods.org/pods/GreedoLayout) 5 | [![Platform](https://img.shields.io/cocoapods/p/GreedoLayout.svg?style=flat)](https://cocoapods.org/pods/GreedoLayout) 6 | 7 | A library that computes what size the `UICollectionView` cells should be to 8 | display images in a variable height fixed aspect ratio grid. 9 | 10 | ![image](screenshot.png) 11 | 12 | ### Getting Started 13 | 14 | #### Installation with CocoaPods 15 | 16 | [CocoaPods](cocoapods.org) is a 3rd-party dependency manager for Swift and 17 | Objective-C projects. For more information, refer to the [CocoaPods Getting Started Guide](https://guides.cocoapods.org/using/getting-started.html). 18 | Otherwise, you can install CocoaPods with the following command: 19 | 20 | ```bash 21 | $ gem install cocoapods 22 | ``` 23 | 24 | ##### Podfile 25 | 26 | To integrate GreedoLayout into your Xcode project using CocoaPods, specify it in 27 | your `Podfile`: 28 | 29 | ```ruby 30 | source 'https://github.com/CocoaPods/Specs.git' 31 | pod 'GreedoLayout' 32 | ``` 33 | 34 | Then, run the following command: 35 | 36 | ```bash 37 | $ pod install 38 | ``` 39 | 40 | ### License 41 | 42 | GreedoLayout is released under the MIT license. See `LICENSE` for details. 43 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/500px/greedo-layout-for-ios/2a15a09fdd71bf88c1732f9ee73bf16f369147e5/screenshot.png --------------------------------------------------------------------------------