         #endif
         
         button.setTitleColor(globalTitleColor ?? UIColor.black, for: .normal)
-		button.titleLabel!.font = globalTitleFont ?? UIFont.boldSystemFont(ofSize: 18.0)
+		button.titleLabel?.font = globalTitleFont ?? UIFont.boldSystemFont(ofSize: 18.0)
 		
 		button.addTarget(self, action: #selector(DKAssetGroupDetailVC.showGroupSelector), for: .touchUpInside)
         return button
     }()
 		
     public var selectedGroupId: String?
-    public weak var imagePickerController: DKImagePickerController!
-    internal var collectionView: UICollectionView!
-    private var groupListVC: DKAssetGroupListVC!
+    public weak var imagePickerController: DKImagePickerController?
+    internal var collectionView: UICollectionView?
+    private var groupListVC: DKAssetGroupListVC?
     private var hidesCamera: Bool = false
     private var footerView: UIView?
     private var headerView: UIView?
-    private var currentViewSize: CGSize!
+    private var currentViewSize: CGSize?
     private var registeredCellIdentifiers = Set<String>()
     private var thumbnailSize = CGSize.zero
     
     override open func viewDidLoad() {
         super.viewDidLoad()
-        
-        self.imagePickerController.add(observer: self)
-		
-		let layout = self.imagePickerController.UIDelegate.layoutForImagePickerController(self.imagePickerController).init()
-		self.collectionView = UICollectionView(frame: CGRect.zero, collectionViewLayout: layout)
-        self.collectionView.backgroundColor = self.imagePickerController.UIDelegate.imagePickerControllerCollectionViewBackgroundColor()
-        self.collectionView.allowsMultipleSelection = true
-		self.collectionView.delegate = self
-		self.collectionView.dataSource = self
-		self.view.addSubview(self.collectionView)
-		
-		self.footerView = self.imagePickerController.UIDelegate.imagePickerControllerFooterView(self.imagePickerController)
-		if let footerView = self.footerView {
-			self.view.addSubview(footerView)
+
+        guard let imagePickerController = imagePickerController else {
+            assertionFailure("Expect imagePickerController")
+            return
+        }
+
+        imagePickerController.add(observer: self)
+		
+		let layout = imagePickerController.UIDelegate.layoutForImagePickerController(imagePickerController).init()
+		let collectionView = UICollectionView(frame: CGRect.zero, collectionViewLayout: layout)
+        collectionView.backgroundColor = imagePickerController.UIDelegate.imagePickerControllerCollectionViewBackgroundColor()
+        collectionView.allowsMultipleSelection = true
+		collectionView.delegate = self
+		collectionView.dataSource = self
+		view.addSubview(collectionView)
+
+        self.collectionView = collectionView
+		
+		footerView = imagePickerController.UIDelegate.imagePickerControllerFooterView(imagePickerController)
+		if let footerView = footerView {
+			view.addSubview(footerView)
 		}
       
-        self.headerView = self.imagePickerController.UIDelegate.imagePickerControllerHeaderView(self.imagePickerController)
-        if let headerView = self.headerView {
-            self.view.addSubview(headerView)
-        }
-		
-		self.hidesCamera = self.imagePickerController.sourceType == .photo
-		self.checkPhotoPermission()
-        
-        if self.imagePickerController.allowSwipeToSelect && !self.imagePickerController.singleSelect {
+        headerView = imagePickerController.UIDelegate.imagePickerControllerHeaderView(imagePickerController)
+        if let headerView = headerView {
+            view.addSubview(headerView)
+        }
+		
+		hidesCamera = imagePickerController.sourceType == .photo
+		checkPhotoPermission()
+        
+        if imagePickerController.allowSwipeToSelect && !imagePickerController.singleSelect {
             let swipeOutGesture: UIPanGestureRecognizer = UIPanGestureRecognizer(target: self, action: #selector(self.swiping(gesture:)))
             swipeOutGesture.delegate = self
-            self.collectionView.panGestureRecognizer.require(toFail: swipeOutGesture)
-            self.collectionView.addGestureRecognizer(swipeOutGesture)
+            collectionView.panGestureRecognizer.require(toFail: swipeOutGesture)
+            collectionView.addGestureRecognizer(swipeOutGesture)
         }
     }
     

    }
    
    func imagePickerControllerDidDeselect(assets: [DKAsset]) {
	// Prevent CV bug which could crash in performBatchUpdates
        self.collectionView.numberOfItems(inSection: 0)
	    
        self.collectionView.performBatchUpdates({
            for indexPathForVisible in self.collectionView.indexPathsForVisibleItems {
                if let cell = (self.collectionView.cellForItem(at: indexPathForVisible) as? DKAssetGroupDetailBaseCell),
                    let asset = cell.asset, cell.isSelected {
                    if let selectedIndex = self.imagePickerController.index(of: asset) {
                        cell.selectedIndex = selectedIndex
                    } else if cell.isSelected {
                        self.collectionView.deselectItem(at: indexPathForVisible, animated: true)
                    }
                }
            }
        }, completion: nil)
    }
    
	// MARK: - DKImageGroupDataManagerObserver

	}
	
	func group(groupId: String, didRemoveAssets assets: [DKAsset]) {
        guard let imagePickerController = imagePickerController else {
            assertionFailure("Expect imagePickerController")
            return
        }

        for removedAsset in assets {
            if imagePickerController.contains(asset: removedAsset) {
                imagePickerController.deselect(asset: removedAsset)
            }
        }
	}
