title: Swift - Use of unresolved identifier 'self' / Use of unresolved identifier 'Meme' / Use of unresolved identifier 'memedImage'
body: <p>I get the error message Use of unresolved identifier 'self' as well as the error message Use of unresolved identifier 'Meme'; did you mean 'time'? and Use of unresolved identifier 'memedImage' in Xcode. I am trying to make a MemeMaker and am having trouble creating a struct for  the modified image of the meme. Here is my code:</p>
  
  <pre><code>import UIKit
  
  
  class ViewController: UIViewController, 
  UIImagePickerControllerDelegate,
  UINavigationControllerDelegate {
  
      @IBOutlet weak var ImageView: UIImageView!
      @IBOutlet weak var cameraButton: UIBarButtonItem!
      @IBOutlet weak var topTextField: UITextField!
      @IBOutlet weak var bottomTextField: UITextField!
  
      let textFieldDelegate = TextFieldDelegate()
  
      let memeTextAttributes:[NSAttributedString.Key: Any] = [
          NSAttributedString.Key.strokeColor: UIColor.black,
          NSAttributedString.Key.foregroundColor: UIColor.white,
          NSAttributedString.Key.font: UIFont(name: "HelveticaNeue- 
         CondensedBlack", size: 40)!,
         NSAttributedString.Key.strokeWidth: -3.5]
  
  
  
      override func viewWillAppear(_ animated: Bool) {
          super.viewWillAppear(animated)
  
  
          topTextField.textAlignment = .center
          bottomTextField.textAlignment = .center
          topTextField.text = "Top Text"
          bottomTextField.text = "Bottom Text"
  
          if UIImagePickerController.isSourceTypeAvailable(.camera) {
              cameraButton.isEnabled = true
          } else {
              cameraButton.isEnabled = false
          }
      }
  
  
      override func viewDidLoad() {
          super.viewDidLoad()
          //
          UIImagePickerController().delegate = self
          //
          self.topTextField.delegate = textFieldDelegate
          self.bottomTextField.delegate = textFieldDelegate
          //
          topTextField.defaultTextAttributes = memeTextAttributes
          bottomTextField.defaultTextAttributes = memeTextAttributes
          //
  
      }
  
      //Button to allow user pick an image from an Album
      @IBAction func pickImageFromAlbum(_ sender: Any) {
          let imagePicker = UIImagePickerController()
          imagePicker.delegate = self
          imagePicker.sourceType = .photoLibrary
          present(imagePicker, animated: true, completion: nil)
      }
  
      //Allows user to use camera to take a photo
      @IBAction func takeImageFromCamera(_ sender: Any) {
          let imagePicker = UIImagePickerController()
          imagePicker.delegate = self
          imagePicker.sourceType = .camera
          present(imagePicker, animated: true, completion: nil)
      }
  
      @objc internal func imagePickerController(_ picker: 
  UIImagePickerController, didFinishPickingMediaWithInfo info: [String: 
  Any]) {
      if let pickedImage =
  
    info[convertFromUIImagePickerControllerInfoKey
  (UIImagePickerController.InfoKey.originalImage)] as? UIImage {
  
          ImageView.contentMode = .scaleToFill
          ImageView.image = pickedImage
          dismiss(animated: true, completion: nil)
  
          }
      }
  }
  
  func generateMemedImage() -&gt; UIImage {
  
      // Render view to an image
      UIGraphicsBeginImageContext(self.UIView.frame.size) 
      //Use of unresolved identifier 'self'
      UIView.drawHierarchy(in: self.UIView.frame, afterScreenUpdates: 
  true) //Use of unresolved identifier 'self'
      let memedImage:UIImage = 
  UIGraphicsGetImageFromCurrentImageContext()!
      UIGraphicsEndImageContext()
  
      return memedImage
  }
  
  func save() {
      // Creates the meme
      let meme = Meme(topText: topTextField.text!, bottomText: 
  bottomTextField.text!, originalImage: UIImageView.image!, memedImage: 
  memedImage) //Use of unresolved identifier 'memedImage'
  }
  
  // Helper function inserted by Swift 4.2 migrator.
  fileprivate func convertFromUIImagePickerControllerInfoKey(_ input: 
  UIImagePickerController.InfoKey) -&gt; String {
      return input.rawValue
  }
  </code></pre>