                 self.delegate?.didSelectImage(result!)
             }
         }
-        dismissPicker(false)
-    }
-
-    /////////////////////////////////////////
-    // Public API
-    /////////////////////////////////////////
-
-    public func dismissPicker(animated: Bool) {
-        UIView.animateWithDuration(0.2, animations: {
-            self.backgroundView.alpha = 0
-            self.pickerContainer.transform = CGAffineTransformIdentity
-            }) { _ in
-                self.removeFromParentViewController()
-                self.pickerContainer.removeFromSuperview()
-                self.backgroundView.removeFromSuperview()
-        }
-    }
-
-    public func show(fromVc vc: UIViewController) {
-        fetchImageAssets()
-        collectionView.setContentOffset(CGPointZero, animated: false)
-        let window = UIApplication.sharedApplication().keyWindow!
-        if self.dismissOnTap { window.addSubview(backgroundView) }
-        window.addSubview(pickerContainer)
-        vc.addChildViewController(self)
-        didMoveToParentViewController(vc)
-        _ = self.view
-        UIView.animateWithDuration(0.2, delay: 0, options: .CurveEaseIn, animations: {
-            self.backgroundView.alpha = 1
-            self.pickerContainer.transform = CGAffineTransformMakeTranslation(0, -self.pickerHeight)
-            }, completion: nil)
     }
 
     /////////////////////////////////////////

    /////////////////////////////////////////

    private func setUp() {
        self.modalPresentationStyle = .OverCurrentContext
        fetchImageAssets()
        if PHPhotoLibrary.authorizationStatus() != .Authorized {
            PHPhotoLibrary.requestAuthorization { status in

    func didSelectImage(image: UIImage)
}

public class ImagePickerViewController: UIView, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, UIImagePickerControllerDelegate, UINavigationControllerDelegate, PHPhotoLibraryChangeObserver {

    private static let screenSize = UIScreen.mainScreen().bounds.size
    private static let expectedCellWidth: CGFloat = 240
