66//
77// MIT License
88//
9- // Copyright (c) 2016 Giulio Lombardo
9+ // Copyright (c) 2017 Giulio Lombardo
1010//
1111// Permission is hereby granted, free of charge, to any person obtaining a copy
12- // of this software and associated documentation files (the "Software"), to deal
13- // in the Software without restriction, including without limitation the rights
14- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15- // copies of the Software, and to permit persons to whom the Software is
12+ // of this software and associated documentation files (the "Software"), to
13+ // deal in the Software without restriction, including without limitation the
14+ // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
15+ // sell copies of the Software, and to permit persons to whom the Software is
1616// furnished to do so, subject to the following conditions:
1717//
18- // The above copyright notice and this permission notice shall be included in all
19- // copies or substantial portions of the Software.
18+ // The above copyright notice and this permission notice shall be included in
19+ // all copies or substantial portions of the Software.
2020//
2121// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2222// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2323// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2424// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27- // SOFTWARE.
25+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26+ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
27+ // IN THE SOFTWARE.
2828//
2929
3030import UIKit
@@ -41,7 +41,7 @@ class GLIndexedCollectionViewFlowLayout: UICollectionViewFlowLayout {
4141 return CGPoint ( x: proposedContentOffset. x, y: 0 )
4242 }
4343
44- // To make paginated scrolling work fine this CGFloat below must be
44+ // To make paginated scrolling work fine this CGFloat below MUST be
4545 // equal to the value set in the insetForSectionAt method of
4646 // UICollectionView's UICollectionViewDelegate Flow Layout.
4747 let collectionViewInsets : CGFloat = 10.0
@@ -53,7 +53,7 @@ class GLIndexedCollectionViewFlowLayout: UICollectionViewFlowLayout {
5353 // Note: This will only cover horizonal scrolling and pagination, if you
5454 // need vertical pagination replace the .x coordinate with .y and update
5555 // collectionViewInsets value with the approriate one.
56- let proposedXCoordWithInsets = proposedContentOffset. x + collectionViewInsets
56+ let proposedXCoordWithInsets : CGFloat = proposedContentOffset. x + collectionViewInsets
5757
5858 // We now create a variable and we assign a very high CGFloat to it (a
5959 // big number here is needed to cover very large
@@ -67,7 +67,7 @@ class GLIndexedCollectionViewFlowLayout: UICollectionViewFlowLayout {
6767 // cell which needs the least offsetCorrection value: it will mean that
6868 // it's the first cell on the left of the screen which will give
6969 // pagination.
70- for layoutAttributes in super. layoutAttributesForElements ( in: CGRect ( x: proposedContentOffset. x, y: 0 , width: collectionView!. bounds. width, height: collectionView!. bounds. height) ) ! {
70+ for layoutAttributes : UICollectionViewLayoutAttributes in super. layoutAttributesForElements ( in: CGRect ( x: proposedContentOffset. x, y: 0 , width: collectionView!. bounds. width, height: collectionView!. bounds. height) ) ! {
7171 // Since layoutAttributesForElements may contain all sort of layout
7272 // attributes we need to check if it belongs to a
7373 // UICollectionViewCell, otherwise logic won't work.
@@ -110,7 +110,8 @@ class GLCollectionTableViewCell: UITableViewCell {
110110 `delegate` methods.
111111
112112 GLIndexedCollectionView requires a `strong` ARC reference, do not assign a
113- `weak` reference otherwise it could result in a crash.
113+ `weak` reference to it otherwise it could be released unexpectedly,
114+ causing a crash.
114115
115116 */
116117 var collectionView : GLIndexedCollectionView !
@@ -186,7 +187,7 @@ class GLCollectionTableViewCell: UITableViewCell {
186187 Re-assigns `dataSource` and `delegate` classes back to the
187188 GLIndexedCollectionView inside GLCollectionTableViewCell.
188189
189- It's highly recommended to call this func in your [tableView(_:willDisplay:forRowAt:)](apple-reference-documentation://hs3G9NleF7)
190+ It's highly recommended to call this ` func` in your [tableView(_:willDisplay:forRowAt:)](apple-reference-documentation://hs3G9NleF7)
190191 method of GLTableCollectionViewController so the UITableView will re-assign
191192 it automatically following the regular UITableViewCells reuse logic.
192193
@@ -207,7 +208,7 @@ class GLCollectionTableViewCell: UITableViewCell {
207208 will come from.
208209
209210 */
210- func setCollectionViewDataSourceDelegate ( dataSource: UICollectionViewDataSource , delegate: UICollectionViewDelegate , indexPath: IndexPath ) {
211+ func setCollectionView ( dataSource: UICollectionViewDataSource , delegate: UICollectionViewDelegate , indexPath: IndexPath ) {
211212 collectionView. indexPath = indexPath
212213
213214 if collectionView. dataSource == nil {
0 commit comments