Learning iOS and trying to figure out the best way to share a "component" across multiple screens. I'm using programmatic layout and no storyboards so that may be making this more difficult than it should be.
I have a UIImageView paint palette chooser with a corresponding selection history UICollectionView of previously chosen colors that is used across many different screens. These are data source driven and also support some UI events like selection, scrolling, drag, etc. All of these interactions bubble up to the view controller for handling along with everything else on this screen. This makes it hard to re-use since the component is not self-contained but instead spread across some views with UI handling all flowing through the controller. How would I go about getting this thing self-contained so that I can just drop it into multiple screens without duplicating code?