├── BidirectionalCollection
├── Demo.gif
├── ViewController.h
├── AppDelegate.h
├── main.m
├── Images.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Info.plist
├── AppDelegate.m
├── ViewController.m
└── Base.lproj
│ ├── LaunchScreen.xib
│ └── Main.storyboard
├── BidirectionalCollection.xcodeproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── BidirectionalCollection.xcscmblueprint
│ │ └── BidirectionalCollection.xccheckout
└── project.pbxproj
├── README.md
├── BidirectionalCollectionLayout
├── BidirectionCollectionLayout.h
└── BidirectionCollectionLayout.m
├── BidirectionalCollectionTests
├── Info.plist
└── BidirectionalCollectionTests.m
├── LICENSE
└── .gitignore
/BidirectionalCollection/Demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akashraje/BidirectionalCollectionViewLayout/HEAD/BidirectionalCollection/Demo.gif
--------------------------------------------------------------------------------
/BidirectionalCollection.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/BidirectionalCollection/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // BidirectionalCollection
4 | //
5 | // Created by Akash Raje on 18/07/15.
6 | // Copyright (c) 2015 Akash Raje. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # BidirectionalCollectionViewLayout
2 | An example with Custom CollectionViewLayout which will allow CollectionView to scroll in both Directions. Persisting the CollectionView's cell reusability.
3 | Also includes the option capability of floating headers.
4 |
5 | 
6 |
--------------------------------------------------------------------------------
/BidirectionalCollection/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // BidirectionalCollection
4 | //
5 | // Created by Akash Raje on 18/07/15.
6 | // Copyright (c) 2015 Akash Raje. 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 |
--------------------------------------------------------------------------------
/BidirectionalCollection/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // BidirectionalCollection
4 | //
5 | // Created by Akash Raje on 18/07/15.
6 | // Copyright (c) 2015 Akash Raje. 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 |
--------------------------------------------------------------------------------
/BidirectionalCollectionLayout/BidirectionCollectionLayout.h:
--------------------------------------------------------------------------------
1 | //
2 | // BidirectionCollectionLayout.h
3 | // BidirectionalCollectionView
4 | //
5 | // Created by Akash Raje on 14/07/15.
6 | // Copyright (c) 2015 Akash Raje. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @protocol BidirectionalCollectionLayoutDelegate
12 | @optional
13 | - (BOOL)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout shouldFloatSectionAtIndex:(NSInteger)section;
14 |
15 | @end
16 |
17 | @interface BidirectionCollectionLayout : UICollectionViewFlowLayout
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/BidirectionalCollectionTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | com.akashraje.$(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 |
--------------------------------------------------------------------------------
/BidirectionalCollectionTests/BidirectionalCollectionTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // BidirectionalCollectionTests.m
3 | // BidirectionalCollectionTests
4 | //
5 | // Created by Akash Raje on 18/07/15.
6 | // Copyright (c) 2015 Akash Raje. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface BidirectionalCollectionTests : XCTestCase
13 |
14 | @end
15 |
16 | @implementation BidirectionalCollectionTests
17 |
18 | - (void)setUp {
19 | [super setUp];
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 | }
22 |
23 | - (void)tearDown {
24 | // Put teardown code here. This method is called after the invocation of each test method in the class.
25 | [super tearDown];
26 | }
27 |
28 | - (void)testExample {
29 | // This is an example of a functional test case.
30 | XCTAssert(YES, @"Pass");
31 | }
32 |
33 | - (void)testPerformanceExample {
34 | // This is an example of a performance test case.
35 | [self measureBlock:^{
36 | // Put the code you want to measure the time of here.
37 | }];
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 akashraje
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 |
23 |
--------------------------------------------------------------------------------
/BidirectionalCollection/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" : "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 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4 |
5 | ## Build generated
6 | build/
7 | DerivedData/
8 |
9 | ## Various settings
10 | *.pbxuser
11 | !default.pbxuser
12 | *.mode1v3
13 | !default.mode1v3
14 | *.mode2v3
15 | !default.mode2v3
16 | *.perspectivev3
17 | !default.perspectivev3
18 | xcuserdata/
19 |
20 | ## Other
21 | *.moved-aside
22 | *.xcuserstate
23 |
24 | ## Obj-C/Swift specific
25 | *.hmap
26 | *.ipa
27 | *.dSYM.zip
28 | *.dSYM
29 |
30 | # CocoaPods
31 | #
32 | # We recommend against adding the Pods directory to your .gitignore. However
33 | # you should judge for yourself, the pros and cons are mentioned at:
34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
35 | #
36 | # Pods/
37 |
38 | # Carthage
39 | #
40 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
41 | # Carthage/Checkouts
42 |
43 | Carthage/Build
44 |
45 | # fastlane
46 | #
47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
48 | # screenshots whenever they are needed.
49 | # For more information about the recommended setup visit:
50 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
51 |
52 | fastlane/report.xml
53 | fastlane/screenshots
54 |
55 | # Code Injection
56 | #
57 | # After new code Injection tools there's a generated folder /iOSInjectionProject
58 | # https://github.com/johnno1962/injectionforxcode
59 |
60 | iOSInjectionProject/
--------------------------------------------------------------------------------
/BidirectionalCollection/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | com.akashraje.$(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 | 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 |
--------------------------------------------------------------------------------
/BidirectionalCollection.xcodeproj/project.xcworkspace/xcshareddata/BidirectionalCollection.xcscmblueprint:
--------------------------------------------------------------------------------
1 | {
2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "92B8CBFD77C99B68CD66E5B93D1E6503BBA53123",
3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {
4 |
5 | },
6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
7 | "13E080F07A96198B9F431262607FD27AA7D84BF1" : 0,
8 | "92B8CBFD77C99B68CD66E5B93D1E6503BBA53123" : 0
9 | },
10 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "86056711-C572-4D34-A0C0-7056EAFB6F74",
11 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
12 | "13E080F07A96198B9F431262607FD27AA7D84BF1" : "BidirectionCollectionView",
13 | "92B8CBFD77C99B68CD66E5B93D1E6503BBA53123" : "BidirectionalCollectionViewLayout"
14 | },
15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "BidirectionalCollection",
16 | "DVTSourceControlWorkspaceBlueprintVersion" : 204,
17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "BidirectionalCollection.xcodeproj",
18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
19 | {
20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/akashraje\/BidirectionCollectionView.git",
21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "13E080F07A96198B9F431262607FD27AA7D84BF1"
23 | },
24 | {
25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/akashraje\/BidirectionalCollectionViewLayout.git",
26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "92B8CBFD77C99B68CD66E5B93D1E6503BBA53123"
28 | }
29 | ]
30 | }
--------------------------------------------------------------------------------
/BidirectionalCollection/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // BidirectionalCollection
4 | //
5 | // Created by Akash Raje on 18/07/15.
6 | // Copyright (c) 2015 Akash Raje. 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 |
--------------------------------------------------------------------------------
/BidirectionalCollection.xcodeproj/project.xcworkspace/xcshareddata/BidirectionalCollection.xccheckout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDESourceControlProjectFavoriteDictionaryKey
6 |
7 | IDESourceControlProjectIdentifier
8 | 86056711-C572-4D34-A0C0-7056EAFB6F74
9 | IDESourceControlProjectName
10 | BidirectionalCollection
11 | IDESourceControlProjectOriginsDictionary
12 |
13 | 13E080F07A96198B9F431262607FD27AA7D84BF1
14 | https://github.com/akashraje/BidirectionCollectionView.git
15 | 92B8CBFD77C99B68CD66E5B93D1E6503BBA53123
16 | https://github.com/akashraje/BidirectionalCollectionViewLayout.git
17 |
18 | IDESourceControlProjectPath
19 | BidirectionalCollection.xcodeproj
20 | IDESourceControlProjectRelativeInstallPathDictionary
21 |
22 | 13E080F07A96198B9F431262607FD27AA7D84BF1
23 | ../../../BidirectionCollectionView
24 | 92B8CBFD77C99B68CD66E5B93D1E6503BBA53123
25 | ../..
26 |
27 | IDESourceControlProjectURL
28 | https://github.com/akashraje/BidirectionalCollectionViewLayout.git
29 | IDESourceControlProjectVersion
30 | 111
31 | IDESourceControlProjectWCCIdentifier
32 | 92B8CBFD77C99B68CD66E5B93D1E6503BBA53123
33 | IDESourceControlProjectWCConfigurations
34 |
35 |
36 | IDESourceControlRepositoryExtensionIdentifierKey
37 | public.vcs.git
38 | IDESourceControlWCCIdentifierKey
39 | 92B8CBFD77C99B68CD66E5B93D1E6503BBA53123
40 | IDESourceControlWCCName
41 | BidirectionalCollectionViewLayout
42 |
43 |
44 | IDESourceControlRepositoryExtensionIdentifierKey
45 | public.vcs.git
46 | IDESourceControlWCCIdentifierKey
47 | 13E080F07A96198B9F431262607FD27AA7D84BF1
48 | IDESourceControlWCCName
49 | BidirectionCollectionView
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/BidirectionalCollection/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // BidirectionalCollection
4 | //
5 | // Created by Akash Raje on 18/07/15.
6 | // Copyright (c) 2015 Akash Raje. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 |
11 | @interface CollectionCell : UICollectionViewCell
12 | {
13 |
14 | __weak IBOutlet UILabel *_lblIndex;
15 | }
16 | @property (nonatomic, strong) NSString* index;
17 | @end
18 |
19 | @implementation CollectionCell
20 |
21 | - (void)setIndex:(NSString *)index {
22 | _index = index;
23 | _lblIndex.text = index;
24 | }
25 | @end
26 |
27 |
28 | @interface ViewController ()
29 | {
30 | __weak IBOutlet UICollectionView *_collectionView;
31 |
32 | }
33 | @end
34 |
35 | @implementation ViewController
36 |
37 | - (void)viewDidLoad {
38 | [super viewDidLoad];
39 | // Do any additional setup after loading the view, typically from a nib.
40 | }
41 |
42 | - (void)didReceiveMemoryWarning {
43 | [super didReceiveMemoryWarning];
44 | // Dispose of any resources that can be recreated.
45 | }
46 |
47 | #pragma --mark CollectionView DataSource
48 |
49 | - (NSInteger)collectionView:(UICollectionView *)view numberOfItemsInSection:(NSInteger)section
50 | {
51 | return 10;
52 | }
53 |
54 | - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
55 | return 10;
56 | }
57 |
58 | - (CGSize)collectionView:(UICollectionView *)cv layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
59 | {
60 | return (indexPath.section == 0) ? CGSizeMake(200, 80) : CGSizeMake(200, 200);
61 | }
62 |
63 | - (BOOL)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout shouldFloatSectionAtIndex:(NSInteger)section
64 | {
65 | return (section == 0);
66 | }
67 |
68 | - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section
69 | {
70 | return 10.f;
71 | }
72 |
73 | - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
74 | {
75 | return 10.f;
76 | }
77 |
78 | - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
79 | {
80 | return UIEdgeInsetsMake(10, 10, 10, 10);
81 | }
82 |
83 | - (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath {
84 |
85 | CollectionCell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"CollectionCellId" forIndexPath:indexPath];
86 | cell.index = [NSString stringWithFormat:@"%ld - %ld",(long)indexPath.section, (long)indexPath.row];
87 | if (indexPath.section == 0) {
88 | cell.backgroundColor = [UIColor orangeColor];
89 | } else {
90 | cell.backgroundColor = [UIColor whiteColor];
91 | }
92 | return cell;
93 | }
94 | @end
95 |
96 |
--------------------------------------------------------------------------------
/BidirectionalCollection/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
20 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/BidirectionalCollection/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 |
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 |
--------------------------------------------------------------------------------
/BidirectionalCollectionLayout/BidirectionCollectionLayout.m:
--------------------------------------------------------------------------------
1 | //
2 | // BidirectionCollectionLayout.m
3 | // BidirectionalCollectionView
4 | //
5 | // Created by Akash Raje on 14/07/15.
6 | // Copyright (c) 2015 Akash Raje. All rights reserved.
7 | //
8 |
9 | #import "BidirectionCollectionLayout.h"
10 |
11 | @interface BidirectionCollectionLayout ()
12 |
13 | @end
14 |
15 | @implementation BidirectionCollectionLayout
16 | {
17 | NSDictionary *_layoutInfo;
18 | UIEdgeInsets maxInsets;
19 | CGFloat maxRowsWidth;
20 | CGFloat maxColumnHeight;
21 | __weak id delegate;
22 | }
23 |
24 | - (void)prepareLayout
25 | {
26 | delegate = (id) self.collectionView.delegate;
27 | //Calculate max values
28 | maxInsets = [self maxInsets];
29 | maxRowsWidth = [self maxRowWidth];
30 | maxColumnHeight = [self maxColumnHeight];
31 |
32 | //Store calculated frames for cells in the dictionary
33 | NSMutableDictionary *cellLayoutInfo = [NSMutableDictionary dictionary];
34 |
35 | //Calculate Frame for a cell, per values from DataSource
36 | CGFloat originY = 0;
37 | CGFloat floatingSectionOriginY = self.collectionView.contentOffset.y;
38 | BOOL sectionIsFloating = NO;
39 |
40 | for (NSInteger section = 0; section < [self.collectionView numberOfSections]; section++) {
41 |
42 | UIEdgeInsets itemInsets = UIEdgeInsetsZero;
43 | if ([delegate respondsToSelector:@selector(collectionView:layout:insetForSectionAtIndex:)]) {
44 | itemInsets = [delegate collectionView:self.collectionView layout:self insetForSectionAtIndex:section];
45 | originY += itemInsets.top;
46 | }
47 |
48 | CGFloat height = 0;
49 | NSInteger itemCount = [self.collectionView numberOfItemsInSection:section];
50 | CGFloat originX = itemInsets.left;
51 |
52 | if ([delegate respondsToSelector:@selector(collectionView:layout:shouldFloatSectionAtIndex:)]) {
53 | sectionIsFloating = [delegate collectionView:self.collectionView layout:self shouldFloatSectionAtIndex:section];
54 | }
55 | for (NSInteger item = 0; item < itemCount; item++) {
56 | NSIndexPath *indexPath = [NSIndexPath indexPathForItem:item inSection:section];
57 |
58 | UICollectionViewLayoutAttributes *itemAttributes = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath];
59 | CGSize itemSize = CGSizeZero;
60 | if ([delegate respondsToSelector:@selector(collectionView:layout:sizeForItemAtIndexPath:)]) {
61 | itemSize = [delegate collectionView:self.collectionView layout:self sizeForItemAtIndexPath:indexPath];
62 |
63 | float selectedOriginY = originY;
64 | if (sectionIsFloating) {
65 | if (floatingSectionOriginY >= originY) {
66 | selectedOriginY = floatingSectionOriginY;
67 | }
68 | itemAttributes.zIndex = 1000;//any value greater than '0'
69 | }
70 |
71 | itemAttributes.frame = CGRectMake(originX, selectedOriginY, itemSize.width, itemSize.height);
72 | }
73 | cellLayoutInfo[indexPath] = itemAttributes;
74 |
75 | CGFloat interItemSpacingX = 0;
76 | if ([delegate respondsToSelector:@selector(collectionView:layout:minimumInteritemSpacingForSectionAtIndex:)]) {
77 | interItemSpacingX = [delegate collectionView:self.collectionView layout:self minimumInteritemSpacingForSectionAtIndex:section];
78 | }
79 |
80 | originX += floorf(itemSize.width + interItemSpacingX);
81 | height = height > itemSize.height ? height : itemSize.height;
82 | }
83 |
84 | CGFloat interItemSpacingY = 0;
85 | if ([delegate respondsToSelector:@selector(collectionView:layout:minimumLineSpacingForSectionAtIndex:)]) {
86 | interItemSpacingY = [delegate collectionView:self.collectionView layout:self minimumLineSpacingForSectionAtIndex:section];
87 | }
88 |
89 | originY += floor(height + interItemSpacingY);
90 | if (sectionIsFloating) {
91 | floatingSectionOriginY += height;
92 | }
93 | }
94 |
95 | _layoutInfo = cellLayoutInfo;
96 | }
97 |
98 | - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect
99 | {
100 | NSMutableArray *allAttributes = [NSMutableArray arrayWithCapacity:_layoutInfo.count];
101 |
102 | [_layoutInfo enumerateKeysAndObjectsUsingBlock:^(NSIndexPath *indexPath,
103 | UICollectionViewLayoutAttributes *attributes,
104 | BOOL *innerStop) {
105 | if (CGRectIntersectsRect(rect, attributes.frame)) {
106 | [allAttributes addObject:attributes];
107 | }
108 | }];
109 |
110 | return allAttributes;
111 | }
112 |
113 | - (BOOL) shouldInvalidateLayoutForBoundsChange:(CGRect)newBound
114 | {
115 | return YES;
116 | }
117 |
118 | - (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath
119 | {
120 | return _layoutInfo[indexPath];
121 | }
122 |
123 | - (CGSize)collectionViewContentSize
124 | {
125 | CGFloat width = maxInsets.left
126 | + maxRowsWidth
127 | + maxInsets.right;
128 |
129 | CGFloat height = maxInsets.top
130 | + maxColumnHeight
131 | + maxInsets.bottom;
132 |
133 | return CGSizeMake(width, height);
134 | }
135 |
136 | //Maximum width of perticular section in CollectionView
137 | - (CGFloat)maxRowWidth
138 | {
139 | NSInteger sectionCount = [self.collectionView numberOfSections];
140 | CGFloat maxRowWidth = 0;
141 | for (NSInteger section = 0; section < sectionCount; section++) {
142 | CGFloat maxWidth = 0;
143 | NSInteger itemCount = [self.collectionView numberOfItemsInSection:section];
144 |
145 | //Find total width of this section.
146 | for (NSInteger item = 0; item < itemCount; item++) {
147 | NSIndexPath *indexPath = [NSIndexPath indexPathForItem:item inSection:section];
148 |
149 | if ([delegate respondsToSelector:@selector(collectionView:layout:sizeForItemAtIndexPath:)]) {
150 | CGSize itemSize = [delegate collectionView:self.collectionView layout:self sizeForItemAtIndexPath:indexPath];
151 | maxWidth += itemSize.width ;
152 | }
153 | }
154 |
155 | CGFloat interItemSpace = 0;
156 | if ([delegate respondsToSelector:@selector(collectionView:layout:minimumInteritemSpacingForSectionAtIndex:)]) {
157 | CGFloat interItemSpacingX = [delegate collectionView:self.collectionView layout:self minimumInteritemSpacingForSectionAtIndex:section];
158 | UIEdgeInsets itemInsets = UIEdgeInsetsZero;
159 | if ([delegate respondsToSelector:@selector(collectionView:layout:insetForSectionAtIndex:)]) {
160 | itemInsets = [delegate collectionView:self.collectionView layout:self insetForSectionAtIndex:section];
161 | }
162 |
163 | interItemSpace = interItemSpacingX * (itemCount - 1);
164 | }
165 | maxWidth += interItemSpace;
166 | maxRowWidth = maxWidth > maxRowWidth ? maxWidth : maxRowWidth;
167 | }
168 |
169 | return maxRowWidth;
170 | }
171 |
172 | //Maximum Height of perticular Column in CollectionView
173 | - (CGFloat)maxColumnHeight
174 | {
175 | NSInteger sectionCount = [self.collectionView numberOfSections];
176 | CGFloat maxHeight = 0;
177 | for (NSInteger section = 0; section < sectionCount; section++) {
178 | NSInteger itemCount = [self.collectionView numberOfItemsInSection:section];
179 | CGFloat maxRowHeight = 0;
180 | for (NSInteger item = 0; item < itemCount; item++) {
181 | NSIndexPath *indexPath = [NSIndexPath indexPathForItem:item inSection:section];
182 | if ([delegate respondsToSelector:@selector(collectionView:layout:sizeForItemAtIndexPath:)]) {
183 | CGSize itemSize = [delegate collectionView:self.collectionView layout:self sizeForItemAtIndexPath:indexPath];
184 | maxRowHeight = itemSize.height > maxRowHeight ? itemSize.height : maxRowHeight;
185 | }
186 | }
187 | CGFloat interSectionSpacingY = 0;
188 | if ([delegate respondsToSelector:@selector(collectionView:layout:minimumLineSpacingForSectionAtIndex:)]) {
189 | interSectionSpacingY = [delegate collectionView:self.collectionView layout:self minimumLineSpacingForSectionAtIndex:section];
190 | }
191 |
192 | UIEdgeInsets itemInsets = UIEdgeInsetsZero;
193 | if ([delegate respondsToSelector:@selector(collectionView:layout:insetForSectionAtIndex:)]) {
194 | itemInsets = [delegate collectionView:self.collectionView layout:self insetForSectionAtIndex:section];
195 | }
196 |
197 | maxHeight += maxRowHeight;
198 |
199 | //Add interSectionSpacing and Insets for all sections except last.
200 | if (section != sectionCount-1) {
201 | maxHeight += interSectionSpacingY + itemInsets.top;
202 | }
203 | }
204 |
205 | return maxHeight;
206 | }
207 |
208 | - (UIEdgeInsets)maxInsets
209 | {
210 | UIEdgeInsets maxEdgeInsets = UIEdgeInsetsZero;
211 | NSInteger sectionCount = [self.collectionView numberOfSections];
212 | if ([delegate respondsToSelector:@selector(collectionView:layout:insetForSectionAtIndex:)]) {
213 | UIEdgeInsets topRowInsets = [delegate collectionView:self.collectionView layout:self insetForSectionAtIndex:0];
214 | UIEdgeInsets bottomRowInsets = [delegate collectionView:self.collectionView layout:self insetForSectionAtIndex:sectionCount];
215 | maxEdgeInsets.top = topRowInsets.top;
216 | maxEdgeInsets.bottom = bottomRowInsets.bottom;
217 | }
218 |
219 | for (NSInteger section = 0; section < sectionCount; section++) {
220 | if ([delegate respondsToSelector:@selector(collectionView:layout:insetForSectionAtIndex:)]) {
221 | UIEdgeInsets itemInsets = [delegate collectionView:self.collectionView layout:self insetForSectionAtIndex:section];
222 | maxEdgeInsets.left = itemInsets.left;
223 | maxEdgeInsets.right = itemInsets.right;
224 | }
225 | }
226 |
227 | return maxEdgeInsets;
228 | }
229 |
230 | @end
231 |
--------------------------------------------------------------------------------
/BidirectionalCollection.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 5628FFAF1B5AB1EA00D89F45 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5628FFAE1B5AB1EA00D89F45 /* main.m */; };
11 | 5628FFB21B5AB1EA00D89F45 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5628FFB11B5AB1EA00D89F45 /* AppDelegate.m */; };
12 | 5628FFB51B5AB1EA00D89F45 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5628FFB41B5AB1EA00D89F45 /* ViewController.m */; };
13 | 5628FFB81B5AB1EA00D89F45 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5628FFB61B5AB1EA00D89F45 /* Main.storyboard */; };
14 | 5628FFBA1B5AB1EA00D89F45 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5628FFB91B5AB1EA00D89F45 /* Images.xcassets */; };
15 | 5628FFBD1B5AB1EA00D89F45 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5628FFBB1B5AB1EA00D89F45 /* LaunchScreen.xib */; };
16 | 5628FFC91B5AB1EA00D89F45 /* BidirectionalCollectionTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5628FFC81B5AB1EA00D89F45 /* BidirectionalCollectionTests.m */; };
17 | 5628FFD51B5AB29B00D89F45 /* BidirectionCollectionLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 5628FFD41B5AB29B00D89F45 /* BidirectionCollectionLayout.m */; };
18 | 56CE83E11BEE082E007BC3BE /* Demo.gif in Resources */ = {isa = PBXBuildFile; fileRef = 56CE83E01BEE082E007BC3BE /* Demo.gif */; };
19 | /* End PBXBuildFile section */
20 |
21 | /* Begin PBXContainerItemProxy section */
22 | 5628FFC31B5AB1EA00D89F45 /* PBXContainerItemProxy */ = {
23 | isa = PBXContainerItemProxy;
24 | containerPortal = 5628FFA11B5AB1EA00D89F45 /* Project object */;
25 | proxyType = 1;
26 | remoteGlobalIDString = 5628FFA81B5AB1EA00D89F45;
27 | remoteInfo = BidirectionalCollection;
28 | };
29 | /* End PBXContainerItemProxy section */
30 |
31 | /* Begin PBXFileReference section */
32 | 5628FFA91B5AB1EA00D89F45 /* BidirectionalCollection.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BidirectionalCollection.app; sourceTree = BUILT_PRODUCTS_DIR; };
33 | 5628FFAD1B5AB1EA00D89F45 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
34 | 5628FFAE1B5AB1EA00D89F45 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
35 | 5628FFB01B5AB1EA00D89F45 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
36 | 5628FFB11B5AB1EA00D89F45 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
37 | 5628FFB31B5AB1EA00D89F45 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; };
38 | 5628FFB41B5AB1EA00D89F45 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; };
39 | 5628FFB71B5AB1EA00D89F45 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
40 | 5628FFB91B5AB1EA00D89F45 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
41 | 5628FFBC1B5AB1EA00D89F45 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; };
42 | 5628FFC21B5AB1EA00D89F45 /* BidirectionalCollectionTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BidirectionalCollectionTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
43 | 5628FFC71B5AB1EA00D89F45 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
44 | 5628FFC81B5AB1EA00D89F45 /* BidirectionalCollectionTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BidirectionalCollectionTests.m; sourceTree = ""; };
45 | 5628FFD31B5AB29B00D89F45 /* BidirectionCollectionLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BidirectionCollectionLayout.h; sourceTree = ""; };
46 | 5628FFD41B5AB29B00D89F45 /* BidirectionCollectionLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BidirectionCollectionLayout.m; sourceTree = ""; };
47 | 56CE83E01BEE082E007BC3BE /* Demo.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = Demo.gif; sourceTree = ""; };
48 | /* End PBXFileReference section */
49 |
50 | /* Begin PBXFrameworksBuildPhase section */
51 | 5628FFA61B5AB1EA00D89F45 /* Frameworks */ = {
52 | isa = PBXFrameworksBuildPhase;
53 | buildActionMask = 2147483647;
54 | files = (
55 | );
56 | runOnlyForDeploymentPostprocessing = 0;
57 | };
58 | 5628FFBF1B5AB1EA00D89F45 /* Frameworks */ = {
59 | isa = PBXFrameworksBuildPhase;
60 | buildActionMask = 2147483647;
61 | files = (
62 | );
63 | runOnlyForDeploymentPostprocessing = 0;
64 | };
65 | /* End PBXFrameworksBuildPhase section */
66 |
67 | /* Begin PBXGroup section */
68 | 5628FFA01B5AB1EA00D89F45 = {
69 | isa = PBXGroup;
70 | children = (
71 | 5628FFD21B5AB29B00D89F45 /* BidirectionalCollectionLayout */,
72 | 5628FFAB1B5AB1EA00D89F45 /* BidirectionalCollection */,
73 | 5628FFC51B5AB1EA00D89F45 /* BidirectionalCollectionTests */,
74 | 5628FFAA1B5AB1EA00D89F45 /* Products */,
75 | );
76 | sourceTree = "";
77 | };
78 | 5628FFAA1B5AB1EA00D89F45 /* Products */ = {
79 | isa = PBXGroup;
80 | children = (
81 | 5628FFA91B5AB1EA00D89F45 /* BidirectionalCollection.app */,
82 | 5628FFC21B5AB1EA00D89F45 /* BidirectionalCollectionTests.xctest */,
83 | );
84 | name = Products;
85 | sourceTree = "";
86 | };
87 | 5628FFAB1B5AB1EA00D89F45 /* BidirectionalCollection */ = {
88 | isa = PBXGroup;
89 | children = (
90 | 5628FFB01B5AB1EA00D89F45 /* AppDelegate.h */,
91 | 5628FFB11B5AB1EA00D89F45 /* AppDelegate.m */,
92 | 5628FFB31B5AB1EA00D89F45 /* ViewController.h */,
93 | 5628FFB41B5AB1EA00D89F45 /* ViewController.m */,
94 | 5628FFB61B5AB1EA00D89F45 /* Main.storyboard */,
95 | 5628FFB91B5AB1EA00D89F45 /* Images.xcassets */,
96 | 5628FFBB1B5AB1EA00D89F45 /* LaunchScreen.xib */,
97 | 56CE83E01BEE082E007BC3BE /* Demo.gif */,
98 | 5628FFAC1B5AB1EA00D89F45 /* Supporting Files */,
99 | );
100 | path = BidirectionalCollection;
101 | sourceTree = "";
102 | };
103 | 5628FFAC1B5AB1EA00D89F45 /* Supporting Files */ = {
104 | isa = PBXGroup;
105 | children = (
106 | 5628FFAD1B5AB1EA00D89F45 /* Info.plist */,
107 | 5628FFAE1B5AB1EA00D89F45 /* main.m */,
108 | );
109 | name = "Supporting Files";
110 | sourceTree = "";
111 | };
112 | 5628FFC51B5AB1EA00D89F45 /* BidirectionalCollectionTests */ = {
113 | isa = PBXGroup;
114 | children = (
115 | 5628FFC81B5AB1EA00D89F45 /* BidirectionalCollectionTests.m */,
116 | 5628FFC61B5AB1EA00D89F45 /* Supporting Files */,
117 | );
118 | path = BidirectionalCollectionTests;
119 | sourceTree = "";
120 | };
121 | 5628FFC61B5AB1EA00D89F45 /* Supporting Files */ = {
122 | isa = PBXGroup;
123 | children = (
124 | 5628FFC71B5AB1EA00D89F45 /* Info.plist */,
125 | );
126 | name = "Supporting Files";
127 | sourceTree = "";
128 | };
129 | 5628FFD21B5AB29B00D89F45 /* BidirectionalCollectionLayout */ = {
130 | isa = PBXGroup;
131 | children = (
132 | 5628FFD31B5AB29B00D89F45 /* BidirectionCollectionLayout.h */,
133 | 5628FFD41B5AB29B00D89F45 /* BidirectionCollectionLayout.m */,
134 | );
135 | path = BidirectionalCollectionLayout;
136 | sourceTree = "";
137 | };
138 | /* End PBXGroup section */
139 |
140 | /* Begin PBXNativeTarget section */
141 | 5628FFA81B5AB1EA00D89F45 /* BidirectionalCollection */ = {
142 | isa = PBXNativeTarget;
143 | buildConfigurationList = 5628FFCC1B5AB1EA00D89F45 /* Build configuration list for PBXNativeTarget "BidirectionalCollection" */;
144 | buildPhases = (
145 | 5628FFA51B5AB1EA00D89F45 /* Sources */,
146 | 5628FFA61B5AB1EA00D89F45 /* Frameworks */,
147 | 5628FFA71B5AB1EA00D89F45 /* Resources */,
148 | );
149 | buildRules = (
150 | );
151 | dependencies = (
152 | );
153 | name = BidirectionalCollection;
154 | productName = BidirectionalCollection;
155 | productReference = 5628FFA91B5AB1EA00D89F45 /* BidirectionalCollection.app */;
156 | productType = "com.apple.product-type.application";
157 | };
158 | 5628FFC11B5AB1EA00D89F45 /* BidirectionalCollectionTests */ = {
159 | isa = PBXNativeTarget;
160 | buildConfigurationList = 5628FFCF1B5AB1EA00D89F45 /* Build configuration list for PBXNativeTarget "BidirectionalCollectionTests" */;
161 | buildPhases = (
162 | 5628FFBE1B5AB1EA00D89F45 /* Sources */,
163 | 5628FFBF1B5AB1EA00D89F45 /* Frameworks */,
164 | 5628FFC01B5AB1EA00D89F45 /* Resources */,
165 | );
166 | buildRules = (
167 | );
168 | dependencies = (
169 | 5628FFC41B5AB1EA00D89F45 /* PBXTargetDependency */,
170 | );
171 | name = BidirectionalCollectionTests;
172 | productName = BidirectionalCollectionTests;
173 | productReference = 5628FFC21B5AB1EA00D89F45 /* BidirectionalCollectionTests.xctest */;
174 | productType = "com.apple.product-type.bundle.unit-test";
175 | };
176 | /* End PBXNativeTarget section */
177 |
178 | /* Begin PBXProject section */
179 | 5628FFA11B5AB1EA00D89F45 /* Project object */ = {
180 | isa = PBXProject;
181 | attributes = {
182 | LastUpgradeCheck = 0610;
183 | ORGANIZATIONNAME = "Akash Raje";
184 | TargetAttributes = {
185 | 5628FFA81B5AB1EA00D89F45 = {
186 | CreatedOnToolsVersion = 6.1.1;
187 | };
188 | 5628FFC11B5AB1EA00D89F45 = {
189 | CreatedOnToolsVersion = 6.1.1;
190 | TestTargetID = 5628FFA81B5AB1EA00D89F45;
191 | };
192 | };
193 | };
194 | buildConfigurationList = 5628FFA41B5AB1EA00D89F45 /* Build configuration list for PBXProject "BidirectionalCollection" */;
195 | compatibilityVersion = "Xcode 3.2";
196 | developmentRegion = English;
197 | hasScannedForEncodings = 0;
198 | knownRegions = (
199 | en,
200 | Base,
201 | );
202 | mainGroup = 5628FFA01B5AB1EA00D89F45;
203 | productRefGroup = 5628FFAA1B5AB1EA00D89F45 /* Products */;
204 | projectDirPath = "";
205 | projectRoot = "";
206 | targets = (
207 | 5628FFA81B5AB1EA00D89F45 /* BidirectionalCollection */,
208 | 5628FFC11B5AB1EA00D89F45 /* BidirectionalCollectionTests */,
209 | );
210 | };
211 | /* End PBXProject section */
212 |
213 | /* Begin PBXResourcesBuildPhase section */
214 | 5628FFA71B5AB1EA00D89F45 /* Resources */ = {
215 | isa = PBXResourcesBuildPhase;
216 | buildActionMask = 2147483647;
217 | files = (
218 | 5628FFB81B5AB1EA00D89F45 /* Main.storyboard in Resources */,
219 | 56CE83E11BEE082E007BC3BE /* Demo.gif in Resources */,
220 | 5628FFBD1B5AB1EA00D89F45 /* LaunchScreen.xib in Resources */,
221 | 5628FFBA1B5AB1EA00D89F45 /* Images.xcassets in Resources */,
222 | );
223 | runOnlyForDeploymentPostprocessing = 0;
224 | };
225 | 5628FFC01B5AB1EA00D89F45 /* Resources */ = {
226 | isa = PBXResourcesBuildPhase;
227 | buildActionMask = 2147483647;
228 | files = (
229 | );
230 | runOnlyForDeploymentPostprocessing = 0;
231 | };
232 | /* End PBXResourcesBuildPhase section */
233 |
234 | /* Begin PBXSourcesBuildPhase section */
235 | 5628FFA51B5AB1EA00D89F45 /* Sources */ = {
236 | isa = PBXSourcesBuildPhase;
237 | buildActionMask = 2147483647;
238 | files = (
239 | 5628FFB51B5AB1EA00D89F45 /* ViewController.m in Sources */,
240 | 5628FFB21B5AB1EA00D89F45 /* AppDelegate.m in Sources */,
241 | 5628FFD51B5AB29B00D89F45 /* BidirectionCollectionLayout.m in Sources */,
242 | 5628FFAF1B5AB1EA00D89F45 /* main.m in Sources */,
243 | );
244 | runOnlyForDeploymentPostprocessing = 0;
245 | };
246 | 5628FFBE1B5AB1EA00D89F45 /* Sources */ = {
247 | isa = PBXSourcesBuildPhase;
248 | buildActionMask = 2147483647;
249 | files = (
250 | 5628FFC91B5AB1EA00D89F45 /* BidirectionalCollectionTests.m in Sources */,
251 | );
252 | runOnlyForDeploymentPostprocessing = 0;
253 | };
254 | /* End PBXSourcesBuildPhase section */
255 |
256 | /* Begin PBXTargetDependency section */
257 | 5628FFC41B5AB1EA00D89F45 /* PBXTargetDependency */ = {
258 | isa = PBXTargetDependency;
259 | target = 5628FFA81B5AB1EA00D89F45 /* BidirectionalCollection */;
260 | targetProxy = 5628FFC31B5AB1EA00D89F45 /* PBXContainerItemProxy */;
261 | };
262 | /* End PBXTargetDependency section */
263 |
264 | /* Begin PBXVariantGroup section */
265 | 5628FFB61B5AB1EA00D89F45 /* Main.storyboard */ = {
266 | isa = PBXVariantGroup;
267 | children = (
268 | 5628FFB71B5AB1EA00D89F45 /* Base */,
269 | );
270 | name = Main.storyboard;
271 | sourceTree = "";
272 | };
273 | 5628FFBB1B5AB1EA00D89F45 /* LaunchScreen.xib */ = {
274 | isa = PBXVariantGroup;
275 | children = (
276 | 5628FFBC1B5AB1EA00D89F45 /* Base */,
277 | );
278 | name = LaunchScreen.xib;
279 | sourceTree = "";
280 | };
281 | /* End PBXVariantGroup section */
282 |
283 | /* Begin XCBuildConfiguration section */
284 | 5628FFCA1B5AB1EA00D89F45 /* Debug */ = {
285 | isa = XCBuildConfiguration;
286 | buildSettings = {
287 | ALWAYS_SEARCH_USER_PATHS = NO;
288 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
289 | CLANG_CXX_LIBRARY = "libc++";
290 | CLANG_ENABLE_MODULES = YES;
291 | CLANG_ENABLE_OBJC_ARC = YES;
292 | CLANG_WARN_BOOL_CONVERSION = YES;
293 | CLANG_WARN_CONSTANT_CONVERSION = YES;
294 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
295 | CLANG_WARN_EMPTY_BODY = YES;
296 | CLANG_WARN_ENUM_CONVERSION = YES;
297 | CLANG_WARN_INT_CONVERSION = YES;
298 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
299 | CLANG_WARN_UNREACHABLE_CODE = YES;
300 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
301 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
302 | COPY_PHASE_STRIP = NO;
303 | ENABLE_STRICT_OBJC_MSGSEND = YES;
304 | GCC_C_LANGUAGE_STANDARD = gnu99;
305 | GCC_DYNAMIC_NO_PIC = NO;
306 | GCC_OPTIMIZATION_LEVEL = 0;
307 | GCC_PREPROCESSOR_DEFINITIONS = (
308 | "DEBUG=1",
309 | "$(inherited)",
310 | );
311 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
312 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
313 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
314 | GCC_WARN_UNDECLARED_SELECTOR = YES;
315 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
316 | GCC_WARN_UNUSED_FUNCTION = YES;
317 | GCC_WARN_UNUSED_VARIABLE = YES;
318 | IPHONEOS_DEPLOYMENT_TARGET = 8.1;
319 | MTL_ENABLE_DEBUG_INFO = YES;
320 | ONLY_ACTIVE_ARCH = YES;
321 | SDKROOT = iphoneos;
322 | TARGETED_DEVICE_FAMILY = "1,2";
323 | };
324 | name = Debug;
325 | };
326 | 5628FFCB1B5AB1EA00D89F45 /* Release */ = {
327 | isa = XCBuildConfiguration;
328 | buildSettings = {
329 | ALWAYS_SEARCH_USER_PATHS = NO;
330 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
331 | CLANG_CXX_LIBRARY = "libc++";
332 | CLANG_ENABLE_MODULES = YES;
333 | CLANG_ENABLE_OBJC_ARC = YES;
334 | CLANG_WARN_BOOL_CONVERSION = YES;
335 | CLANG_WARN_CONSTANT_CONVERSION = YES;
336 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
337 | CLANG_WARN_EMPTY_BODY = YES;
338 | CLANG_WARN_ENUM_CONVERSION = YES;
339 | CLANG_WARN_INT_CONVERSION = YES;
340 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
341 | CLANG_WARN_UNREACHABLE_CODE = YES;
342 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
343 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
344 | COPY_PHASE_STRIP = YES;
345 | ENABLE_NS_ASSERTIONS = NO;
346 | ENABLE_STRICT_OBJC_MSGSEND = YES;
347 | GCC_C_LANGUAGE_STANDARD = gnu99;
348 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
349 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
350 | GCC_WARN_UNDECLARED_SELECTOR = YES;
351 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
352 | GCC_WARN_UNUSED_FUNCTION = YES;
353 | GCC_WARN_UNUSED_VARIABLE = YES;
354 | IPHONEOS_DEPLOYMENT_TARGET = 8.1;
355 | MTL_ENABLE_DEBUG_INFO = NO;
356 | SDKROOT = iphoneos;
357 | TARGETED_DEVICE_FAMILY = "1,2";
358 | VALIDATE_PRODUCT = YES;
359 | };
360 | name = Release;
361 | };
362 | 5628FFCD1B5AB1EA00D89F45 /* Debug */ = {
363 | isa = XCBuildConfiguration;
364 | buildSettings = {
365 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
366 | INFOPLIST_FILE = BidirectionalCollection/Info.plist;
367 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
368 | PRODUCT_NAME = "$(TARGET_NAME)";
369 | };
370 | name = Debug;
371 | };
372 | 5628FFCE1B5AB1EA00D89F45 /* Release */ = {
373 | isa = XCBuildConfiguration;
374 | buildSettings = {
375 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
376 | INFOPLIST_FILE = BidirectionalCollection/Info.plist;
377 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
378 | PRODUCT_NAME = "$(TARGET_NAME)";
379 | };
380 | name = Release;
381 | };
382 | 5628FFD01B5AB1EA00D89F45 /* Debug */ = {
383 | isa = XCBuildConfiguration;
384 | buildSettings = {
385 | BUNDLE_LOADER = "$(TEST_HOST)";
386 | FRAMEWORK_SEARCH_PATHS = (
387 | "$(SDKROOT)/Developer/Library/Frameworks",
388 | "$(inherited)",
389 | );
390 | GCC_PREPROCESSOR_DEFINITIONS = (
391 | "DEBUG=1",
392 | "$(inherited)",
393 | );
394 | INFOPLIST_FILE = BidirectionalCollectionTests/Info.plist;
395 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
396 | PRODUCT_NAME = "$(TARGET_NAME)";
397 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/BidirectionalCollection.app/BidirectionalCollection";
398 | };
399 | name = Debug;
400 | };
401 | 5628FFD11B5AB1EA00D89F45 /* Release */ = {
402 | isa = XCBuildConfiguration;
403 | buildSettings = {
404 | BUNDLE_LOADER = "$(TEST_HOST)";
405 | FRAMEWORK_SEARCH_PATHS = (
406 | "$(SDKROOT)/Developer/Library/Frameworks",
407 | "$(inherited)",
408 | );
409 | INFOPLIST_FILE = BidirectionalCollectionTests/Info.plist;
410 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
411 | PRODUCT_NAME = "$(TARGET_NAME)";
412 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/BidirectionalCollection.app/BidirectionalCollection";
413 | };
414 | name = Release;
415 | };
416 | /* End XCBuildConfiguration section */
417 |
418 | /* Begin XCConfigurationList section */
419 | 5628FFA41B5AB1EA00D89F45 /* Build configuration list for PBXProject "BidirectionalCollection" */ = {
420 | isa = XCConfigurationList;
421 | buildConfigurations = (
422 | 5628FFCA1B5AB1EA00D89F45 /* Debug */,
423 | 5628FFCB1B5AB1EA00D89F45 /* Release */,
424 | );
425 | defaultConfigurationIsVisible = 0;
426 | defaultConfigurationName = Release;
427 | };
428 | 5628FFCC1B5AB1EA00D89F45 /* Build configuration list for PBXNativeTarget "BidirectionalCollection" */ = {
429 | isa = XCConfigurationList;
430 | buildConfigurations = (
431 | 5628FFCD1B5AB1EA00D89F45 /* Debug */,
432 | 5628FFCE1B5AB1EA00D89F45 /* Release */,
433 | );
434 | defaultConfigurationIsVisible = 0;
435 | defaultConfigurationName = Release;
436 | };
437 | 5628FFCF1B5AB1EA00D89F45 /* Build configuration list for PBXNativeTarget "BidirectionalCollectionTests" */ = {
438 | isa = XCConfigurationList;
439 | buildConfigurations = (
440 | 5628FFD01B5AB1EA00D89F45 /* Debug */,
441 | 5628FFD11B5AB1EA00D89F45 /* Release */,
442 | );
443 | defaultConfigurationIsVisible = 0;
444 | defaultConfigurationName = Release;
445 | };
446 | /* End XCConfigurationList section */
447 | };
448 | rootObject = 5628FFA11B5AB1EA00D89F45 /* Project object */;
449 | }
450 |
--------------------------------------------------------------------------------