Question: I'm developing an iOS app which includes Facebook Login, I have done the login button, but going through the Facebook Test I saw a test to ensure token validity, and if not valid, ask the user to sign in again, I would like to know how to check if a Access Token is valid or expired using Swift 3.0.

Answer: 
I think this will work.

```
override init(collectionViewLayout layout: UICollectionViewLayout) {
    super.init(collectionViewLayout: layout)
    collectionView?.collectionViewLayout = YourCollectionViewLayout()
}

```
It's possible to do what I was trying to do. Basically, follow the tutorials I suggested in my own question and setup the collection view and its view layout as follow:

```
collectionViewLayout = PinterestLayout()
collectionViewLayout.delegate = self
collectionView = DynamicCollectionView.init(frame: .zero, collectionViewLayout: collectionViewLayout)

```

Note that I'm using `DynamicCollectionView` (instead of `UICollectionView`). This class is not provided by Apple: I've made my own using the code provided in [this post](https://stackoverflow.com/a/26232188/1898973). 

Remember that this approach is when you're creating a view programmatically, using constraints. (May be it has another cases of use)