stefanceriu / SCPageViewController

Just like UIPageViewController but better.. :)
MIT License
352 stars 70 forks source link

Large number of dynamic data #26

Closed adelburekovic closed 8 years ago

adelburekovic commented 8 years ago

Basically my question is: can i use this PageViewController in situations where there is potentially large number of dynamic screens (screens are being dynamically loaded and users can remove some of them at will).

stefanceriu commented 8 years ago

I can't see any reason why not. It exposes methods for dynamically inserting, deleting and reloading pages and you can define the number of pages to be preloaded before and after the current one through the layouters.

adelburekovic commented 8 years ago

Thank you for your response.

I have Been checking Demo Swift project and i am seeing that ViewControllers are being stored in an array where they are used when needed.

How would that work in my example where i could have potentially 100 screens of pretty complex ViewControllers. Isn’t holding so many ViewControllers in an array bad practice memory wise?

Other option i see is always creating new ViewController which is also not perfect and could possibly create performance issues?

Any advice how i should approach this problem would be really appreciated.

stefanceriu commented 8 years ago

You're right, in the demo app none of the view controller are released, which is fine, cause they're just demos :)

You will probably want to go with something similar to what UITableViews are doing with their cells: hold a pool of view controllers which you keep reusing, configuring and then passing to the page view controller. That should keep their number low and also help improve the speed on creation.

Now, considering this is not really an issue on the components itself, I will close it.