Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# OTFCareKit

OTFCareKit is a fork of Apple's CareKit. It is an open source software framework for creating apps that help people better understand and manage their health.

The full documentation is available here: https://github.com/HippocratesTech/OTFCareKit/blob/master/README.md
26 changes: 26 additions & 0 deletions CareKit.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Pod::Spec.new do |s|
s.name = 'CareKit'
s.version = '2.0'
s.summary = 'CareKit is an open source software framework for creating apps that help people better understand and manage their health.'
s.homepage = 'https://github.com/carekit-apple/CareKit/'
s.documentation_url = 'https://developer.apple.com/documentation/carekit'
s.screenshots = [ 'https://user-images.githubusercontent.com/51756298/69096972-66de0b00-0a0a-11ea-96f0-4605d04ab396.gif',
'https://user-images.githubusercontent.com/51756298/69107801-7586eb00-0a27-11ea-8aa2-eca687602c76.gif']
s.license = { :type => 'BSD', :file => 'LICENSE' }
s.author = { 'researchandcare.org' => 'https://www.researchandcare.org' }
s.platform = :ios
s.ios.deployment_target = '13.0'
s.watchos.deployment_target = '6.0'
s.swift_versions = '5.0'
s.source = { :git => 'https://github.com/carekit-apple/carekit.git', :tag => s.version.to_s}

s.source_files = 'CareKit/CareKit/**/*'
s.exclude_files = [ 'CareKit/CareKit/**/*.plist', 'OCKCatalog', 'OCKSample', 'DerivedData' ]
s.xcconfig = { 'LIBRARY_SEARCH_PATHS' => "$(SRCROOT)/Pods/**" }
#sp.module_map = 'CareKit/CareKit.modulemap'
s.requires_arc = true
s.frameworks = 'CareKitUI', 'CareKitStore'
s.dependency 'CareKitUI', '2.0'
s.dependency 'CareKitStore', '2.0'

end
2,972 changes: 1,488 additions & 1,484 deletions CareKit/CareKit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

107 changes: 107 additions & 0 deletions CareKit/CareKit.xcodeproj/xcshareddata/xcschemes/CareKit.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1140"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8605A5B91C4F04EC00DD65FF"
BuildableName = "CareKit.framework"
BlueprintName = "CareKit iOS"
ReferencedContainer = "container:CareKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES"
onlyGenerateCoverageForSpecifiedTargets = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8605A5B91C4F04EC00DD65FF"
BuildableName = "CareKit.framework"
BlueprintName = "CareKit iOS"
ReferencedContainer = "container:CareKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
<CodeCoverageTargets>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8605A5B91C4F04EC00DD65FF"
BuildableName = "CareKit.framework"
BlueprintName = "CareKit iOS"
ReferencedContainer = "container:CareKit.xcodeproj">
</BuildableReference>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E784B8F72232EED600736CA5"
BuildableName = "CareKitCarePlanStore.framework"
BlueprintName = "CareKitCarePlanStore"
ReferencedContainer = "container:CareKitCarePlanStore/CareKitCarePlanStore.xcodeproj">
</BuildableReference>
</CodeCoverageTargets>
<TestPlans>
<TestPlanReference
reference = "container:../CareKit.xctestplan"
default = "YES">
</TestPlanReference>
</TestPlans>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8605A5B91C4F04EC00DD65FF"
BuildableName = "CareKit.framework"
BlueprintName = "CareKit iOS"
ReferencedContainer = "container:CareKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8605A5B91C4F04EC00DD65FF"
BuildableName = "CareKit.framework"
BlueprintName = "CareKit iOS"
ReferencedContainer = "container:CareKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1140"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5196C7F8226F8F8F00F1C2A2"
BuildableName = "CareKitTests iOS.xctest"
BlueprintName = "CareKitTests iOS"
ReferencedContainer = "container:CareKit.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
32 changes: 32 additions & 0 deletions CareKit/CareKit/CareKit.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
Copyright (c) 2019, Apple Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

@_exported import CareKitStore
@_exported import CareKitUI
62 changes: 62 additions & 0 deletions CareKit/CareKit/Details/OCKDetailViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
Copyright (c) 2019, Apple Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

import CareKitUI
import UIKit

/// A view controller that can be customized to display the details of another view.
/// The detail view's content stack view can be populated with arbitrary content.
open class OCKDetailViewController: UIViewController {
private lazy var doneButton: UIBarButtonItem = {
let item = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(dismissViewController))
return item
}()

/// A detailed content view.
public var detailView: OCKDetailView {
guard let view = view as? OCKDetailView else { fatalError("Unsupported view.") }
return view
}

@available(*, unavailable)
override open func loadView() {
view = OCKDetailView()
}

override open func viewDidLoad() {
super.viewDidLoad()
navigationItem.rightBarButtonItem = doneButton
}

@objc
private func dismissViewController() {
dismiss(animated: true, completion: nil)
}
}
71 changes: 71 additions & 0 deletions CareKit/CareKit/Extensions/Calendar+Extensions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
Copyright (c) 2019, Apple Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

import Foundation

extension Calendar {

/// Returns a date interval that spans the entire week of the given date. The difference between this method and the
/// Foundation `Calendar.dateInterval(of:for:)` method is that this method produces non-overlapping
/// intervals.
func dateIntervalOfWeek(for date: Date) -> DateInterval {
var interval = Calendar.current.dateInterval(of: .weekOfYear, for: date)!
interval.duration -= 1 // The default interval contains 1 second of the next day after the interval. Subtract that off
return interval
}

/// Returns string representations of the weekdays, in the order the weekdays occur on the local calendar.
/// This differs with the Foundation `Calendar.veryShortWeekdaySymbols` in that the ordering is changed such
/// that the first element of the array corresponds to the first weekday in the current locale, instead of Sunday.
///
/// This method is required for handling certain regions in which the first day of the week is Monday.
func orderedWeekdaySymbolsVeryShort() -> [String] {
var symbols = veryShortWeekdaySymbols
Array(1..<firstWeekday).forEach { _ in
let symbol = symbols.removeFirst()
symbols.append(symbol)
}
return symbols
}

/// Returns string representations of the weekdays, in the order the weekdays occur on the local calendar.
/// This differs with the Foundation `Calendar.weekdaySymbols` in that the ordering is changed such
/// that the first element of the array corresponds to the first weekday in the current locale, instead of Sunday.
///
/// This method is required for handling certain regions in which the first day of the week is Monday.
func orderedWeekdaySymbols() -> [String] {
var symbols = weekdaySymbols
Array(1..<firstWeekday).forEach { _ in
let symbol = symbols.removeFirst()
symbols.append(symbol)
}
return symbols
}
}
Loading