Skip to content

Update many of the concrete CareKit types to Hashable for SwiftUI #726

@cbaker6

Description

@cbaker6

Many of the types in CareKit are structs that conform to Equatable, but not Hashable. My guess is because these types pre-date SwiftUI. This causes issues when using the respective types to update a SwiftUI view. See a bug that is mentioned here for reference netreconlab/CareKitSample-ParseCareKit#145 (comment)

Can types such as OCKAnyEvent, OCKPatient, OCKOutcome, etc. be made Hashable? This is harder than it seems as it will initially break a lot of the CareKit code.

Also, a nice to have is to have CareStoreFetchedResults made Hashable and to be able to get return types of [OCKPatient], [OCKCarePlan], etc. Note, I'm not suggesting that protocols such as OCKAnyPatient conform to Hashable (though this would fix this issue for all types entirely) as that will cause additional breaks in CareKit and possibly break developers code if they created their own types by conforming.

A workaround along with conformance for many of the types are in our Essentials framework (the files typically end in ...+Hashable.swift): https://github.com/netreconlab/CareKitEssentials/tree/main/Sources/CareKitEssentials/Extensions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions