Created
July 25, 2019 09:01
-
-
Save 0xMarK/b5002866a1382d69cf1af5f36af5538c to your computer and use it in GitHub Desktop.
ChatCollectionView
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
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