Suppose I have a ParentCollectionViewController
which has the data called assetID
.
This data is also available in the ParentCollectionViewControllerCell
.
How can I pass this data in the ChildCollectionView
which is located in each ParentCollectionViewControllerCell
.
Thanks!
I found an easier alternative.
Declare a function setData() in the ChildCollectionView file.
func setData(dataString: String){
print(dataString, "data you wanted to pass")
}
Take an outlet of the ChildCollectionView from the storyboard into the ParentCollectionViewCell
Call the setData(data) function in ParentCollectionViewCell using the outlet and pass the data into it. Like this:
var dataString: String! {
didSet {
childCollectionViewOutlet.setData(dataString: dataString)
}
}
And voila! You will now have the data available in the desired ChildCollectionView. Hope this helps someone