Actividad torre de hanoi

main
Juan David 1 month ago
parent d4e9431d38
commit 62c8e7e2d3

@ -731,4 +731,5 @@ El test que se realizó es acerca del estado de animo y ansiedad, el cuál luce
![](imagenes/testAn.png) ![](imagenes/testAn.png)
Para la parte de actividades, se requiere crear de nuevo un Swift File, con el nombre de ActiveTaskManager

@ -0,0 +1,28 @@
//
// ActiveTaskManager.swift
// RK-Journals
//
// Created by Juan David López Regalado on 21/11/24.
//
import Foundation
import ResearchKit
import ResearchKitUI
import ResearchKitActiveTask
import ResearchKitActiveTask_Private
class ActiveTaskManager {
static let shared = ActiveTaskManager()
func createActiveTasks() -> ORKOrderedTask {
let towerOfHanoiStep = ORKTowerOfHanoiStep(
identifier: "towerOfHanoiStep"
)
return ORKOrderedTask(identifier: "activeTasks", steps:[towerOfHanoiStep ])
}
}

@ -77,6 +77,9 @@
<rect key="frame" x="140" y="252" width="113" height="35"/> <rect key="frame" x="140" y="252" width="113" height="35"/>
<state key="normal" title="Button"/> <state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="Actividades"/> <buttonConfiguration key="configuration" style="plain" title="Actividades"/>
<connections>
<action selector="activitiesButtonTapped:" destination="JfP-LC-owM" eventType="touchUpInside" id="hfR-ky-qXK"/>
</connections>
</button> </button>
</subviews> </subviews>
<viewLayoutGuide key="safeArea" id="juQ-Ke-iUj"/> <viewLayoutGuide key="safeArea" id="juQ-Ke-iUj"/>

@ -44,6 +44,13 @@ class TasksViewController: UIViewController, ORKTaskViewControllerDelegate {
present(taskViewController, animated: true, completion: nil) present(taskViewController, animated: true, completion: nil)
} }
@IBAction func activitiesButtonTapped(_ sender: UIButton) {
let taskViewController = ORKTaskViewController(task: ActiveTaskManager.shared.createActiveTasks(), taskRun: nil)
taskViewController.delegate = self
taskViewController.modalPresentationStyle = .fullScreen
present(taskViewController, animated: true, completion: nil)
}
func consentPDFViewerTask() -> ORKOrderedTask{ func consentPDFViewerTask() -> ORKOrderedTask{
var docURL = (FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)).last var docURL = (FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)).last
docURL = docURL?.appendingPathComponent("consent.pdf") docURL = docURL?.appendingPathComponent("consent.pdf")

Loading…
Cancel
Save