jamonholmgren / ProMotion

ProMotion is a RubyMotion gem that makes iPhone development less like Objective-C and more like Ruby.
MIT License
1.26k stars 148 forks source link

CollectionScreen#on_load never gets called #775

Open sfsekaran opened 8 years ago

sfsekaran commented 8 years ago

To whom it may concern,

In the documentation, the CollectionScreen should call the on_load method once viewDidLoad gets called. Via manual testing, I found this doesn't happen.

I also believe I found the issue in the code.

The following method, view_did_load, calls on_load, and is common to all screens: https://github.com/infinitered/ProMotion/blob/a40c03ca89e21c21ef4c2fc35d5d3b85ea4c77de/lib/ProMotion/screen/screen_module.rb#L38

In ProMotion::Collection#viewDidLoad, which is an include of CollectionScreen, you'll notice that self.view_did_load is never called: https://github.com/infinitered/ProMotion/blob/a40c03ca89e21c21ef4c2fc35d5d3b85ea4c77de/lib/ProMotion/collection/collection.rb#L19

Whereas in ScreenModuleViewController#viewDidLoad, it is called (as it should be): https://github.com/infinitered/ProMotion/blob/a40c03ca89e21c21ef4c2fc35d5d3b85ea4c77de/app/screens/screen_module_view_controller.rb#L13

Please fix! :) Meanwhile, I will override viewDidLoad in my subclass of PM::CollectionScreen, and place the following code there:

  def viewDidLoad
    super
    self.view_did_load if self.respond_to?(:view_did_load)
  end

Best regards, Sathya Sekaran

markrickert commented 8 years ago

Hi @sfsekaran, thanks for reporting this. This should be a simple fix and we'd welcome a pull request with accompanying tests.