Skip to content

Commit

Permalink
Fixes issue #1
Browse files Browse the repository at this point in the history
Add a public initializer for YBSlantedCollectionViewLayoutSizeOptions.
  • Loading branch information
yacir committed Sep 5, 2016
1 parent 5be479a commit bd50a75
Show file tree
Hide file tree
Showing 16 changed files with 530 additions and 34 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# YBSlantedCollectionViewLayout CHANGELOG

## 2.1.1
* Add a public initializer for YBSlantedCollectionViewLayoutSizeOptions.

## 2.1.0

* Add tests
Expand Down
2 changes: 1 addition & 1 deletion Source/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.0.0</string>
<string>2.1.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
35 changes: 27 additions & 8 deletions Source/YBSlantedCollectionViewLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,35 @@ import UIKit;
/// The item size options
public struct YBSlantedCollectionViewLayoutSizeOptions {
/**
* The item height if the scroll direction is setted to `Vertical`.
* Default value is `220`
The item height if the scroll direction is setted to `Vertical`.
Default value is `220`
*/
var VerticalSize: CGFloat = 220
public var verticalSize: CGFloat

/**
* The item width if the scroll direction is setted to `Horizontal`.
* Default value is `290`
The item width if the scroll direction is setted to `Horizontal`.
Default value is `290`
*/
var HorizontalSize: CGFloat = 290
public var horizontalSize: CGFloat

/**
Init with default values
*/
public init() {
self.verticalSize = 220;
self.horizontalSize = 290;
}

/**
Initialize with custom values
- Parameter verticalSize: Cell's height for `Vertical` scroll direction
- Parameter horizontalSize: Cell's width for `Horizontal` scroll direction
*/
public init(verticalSize verticalSize:CGFloat, horizontalSize:CGFloat) {
self.verticalSize = verticalSize;
self.horizontalSize = horizontalSize;
}
}

/**
Expand Down Expand Up @@ -116,10 +135,10 @@ public class YBSlantedCollectionViewLayout: UICollectionViewLayout {

internal var size: CGFloat {
if ( hasVerticalDirection ) {
return itemSizeOptions.VerticalSize
return itemSizeOptions.verticalSize
}

return itemSizeOptions.HorizontalSize
return itemSizeOptions.horizontalSize
}

internal var hasVerticalDirection: Bool {
Expand Down
2 changes: 1 addition & 1 deletion YBSlantedCollectionViewLayout.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "YBSlantedCollectionViewLayout"
s.version = "2.1.0"
s.version = "2.1.1"
s.summary = "UICollectionViewLayout allowing the display of slanted content on UICollectionView"

s.description = <<-DESC
Expand Down
4 changes: 2 additions & 2 deletions docs/Classes.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<a href="Structs.html">Structs</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Structs.html#/s:V29YBSlantedCollectionViewLayout40YBSlantedCollectionViewLayoutSizeOptions">YBSlantedCollectionViewLayoutSizeOptions</a>
<a href="Structs/YBSlantedCollectionViewLayoutSizeOptions.html">YBSlantedCollectionViewLayoutSizeOptions</a>
</li>
</ul>
</li>
Expand Down Expand Up @@ -92,7 +92,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2016 <a class="link" href="https://linkedin.com/in/yassir-barchi-318a7949" target="_blank" rel="external">Yassir</a>. All rights reserved. (Last updated: 2016-03-11)</p>
<p>&copy; 2016 <a class="link" href="https://linkedin.com/in/yassir-barchi-318a7949" target="_blank" rel="external">Yassir</a>. All rights reserved. (Last updated: 2016-09-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down
4 changes: 2 additions & 2 deletions docs/Classes/YBSlantedCollectionViewLayout.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<a href="../Structs.html">Structs</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs.html#/s:V29YBSlantedCollectionViewLayout40YBSlantedCollectionViewLayoutSizeOptions">YBSlantedCollectionViewLayoutSizeOptions</a>
<a href="../Structs/YBSlantedCollectionViewLayoutSizeOptions.html">YBSlantedCollectionViewLayoutSizeOptions</a>
</li>
</ul>
</li>
Expand Down Expand Up @@ -431,7 +431,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2016 <a class="link" href="https://linkedin.com/in/yassir-barchi-318a7949" target="_blank" rel="external">Yassir</a>. All rights reserved. (Last updated: 2016-03-11)</p>
<p>&copy; 2016 <a class="link" href="https://linkedin.com/in/yassir-barchi-318a7949" target="_blank" rel="external">Yassir</a>. All rights reserved. (Last updated: 2016-09-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down
5 changes: 3 additions & 2 deletions docs/Structs.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<a href="Structs.html">Structs</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Structs.html#/s:V29YBSlantedCollectionViewLayout40YBSlantedCollectionViewLayoutSizeOptions">YBSlantedCollectionViewLayoutSizeOptions</a>
<a href="Structs/YBSlantedCollectionViewLayoutSizeOptions.html">YBSlantedCollectionViewLayoutSizeOptions</a>
</li>
</ul>
</li>
Expand Down Expand Up @@ -70,6 +70,7 @@ <h1>Structs</h1>
<div class="abstract">
<p>The item size options</p>

<a href="Structs/YBSlantedCollectionViewLayoutSizeOptions.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
Expand All @@ -87,7 +88,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2016 <a class="link" href="https://linkedin.com/in/yassir-barchi-318a7949" target="_blank" rel="external">Yassir</a>. All rights reserved. (Last updated: 2016-03-11)</p>
<p>&copy; 2016 <a class="link" href="https://linkedin.com/in/yassir-barchi-318a7949" target="_blank" rel="external">Yassir</a>. All rights reserved. (Last updated: 2016-09-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down
232 changes: 232 additions & 0 deletions docs/Structs/YBSlantedCollectionViewLayoutSizeOptions.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>YBSlantedCollectionViewLayoutSizeOptions Struct Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>

</head>
<body>
<a name="//apple_ref/swift/Struct/YBSlantedCollectionViewLayoutSizeOptions" class="dashAnchor"></a>
<a title="YBSlantedCollectionViewLayoutSizeOptions Struct Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">YBSlantedCollectionViewLayout Docs</a> (100% documented)</p>
<p class="header-right"><a href="https://github.com/yacir/YBSlantedCollectionViewLayout"><img src="../img/gh.png"/>View on GitHub</a></p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html">YBSlantedCollectionViewLayout Reference</a>
<img id="carat" src="../img/carat.png" />
YBSlantedCollectionViewLayoutSizeOptions Struct Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/YBSlantedCollectionViewLayout.html">YBSlantedCollectionViewLayout</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structs</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/YBSlantedCollectionViewLayoutSizeOptions.html">YBSlantedCollectionViewLayoutSizeOptions</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>YBSlantedCollectionViewLayoutSizeOptions</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">YBSlantedCollectionViewLayoutSizeOptions</span></code></pre>

</div>
</div>
<p>The item size options</p>

</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:vV29YBSlantedCollectionViewLayout40YBSlantedCollectionViewLayoutSizeOptions12verticalSizeV12CoreGraphics7CGFloat"></a>
<a name="//apple_ref/swift/Property/verticalSize" class="dashAnchor"></a>
<a class="token" href="#/s:vV29YBSlantedCollectionViewLayout40YBSlantedCollectionViewLayoutSizeOptions12verticalSizeV12CoreGraphics7CGFloat">verticalSize</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The item height if the scroll direction is setted to <code>Vertical</code>.
Default value is <code>220</code></p>

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">verticalSize</span><span class="p">:</span> <span class="kt">CGFloat</span></code></pre>

</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vV29YBSlantedCollectionViewLayout40YBSlantedCollectionViewLayoutSizeOptions14horizontalSizeV12CoreGraphics7CGFloat"></a>
<a name="//apple_ref/swift/Property/horizontalSize" class="dashAnchor"></a>
<a class="token" href="#/s:vV29YBSlantedCollectionViewLayout40YBSlantedCollectionViewLayoutSizeOptions14horizontalSizeV12CoreGraphics7CGFloat">horizontalSize</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The item width if the scroll direction is setted to <code>Horizontal</code>.
Default value is <code>290</code></p>

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">horizontalSize</span><span class="p">:</span> <span class="kt">CGFloat</span></code></pre>

</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FV29YBSlantedCollectionViewLayout40YBSlantedCollectionViewLayoutSizeOptionscFT_S0_"></a>
<a name="//apple_ref/swift/Method/init()" class="dashAnchor"></a>
<a class="token" href="#/s:FV29YBSlantedCollectionViewLayout40YBSlantedCollectionViewLayoutSizeOptionscFT_S0_">init()</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Init with default values</p>

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">()</span></code></pre>

</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FV29YBSlantedCollectionViewLayout40YBSlantedCollectionViewLayoutSizeOptionscFT12verticalSizeV12CoreGraphics7CGFloat14horizontalSizeS2__S0_"></a>
<a name="//apple_ref/swift/Method/init(verticalSize:horizontalSize:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV29YBSlantedCollectionViewLayout40YBSlantedCollectionViewLayoutSizeOptionscFT12verticalSizeV12CoreGraphics7CGFloat14horizontalSizeS2__S0_">init(verticalSize:horizontalSize:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Initialize with custom values</p>

<div class="aside aside-parameter">
<p class="aside-title">Parameter</p>
Parameter verticalSize: Cell&rsquo;s height for <code>Vertical</code> scroll direction

</div>

<div class="aside aside-parameter">
<p class="aside-title">Parameter</p>
Parameter horizontalSize: Cell&rsquo;s width for <code>Horizontal</code> scroll direction

</div>

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">verticalSize</span> <span class="nv">verticalSize</span><span class="p">:</span><span class="kt">CGFloat</span><span class="p">,</span> <span class="nv">horizontalSize</span><span class="p">:</span><span class="kt">CGFloat</span><span class="p">)</span></code></pre>

</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>verticalSize</em>
</code>
</td>
<td>
<div>
<p>Cell&rsquo;s height for <code>Vertical</code> scroll direction</p>

</div>
</td>
</tr>
<tr>
<td>
<code>
<em>horizontalSize</em>
</code>
</td>
<td>
<div>
<p>Cell&rsquo;s width for <code>Horizontal</code> scroll direction</p>

</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2016 <a class="link" href="https://linkedin.com/in/yassir-barchi-318a7949" target="_blank" rel="external">Yassir</a>. All rights reserved. (Last updated: 2016-09-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<a href="Structs.html">Structs</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Structs.html#/s:V29YBSlantedCollectionViewLayout40YBSlantedCollectionViewLayoutSizeOptions">YBSlantedCollectionViewLayoutSizeOptions</a>
<a href="Structs/YBSlantedCollectionViewLayoutSizeOptions.html">YBSlantedCollectionViewLayoutSizeOptions</a>
</li>
</ul>
</li>
Expand Down Expand Up @@ -92,7 +92,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2016 <a class="link" href="https://linkedin.com/in/yassir-barchi-318a7949" target="_blank" rel="external">Yassir</a>. All rights reserved. (Last updated: 2016-03-11)</p>
<p>&copy; 2016 <a class="link" href="https://linkedin.com/in/yassir-barchi-318a7949" target="_blank" rel="external">Yassir</a>. All rights reserved. (Last updated: 2016-09-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down
Loading

0 comments on commit bd50a75

Please sign in to comment.