Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use asset when available in detail card view #579

Merged
merged 13 commits into from
May 7, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ open class OCKTaskController: ObservableObject {
let detailViewController = OCKDetailViewController(showsCloseButton: true)
detailViewController.detailView.titleLabel.text = task.title
detailViewController.detailView.bodyLabel.text = task.instructions
detailViewController.detailView.imageView.image = task.asset.map(UIImage.init(named:)) ?? nil
cbaker6 marked this conversation as resolved.
Show resolved Hide resolved
return detailViewController
}

Expand Down
3 changes: 3 additions & 0 deletions CareKitStore/CareKitStore/Protocols/Tasks/OCKAnyTask.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public protocol OCKAnyTask {
/// An universally unique identifier for this task.
var uuid: UUID { get }

/// A string representation of an asset.
var asset: String? { get }

cbaker6 marked this conversation as resolved.
Show resolved Hide resolved
/// An identifier for this task in a remote store.
var remoteID: String? { get }

Expand Down
2 changes: 1 addition & 1 deletion OCKSample/OCKSample/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private extension OCKStore {
var doxylamine = OCKTask(id: "doxylamine", title: "Take Doxylamine",
carePlanUUID: nil, schedule: schedule)
doxylamine.instructions = "Take 25mg of doxylamine when you experience nausea."

doxylamine.asset = "AppIcon"
let nauseaSchedule = OCKSchedule(composing: [
OCKScheduleElement(start: beforeBreakfast, end: nil, interval: DateComponents(day: 1),
text: "Anytime throughout the day", targetValues: [], duration: .allDay)
Expand Down