This is just a standard class declaration, but the “weak” part *is* important… except in this case they’re recommending a weak ref where I don’t think it’s necessary. I don’t know of a formal name, but I call this the “timid reference”.
+----------> paymentView
PaymentViewController ^
+---> view ---/
Since paymentView doesn’t have a reference to the controller (and if it did, it should be a weak reference *anyway*) there is no risk of a circular reference here. So, in this case, ignore that “weak” part. We’re left with this:
class PaymentViewController < UIViewController
attr_accessor :paymentView
end
So far so good! :-D
Things to note:
- no need to declare that PaymentVC implements the protocol. Implement the required methods and RubyMotion will take care of the rest.
- no need to import / require anything
Colin T.A. Gray
Community Manager
HipByte