Post

Replies

Boosts

Views

Activity

Reply to Inconsistent behavior in invoking a Swift method from a different class?
The problem was solved by a posting on Stack Overflow. Basically, you were correct - the problem was that I was creating an additional instance of the GameViewController. In order to force graphRef to refer to the original instance, the suggestion was to re-bind it to the appropriate instance by placing this statement in the Renderer init: self.graphRef = graphRef Then the guard statement in GameViewController needed to include the change so that graphRef referred to self and the init in Renderer needed to be notified of the same thing. After these changes, I was able to call dodraw() using graphRef.dodraw() and everything worked well. Thanks for your help!
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’23