# How to implement dynamic type with collection view compositional layout?

**URL:** <https://forums.kodeco.com/t/how-to-implement-dynamic-type-with-collection-view-compositional-layout/137772>\
**Category:** Auto Layout by Tutorials\
**Created:** [April 15, 2021, 2:56am UTC](https://forums.kodeco.com/t/how-to-implement-dynamic-type-with-collection-view-compositional-layout/137772 "2021-04-15T02:56:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![skyfoxs](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/skyfoxs/32/107755_2.png) [@skyfoxs](https://forums.kodeco.com/u/skyfoxs)\
**Post date:** [April 15, 2021, 2:56am UTC](https://forums.kodeco.com/t/how-to-implement-dynamic-type-with-collection-view-compositional-layout/137772/1 "2021-04-15T02:56:58Z")

</div>

Hi.  
To support dynamic type in the collection view, in the book we create a custom collection view layout.  
I have a question. Can we use the collection view compositional layout and still support the dynamic type?

Currently, I use the collection view compositional layout for my company project and try to use `traitCollectionDidChange(_:)` to update the layout by deactivating and activate a set of constraints in the custom collection view cell and call the `collectionView.collectionViewLayout.invalidateLayout()` in the view controller.

The problem is when the user changes the dynamic type in the settings, sometimes the cell change layout correctly but sometimes doesn’t. if the user scrolls the collection view most of the new cell display correctly. Not sure if I have to use a custom collection view layout instead of a collection view compositional layout.

Thanks
