0

I have the following getter:

-(UICollectionViewFlowLayout *)verticalFlowViewLayout {
 if (!_verticalFlowViewLayout) {
 _verticalFlowViewLayout = [[UICollectionViewFlowLayout alloc]init;  
[_verticalFlowViewLayout setItemSize:DeviceIsPad()self.iPadCollectionItemPortraitSize :self.iPhoneCollectionItemPortraitSize];
[_verticalFlowViewLayout setMinimumLineSpacing:MIN_LINE_SPACING];
[_verticalFlowViewLayout setScrollDirection:UICollectionViewScrollDirectionVertical];
}
return _verticalFlowViewLayout;
}

And I want to transform it to SWIFT 2. Any help?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Μήτσος
  • 221
  • 2
  • 11

1 Answers1

1
lazy var verticalFlowLayout: UICollectionViewFlowLayout = {
    verticalFlowLayout = UICollectionViewFlowLayout()
    //other configuration here
}()
Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
Neil Horton
  • 707
  • 6
  • 13
  • Correct, but with this method you cannot use other class types. (i.e the frame size of a collection view outlet). However, I used get{} with a temporary variable (let tempFlow = UICollectionViewFlowLayout()) for this time being and it seems working... – Μήτσος Oct 09 '15 at 12:36