carekit-apple / CareKit

CareKit is an open source software framework for creating apps that help people better understand and manage their health.
https://www.researchandcare.org
Other
2.4k stars 443 forks source link

Access control on Updatable protocols and extensions #404

Open Neil3079 opened 4 years ago

Neil3079 commented 4 years ago

When creating custom views for daily tasks I am finding myself having to repeat a lot of internal functionality. The reason for this is I try as much as possible to build my views from existing components where possible (as I believe is the intention).

One of the main offenders in this area tends to be functionality relating to the protocols defined in the file CareKit > ViewUpdaters > Updatable.swift and the associated extensions to provide default implementations.

While it is easy enough to copy and paste these into my own project I feel them being internal encourages people to roll their own implementation instead of keeping things consistent which often provides a sub-optimal user experience.

I appreciate API stability is key and the implementation of these methods may change, but in this case, I see that as a positive as in most cases we will want these changes to propagate across our custom views to keep them consistent with those packaged in CareKit.

erik-apple commented 4 years ago

Could you perhaps provide us with an example of where you're running into these difficulties? That may help us to either address the problem or point you in a different direction!

Neil3079 commented 4 years ago

Sure no problem!

For example, in quite a few of my custom view I use OCKHeaderView as the header. In my custom ViewSynchronizer I will often have to re-implement functionality contained in OCKHeaderView+Updatable.swft for setting the title, calculating user-readable text based on the schedule and setting accessibility labels.

As said it's not a huge issue to reimplement this functionality, but it feels like it leaves more room for a less than consistent user experience, (not to mention developer slip-ups such as forgetting to implement accessibility labels).