title: Storage variables in UIButton for additional functionality
body: <p>I want to hold in variables and add new functions in UIButton.
  I have tried with extension but with set and get, I could not able to do it. I have tried to create custom UIButton class, but now, I can't able use my functions and variables on my new button class in xcode.</p>
  
  <p>How can I do?
  Thank you...</p>
  
  <pre><code>class ViewController: UIViewController {
      //I want to be able to initialize MyUIButton like below
      @IBOutlet weak var button11: MyUIButton!
  
      override func viewDidLoad() {
          super.viewDidLoad()
          //initialize the databaseAccessor class
          let appDelegate = UIApplication.shared.delegate as! AppDelegate
          let context = appDelegate.persistentContainer.viewContext
          DatabaseAccessor.shared = DatabaseAccessor(delegate: appDelegate, viewContext: context)
  
          // the code that I want to work is below
          button11.getLocation()
  
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  
  
  }
  
  
  import UIKit
  
  @IBDesignable
  class MyUIButton: UIButton {
  
      /*
      // Only override draw() if you perform custom drawing.
      // An empty implementation adversely affects performance during animation.
      override func draw(_ rect: CGRect) {
          // Drawing code
      }
      */
      override func awakeFromNib() {
          super.awakeFromNib()
      }
  
      @IBInspectable var purposeName = ""
      private var purposeIcon = ""
      private var location = 0
  
      func setPurposeName(name: String){
          purposeName = name
      }
  
      func getPurposeName()-&gt; String{
          return purposeName
      }
  
      func setPurposeIcon(name: String){
          purposeIcon = name
      }
  
      func getPurposeIcon()-&gt; String{
          return purposeIcon
      }
  
      func setLocation(location: Int){
          self.location = location
      }
  
      func getLocation()-&gt; Int{
          return location
      }
  }
  </code></pre>
  
  <p>I have done these but non of them has worked... I want to use functions that I made in viewController. Like</p>