Skip to content

Instantly share code, notes, and snippets.

@qwzybug
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qwzybug/f01d8e27969abb27fb0b to your computer and use it in GitHub Desktop.
Save qwzybug/f01d8e27969abb27fb0b to your computer and use it in GitHub Desktop.
func &<T>(x: T, op: T -> T) -> T {
return op(x)
}
func &<T>(x: T, op: T -> ()) -> T {
op(x)
return x
}
attributes.transform3D = CATransform3DIdentity
& { CATransform3DRotate($0, rotation, 0, 1, 0) }
& { CATransform3DTranslate($0, 0, 0, translation) }
& { (var t) in t.m34 = -1.0 / 300 }
override func layoutAttributesForSupplementaryViewOfKind(elementKind: String!, atIndexPath indexPath: NSIndexPath!) -> UICollectionViewLayoutAttributes! {
return UICollectionViewLayoutAttributes(forSupplementaryViewOfKind: elementKind, withIndexPath: indexPath)
& { self.configureAttributes($0, at: indexPath) }
& { $0.size = CGSize(width: self.columnWidth, height: self.columnWidth) }
}
override func layoutAttributesForItemAtIndexPath(indexPath: NSIndexPath!) -> UICollectionViewLayoutAttributes! {
return UICollectionViewLayoutAttributes(forCellWithIndexPath: indexPath)
& { self.configureAttributes($0, at: indexPath) }
& { $0.size = CGSize(width: self.columnWidth, height: self.collectionView.bounds.height) }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment