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 445 forks source link

Can you initialize OCKCareCardViewController using StoryBoard? #68

Closed ninoguba closed 7 years ago

ninoguba commented 8 years ago

Let's say I'm using the StoryBoard to design my app with multiple tabs in a TabViewController and one of these tabs is the OCKCareCardViewController. So far from the documentation and sample app, this can only be instantiated and added to the TabViewController programmatically.

umerkhan-apple commented 8 years ago

@ninoguba In order to do so, the Care Card would have to be IB_INSPECTABLE. If this is highly-requested, then let's try to go ahead and do that.

scdi commented 8 years ago

It would be nice to be able to use the StoryBoard.

sashalondon commented 8 years ago

I would also like this.

ncarroll-mdsol commented 7 years ago

Any update on this? Is there a way to hack around this in the time being?

Is there a good reason for these ViewControllers to not be compatible with Storyboards / Segues?

tktsubota commented 7 years ago

@ncarroll-mdsol I opened a PR a while back addressing this (#109). You can use the storyboard branch on my fork to try it out. See the PR for how to use it.

ninoguba commented 7 years ago

I figured out a way clean way to separate the CareCard/SymptomTracker/Insight controllers on its own and have them somewhat represented in the Storyboard. The trick is subclassing a UINavigationController for each of the CareKit views you want to use then set the nav's viewcontrollers to contain just the corresponding CareKit view. Then in your Storyboard just add your nav controllers and define segues between them.

To address the singularity of the OCKCarePlanStore, just follow how it was done with OCKSample where a singleton CarePlanStoreManager class is used to share the same store between the different views.

Hope this helps!