Skip to content

Commit 356a9fc

Browse files
committed
Update to version 2.0.0
1 parent 0ddd578 commit 356a9fc

40 files changed

Lines changed: 1226 additions & 620 deletions

CHANGELOG

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# YBSlantedCollectionViewLayout CHANGELOG
22

3+
## 2.0.0
4+
5+
* Carthage support
6+
* Improve the attribution of the clic.
7+
* Add size options depending on the scroll direction
8+
* New class added : `YBSlantedCollectionViewCell`
9+
* Deprecat the `applyMaskToCellView (cellView : UICollectionViewCell, forIndexPath: NSIndexPath)` method
10+
311
## 1.0.0
412

5-
Initial release.
13+
* Initial release.

Example/YBSlantedCollectionViewLayoutSample.xcodeproj/project.pbxproj

Lines changed: 70 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,56 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
FB132C751C91125000728981 /* YBSlantedCollectionViewLayout.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FB132C721C91123700728981 /* YBSlantedCollectionViewLayout.framework */; };
11+
FB132C771C91137000728981 /* YBSlantedCollectionViewLayout.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = FB132C721C91123700728981 /* YBSlantedCollectionViewLayout.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1012
FB17358F1C83A0B400EEDB5F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB17358E1C83A0B400EEDB5F /* AppDelegate.swift */; };
1113
FB1735911C83A0B400EEDB5F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB1735901C83A0B400EEDB5F /* ViewController.swift */; };
1214
FB1735941C83A0B400EEDB5F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FB1735921C83A0B400EEDB5F /* Main.storyboard */; };
1315
FB1735961C83A0B400EEDB5F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FB1735951C83A0B400EEDB5F /* Assets.xcassets */; };
1416
FB1735991C83A0B400EEDB5F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FB1735971C83A0B400EEDB5F /* LaunchScreen.storyboard */; };
15-
FB1735A51C83A17700EEDB5F /* YBSlantedCollectionViewLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB1735A41C83A17700EEDB5F /* YBSlantedCollectionViewLayout.swift */; };
1617
FB1735A71C83A22600EEDB5F /* CustomCollectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB1735A61C83A22600EEDB5F /* CustomCollectionCell.swift */; };
1718
FB1735B11C83AABA00EEDB5F /* SettingsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB1735B01C83AABA00EEDB5F /* SettingsController.swift */; };
1819
/* End PBXBuildFile section */
1920

21+
/* Begin PBXContainerItemProxy section */
22+
FB132C711C91123700728981 /* PBXContainerItemProxy */ = {
23+
isa = PBXContainerItemProxy;
24+
containerPortal = FB132C6C1C91123700728981 /* YBSlantedCollectionViewLayout.xcodeproj */;
25+
proxyType = 2;
26+
remoteGlobalIDString = FB0AE5E51C910B3200821862;
27+
remoteInfo = YBSlantedCollectionViewLayout;
28+
};
29+
FB132C731C91123700728981 /* PBXContainerItemProxy */ = {
30+
isa = PBXContainerItemProxy;
31+
containerPortal = FB132C6C1C91123700728981 /* YBSlantedCollectionViewLayout.xcodeproj */;
32+
proxyType = 2;
33+
remoteGlobalIDString = FB0AE5EF1C910B3300821862;
34+
remoteInfo = YBSlantedCollectionViewLayoutTests;
35+
};
36+
/* End PBXContainerItemProxy section */
37+
38+
/* Begin PBXCopyFilesBuildPhase section */
39+
FB132C761C91135E00728981 /* CopyFiles */ = {
40+
isa = PBXCopyFilesBuildPhase;
41+
buildActionMask = 2147483647;
42+
dstPath = "";
43+
dstSubfolderSpec = 10;
44+
files = (
45+
FB132C771C91137000728981 /* YBSlantedCollectionViewLayout.framework in CopyFiles */,
46+
);
47+
runOnlyForDeploymentPostprocessing = 0;
48+
};
49+
/* End PBXCopyFilesBuildPhase section */
50+
2051
/* Begin PBXFileReference section */
52+
FB132C6C1C91123700728981 /* YBSlantedCollectionViewLayout.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = YBSlantedCollectionViewLayout.xcodeproj; path = ../YBSlantedCollectionViewLayout.xcodeproj; sourceTree = "<group>"; };
2153
FB17358B1C83A0B400EEDB5F /* YBSlantedCollectionViewLayoutSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = YBSlantedCollectionViewLayoutSample.app; sourceTree = BUILT_PRODUCTS_DIR; };
2254
FB17358E1C83A0B400EEDB5F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
2355
FB1735901C83A0B400EEDB5F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
2456
FB1735931C83A0B400EEDB5F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
2557
FB1735951C83A0B400EEDB5F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
2658
FB1735981C83A0B400EEDB5F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
2759
FB17359A1C83A0B400EEDB5F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
28-
FB1735A41C83A17700EEDB5F /* YBSlantedCollectionViewLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YBSlantedCollectionViewLayout.swift; sourceTree = "<group>"; };
2960
FB1735A61C83A22600EEDB5F /* CustomCollectionCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomCollectionCell.swift; sourceTree = "<group>"; };
3061
FB1735B01C83AABA00EEDB5F /* SettingsController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsController.swift; sourceTree = "<group>"; };
3162
/* End PBXFileReference section */
@@ -35,18 +66,28 @@
3566
isa = PBXFrameworksBuildPhase;
3667
buildActionMask = 2147483647;
3768
files = (
69+
FB132C751C91125000728981 /* YBSlantedCollectionViewLayout.framework in Frameworks */,
3870
);
3971
runOnlyForDeploymentPostprocessing = 0;
4072
};
4173
/* End PBXFrameworksBuildPhase section */
4274

4375
/* Begin PBXGroup section */
76+
FB132C6D1C91123700728981 /* Products */ = {
77+
isa = PBXGroup;
78+
children = (
79+
FB132C721C91123700728981 /* YBSlantedCollectionViewLayout.framework */,
80+
FB132C741C91123700728981 /* YBSlantedCollectionViewLayoutTests.xctest */,
81+
);
82+
name = Products;
83+
sourceTree = "<group>";
84+
};
4485
FB1735821C83A0B400EEDB5F = {
4586
isa = PBXGroup;
4687
children = (
47-
FB1735A31C83A17700EEDB5F /* YBSlantedCollectionViewLayout */,
4888
FB17358D1C83A0B400EEDB5F /* YBSlantedCollectionViewLayoutSample */,
4989
FB17358C1C83A0B400EEDB5F /* Products */,
90+
FB132C6C1C91123700728981 /* YBSlantedCollectionViewLayout.xcodeproj */,
5091
);
5192
sourceTree = "<group>";
5293
};
@@ -72,15 +113,6 @@
72113
path = YBSlantedCollectionViewLayoutSample;
73114
sourceTree = "<group>";
74115
};
75-
FB1735A31C83A17700EEDB5F /* YBSlantedCollectionViewLayout */ = {
76-
isa = PBXGroup;
77-
children = (
78-
FB1735A41C83A17700EEDB5F /* YBSlantedCollectionViewLayout.swift */,
79-
);
80-
name = YBSlantedCollectionViewLayout;
81-
path = ../YBSlantedCollectionViewLayout;
82-
sourceTree = "<group>";
83-
};
84116
FB1735CF1C84FDED00EEDB5F /* Controllers */ = {
85117
isa = PBXGroup;
86118
children = (
@@ -108,6 +140,7 @@
108140
FB1735871C83A0B400EEDB5F /* Sources */,
109141
FB1735881C83A0B400EEDB5F /* Frameworks */,
110142
FB1735891C83A0B400EEDB5F /* Resources */,
143+
FB132C761C91135E00728981 /* CopyFiles */,
111144
);
112145
buildRules = (
113146
);
@@ -144,13 +177,36 @@
144177
mainGroup = FB1735821C83A0B400EEDB5F;
145178
productRefGroup = FB17358C1C83A0B400EEDB5F /* Products */;
146179
projectDirPath = "";
180+
projectReferences = (
181+
{
182+
ProductGroup = FB132C6D1C91123700728981 /* Products */;
183+
ProjectRef = FB132C6C1C91123700728981 /* YBSlantedCollectionViewLayout.xcodeproj */;
184+
},
185+
);
147186
projectRoot = "";
148187
targets = (
149188
FB17358A1C83A0B400EEDB5F /* YBSlantedCollectionViewLayoutSample */,
150189
);
151190
};
152191
/* End PBXProject section */
153192

193+
/* Begin PBXReferenceProxy section */
194+
FB132C721C91123700728981 /* YBSlantedCollectionViewLayout.framework */ = {
195+
isa = PBXReferenceProxy;
196+
fileType = wrapper.framework;
197+
path = YBSlantedCollectionViewLayout.framework;
198+
remoteRef = FB132C711C91123700728981 /* PBXContainerItemProxy */;
199+
sourceTree = BUILT_PRODUCTS_DIR;
200+
};
201+
FB132C741C91123700728981 /* YBSlantedCollectionViewLayoutTests.xctest */ = {
202+
isa = PBXReferenceProxy;
203+
fileType = wrapper.cfbundle;
204+
path = YBSlantedCollectionViewLayoutTests.xctest;
205+
remoteRef = FB132C731C91123700728981 /* PBXContainerItemProxy */;
206+
sourceTree = BUILT_PRODUCTS_DIR;
207+
};
208+
/* End PBXReferenceProxy section */
209+
154210
/* Begin PBXResourcesBuildPhase section */
155211
FB1735891C83A0B400EEDB5F /* Resources */ = {
156212
isa = PBXResourcesBuildPhase;
@@ -173,7 +229,6 @@
173229
FB1735A71C83A22600EEDB5F /* CustomCollectionCell.swift in Sources */,
174230
FB1735911C83A0B400EEDB5F /* ViewController.swift in Sources */,
175231
FB17358F1C83A0B400EEDB5F /* AppDelegate.swift in Sources */,
176-
FB1735A51C83A17700EEDB5F /* YBSlantedCollectionViewLayout.swift in Sources */,
177232
);
178233
runOnlyForDeploymentPostprocessing = 0;
179234
};
@@ -285,7 +340,7 @@
285340
buildSettings = {
286341
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
287342
INFOPLIST_FILE = YBSlantedCollectionViewLayoutSample/Info.plist;
288-
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
343+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
289344
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
290345
PRODUCT_BUNDLE_IDENTIFIER = YB.YBSlantedCollectionViewLayoutSample;
291346
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -298,7 +353,7 @@
298353
buildSettings = {
299354
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
300355
INFOPLIST_FILE = YBSlantedCollectionViewLayoutSample/Info.plist;
301-
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
356+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
302357
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
303358
PRODUCT_BUNDLE_IDENTIFIER = YB.YBSlantedCollectionViewLayoutSample;
304359
PRODUCT_NAME = "$(TARGET_NAME)";

Example/YBSlantedCollectionViewLayoutSample/Base.lproj/Main.storyboard

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,16 @@
3636
<subviews>
3737
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="clg-ma-frh">
3838
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
39-
<collectionViewLayout key="collectionViewLayout" id="mTM-Vp-4z9" customClass="YBSlantedCollectionViewLayout" customModule="YBSlantedCollectionViewLayoutSample" customModuleProvider="target">
39+
<collectionViewLayout key="collectionViewLayout" id="mTM-Vp-4z9" customClass="YBSlantedCollectionViewLayout" customModule="YBSlantedCollectionViewLayout">
4040
<userDefinedRuntimeAttributes>
4141
<userDefinedRuntimeAttribute type="number" keyPath="slantingDelta">
4242
<integer key="value" value="50"/>
4343
</userDefinedRuntimeAttribute>
44-
<userDefinedRuntimeAttribute type="boolean" keyPath="firstCellSlantingEnabled" value="NO"/>
45-
<userDefinedRuntimeAttribute type="boolean" keyPath="lastCellSlantingEnabled" value="NO"/>
44+
<userDefinedRuntimeAttribute type="boolean" keyPath="firstCellSlantingEnabled" value="YES"/>
45+
<userDefinedRuntimeAttribute type="boolean" keyPath="lastCellSlantingEnabled" value="YES"/>
46+
<userDefinedRuntimeAttribute type="number" keyPath="lineSpacing">
47+
<real key="value" value="5"/>
48+
</userDefinedRuntimeAttribute>
4649
</userDefinedRuntimeAttributes>
4750
</collectionViewLayout>
4851
<cells>

Example/YBSlantedCollectionViewLayoutSample/CustomCollectionCell.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ import Foundation
1010

1111
import UIKit
1212

13+
import YBSlantedCollectionViewLayout
14+
1315
let yOffsetSpeed: CGFloat = 150.0
1416
let xOffsetSpeed: CGFloat = 100.0
1517

16-
class CustomCollectionCell: UICollectionViewCell {
18+
class CustomCollectionCell: YBSlantedCollectionViewCell {
1719

1820
@IBOutlet weak var imageView: UIImageView!
1921

Example/YBSlantedCollectionViewLayoutSample/SettingsController.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import Foundation
1010

1111
import UIKit
1212

13+
import YBSlantedCollectionViewLayout
14+
1315
class SettingsController: UITableViewController {
1416

1517
weak var collectionViewLayout: YBSlantedCollectionViewLayout!

Example/YBSlantedCollectionViewLayoutSample/ViewController.swift

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
import UIKit
1010

11+
import YBSlantedCollectionViewLayout
12+
1113
class ViewController: UIViewController {
1214

1315
@IBOutlet weak var collectionView: UICollectionView!
@@ -26,9 +28,7 @@ class ViewController: UIViewController {
2628
images.append(image!)
2729
}
2830
}
29-
let layout = collectionView.collectionViewLayout as! YBSlantedCollectionViewLayout
30-
layout.scrollDirection = UICollectionViewScrollDirection.Horizontal
31-
31+
3232
self.navigationController?.navigationBarHidden = true
3333
}
3434

@@ -76,14 +76,18 @@ extension ViewController: UICollectionViewDataSource {
7676
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as! CustomCollectionCell
7777

7878
cell.image = images[indexPath.row]
79-
80-
let layout = collectionView.collectionViewLayout as! YBSlantedCollectionViewLayout
81-
layout.applyMaskToCellView(cell, forIndexPath: indexPath)
82-
79+
8380
return cell
8481
}
8582
}
8683

84+
extension ViewController: UICollectionViewDelegate {
85+
86+
func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
87+
NSLog("Did select item at indexPath: [\(indexPath.section)][\(indexPath.row)]")
88+
}
89+
}
90+
8791
extension ViewController: UIScrollViewDelegate {
8892
func scrollViewDidScroll(scrollView: UIScrollView) {
8993
guard let collectionView = self.collectionView else {return}

README.md

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
[![Version](https://img.shields.io/cocoapods/v/YBSlantedCollectionViewLayout.svg?style=flat)](http://cocoapods.org/pods/YBSlantedCollectionViewLayout)
44
[![License](https://img.shields.io/cocoapods/l/YBSlantedCollectionViewLayout.svg?style=flat)](http://cocoapods.org/pods/YBSlantedCollectionViewLayout)
55
[![Platform](https://img.shields.io/cocoapods/p/YBSlantedCollectionViewLayout.svg?style=flat)](http://cocoapods.org/pods/YBSlantedCollectionViewLayout)
6+
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
67

78
## Overview
89
YBSlantedCollectionViewLayout is a subclass of UICollectionViewLayout allowing the display of slanted content on UICollectionView.
910

1011
<p align="center" >
11-
12-
<img src="https://cloud.githubusercontent.com/assets/2587473/13427516/d9af399e-dfb4-11e5-8109-ae997dc7c340.gif" alt="YBSlantedCollectionViewLayout" title="YBSlantedCollectionViewLayout">
13-
12+
<iframe src="https://appetize.io/embed/nd8vgwg0rkke19nmw3wzkapr5g?device=iphone5s&scale=75&autoplay=true&orientation=portrait&deviceColor=black" width="274px" height="587px" frameborder="0" scrolling="no"></iframe>
1413
</p>
1514

1615
## Usage
@@ -24,6 +23,7 @@ var firstCellSlantingEnabled: Bool
2423
var lastCellSlantingEnabled: Bool
2524
var lineSpacing: CGFloat
2625
var scrollDirection: UICollectionViewScrollDirection
26+
var itemSizeOptions: YBSlantedCollectionViewLayoutSizeOptions
2727
```
2828

2929
- _slantingDelta_ is the slanting delta. Defaults to 50
@@ -32,40 +32,33 @@ var scrollDirection: UICollectionViewScrollDirection
3232
- _lastCellSlantingEnabled_ allows to enable the slanting for the last cell. By default, this property is set to `true`
3333
- _lineSpacing_ is the spacing to use between two items. Defaults to 10.0
3434
- _scrollDirection_ is the scroll direction. Defaults to `UICollectionViewScrollDirectionVertical`
35+
- _itemSizeOptions_ allows to set the item's width/height depending on the scroll direction.
3536

3637
### Apply the slanting mask
3738

38-
To apply the slanting mask on the cellView, call the `applyMaskToCellView` method like the following example:
39-
40-
```swift
41-
func collectionView(collectionView: UICollectionView,
42-
cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
43-
44-
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as! CustomCollectionCell
45-
46-
// do something
47-
48-
// Apply the mask
49-
let layout = collectionView.collectionViewLayout as! YBSlantedCollectionViewLayout
50-
layout.applyMaskToCellView(cell, forIndexPath: indexPath)
51-
52-
return cell
53-
}
54-
```
55-
39+
To apply the slanting mask on the cellView, use the `YBSlantedCollectionViewCell` or subclass it.
5640

5741
## Installation
5842

43+
### CocoaPods
5944
YBSlantedCollectionViewLayout is available through [CocoaPods](http://cocoapods.org). To install
6045
it, simply add the following line to your Podfile:
6146

6247
```ruby
63-
pod "YBSlantedCollectionViewLayout", '~> 1.0'
48+
pod "YBSlantedCollectionViewLayout", '~> 2.0'
49+
```
50+
51+
### Carthage
52+
53+
You can also install it via [Carthage](https://github.com/Carthage/Carthage). To do so, add the following to your Cartfile:
54+
55+
```terminal
56+
github 'yacir/YBSlantedCollectionViewLayout'
6457
```
6558

66-
## Todo
67-
- [] Carthage support
68-
- [] Improve the attribution of the clic
59+
## Roadmap
60+
- [x] Improve the attribution of the clic
61+
- [x] Carthage support
6962
- [] Tests
7063

7164
## Author
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.0.0</string>
18+
<string>2.0.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

0 commit comments

Comments
 (0)