This is preview!
Click on Join Now to Sign Up
Use composition over inheritance and use a factory. I.e. Call a factory function to produce an instance of your API object (which may be a re-used instance) and pass it along as an option to your controller when instantiating the controller. Alternatively, if you don't feel like injecting the dependency when constructing your controller (though clean application design mandates you really should...), you can call the factory to obtain an instance of the API object in the controller's init method instead.The problem is, that the FB-SDK functionality is used in very different contexts, but shares some common variables and some of them could only be intialized once. Inheriting from it or initialzing a new isntance it for every controller which uses it, seems not very practical for me.