I have a simple tabbed application with two views (two .h and .m files).
I have a few routines that are common to both. What is the proper way to migrate them to one common module so both views can call them?
I have a simple tabbed application with two views (two .h and .m files).
I have a few routines that are common to both. What is the proper way to migrate them to one common module so both views can call them?
We are getting into object oriented design philosophy here. Describe what those "routines" do in natural language. If the relationship between your two UIViews and the common stuff is "is a", use inheritance to make your two UIView subclasses extend from a common base class. If it's "has a", use composition - move the common functionality into a separate class, an instance of which each of your two UIViews would contain.
A common need, I think - perhaps you'll need those routines in other apps? Maybe your own framework would help...
See http://stackoverflow.com/questions/34252627/create-framework-library-module-of-swift-objects-in-xcode
One approach is to create a singleton 'model' that contains the common methods and call those methods in the singleton.