Created
February 18, 2013 10:42
-
-
Save luca-bernardi/4976541 to your computer and use it in GitHub Desktop.
How to use inline block to better organize a block of code
This file contains 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
__weak typeof(self) weakSelf = self; | |
self.collectionView = (UICollectionView *)^{ | |
UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init]; | |
UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:weakSelf.view.bounds | |
collectionViewLayout:flowLayout]; | |
collectionView.delegate = weakSelf; | |
collectionView.dataSource = weakSelf; | |
return collectionView; | |
}(); |
@kylef I'm not doing this anymore and indeed I'm doing the same you were suggesting, even though is still see the problem that someone that is not familiar with this trick might take sometimes to understand the code.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is totally overkill, you can do the following: