I currently have two classes. Class A has my UIView attached to it. My second Class, Class B has some other functions that works in the background. I have one function that ends up with a string. Is there a easy way to move that string from Class B to Class A that has the UIView.
Share
Sure — just make sure that the instance of B has a reference to the instance of A that you want to pass the string to.
Rule: Any time you want one object, say
foo, to be able to communicate directly with another object,bar, thenfooneeds a pointer tobar.Communication between objects isn’t always direct — some other object (or objects) may act as intermediaries. That doesn’t change the rule above; indirect communication is just a sequence of direct communications. If
foouses a notification to communicate withbar,fooneeds a pointer to the notification center, and the notification center needs a pointer tobar.