Below attached image is representing my requirement:

[![UITableView](https://i.stack.imgur.com/ajOSy.png)](https://i.stack.imgur.com/ajOSy.png)

In this image the yellow color `UITableView` will have list of different `UITableViewCell` items. In one of the `UITableViewCell` it has `UICollectionView` with its list of `UICollectionViewCell` items and the scroll direction for the `UICollectionView` is set to *horizontal*

Each `UICollectionViewCell` will have one `UITableView` (Highlighted in Red Color) and it will have its list of `UITableViewCell` (Highlited in Rose Color) items. Here, the `UITableViewCell` (Highlited in Rose Color) item can collapse/expand. Whenever the cell is collapse/expand the red table's content size is handled automatically. But, whenever the red table's content size is increased the collectionview size is not increasing.

I have added all relevant constraints to these UI elements. But, the content size or frame of the collectionview is not expanding when a tableview cell is expanded.

To understand better here i am breaking it down how the views are designed:

1. Yellow tableview embedded inside a `UIViewController` and it will have one simple `UITableViewCell` which has no custom class
2. To the cell programatically the `UICollectionView` will be added. This `UICollectionView` is placed in one `xib` file and it has embeded inside a `UIView`
3. `UICollectionViewCell` has been created in one `xib` and it will have `UITableView` element inside.
4. Also, `UITableViewCell` has its own `xib` to refer and this is the cell which will gets expand/collapse

I have tried modifying the `intrinsicContentSize` property to modify the `UICollectionView` property's height where it has embedded inside `UIView` element whenever the expand is happening. Please, refer the `CardView.swift` for the reference.

[CardView.swift](https://gist.github.com/spraveenk91/e0139551f4a2ae1d268829c10df86315)

**I know the design is bit complex.** But, what am i missing here?