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: 
How about you just create a variable that creates your flow layout for you like this

```
var flowLayout: UICollectionViewFlowLayout {
    let _flowLayout = UICollectionViewFlowLayout()

    // edit properties here
    _flowLayout.itemSize = CGSize(width: 98, height: 134)
    _flowLayout.sectionInset = UIEdgeInsetsMake(0, 5, 0, 5)
    _flowLayout.scrollDirection = UICollectionViewScrollDirection.horizontal
    _flowLayout.minimumInteritemSpacing = 0.0
    // edit properties here

    return _flowLayout
}

```

And then you can set it by calling the variable.

```
self.collectionView.collectionViewLayout = flowLayout // after initializing it another way
// or
UICollectionView(frame: .zero, collectionViewLayout: flowLayout)

```
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)