Skip to content

Instantly share code, notes, and snippets.

@0xMarK
Created July 25, 2019 09:01
Show Gist options
  • Save 0xMarK/b5002866a1382d69cf1af5f36af5538c to your computer and use it in GitHub Desktop.
Save 0xMarK/b5002866a1382d69cf1af5f36af5538c to your computer and use it in GitHub Desktop.
ChatCollectionView
class ChatViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
collectionView.transform = CGAffineTransform.reversed
// .........
}
}
class ChatCollectionViewCell: UICollectionViewCell {
override func apply(_ layoutAttributes: UICollectionViewLayoutAttributes) {
super.apply(layoutAttributes)
guard transform.isIdentity else { return }
UIView.performWithoutAnimation { transform = CGAffineTransform.reversed }
}
}
extension CGAffineTransform {
static let reversed = CGAffineTransform(a: 1, b: 0, c: 0, d: -1, tx: 0, ty: 0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment