
Custom layouts for UICollectionView with examples [iOS 12+].
The uicollectionview-layouts-kit is a collection of custom layouts for UICollectionView in iOS. These layouts provide various design options and support both portrait and landscape UI orientations, as well as all iOS-related screen sizes. The project is meant for demonstration purposes and should not be used for commercial or proprietary projects due to the usage of assets taken from the web.
If you prefer the programmatic approach, set the instance of a layout using the following scheme:
let customLayout = CustomLayout()
collectionView.collectionViewLayout = customLayout
To set up the layouts via Storyboard/Nib, follow these steps:
In your view controller, provide a valid reference to the UIViewController from the Storyboard/Nib file where you overridden the default layout class.
For cases when you need to tell your custom layout what class is going to delegate the layout handling, use the following code:
customLayout.delegate = self
For cases when you simply need to change properties for custom layouts that were set via the visual editor, use the following code:
customLayout.property = newValue
If you use the Storyboard/Nib approach, consider creating an IBOutlet to the custom layout and directly set it up instead of casting the layout using the collection view reference.
The uicollectionview-layouts-kit provides a collection of custom layouts for UICollectionView in iOS. It offers various design options, supports different screen sizes and orientations, and can be easily integrated into projects either programmatically or via Storyboard/Nib setup. It is important to note that the project should only be used for demonstration purposes and not for commercial or proprietary projects due to the usage of web-based assets.
