Design for an application framework that will allow each implementation to customize parts of the UI

I am tasked with designing an application framework that will allow each implementation to customize parts of the user interface. One such example would be that the implementation (let’s call it client from now on) can define the collection view cells to return for a particular screen. The framework is simply responsible for vending the appropriate objects to make building an App much easier since we will be building several similar looking instances.

My current approach to the framework has been to design a Coordination Controller that is responsible for all presentation and dismissal events throughout the App. The default Coordination Controller vends out all the default view controllers inside the framework that all perform their relevant tasks without necessarily providing configured UI. For instance: one controller will show a collection view with template cells and nothing special. The benefit of this design is that it removes the coupling between controllers and also allows for a client to override the default coordinator and return an entirely new view controller for a specific task.

The problem I’m having is how should I design this framework to allow a client to add their own custom UI into the App.

Approach One

Make the framework require a view factory and let this view factory be responsible for vending out all the relevant views. Thus, in the App Delegate we might enforce that the client create a CollectionViewCellFactory for instance and the interface defines all the cells that any conforming class will need to supply. I inherited a code base with this design and moved away from it as it was far too abstract and customizable. It came with tons of factories for every aspect of the App and this added days onto the setup time of every App.

Approach Two

Each view controller specifies subclassing hooks or setup API that will allow for these custom UI classes to be defined at run time (Similar to how UISplitViewController allows callers to setup the controllers using the viewControllers property). To do this each client will simply subclass the base Coordination Controller and in each controllers presentation; set the appropriate values onto the controller so that it achieves the desired UI. Something like

viewController.registerReusableCellsBlock = ^(UICollectionView *collectionView){
   //perform custom registration
}

viewController.cellDequeueBlock = ^UICollectionViewCell<SomeProtocol> *(UICollectionView *collectionView,NSIndexPath *indexPath){
   //dequeue custom cells
}

Currently, I separate the data source for a view into a separate object to promote reusability and prevent ViewController bloat. This makes subclassing the view controller to supply the interface of the cells a little harder but not impossible.

Approach 3

Perhaps its a bad idea to attempt to design a framework and anticipate its usage. Maybe the best option is to allow for subclassing with maximum control, even if the setup cost is relatively high. Then, once I’ve built it for several clients I might notice the patterns that emerge and begin optimization along the route.

I understand how I might make it customizable internal to the framework, what I’m struggling with is how to best define an interface that defines potential customization points of the framework by the client.

TL;DR

The most complicated part of the interface deals with a Collection View nested inside Collection View Cells. This allows for horizontal paging and vertical scrolling of cells. This is achieved by having one data source that manages the horizontal cells and configures each cell’s collection view with a new data source.

How would one design an interface that allows all these cells to be customizable?

3

This is old but worthy question that never got a worthy answer, which, in my experience, in response to

How would one design an interface that allows all these cells to be customizable?

is- don’t do it.

Constraining the choices a client can make in customization- whether in UI or in something else- is almost always better for the vendor- because it simplifies the solution and reduces the support burden- and also for the client- because then they are most able to leverage the vendor’s expertise to get to the sweet spot of the solution space, without wasting their own time reinventing the wheel.

If they need a different solution, they will tell you. If they insist on customization, they need a different solution and just don’t know it yet.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật