https://github.com/VladIacobIonut/Swinflate
A bunch of layouts providing light and seamless experiences in your Collection View
https://github.com/VladIacobIonut/Swinflate
Last synced: 5 months ago
JSON representation
A bunch of layouts providing light and seamless experiences in your Collection View
- Host: GitHub
- URL: https://github.com/VladIacobIonut/Swinflate
- Owner: VladIacobIonut
- License: mit
- Created: 2018-12-17T09:41:26.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-08T13:30:23.000Z (almost 5 years ago)
- Last Synced: 2024-08-16T10:42:01.017Z (8 months ago)
- Language: Swift
- Homepage:
- Size: 30.8 MB
- Stars: 228
- Watchers: 5
- Forks: 12
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - Swinflate - A bunch of layouts providing light and seamless experiences in your CollectionView. (UI / Table View / Collection View)
- awesome-ios-star - Swinflate - A bunch of layouts providing light and seamless experiences in your CollectionView. (UI / Table View / Collection View)
README
# Swinflate
[](https://github.com/Carthage/Carthage)
[](http://cocoadocs.org/docsets/Compass)
[](https://developer.apple.com/swift/)

## Description
Swinflate aims to encorporate a set of collection view layouts which provide a better and even more fluid experience in collection vieews . It is amongst the goals of this project to make it ruthlessly simple for you to use it in your application.
## Available layouts
#### SWInflateLayout
#### SWHorizontalStackLayout
## Requirements
* Swift 4.2
* Xcode 10+
* iOS 11.0+Installation
------------**Swinflate** is available for installation via **Swift Package Manager** and **Carthage**.
To install via Carthage, paste the next line your Cartfile:```
github "https://github.com/VladIacobIonut/Swinflate" ~> 1.0.3
```Usage
------------This layouts are designed to work with horizontal collection view of a single row and multiple columns.
1. Before using it, please import it in the class where your collectionView lies.
```swift
import Swinflate
```2. To implement it, just pass an instance of one of the layout classes enumerated above to the constructor of the collectionView.
###### SWInflateLayout
```swift
collectionView = UICollectionView(frame: .zero, collectionViewLayout: SWInflateLayout())
```###### SWHorizontalStackLayout
```swift
let stackLayout = SWHorizontalStackLayout()
stackLayout.hasStackEffect = true
collectionView = UICollectionView(frame: .zero, collectionViewLayout: stackLayout)
```Note
- This layout allow you to enable or disable the stack effect by setting the `hasStackEffect` property ( this property is `false` by default).
- Both layouts allow you to enable or disable the paging effect by setting the `isPagingEnabled` property ( this property is `true` by default).
3. You should also return the item size for your cells in the `sizeForItem` method of the `UICollectionViewDelegateFlowLayout` .```swift
extension CustomLayoutViewController: UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: cellWidth, height: cellHeight)
}
}
```