Created
          June 30, 2019 10:00 
        
      - 
      
- 
        Save yfujiki/cf1d3779cc5b068b74d230f4ed543790 to your computer and use it in GitHub Desktop. 
    Overview of layout for https://github.com/yfujiki/CompositionalLayoutSample
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | private lazy var compositionalLayout: UICollectionViewCompositionalLayout = { | |
| let layout = UICollectionViewCompositionalLayout { [weak self] | |
| (sectionIndex: Int, layoutEnvironment: NSCollectionLayoutEnvironment) -> NSCollectionLayoutSection? in | |
| switch Section(rawValue: sectionIndex) { | |
| case .brandNames: | |
| return self?.setupBrandNamesSection() | |
| case .catFoods: | |
| return self?.setupCatFoodsSection() | |
| case .cats: | |
| return self?.setupCatsSection() | |
| case .none: | |
| fatalError("Should not be none ") | |
| } | |
| } | |
| return layout | |
| }() | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| ... | |
| collectionView.collectionViewLayout = compositionalLayout | |
| ... | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment