I can't fit the post here, so here's the link to it on stack overflow: https://stackoverflow.com/questions/78419812/reconfigure-custom-content-configuration
Reconfigure custom content configuration
Change
var configuration: UIContentConfiguration
to
var configuration: UIContentConfiguration {
didSet {
configureSubviews()
}
}
and remove the subviews in the content view initialization:
subviews.forEach {
$0.removeFromSuperview()
}