xcode - Swift convert code to component for use multiple times -
i'm swift newbie , i'm trying achieve feels should easy lack of knowledge of storyboard + swift + terminology holding me back! i'd create horizontal scroller component achieves following design goals: i can add view in app few lines of code i can pass in array of values configure each of elements in scroller the scroller elements (cells?) designed in .xib file i can have multiple instances of scroller in view i've created simple example scroller has following structure: viewcontroller (horizontalscrollervc.swift) storyboard (used creating outlets, constraints , config) a uicollectionviewcell subclass (mycell.swift) a custom xib file class property set mycell.swift (mycell.xib) i imagine component might used in viewcontroller's viewdidload() method this: //**pseudo code** let data1 = ["a","b","c"] let data2 = ["1","2","3"] let scroller1:myscroller = scrollerfromdata(data:data1) sc...