diff --git a/juandlr b/juandlr new file mode 100644 index 0000000..2e682e1 --- /dev/null +++ b/juandlr @@ -0,0 +1,7 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW +QyNTUxOQAAACAuTfFTJ/mBkHnK4Rp3/v5PEuhG/KWmmYxoGmYrHQ22jgAAAKCWvZUolr2V +KAAAAAtzc2gtZWQyNTUxOQAAACAuTfFTJ/mBkHnK4Rp3/v5PEuhG/KWmmYxoGmYrHQ22jg +AAAEDSaavKByFdT9fm5Kd80MLdY/8CPpzHCnpwxI1EO/rlUC5N8VMn+YGQecrhGnf+/k8S +6Eb8paaZjGgaZisdDbaOAAAAGm0xOTEyMDI5OEBtb3JlbGlhLnRlY25tLm14AQID +-----END OPENSSH PRIVATE KEY----- diff --git a/juandlr.pub b/juandlr.pub new file mode 100644 index 0000000..a1e6f08 --- /dev/null +++ b/juandlr.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC5N8VMn+YGQecrhGnf+/k8S6Eb8paaZjGgaZisdDbaO m19120298@morelia.tecnm.mx diff --git a/surveys-example.xcodeproj/project.pbxproj b/surveys-example.xcodeproj/project.pbxproj index 91b7fc3..f705c24 100644 --- a/surveys-example.xcodeproj/project.pbxproj +++ b/surveys-example.xcodeproj/project.pbxproj @@ -7,46 +7,51 @@ objects = { /* Begin PBXBuildFile section */ + F53D0B8F2C366603003BED2B /* ActivitiesManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F53D0B8E2C366602003BED2B /* ActivitiesManager.swift */; }; + F53D0B952C366620003BED2B /* ActivitiesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F53D0B942C366620003BED2B /* ActivitiesViewController.swift */; }; F562558D2C1A1DF000BF163B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F562558C2C1A1DF000BF163B /* AppDelegate.swift */; }; F562558F2C1A1DF000BF163B /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F562558E2C1A1DF000BF163B /* SceneDelegate.swift */; }; F56255912C1A1DF000BF163B /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F56255902C1A1DF000BF163B /* ViewController.swift */; }; F56255942C1A1DF000BF163B /* Base in Resources */ = {isa = PBXBuildFile; fileRef = F56255932C1A1DF000BF163B /* Base */; }; F56255962C1A1DF200BF163B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F56255952C1A1DF200BF163B /* Assets.xcassets */; }; F56255992C1A1DF200BF163B /* Base in Resources */ = {isa = PBXBuildFile; fileRef = F56255982C1A1DF200BF163B /* Base */; }; - F56255B02C1A1EF900BF163B /* ResearchKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F56255A82C1A1E7E00BF163B /* ResearchKit.framework */; }; - F56255B12C1A1EF900BF163B /* ResearchKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F56255A82C1A1E7E00BF163B /* ResearchKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - F56255B22C1A1EF900BF163B /* ResearchKitActiveTask.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F56255AE2C1A1E7E00BF163B /* ResearchKitActiveTask.framework */; }; - F56255B32C1A1EF900BF163B /* ResearchKitActiveTask.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F56255AE2C1A1E7E00BF163B /* ResearchKitActiveTask.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - F56255B42C1A1EF900BF163B /* ResearchKitUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F56255AC2C1A1E7E00BF163B /* ResearchKitUI.framework */; }; - F56255B52C1A1EF900BF163B /* ResearchKitUI.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F56255AC2C1A1E7E00BF163B /* ResearchKitUI.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F593A87F2C34E223005283D3 /* FormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F593A87E2C34E223005283D3 /* FormViewController.swift */; }; + F593A8852C34E5F8005283D3 /* ConsentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F593A8842C34E5F8005283D3 /* ConsentViewController.swift */; }; F59F9B402C1A303B0083C2E9 /* ConsentManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F59F9B3F2C1A303B0083C2E9 /* ConsentManager.swift */; }; + F5F577462C2C8F7400FCB852 /* ResearchKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5F5773E2C2C8D0B00FCB852 /* ResearchKit.framework */; }; + F5F577472C2C8F7400FCB852 /* ResearchKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F5F5773E2C2C8D0B00FCB852 /* ResearchKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F5F577482C2C8F7400FCB852 /* ResearchKitActiveTask.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5F577442C2C8D0B00FCB852 /* ResearchKitActiveTask.framework */; }; + F5F577492C2C8F7400FCB852 /* ResearchKitActiveTask.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F5F577442C2C8D0B00FCB852 /* ResearchKitActiveTask.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F5F5774A2C2C8F7400FCB852 /* ResearchKitUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5F577422C2C8D0B00FCB852 /* ResearchKitUI.framework */; }; + F5F5774B2C2C8F7400FCB852 /* ResearchKitUI.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F5F577422C2C8D0B00FCB852 /* ResearchKitUI.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F5F7D6DE2C1C13E80090E8CB /* SurveyManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5F7D6DD2C1C13E80090E8CB /* SurveyManager.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - F56255A72C1A1E7E00BF163B /* PBXContainerItemProxy */ = { + F5F5773D2C2C8D0B00FCB852 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = F56255A02C1A1E7E00BF163B /* ResearchKit.xcodeproj */; + containerPortal = F5F577362C2C8D0B00FCB852 /* ResearchKit.xcodeproj */; proxyType = 2; remoteGlobalIDString = B183A5951A8535D100C76870; remoteInfo = ResearchKit; }; - F56255A92C1A1E7E00BF163B /* PBXContainerItemProxy */ = { + F5F5773F2C2C8D0B00FCB852 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = F56255A02C1A1E7E00BF163B /* ResearchKit.xcodeproj */; + containerPortal = F5F577362C2C8D0B00FCB852 /* ResearchKit.xcodeproj */; proxyType = 2; remoteGlobalIDString = 86CC8E9A1AC09332001CCD89; remoteInfo = ResearchKitTests; }; - F56255AB2C1A1E7E00BF163B /* PBXContainerItemProxy */ = { + F5F577412C2C8D0B00FCB852 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = F56255A02C1A1E7E00BF163B /* ResearchKit.xcodeproj */; + containerPortal = F5F577362C2C8D0B00FCB852 /* ResearchKit.xcodeproj */; proxyType = 2; remoteGlobalIDString = CA1C7A5A288B0C68004DAB3A; remoteInfo = "ResearchKitUI (iOS)"; }; - F56255AD2C1A1E7E00BF163B /* PBXContainerItemProxy */ = { + F5F577432C2C8D0B00FCB852 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = F56255A02C1A1E7E00BF163B /* ResearchKit.xcodeproj */; + containerPortal = F5F577362C2C8D0B00FCB852 /* ResearchKit.xcodeproj */; proxyType = 2; remoteGlobalIDString = CAD08967289DD747007B2A98; remoteInfo = ResearchKitActiveTask; @@ -60,9 +65,9 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - F56255B52C1A1EF900BF163B /* ResearchKitUI.framework in Embed Frameworks */, - F56255B12C1A1EF900BF163B /* ResearchKit.framework in Embed Frameworks */, - F56255B32C1A1EF900BF163B /* ResearchKitActiveTask.framework in Embed Frameworks */, + F5F5774B2C2C8F7400FCB852 /* ResearchKitUI.framework in Embed Frameworks */, + F5F577472C2C8F7400FCB852 /* ResearchKit.framework in Embed Frameworks */, + F5F577492C2C8F7400FCB852 /* ResearchKitActiveTask.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -70,6 +75,8 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + F53D0B8E2C366602003BED2B /* ActivitiesManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivitiesManager.swift; sourceTree = ""; }; + F53D0B942C366620003BED2B /* ActivitiesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivitiesViewController.swift; sourceTree = ""; }; F56255892C1A1DF000BF163B /* surveys-example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "surveys-example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; F562558C2C1A1DF000BF163B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; F562558E2C1A1DF000BF163B /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -78,8 +85,11 @@ F56255952C1A1DF200BF163B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; F56255982C1A1DF200BF163B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; F562559A2C1A1DF200BF163B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - F56255A02C1A1E7E00BF163B /* ResearchKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ResearchKit.xcodeproj; path = "../../../../Downloads/ResearchKit-main/ResearchKit.xcodeproj"; sourceTree = ""; }; + F593A87E2C34E223005283D3 /* FormViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormViewController.swift; sourceTree = ""; }; + F593A8842C34E5F8005283D3 /* ConsentViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConsentViewController.swift; sourceTree = ""; }; F59F9B3F2C1A303B0083C2E9 /* ConsentManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConsentManager.swift; sourceTree = ""; }; + F5F577362C2C8D0B00FCB852 /* ResearchKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ResearchKit.xcodeproj; path = "../../ResearchKit-main/ResearchKit.xcodeproj"; sourceTree = ""; }; + F5F7D6DD2C1C13E80090E8CB /* SurveyManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SurveyManager.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -87,9 +97,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F56255B42C1A1EF900BF163B /* ResearchKitUI.framework in Frameworks */, - F56255B02C1A1EF900BF163B /* ResearchKit.framework in Frameworks */, - F56255B22C1A1EF900BF163B /* ResearchKitActiveTask.framework in Frameworks */, + F5F5774A2C2C8F7400FCB852 /* ResearchKitUI.framework in Frameworks */, + F5F577462C2C8F7400FCB852 /* ResearchKit.framework in Frameworks */, + F5F577482C2C8F7400FCB852 /* ResearchKitActiveTask.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -99,7 +109,7 @@ F56255802C1A1DF000BF163B = { isa = PBXGroup; children = ( - F56255A02C1A1E7E00BF163B /* ResearchKit.xcodeproj */, + F5F577362C2C8D0B00FCB852 /* ResearchKit.xcodeproj */, F562558B2C1A1DF000BF163B /* surveys-example */, F562558A2C1A1DF000BF163B /* Products */, F56255AF2C1A1EF900BF163B /* Frameworks */, @@ -118,33 +128,38 @@ isa = PBXGroup; children = ( F562558C2C1A1DF000BF163B /* AppDelegate.swift */, - F59F9B3F2C1A303B0083C2E9 /* ConsentManager.swift */, F562558E2C1A1DF000BF163B /* SceneDelegate.swift */, + F59F9B3F2C1A303B0083C2E9 /* ConsentManager.swift */, + F5F7D6DD2C1C13E80090E8CB /* SurveyManager.swift */, + F53D0B8E2C366602003BED2B /* ActivitiesManager.swift */, F56255902C1A1DF000BF163B /* ViewController.swift */, - F56255922C1A1DF000BF163B /* Main.storyboard */, + F593A8842C34E5F8005283D3 /* ConsentViewController.swift */, + F593A87E2C34E223005283D3 /* FormViewController.swift */, + F53D0B942C366620003BED2B /* ActivitiesViewController.swift */, F56255952C1A1DF200BF163B /* Assets.xcassets */, + F56255922C1A1DF000BF163B /* Main.storyboard */, F56255972C1A1DF200BF163B /* LaunchScreen.storyboard */, F562559A2C1A1DF200BF163B /* Info.plist */, ); path = "surveys-example"; sourceTree = ""; }; - F56255A12C1A1E7E00BF163B /* Products */ = { + F56255AF2C1A1EF900BF163B /* Frameworks */ = { isa = PBXGroup; children = ( - F56255A82C1A1E7E00BF163B /* ResearchKit.framework */, - F56255AA2C1A1E7E00BF163B /* ResearchKitTests.xctest */, - F56255AC2C1A1E7E00BF163B /* ResearchKitUI.framework */, - F56255AE2C1A1E7E00BF163B /* ResearchKitActiveTask.framework */, ); - name = Products; + name = Frameworks; sourceTree = ""; }; - F56255AF2C1A1EF900BF163B /* Frameworks */ = { + F5F577372C2C8D0B00FCB852 /* Products */ = { isa = PBXGroup; children = ( + F5F5773E2C2C8D0B00FCB852 /* ResearchKit.framework */, + F5F577402C2C8D0B00FCB852 /* ResearchKitTests.xctest */, + F5F577422C2C8D0B00FCB852 /* ResearchKitUI.framework */, + F5F577442C2C8D0B00FCB852 /* ResearchKitActiveTask.framework */, ); - name = Frameworks; + name = Products; sourceTree = ""; }; /* End PBXGroup section */ @@ -196,8 +211,8 @@ projectDirPath = ""; projectReferences = ( { - ProductGroup = F56255A12C1A1E7E00BF163B /* Products */; - ProjectRef = F56255A02C1A1E7E00BF163B /* ResearchKit.xcodeproj */; + ProductGroup = F5F577372C2C8D0B00FCB852 /* Products */; + ProjectRef = F5F577362C2C8D0B00FCB852 /* ResearchKit.xcodeproj */; }, ); projectRoot = ""; @@ -208,32 +223,32 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ - F56255A82C1A1E7E00BF163B /* ResearchKit.framework */ = { + F5F5773E2C2C8D0B00FCB852 /* ResearchKit.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; path = ResearchKit.framework; - remoteRef = F56255A72C1A1E7E00BF163B /* PBXContainerItemProxy */; + remoteRef = F5F5773D2C2C8D0B00FCB852 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F56255AA2C1A1E7E00BF163B /* ResearchKitTests.xctest */ = { + F5F577402C2C8D0B00FCB852 /* ResearchKitTests.xctest */ = { isa = PBXReferenceProxy; fileType = wrapper.cfbundle; path = ResearchKitTests.xctest; - remoteRef = F56255A92C1A1E7E00BF163B /* PBXContainerItemProxy */; + remoteRef = F5F5773F2C2C8D0B00FCB852 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F56255AC2C1A1E7E00BF163B /* ResearchKitUI.framework */ = { + F5F577422C2C8D0B00FCB852 /* ResearchKitUI.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; path = ResearchKitUI.framework; - remoteRef = F56255AB2C1A1E7E00BF163B /* PBXContainerItemProxy */; + remoteRef = F5F577412C2C8D0B00FCB852 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F56255AE2C1A1E7E00BF163B /* ResearchKitActiveTask.framework */ = { + F5F577442C2C8D0B00FCB852 /* ResearchKitActiveTask.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; path = ResearchKitActiveTask.framework; - remoteRef = F56255AD2C1A1E7E00BF163B /* PBXContainerItemProxy */; + remoteRef = F5F577432C2C8D0B00FCB852 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXReferenceProxy section */ @@ -256,9 +271,14 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + F593A87F2C34E223005283D3 /* FormViewController.swift in Sources */, F59F9B402C1A303B0083C2E9 /* ConsentManager.swift in Sources */, + F53D0B8F2C366603003BED2B /* ActivitiesManager.swift in Sources */, + F593A8852C34E5F8005283D3 /* ConsentViewController.swift in Sources */, + F53D0B952C366620003BED2B /* ActivitiesViewController.swift in Sources */, F56255912C1A1DF000BF163B /* ViewController.swift in Sources */, F562558D2C1A1DF000BF163B /* AppDelegate.swift in Sources */, + F5F7D6DE2C1C13E80090E8CB /* SurveyManager.swift in Sources */, F562558F2C1A1DF000BF163B /* SceneDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -337,7 +357,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 17.5; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; @@ -394,7 +414,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 17.5; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; diff --git a/surveys-example.xcodeproj/xcuserdata/juandavidlopezregalado.xcuserdatad/xcschemes/xcschememanagement.plist b/surveys-example.xcodeproj/xcuserdata/juandavidlopezregalado.xcuserdatad/xcschemes/xcschememanagement.plist index 7433e27..044beb0 100644 --- a/surveys-example.xcodeproj/xcuserdata/juandavidlopezregalado.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/surveys-example.xcodeproj/xcuserdata/juandavidlopezregalado.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,7 +7,7 @@ surveys-example.xcscheme_^#shared#^_ orderHint - 4 + 3 diff --git a/surveys-example/ActivitiesManager.swift b/surveys-example/ActivitiesManager.swift new file mode 100644 index 0000000..22d1203 --- /dev/null +++ b/surveys-example/ActivitiesManager.swift @@ -0,0 +1,8 @@ +// +// ActivitiesManager.swift +// surveys-example +// +// Created by Juan David López Regalado on 03/07/24. +// + +import Foundation diff --git a/surveys-example/ActivitiesViewController.swift b/surveys-example/ActivitiesViewController.swift new file mode 100644 index 0000000..ef070e3 --- /dev/null +++ b/surveys-example/ActivitiesViewController.swift @@ -0,0 +1,29 @@ +// +// ActivitiesViewController.swift +// surveys-example +// +// Created by Juan David López Regalado on 03/07/24. +// + +import UIKit + +class ActivitiesViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destination. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/surveys-example/Assets.xcassets/deporte.imageset/Contents.json b/surveys-example/Assets.xcassets/deporte.imageset/Contents.json new file mode 100644 index 0000000..78e2aac --- /dev/null +++ b/surveys-example/Assets.xcassets/deporte.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "deporte.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/surveys-example/Assets.xcassets/deporte.imageset/deporte.png b/surveys-example/Assets.xcassets/deporte.imageset/deporte.png new file mode 100644 index 0000000..9f27a6e Binary files /dev/null and b/surveys-example/Assets.xcassets/deporte.imageset/deporte.png differ diff --git a/surveys-example/Assets.xcassets/form.imageset/Contents.json b/surveys-example/Assets.xcassets/form.imageset/Contents.json new file mode 100644 index 0000000..c76a4ed --- /dev/null +++ b/surveys-example/Assets.xcassets/form.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "form.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/surveys-example/Assets.xcassets/form.imageset/form.png b/surveys-example/Assets.xcassets/form.imageset/form.png new file mode 100644 index 0000000..babe7db Binary files /dev/null and b/surveys-example/Assets.xcassets/form.imageset/form.png differ diff --git a/surveys-example/Assets.xcassets/formulario-de-consentimiento-del-donante.imageset/Contents.json b/surveys-example/Assets.xcassets/formulario-de-consentimiento-del-donante.imageset/Contents.json new file mode 100644 index 0000000..8a726ab --- /dev/null +++ b/surveys-example/Assets.xcassets/formulario-de-consentimiento-del-donante.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "formulario-de-consentimiento-del-donante.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/surveys-example/Assets.xcassets/formulario-de-consentimiento-del-donante.imageset/formulario-de-consentimiento-del-donante.png b/surveys-example/Assets.xcassets/formulario-de-consentimiento-del-donante.imageset/formulario-de-consentimiento-del-donante.png new file mode 100644 index 0000000..1c615f2 Binary files /dev/null and b/surveys-example/Assets.xcassets/formulario-de-consentimiento-del-donante.imageset/formulario-de-consentimiento-del-donante.png differ diff --git a/surveys-example/Assets.xcassets/formuu.imageset/Contents.json b/surveys-example/Assets.xcassets/formuu.imageset/Contents.json new file mode 100644 index 0000000..b997b2a --- /dev/null +++ b/surveys-example/Assets.xcassets/formuu.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "formuu.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/surveys-example/Assets.xcassets/formuu.imageset/formuu.png b/surveys-example/Assets.xcassets/formuu.imageset/formuu.png new file mode 100644 index 0000000..20c2c62 Binary files /dev/null and b/surveys-example/Assets.xcassets/formuu.imageset/formuu.png differ diff --git a/surveys-example/Assets.xcassets/logo correr.imageset/Contents.json b/surveys-example/Assets.xcassets/logo correr.imageset/Contents.json new file mode 100644 index 0000000..9991842 --- /dev/null +++ b/surveys-example/Assets.xcassets/logo correr.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "logo correr.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/surveys-example/Assets.xcassets/logo correr.imageset/logo correr.jpg b/surveys-example/Assets.xcassets/logo correr.imageset/logo correr.jpg new file mode 100644 index 0000000..758646b Binary files /dev/null and b/surveys-example/Assets.xcassets/logo correr.imageset/logo correr.jpg differ diff --git a/surveys-example/Base.lproj/LaunchScreen.storyboard b/surveys-example/Base.lproj/LaunchScreen.storyboard index 865e932..2d171a1 100644 --- a/surveys-example/Base.lproj/LaunchScreen.storyboard +++ b/surveys-example/Base.lproj/LaunchScreen.storyboard @@ -1,7 +1,9 @@ - - + + + - + + @@ -11,15 +13,24 @@ - + - + + + + + + + - + + + + diff --git a/surveys-example/Base.lproj/Main.storyboard b/surveys-example/Base.lproj/Main.storyboard index 173e418..a9beeda 100644 --- a/surveys-example/Base.lproj/Main.storyboard +++ b/surveys-example/Base.lproj/Main.storyboard @@ -1,5 +1,5 @@ - + @@ -9,54 +9,216 @@ - + - + - + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + + + - + - + + + + diff --git a/surveys-example/ConsentManager.swift b/surveys-example/ConsentManager.swift index 2a37123..7734296 100644 --- a/surveys-example/ConsentManager.swift +++ b/surveys-example/ConsentManager.swift @@ -67,8 +67,8 @@ class ConsentManager{ webViewStep.showSignatureAfterContent = true - - let task = ORKOrderedTask(identifier: "ConsentTask", steps: [welcomeStep, beforeYouJoin, webViewStep /*other steps*/]) + let task = ORKOrderedTask(identifier: "ConsentTask", steps: [welcomeStep, beforeYouJoin, webViewStep, /*other steps*/]) + return task diff --git a/surveys-example/ConsentViewController.swift b/surveys-example/ConsentViewController.swift new file mode 100644 index 0000000..0a5f57e --- /dev/null +++ b/surveys-example/ConsentViewController.swift @@ -0,0 +1,47 @@ +// +// ConsentViewController.swift +// surveys-example +// +// Created by Juan David López Regalado on 02/07/24. +// +import UIKit +import ResearchKit +import ResearchKitUI + +class ConsentViewController: UIViewController, ORKTaskViewControllerDelegate { + + @IBOutlet weak var startForm: UIButton! + + var consentCompleted = false + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view. + startForm.isEnabled = false // Inicialmente deshabilitamos el botón + + } + + @IBAction func startConsent(_ sender: Any) { + + let consentTask = ConsentManager.shared.createConsentTask() + let taskViewController = ORKTaskViewController(task: consentTask, taskRun: nil) + + taskViewController.delegate = self + present(taskViewController, animated: true, completion: nil) + } + + func taskViewController(_ taskViewController: ORKTaskViewController, didFinishWith reason: ORKTaskFinishReason, error: Error?) { + taskViewController.dismiss(animated: true, completion: nil) + + if reason == .completed { + consentCompleted = true + startForm.isEnabled = true // Habilitamos el botón si el consentimiento se completó correctamente + + } else { + consentCompleted = false + startForm.isEnabled = false // Mantenemos el botón deshabilitado si no se completó el consentimiento + } + } +} + + diff --git a/surveys-example/FormViewController.swift b/surveys-example/FormViewController.swift new file mode 100644 index 0000000..05ae9ab --- /dev/null +++ b/surveys-example/FormViewController.swift @@ -0,0 +1,47 @@ +// +// FormViewController.swift +// surveys-example +// +// Created by Juan David López Regalado on 02/07/24. +// + +import UIKit +import ResearchKit +import ResearchKitUI + +class FormViewController: UIViewController, ORKTaskViewControllerDelegate { + + @IBOutlet weak var startActivities: UIButton! + + var formCompleted = false // Variable que controla si el consentimiento se ha completado + + + override func viewDidLoad() { + super.viewDidLoad() + + startActivities.isEnabled = false // Inicialmente deshabilitamos el botón + + // Do any additional setup after loading the view. + } + + @IBAction func startForm(_ sender: Any) { + + let taskViewController = ORKTaskViewController(task: SurveyManager.shared.createSurveyTask(), taskRun: nil) + taskViewController.delegate = self + present(taskViewController, animated: true, completion: nil) + + } + + func taskViewController(_ taskViewController: ORKTaskViewController, didFinishWith reason: ORKTaskFinishReason, error: (any Error)?) { + taskViewController.dismiss(animated: true, completion: nil) + + + if reason == .completed { + formCompleted = true + startActivities.isEnabled = true // Habilitamos el botón si el consentimiento se completó correctamente + } else { + formCompleted = false + startActivities.isEnabled = false // Mantenemos el botón deshabilitado si no se completó el consentimiento + } + } + } diff --git a/surveys-example/PDFManager.swift b/surveys-example/PDFManager.swift new file mode 100644 index 0000000..d489777 --- /dev/null +++ b/surveys-example/PDFManager.swift @@ -0,0 +1,25 @@ +// +// PDFManager.swift +// surveys-example +// +// Created by Juan David López Regalado on 27/06/24. +// + +import Foundation +import ResearchKit + + +guard let stepResult = taskViewController.result.result(forIdentifier: "WebViewStepIdentifier") as? ORKStepResult else { + return +} + +if let webViewStepResult = stepResult.results?.first as? ORKWebViewStepResult, let html = webViewStepResult.htmlWithSignature { + let htmlFormatter = ORKHTMLPDFWriter() + + htmlFormatter.writePDF(fromHTML: html) { data, error in + let pdfURL = FileManager.default.temporaryDirectory + .appendingPathComponent("consentTask") + .appendingPathExtension("pdf") + try? data.write(to: pdfURL) + } +} diff --git a/surveys-example/SurveyManager.swift b/surveys-example/SurveyManager.swift new file mode 100644 index 0000000..85a459b --- /dev/null +++ b/surveys-example/SurveyManager.swift @@ -0,0 +1,366 @@ +// +// Tasks.swift +// surveys-example +// +// Created by Juan David López Regalado on 14/06/24. +// +import Foundation +import ResearchKit + +class SurveyManager { + static let shared = SurveyManager() + + func createSurveyTask() -> ORKTask { + + // Agradecimiento y explicaciojn + let thankUJoin = ORKInstructionStep(identifier: "thankUJoin") + thankUJoin.title = "Thank You!" + thankUJoin.iconImage = UIImage(systemName: "heart.fill") + thankUJoin.detailText = "Thanks For Join Us, I Would Appreciate It If You Answered The Next Questions as Honestly as Possible, remember That Your Data is Private, it will not be Shared with Anyone Else and Will Only be Used for the Proposed Study." + +// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + // Ficha de identificacion + + let personalInfoStepTitle = "Personal Information" + let personalInfoStep = ORKInstructionStep(identifier: "personalInfoStep") + personalInfoStep.title = personalInfoStepTitle + personalInfoStep.text = "Here you will find questions about your personal data" + personalInfoStep.image = UIImage(systemName: "person.fill") + + + // Nombre + let textQuestionStepTitle = "Name" + let textAnswerFormat = ORKTextAnswerFormat(maximumLength: 30) + textAnswerFormat.multipleLines = false + let textQuestionStep = ORKQuestionStep(identifier: "textName", title: textQuestionStepTitle, question: "What is your name?", answer: textAnswerFormat) + + // Sexo + let multiGenderChoice = "Sex" + let gendChoices = [ + ORKTextChoice(text: "Male", value: "male" as NSString), + ORKTextChoice(text: "Female", value: "female" as NSString), + ORKTextChoice(text: "I prefer not to say", value: "Inf" as NSString)] + + let genderChoiceFormat = ORKTextChoiceAnswerFormat(style: .singleChoice, textChoices: gendChoices) + let multiGenderQuestionStep = ORKQuestionStep(identifier: "multiGenderQuestionStep", title: multiGenderChoice,question: "What is your Sex?", answer: genderChoiceFormat) + + // Fecha de nacimiento + let dobStepTitle = "Date of Birth" + let dobAnswerFormat = ORKDateAnswerFormat(style: .date) + let dobStep = ORKQuestionStep(identifier: "dobStep", title: dobStepTitle, question: "When were you born?", answer: dobAnswerFormat) + + + // Peso + let weighQuestion = ORKFormItem(sectionTitle: "What is your weight?") + + let weightQuestionFormItem = ORKFormItem(identifier: "weightQuestionForm", text: nil, answerFormat: ORKAnswerFormat.weightAnswerFormat()) + weightQuestionFormItem.placeholder = "Tap here" + + let weighForm = ORKFormStep(identifier: "WeightQuestionIde", title: "Weigh", text: " ") + weighForm.formItems = [weighQuestion, weightQuestionFormItem] + + // Estatura + let heightQuestion = ORKFormItem(sectionTitle: "What is your height?") + + let heightQuestionFormItem = ORKFormItem(identifier: "weightQuestionForm", text: nil, answerFormat: ORKAnswerFormat.heightAnswerFormat()) + heightQuestionFormItem.placeholder = "Tap here" + + let heightForm = ORKFormStep(identifier: "HeightQuestionIde", title: "Height", text: " ") + heightForm.formItems = [heightQuestion, heightQuestionFormItem] + + // Residencia + let residenceChoice = "Reside" + let residenceChoices = [ + ORKTextChoice(text: "Urban", value: "urban" as NSString), + ORKTextChoice(text: "Sub-urban", value: "suburban" as NSString), + ORKTextChoice(text: "Rural", value: "Rural" as NSString)] + + let residenceChoiceFormat = ORKTextChoiceAnswerFormat(style: .singleChoice, textChoices: residenceChoices) + let residenceQuestionStep = ORKQuestionStep(identifier: "residenceStep", title: residenceChoice,question: "Where do you Reside?", answer: residenceChoiceFormat) + + + // Pregunta de ocupación + let occupationQuestionTitle = "Occupation" + let occupationChoices = [ + ORKTextChoice(text: "Student", value: "student" as NSString), + ORKTextChoice(text: "Employed", value: "employed" as NSString), + ORKTextChoice(text: "Self-Employed", value: "self_employed" as NSString), + ORKTextChoice(text: "Unemployed", value: "unemployed" as NSString), + ORKTextChoice(text: "Retired", value: "retired" as NSString), + ORKTextChoice(text: "Homemaker", value: "homemaker" as NSString), + ORKTextChoice(text: "Other", value: "other" as NSString) + ] + + let occupationChoiceFormat = ORKValuePickerAnswerFormat(textChoices: occupationChoices) + let occupationQuestionStep = ORKQuestionStep(identifier: "occupationQuestionStep", title: occupationQuestionTitle, question: "What is your occupation?", answer: occupationChoiceFormat) + + // Pregunta adicional para especificar detalles de ocupación + _ = "Please specify your occupation:" + let specifyOccupationAnswerFormat = ORKTextAnswerFormat(maximumLength: 100) + specifyOccupationAnswerFormat.multipleLines = true // Permitir múltiples líneas para detalles extensos + + // Añadir la pregunta adicional después de la pregunta de ocupación + let occupationFormStep = ORKFormStep(identifier: "OccupationFormStep", title: "Occupation", text: "Select your occupation and specify details if necessary.") + occupationFormStep.formItems = [ + ORKFormItem(identifier: "OccupationFormItem", text: nil, answerFormat: occupationChoiceFormat), + ORKFormItem(identifier: "SpecifyOccupationDetailsFormItem", text: nil, answerFormat: specifyOccupationAnswerFormat) + ] + + +//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=- + + // Heredo Familiares + + let hereditaryInfoStepTitle = "Hereditary Family History" + let hereditaryInfoStep = ORKInstructionStep(identifier: "hereditaryInfoStep") + hereditaryInfoStep.title = hereditaryInfoStepTitle + hereditaryInfoStep.text = "Here you will find questions about your family, and their diseases" + hereditaryInfoStep.image = UIImage(systemName: "person.3.fill") + + // Patologías hereditarias + let patologyChoice = "Pathologies" + let patologyChoices = [ + ORKTextChoice(text: "Diabetes", value: "diabetes" as NSString), + ORKTextChoice(text: "Heart Disease", value: "heartDisease" as NSString), + ORKTextChoice(text: "Hypertension", value: "hypertension" as NSString), + ORKTextChoice(text: "Cancer", value: "cancer" as NSString), + ORKTextChoice(text: "Asthma", value: "asthma" as NSString)] + + let patologyChoiceFormat = ORKTextChoiceAnswerFormat(style: .multipleChoice, textChoices: patologyChoices) + let patologyQuestionStep = ORKQuestionStep(identifier: "patologyStep", title: patologyChoice, question: "Select only the pathologies that your close relatives such as father, mother, grandfather or grandmother have or had.", answer: patologyChoiceFormat) + + + // Patologías mentales hereditarias + let mentalPatologyChoice = "Mental Pathologies" + let mentalPatologyChoices = [ + ORKTextChoice(text: "Bipolarity", value: "bipolarity" as NSString), + ORKTextChoice(text: "Autism", value: "autism" as NSString), + ORKTextChoice(text: "Depression", value: "depression" as NSString), + ORKTextChoice(text: "ADHD", value: "adhd" as NSString), + ORKTextChoice(text: "Anxiety", value: "anxiety" as NSString)] + + let mentalPatologyChoiceFormat = ORKTextChoiceAnswerFormat(style: .multipleChoice, textChoices: mentalPatologyChoices) + let mentalPatologyQuestionStep = ORKQuestionStep(identifier: "mentalPatologyStep", title: mentalPatologyChoice, question: "Select only the mental pathologies that your close relatives such as father, mother, grandfather or grandmother have or had.", answer: mentalPatologyChoiceFormat) + + +//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + + // Antecedentes personales patológicos + + let persInfoStepTitle = "Pathological personal history" + let persInfoStep = ORKInstructionStep(identifier: "persInfoStep") + persInfoStep.title = persInfoStepTitle + persInfoStep.text = "In this part you will find questions about the diseases you suffered or suffer from." + persInfoStep.image = UIImage(systemName: "person.crop.circle") + + // Enfermedades propias + let diseasesChoice = "Diseases" + let diseasesChoices = [ + ORKTextChoice(text: "Diabetes", value: "diabetes" as NSString), + ORKTextChoice(text: "Heart Disease", value: "heartDisease" as NSString), + ORKTextChoice(text: "Hypertension", value: "hypertension" as NSString), + ORKTextChoice(text: "Cancer", value: "cancer" as NSString), + ORKTextChoice(text: "Asthma", value: "asthma" as NSString), + ORKTextChoice(text: "Hepatitis", value: "hepatitis" as NSString), + ORKTextChoice(text: "Covid", value: "covid" as NSString), + ORKTextChoice(text: "Tuberculosis", value: "tuberculosis" as NSString), + ORKTextChoice(text: "AIDS", value: "aids" as NSString), + ORKTextChoice(text: "Bipolarity", value: "bipolarity" as NSString), + ORKTextChoice(text: "Autism", value: "autism" as NSString), + ORKTextChoice(text: "Depression", value: "depression" as NSString), + ORKTextChoice(text: "ADHD", value: "adhd" as NSString), + ORKTextChoice(text: "Anxiety", value: "anxiety" as NSString)] + + let diseasesChoiceFormat = ORKTextChoiceAnswerFormat(style: .multipleChoice, textChoices: diseasesChoices) + let diseasesQuestionStep = ORKQuestionStep(identifier: "diseasesStep", title: diseasesChoice, question: "Select the diseases you have had or suffer from.", answer: diseasesChoiceFormat) + + + // Vacunacion + let vaccinationQuestionTitle = "Vaccination" + let vaccinationChoices = [ + ORKTextChoice(text: "Yes", value: "never" as NSString), + ORKTextChoice(text: "No", value: "little" as NSString), + ORKTextChoice(text: "I don't remember ", value: "moderate" as NSString),] + + let vaccinationChoiceFormat = ORKValuePickerAnswerFormat(textChoices: vaccinationChoices) + let vaccinationQuestionStep = ORKQuestionStep(identifier: "vaccinationQuestionStep", title: vaccinationQuestionTitle, question: "Do you have your complete vaccination schedule?", answer: vaccinationChoiceFormat) + + // Bebedor alcohol + let alcoholQuestionTitle = "Alcohol drinker" + let alcoholChoices = [ + ORKTextChoice(text: "No Drinks Alcohol", value: "nodrink" as NSString), + ORKTextChoice(text: "Social Drinker", value: "social" as NSString), + ORKTextChoice(text: "Occasional Drinker ", value: "occasional" as NSString), + ORKTextChoice(text: "Dependent Drinker", value: "dependent" as NSString),] + + let alcoholChoiceFormat = ORKValuePickerAnswerFormat(textChoices: alcoholChoices) + let alcoholQuestionStep = ORKQuestionStep(identifier: "alcoholQuestionStep", title: alcoholQuestionTitle, question: "What kind of drinker are you?", answer: alcoholChoiceFormat) + + // fumador tabaco + let smokeQuestionTitle = "Tobacco Smoker" + let smokeChoices = [ + ORKTextChoice(text: "No Smoker", value: "nosmoke" as NSString), + ORKTextChoice(text: "Social Smoker", value: "socialsmoke" as NSString), + ORKTextChoice(text: "Occasional Smoker ", value: "occasionalsmoke" as NSString), + ORKTextChoice(text: "Dependent Smoker", value: "dependentsmoke" as NSString),] + + let smokeChoiceFormat = ORKValuePickerAnswerFormat(textChoices: smokeChoices) + let smokeQuestionStep = ORKQuestionStep(identifier: "smokeQuestionStep", title: smokeQuestionTitle, question: "What kind of smoker are you?", answer: smokeChoiceFormat) + + // drogas + let drugsPatologyChoice = "Drugs" + let drugsPatologyChoices = [ + ORKTextChoice(text: "I do not consume drugs", value: "nodrugs" as NSString), + ORKTextChoice(text: "Marihuana", value: "marihuana" as NSString), + ORKTextChoice(text: "Cocaine", value: "cocaine" as NSString), + ORKTextChoice(text: "MDMA (Ectasty)", value: "mdma" as NSString), + ORKTextChoice(text: "Heroine", value: "heroine" as NSString), + ORKTextChoice(text: "Methamphetamine", value: "metha" as NSString), + ORKTextChoice(text: "LSD", value: "lsd" as NSString), + ORKTextChoice(text: "Hallucinogenic Mushrooms", value: "mushrooms" as NSString), + ORKTextChoice(text: "Other", value: "other" as NSString),] + + let drugsPatologyChoiceFormat = ORKTextChoiceAnswerFormat(style: .multipleChoice, textChoices: drugsPatologyChoices) + let drugsPatologyQuestionStep = ORKQuestionStep(identifier: "drugsPatologyStep", title: drugsPatologyChoice, question: "Select the drug or drugs you consume", answer: drugsPatologyChoiceFormat) + + let frecuencyDrugsQuestionTitle = "Frequency of Drug Use" + let frecuencyDrugsChoices = [ + ORKTextChoice(text: "Never", value: "never" as NSString), + ORKTextChoice(text: "A little", value: "little" as NSString), + ORKTextChoice(text: "Moderate", value: "moderate" as NSString), + ORKTextChoice(text: "A lot", value: "lot" as NSString),] + + let frecuencyDrugsChoiceFormat = ORKValuePickerAnswerFormat(textChoices: frecuencyDrugsChoices) + let frecuencyDrugsQuestionStep = ORKQuestionStep(identifier: "frecuencyDrugsQuestionStep", title: frecuencyDrugsQuestionTitle, question: "How often do you use drugs?", answer: frecuencyDrugsChoiceFormat) + + +//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + + // Antecedentes no patológicos + + let noPersInfoStepTitle = "Non-pathological history" + let noPersInfoStep = ORKInstructionStep(identifier: "moPersInfoStep") + noPersInfoStep.title = noPersInfoStepTitle + noPersInfoStep.text = "In this section, you'll find questions about your non-pathological backgrounds, such as your daily activities and personal habits." + noPersInfoStep.image = UIImage(systemName: "book.fill") + + + // pregunta de actividad física en escala de likert + let scaleQuestionStepTitle = "Physical activity" + let scaleAnswerFormat = ORKScaleAnswerFormat(maximumValue: 10, minimumValue: 0, defaultValue: 5, step: 1) + let scaleQuestionStep = ORKQuestionStep(identifier: "scaleQuestionStep", title: scaleQuestionStepTitle,question: "How active are you?", answer: scaleAnswerFormat) + + + // Tipo de actividad fisica que realizas. + let multiChoiceQuestionStepTitle = "What types of physical activities do you do?" + let textChoices = [ + ORKTextChoice(text: "Walking", value: "walking" as NSString), + ORKTextChoice(text: "Running", value: "running" as NSString), + ORKTextChoice(text: "Swimming", value: "swimming" as NSString), + ORKTextChoice(text: "Cycling", value: "cycling" as NSString), + ORKTextChoice(text: "Soccer", value: "soccer" as NSString), + ORKTextChoice(text: "Basketball", value: "basketball" as NSString), + ORKTextChoice(text: "Tennis", value: "tennis" as NSString), + ORKTextChoice(text: "Baseball", value: "baseball" as NSString), + ORKTextChoice(text: "Golf", value: "golf" as NSString), + ORKTextChoice(text: "Athletics", value: "athletic" as NSString), + ORKTextChoice(text: "Football", value: "football" as NSString), + ORKTextChoice(text: "Martial Arts", value: "martialarts" as NSString), + ORKTextChoice(text: "Other", value: "other" as NSString), + + ] + let multiChoiceAnswerFormat = ORKTextChoiceAnswerFormat(style: .multipleChoice, textChoices: textChoices) + let multiChoiceQuestionStep = ORKQuestionStep(identifier: "multiChoiceQuestionStep", title: multiChoiceQuestionStepTitle, question: "Select the activities you do regularly", answer: multiChoiceAnswerFormat) + + // hobbies + let hobbieQuestionStepTitle = "What types of physical activities do you do?" + let hobbietextChoices = [ + ORKTextChoice(text: "Reading", value: "reading" as NSString), + ORKTextChoice(text: "Watching movies and series", value: "watchingmovies" as NSString), + ORKTextChoice(text: "Video Gaming", value: "gaming" as NSString), + ORKTextChoice(text: "Cooking and baking", value: "cooking" as NSString), + ORKTextChoice(text: "Traveling", value: "traveling" as NSString), + ORKTextChoice(text: "Gardening", value: "gardening" as NSString), + ORKTextChoice(text: "Arts", value: "arts" as NSString), + ORKTextChoice(text: "Music", value: "music" as NSString), + ORKTextChoice(text: "Photography", value: "photography" as NSString), + ORKTextChoice(text: "Writing", value: "writing" as NSString), + ORKTextChoice(text: "Dancing", value: "dancing" as NSString), + ORKTextChoice(text: "Other", value: "other" as NSString), + + ] + let hobbieAnswerFormat = ORKTextChoiceAnswerFormat(style: .multipleChoice, textChoices: hobbietextChoices) + let hobbieQuestionStep = ORKQuestionStep(identifier: "hobbieQuestionStep", title: hobbieQuestionStepTitle, question: "Select the activities you do regularly", answer: hobbieAnswerFormat) + + // level of study + let studyQuestionTitle = "Level of study" + let studyChoices = [ + ORKTextChoice(text: "Elementary School", value: "elementary" as NSString), + ORKTextChoice(text: "Middle School", value: "middle" as NSString), + ORKTextChoice(text: "High School", value: "high" as NSString), + ORKTextChoice(text: "Bachelor's Degree", value: "bachelor" as NSString), + ORKTextChoice(text: "Master's Degree", value: "master" as NSString), + ORKTextChoice(text: "Doctorate", value: "doctorate" as NSString), + ORKTextChoice(text: "Other", value: "other" as NSString), + ] + + let studyChoiceFormat = ORKValuePickerAnswerFormat(textChoices: studyChoices) + let studyQuestionStep = ORKQuestionStep(identifier: "studyQuestionStep", title: studyQuestionTitle, question: "What is your level of study?", answer: studyChoiceFormat) + + // transporte + let transportationQuestionTitle = "Transportation" + let transportationChoices = [ + ORKTextChoice(text: "Telecommuting (remote work)", value: "telecommuting" as NSString), + ORKTextChoice(text: "Car", value: "car" as NSString), + ORKTextChoice(text: "Public Transport (bus, subway, tram, train)", value: "publictransport" as NSString), + ORKTextChoice(text: "Bicycle", value: "bicycle" as NSString), + ORKTextChoice(text: "Motorcycle", value: "motorcycle" as NSString), + ORKTextChoice(text: "Walking", value: "walking" as NSString), + ORKTextChoice(text: "Electric Scooter", value: "electricscooter" as NSString), + ORKTextChoice(text: "Skateboard", value: "skateboard" as NSString), + ORKTextChoice(text: "Other", value: "other" as NSString), + ] + + let transportationChoiceFormat = ORKValuePickerAnswerFormat(textChoices: transportationChoices) + let transportationQuestionStep = ORKQuestionStep(identifier: "transportationQuestionStep", title: transportationQuestionTitle, question: "What is the means of transportation you use from home to work or school?", answer: transportationChoiceFormat) + + //Alimentación + + let foodQuestionTitle = "Alimentation" + let foodChoices = [ + ORKTextChoice(text: "Good", value: "good" as NSString), + ORKTextChoice(text: "Average", value: "average" as NSString), + ORKTextChoice(text: "Poor", value: "poor" as NSString),] + + let foodChoiceFormat = ORKValuePickerAnswerFormat(textChoices: foodChoices) + let foodQuestionStep = ORKQuestionStep(identifier: "foodQuestionStep", title: foodQuestionTitle, question: "How would you describe your quality and quantity of food?", answer: foodChoiceFormat) + + // cuantas veces comes + let alimentationQuestionStepTitle = "Alimentation" + let alimentationAnswerFormat = ORKScaleAnswerFormat(maximumValue: 10, minimumValue: 0, defaultValue: 3, step: 1) + let alimentationQuestionStep = ORKQuestionStep(identifier: "alimentationQuestionStep", title: alimentationQuestionStepTitle,question: "How many meals do you have a day?", answer: alimentationAnswerFormat) + + // tipo de alimento + let typeFoodChoice = "Types of food" + let typeFoodChoices = [ + ORKTextChoice(text: "Chicken", value: "chicken" as NSString), + ORKTextChoice(text: "Beef", value: "beef" as NSString), + ORKTextChoice(text: "Pork", value: "pork" as NSString), + ORKTextChoice(text: "Seafood", value: "seafood" as NSString), + ORKTextChoice(text: "Fruits/Vegetables", value: "fruitsvegetables" as NSString), + ORKTextChoice(text: "Other", value: "other" as NSString) + ] + + let typeFoodChoiceFormat = ORKTextChoiceAnswerFormat(style: .multipleChoice, textChoices: typeFoodChoices) + let typeFoodQuestionStep = ORKQuestionStep(identifier: "typeFoodStep", title: typeFoodChoice, question: "SWhat type of food do you eat?", answer: typeFoodChoiceFormat) + + +//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + + // Mostrar las preguntas + + return ORKOrderedTask(identifier: "SurveyTask", steps: [thankUJoin, personalInfoStep, textQuestionStep, multiGenderQuestionStep, dobStep, weighForm, heightForm, residenceQuestionStep, occupationQuestionStep, occupationFormStep, hereditaryInfoStep, patologyQuestionStep, mentalPatologyQuestionStep, persInfoStep, diseasesQuestionStep, vaccinationQuestionStep, alcoholQuestionStep, smokeQuestionStep, drugsPatologyQuestionStep, frecuencyDrugsQuestionStep,noPersInfoStep, scaleQuestionStep, multiChoiceQuestionStep, hobbieQuestionStep, studyQuestionStep, transportationQuestionStep, foodQuestionStep, alimentationQuestionStep, typeFoodQuestionStep]) + } + + +} diff --git a/surveys-example/ViewController.swift b/surveys-example/ViewController.swift index 67eef33..2707336 100644 --- a/surveys-example/ViewController.swift +++ b/surveys-example/ViewController.swift @@ -5,31 +5,15 @@ // Created by Juan David López Regalado on 12/06/24. // + import UIKit -import ResearchKit -import ResearchKitUI -class ViewController: UIViewController, ORKTaskViewControllerDelegate { +class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } - - @IBAction func startSurveyTapped(_ sender: Any) { - let consentTask = ConsentManager.shared.createConsentTask() - let taskViewController = ORKTaskViewController(task: consentTask, taskRun: nil) - - taskViewController.delegate = self - present(taskViewController,animated: true, completion: nil) - } - - func taskViewController(_ taskViewController: ORKTaskViewController, didFinishWith reason: ORKTaskFinishReason, error: (any Error)?) { - taskViewController.dismiss(animated: true, completion: nil) - } - - } -