From d2d4bbd33382e02f404b4ecde957075abf654af2 Mon Sep 17 00:00:00 2001 From: Stefan Renne Date: Mon, 13 May 2019 15:23:04 +0200 Subject: [PATCH] Dispatch commonInit on Main thread --- PKHUD/FrameView.swift | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/PKHUD/FrameView.swift b/PKHUD/FrameView.swift index 787f72e..473048f 100644 --- a/PKHUD/FrameView.swift +++ b/PKHUD/FrameView.swift @@ -14,20 +14,24 @@ internal class FrameView: UIVisualEffectView { internal init() { super.init(effect: UIBlurEffect(style: .light)) - commonInit() + DispatchQueue.main.async { + self.commonInit() + } } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) - commonInit() + DispatchQueue.main.async { + self.commonInit() + } } - fileprivate func commonInit() { + private func commonInit() { backgroundColor = UIColor(white: 0.8, alpha: 0.36) layer.cornerRadius = 9.0 layer.masksToBounds = true - contentView.addSubview(self.content) + contentView.addSubview(content) let offset = 20.0 @@ -45,7 +49,7 @@ internal class FrameView: UIVisualEffectView { addMotionEffect(group) } - fileprivate var _content = UIView() + private var _content = UIView() internal var content: UIView { get { return _content