I'm sorry in advance for this basic question, I'm just having a hard time finding the answer. I have a view class that subclasses UIView, and has a few basic methods, draw() obviously and others. In my Main.storyboard I've added a UIView element and set its class attribute to this view class I've created. The class is like:
class KeyboardView: UIView {
// local variables ...
override function draw(_ rect: CGRect) {
...
}
class changeKord() {
...
}
// other methods ...
}
From my main ViewController class I would like to reference the instance that is actually created at runtime. When I create an outlet in code for this UIView I need to instantiate it, and I can't access the instance methods in the class. Is there some way to get the actual instance that's created from the outlet variable? Or am I missing something?
What I did was create a global variable outside the View Controller class of type KeyboardView, and in the draw method in the KeyboardView subclass I set that global variable to self, which allows me to reference the instance directly. Which works but seems really hacky.. Is there a way to get the instance from the IBOutlet reference by chance?

