If the contentView is not provided in init(:_) and rather lazily given using setup(contentView: UIView) method, screenshot blocking doesn't work.
The reason is preventScreenCapture variable doesn't get set in this scenario. We prematurely exit out of the setupUI() function if contentView is nil. Therefore, the below block never gets called.
DispatchQueue.main.async {
self.preventScreenCapture = true
}