Static member cannot be used on instance of type or how to make screenshot
<p>I am 100% sure this has been answered but the answers I am finding I cannot seem to make fit into my solution.</p>

<p>Starting from the beginning I have my <strong>ShareViewController</strong> where I have two imageViews put one on one, and in order to make it one image I am taking a screenshot of that imageView size. The code for taking screenshot I have taken here <a href="https://stackoverflow.com/questions/7964153/ios-whats-the-fastest-most-performant-way-to-make-a-screenshot-programaticall/8017292#8017292">iOS: what&#39;s the fastest, most performant way to make a screenshot programmatically?</a></p>

<p>Here is my class: </p>

<pre><code>import UIKit
import Photos

class ShareViewController: UIViewController, UIDocumentInteractionControllerDelegate {

    var defaultImage: UIImage? = nil
    var documentController: UIDocumentInteractionController!

    @IBOutlet weak var imageView: UIImageView!

    @IBOutlet weak var overlayImageView: UIImageView!


    override func viewDidLoad() {
        super.viewDidLoad()

        guard let image = defaultImage else {
            return
        }

        self.imageView.image = image
        self.imageView.contentMode = .ScaleAspectFill

        let subimage1 = UIImage(named: "overlay")
        self.overlayImageView.image = subimage1
        self.imageView.clipsToBounds = true

    }

    @IBAction func shareButton(sender: UIButton) {
        self.screenshot()
        self.shareToInstagram()
        _ = self.imageView.image!
        let fetchOptions = PHFetchOptions()
        fetchOptions.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)]
        let fetchResult = PHAsset.fetchAssetsWithMediaType(.Image, options: fetchOptions)
        if let lastAsset = fetchResult.firstObject as? PHAsset {
            let localIdentifier = lastAsset.localIdentifier
            let u = "instagram://library?LocalIdentifier=" + localIdentifier
            _ = NSURL(string: u)!

        }
    }

    // MARK: - Make Screenshot of ImageView

    class func screenshot() -&gt; UIImage {
        var imageSize = CGSizeZero

        let orientation = UIApplication.sharedApplication().statusBarOrientation
        if UIInterfaceOrientationIsPortrait(orientation) {
            imageSize = UIScreen.mainScreen().bounds.size
        } else {
            imageSize = CGSize(width: UIScreen.mainScreen().bounds.size.height, height: UIScreen.mainScreen().bounds.size.width)
        }

        UIGraphicsBeginImageContextWithOptions(imageSize, false, 0)
        let context = UIGraphicsGetCurrentContext()
        for window in UIApplication.sharedApplication().windows {
            CGContextSaveGState(context)
            CGContextTranslateCTM(context, window.center.x, window.center.y)
            CGContextConcatCTM(context, window.transform)
            CGContextTranslateCTM(context, -window.bounds.size.width * window.layer.anchorPoint.x, -window.bounds.size.height * window.layer.anchorPoint.y)
            if orientation == .LandscapeLeft {
                CGContextRotateCTM(context, CGFloat(M_PI_2))
                CGContextTranslateCTM(context, 0, -imageSize.width)
            } else if orientation == .LandscapeRight {
                CGContextRotateCTM(context, -CGFloat(M_PI_2))
                CGContextTranslateCTM(context, -imageSize.height, 0)
            } else if orientation == .PortraitUpsideDown {
                CGContextRotateCTM(context, CGFloat(M_PI))
                CGContextTranslateCTM(context, -imageSize.width, -imageSize.height)
            }
            if window.respondsToSelector(#selector(UIView.drawViewHierarchyInRect(_:afterScreenUpdates:))) {
                window.drawViewHierarchyInRect(window.bounds, afterScreenUpdates: true)
            } else if let context = context {
                window.layer.renderInContext(context)
            }
            CGContextRestoreGState(context)
        }

        let image = UIGraphicsGetImageFromCurrentImageContext()
        UIGraphicsEndImageContext()
        return image
    }

    // MARK: - Share photo to Instagram

    func displayAlert(title: String, message: String) {
        let alertController = UIAlertController(title: title, message: message, preferredStyle: .Alert)
        alertController.addAction(UIAlertAction(title: "OK", style: .Default, handler: nil))
        presentViewController(alertController, animated: true, completion: nil)
        return
    }

    func displayShareSheet(shareContent:String) {
        let activityViewController = UIActivityViewController(activityItems: [shareContent as NSString], applicationActivities: nil)
        presentViewController(activityViewController, animated: true, completion: {})
    }


    func shareToInstagram() {

        let instagramURL = NSURL(string: "instagram://app")

        if (UIApplication.sharedApplication().canOpenURL(instagramURL!)) {

            let imageData = UIImageJPEGRepresentation(self.imageView.image!, 100)

            let captionString = "caption"

            let writePath = (NSTemporaryDirectory() as NSString).stringByAppendingPathComponent("instagram.igo")
            if imageData?.writeToFile(writePath, atomically: true) == false {

                return

            } else {
                let fileURL = NSURL(fileURLWithPath: writePath)

                self.documentController = UIDocumentInteractionController(URL: fileURL)

                self.documentController.delegate = self

                self.documentController.UTI = "com.instagram.exlusivegram"

                self.documentController.annotation = NSDictionary(object: captionString, forKey: "InstagramCaption")
                self.documentController.presentOpenInMenuFromRect(self.view.frame, inView: self.view, animated: true)

            }

        } else {
            print(" Instagram isn't installed ")
        }
    }
}
</code></pre>

<p>Now when I try to call screenshot() method it says that </p>

<blockquote>
  <p>Static member 'screenshot' cannot be used on instance of type
  'ShareViewController'</p>
</blockquote>

<p>How can I fix this and successfully take screenshot of my imageViews?</p>