I am getting this error "Instance member 'jpegData' cannot be used on type 'UIImage'; did you mean to use a value of this type instead?"
@IBAction func saveButtonWasPressed(_ sender: UIBarButtonItem) {
    if NoteNameLabel.text == "" || NoteNameLabel.text == "NOTE NAME" || noteDescriptionLabel.text == "" || noteDescriptionLabel.text == "Note Description..." {
        let alertController = UIAlertController(title: "Missing Information", message:"You left one or more fields empty. Please make sure that all fields are filled before attempting to save.", preferredStyle: UIAlertController.Style.alert)
        let OKAction = UIAlertAction(title: "Dismiss", style: UIAlertAction.Style.default, handler: nil)
        alertController.addAction(OKAction)
        self.present(alertController, animated: true, completion: nil)
    }
    else {
        if (isExesting == false) {
            let noteName = NoteNameLabel.text
            let noteDescription = noteDescriptionLabel.text
            if let moc = managedObjectContext {
                let note = Note(context: moc)
                if let data: Data = UIImage.jpegData(compressionQuality: 1.0) {
                    note.noteImage = data as NSData as Data
                }
                note.noteName = noteName
                note.noteDescription = noteDescription
                saveToCoreData() {
                    let isPresentingInAddFluidPatientMode = self.presentingViewController is UINavigationController
                    if isPresentingInAddFluidPatientMode {
                        self.dismiss(animated: true, completion: nil)
                    }
                    else {
                        self.navigationController!.popViewController(animated: true)
                    }
                }
            }
        }
        else if (isExesting == true) {
            let note = self.note
            let managedObject = note
            managedObject!.setValue(NoteNameLabel.text, forKey: "noteName")
            managedObject!.setValue(noteDescriptionLabel.text, forKey: "noteDescription")
            if let data: Data = UIImage.jpegData(compressionQuality: 1.0) {
                managedObject!.setValue(data, forKey: "noteImage")
            }
            do {
                try context.save()
I try to use jpegData(compressionQuality:) and pngData() instance methods of the UIImage class like the documentation says I can but still have an error
 
    