Skip to content

Commit

Permalink
Fix version 3.0 beta build (#691)
Browse files Browse the repository at this point in the history
* Fix CI

* fix tests in Xcode project

* update CI

* don't build FHIR on watchOS

* Don't test on watch

* remove extra files

* Build on Xcode 14.3

* cancel on new commits

* remove SPM generated build folder

* build and pass test on watchOS

* remove comments

* test CI on watchOS

* Don't test watchOS on FHIR

* revert FHIR tests back to iOS

* add SPI and point to CareKit docs

* update proj to latest Xcode

* update proj to latest Xcode

* update proj to latest Xcode

* update proj to latest Xcode

* Fix CareKitFHIR xcodeproj build and test on watchOS

* Use fulfillment in async XCTest in newer Xcode

* Make DailyPageViewController store publicly readable

* fix docs

* fix OCKCDPostalAddress CoreData init

* remove unnecessary check

* simplify SPI

* fix build warnings when testing

* Make OCKWeekCalendarPageViewController store public readable

* Bump min SPM to Swift 5.7

* build docs for each

* nit

* remove external links in spi

* Set default value for calendar property in OCKScheduleElement

* Add back tint color in #676

* Fix contact tintColor in ContactView

* fix contact navbar tintColor

* fix contact navbar tintColor

* Encoding/decoding Calendar.current causes crash after delay

* Revery and test OCKScheduleElement

* revert decoding, seems to crash on Xcode 14.3, not 14.2

* Add-ons to PR with CareKit 3.0 beta improvements (#691) (#7)

* Delete stale file

* Use Swift Concurrency API for awaiting expectations

* clean up

* fix tests

* test if self prevents crash as it works in debugger

* revert

* Make calendar type property to skip encoding/decoding

* Call cancelStreamingTask on deinit

* remove print statements in tests

* testing single queue for startQuery streaming

* revert

* Test holding stronger references from stream

* test if AsyncAlgorithms 0.1.0 fixes reference issues

* doc nits

* fixes

* fix watchOS CareKitUI tests

* Switch calendar to computed property

* Add TestColorExtension to CareKitUITests in XC project

* Save second KnowledgeVector increment to prevent data loss

* Update CareKitStore/CareKitStore/Structs/OCKScheduleElement.swift

Co-authored-by: Gavi Rawson <[email protected]>

---------

Co-authored-by: Gavi Rawson <[email protected]>
  • Loading branch information
cbaker6 and gavirawson-apple authored May 3, 2023
1 parent 449fd35 commit 2f2af4e
Show file tree
Hide file tree
Showing 70 changed files with 444 additions and 599 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@ on:
pull_request:
branches: [ main ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

jobs:
test:

runs-on: macos-11

runs-on: macos-12
strategy:
matrix:
destination: ['platform=iOS\ Simulator,OS=15.0,name=iPhone\ 11\ Pro\ Max']
scheme: ['CareKit\ iOS', 'CareKitStore\ iOS', 'CareKitUI\ iOS', 'CareKitFHIR']

destination: ['platform=iOS\ Simulator,OS=16.2,name=iPhone\ 14\ Pro\ Max', 'platform=watchOS\ Simulator,OS=9.1,name=Apple\ Watch\ Series\ 5\ \(40mm\)']
scheme: ['CareKit', 'CareKitStore', 'CareKitUI', 'CareKitFHIR']
steps:
- uses: actions/checkout@v2
- name: Set Xcode Version
run: sudo xcode-select -s /Applications/Xcode_13.0.app
run: sudo xcode-select -s /Applications/Xcode_14.2.app
- name: Use multiple cores
run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
- name: Build
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -verbose -workspace CKWorkspace.xcworkspace -scheme ${{ matrix.scheme }} -destination ${{ matrix.destination }} build test | xcpretty
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Xcode
build/
IDEWorkspaceChecks.plist
*.pbxuser
!default.pbxuser
*.mode1v3
Expand All @@ -24,6 +25,7 @@ DerivedData

# SPM
.build/
.swiftpm/

# DocC
.docc-build
.docc-build
11 changes: 11 additions & 0 deletions .spi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 1
builder:
configs:
- documentation_targets: ["CareKit", "CareKitUI", "CareKitStore", "CareKitFHIR"]
platform: ios
- platform: ios
scheme: "CareKit"
- platform: watchos
scheme: "CareKit"
- platform: macos
scheme: "CareKit"
4 changes: 2 additions & 2 deletions CKWorkspace.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-async-algorithms",
"state" : {
"revision" : "aed5422380244498344a036b8d94e27f370d9a22",
"version" : "0.0.4"
"revision" : "9cfed92b026c524674ed869a4ff2dcfdeedf8a2a",
"version" : "0.1.0"
}
},
{
Expand Down
41 changes: 27 additions & 14 deletions CareKit/CareKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objectVersion = 53;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -883,8 +883,9 @@
8605A5B11C4F04EC00DD65FF /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 1020;
LastUpgradeCheck = 1420;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = carekit.org;
TargetAttributes = {
5196C7F8226F8F8F00F1C2A2 = {
Expand Down Expand Up @@ -936,7 +937,6 @@
};
/* End PBXResourcesBuildPhase section */


/* Begin PBXSourcesBuildPhase section */
5196C7F5226F8F8F00F1C2A2 /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down Expand Up @@ -1107,6 +1107,7 @@
5196C801226F8F8F00F1C2A2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
Expand All @@ -1120,7 +1121,7 @@
DEVELOPMENT_TEAM = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = CareKitTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -1130,16 +1131,19 @@
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = Apple.CareKitTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "watchsimulator watchos iphonesimulator iphoneos";
SUPPORTS_MACCATALYST = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,4";
};
name = Debug;
};
5196C802226F8F8F00F1C2A2 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
Expand All @@ -1153,7 +1157,7 @@
DEVELOPMENT_TEAM = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = CareKitTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -1162,8 +1166,10 @@
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = Apple.CareKitTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "watchsimulator watchos iphonesimulator iphoneos";
SUPPORTS_MACCATALYST = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,4";
};
name = Release;
};
Expand Down Expand Up @@ -1231,7 +1237,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = "$(VERSION_NUMBER)";
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
Expand All @@ -1245,7 +1251,7 @@
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
WATCHOS_DEPLOYMENT_TARGET = 2.1;
WATCHOS_DEPLOYMENT_TARGET = 7.0;
};
name = Debug;
};
Expand Down Expand Up @@ -1307,7 +1313,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = "$(VERSION_NUMBER)";
MTL_ENABLE_DEBUG_INFO = NO;
ONLY_ACTIVE_ARCH = NO;
Expand All @@ -1321,6 +1327,7 @@
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
WATCHOS_DEPLOYMENT_TARGET = 7.0;
};
name = Release;
};
Expand All @@ -1338,16 +1345,19 @@
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = NO;
ENABLE_MODULE_VERIFIER = YES;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
INFOPLIST_FILE = CareKit/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11";
PRODUCT_BUNDLE_IDENTIFIER = org.carekit.CareKit;
PRODUCT_NAME = "$(PROJECT_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1362,7 +1372,7 @@
"SWIFT_ACTIVE_COMPILATION_CONDITIONS[arch=*]" = DEBUG;
SWIFT_TREAT_WARNINGS_AS_ERRORS = NO;
TARGETED_DEVICE_FAMILY = "1,2,4";
WATCHOS_DEPLOYMENT_TARGET = 6.0;
WATCHOS_DEPLOYMENT_TARGET = 7.0;
};
name = Debug;
};
Expand All @@ -1380,16 +1390,19 @@
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = NO;
ENABLE_MODULE_VERIFIER = YES;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
INFOPLIST_FILE = CareKit/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11";
PRODUCT_BUNDLE_IDENTIFIER = org.carekit.CareKit;
PRODUCT_NAME = "$(PROJECT_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1403,7 +1416,7 @@
SUPPORTS_UIKITFORMAC = NO;
SWIFT_TREAT_WARNINGS_AS_ERRORS = NO;
TARGETED_DEVICE_FAMILY = "1,2,4";
WATCHOS_DEPLOYMENT_TARGET = 6.0;
WATCHOS_DEPLOYMENT_TARGET = 7.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1430"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ import SwiftUI

extension OCKAnyEventStore {

@available(iOS 15, *)
@available(watchOS 8, *)
func toggleBooleanOutcome(for event: OCKAnyEvent) async throws -> OCKAnyOutcome {
return try await withCheckedThrowingContinuation { continuation in
toggleBooleanOutcome(for: event, completion: continuation.resume)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import SwiftUI
/// You can inject the store through the environment like this:
///
/// ContentView()
/// .environment(\.careKitStore, store)
/// .environment(\.careStore, store)
///
/// See the `OCKAnyStoreProtocol` and the `OCKStore` for more information about
/// creating a CareKit store.
Expand All @@ -74,7 +74,6 @@ import SwiftUI
/// ```
///
/// If you prefer to update the query date at a very specific time interval, see [`TimelineView`](https://www.google.com/search?client=safari&rls=en&q=timelineview&ie=UTF-8&oe=UTF-8&safari_group=3).
@available(iOS 14, watchOS 7, *)
@propertyWrapper
public struct CareStoreFetchRequest<Result, Query>: DynamicProperty {

Expand Down Expand Up @@ -132,7 +131,6 @@ public struct CareStoreFetchRequest<Result, Query>: DynamicProperty {

// MARK: - Fetching Store Entities

@available(iOS 14, watchOS 7, *)
public extension CareStoreFetchRequest where
Result == OCKAnyTask,
Query == OCKTaskQuery
Expand All @@ -155,7 +153,6 @@ public extension CareStoreFetchRequest where
}
}

@available(iOS 14, watchOS 7, *)
public extension CareStoreFetchRequest where
Result == OCKAnyEvent,
Query == OCKEventQuery
Expand All @@ -178,7 +175,6 @@ public extension CareStoreFetchRequest where
}
}

@available(iOS 14, watchOS 7, *)
public extension CareStoreFetchRequest where
Result == OCKAnyOutcome,
Query == OCKOutcomeQuery
Expand All @@ -201,7 +197,6 @@ public extension CareStoreFetchRequest where
}
}

@available(iOS 14, watchOS 7, *)
public extension CareStoreFetchRequest where
Result == OCKAnyContact,
Query == OCKContactQuery
Expand All @@ -224,7 +219,6 @@ public extension CareStoreFetchRequest where
}
}

@available(iOS 14, watchOS 7, *)
public extension CareStoreFetchRequest where
Result == OCKAnyPatient,
Query == OCKPatientQuery
Expand All @@ -247,7 +241,6 @@ public extension CareStoreFetchRequest where
}
}

@available(iOS 14, watchOS 7, *)
public extension CareStoreFetchRequest where
Result == OCKAnyCarePlan,
Query == OCKCarePlanQuery
Expand All @@ -270,7 +263,6 @@ public extension CareStoreFetchRequest where
}
}

@available(iOS 14, watchOS 7, *)
private extension CareStoreFetchRequest where Query: Equatable {

init(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import SwiftUI
///
/// - The result is generic, and is computed based on the provided `Result`.
/// Going the generic route allows us to create a single controller for all of the entity types in the CareKit store.
@available(iOS 14, watchOS 7, *)
final class CareStoreFetchRequestController<Result, Query>: ObservableObject {

typealias ComputeResults = (
Expand Down Expand Up @@ -92,6 +91,10 @@ final class CareStoreFetchRequestController<Result, Query>: ObservableObject {
)
}

deinit {
cancelStreamingTask()
}

/// Update the current query that is either pending or streaming. If the query is pending
/// make sure to call `streamResults(store:)` explicitly to begin the streaming process.
func update(query: Query) {
Expand Down Expand Up @@ -195,7 +198,6 @@ final class CareStoreFetchRequestController<Result, Query>: ObservableObject {
}
}

@available(iOS 14, watchOS 7, *)
private extension CareStoreFetchRequestController {

/// The status of a data stream from the CareKit store.
Expand All @@ -217,7 +219,6 @@ private extension CareStoreFetchRequestController {
// duplicate queries. We could avoid this indirection by making the
// original generic conform to Equatable, but that locks us into that
// conformance in the public API.
@available(iOS 14, watchOS 7, *)
extension CareStoreFetchRequestController where Query: Equatable {

convenience init(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ import Foundation

extension CareStoreFetchedResult where Result == OCKAnyEvent {

@available(iOS 15, *)
@available(watchOS 8, *)
func toggleBooleanOutcome() async throws -> OCKAnyOutcome {
try await store.toggleBooleanOutcome(for: result)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ UIPageViewController, UIPageViewControllerDataSource, UIPageViewControllerDelega
/// The initial date displayed when the view controller is loaded.
private let startingDate = Date()

private let store: OCKAnyStoreProtocol
/// The store the view controller uses for synchronization.
public let store: OCKAnyStoreProtocol

// MARK: - Life Cycle

Expand Down
Loading

0 comments on commit 2f2af4e

Please sign in to comment.