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

Fix version 3.0 beta build #691

Merged
merged 60 commits into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
8f92969
Fix CI
cbaker6 Apr 7, 2023
b33f1de
fix tests in Xcode project
cbaker6 Apr 7, 2023
5f0cf46
update CI
cbaker6 Apr 7, 2023
0a313d0
don't build FHIR on watchOS
cbaker6 Apr 7, 2023
a92cb94
Don't test on watch
cbaker6 Apr 7, 2023
f07bfef
remove extra files
cbaker6 Apr 7, 2023
7cd56b1
Build on Xcode 14.3
cbaker6 Apr 7, 2023
30a86e1
cancel on new commits
cbaker6 Apr 7, 2023
dde967d
remove SPM generated build folder
cbaker6 Apr 7, 2023
8bc33a7
build and pass test on watchOS
cbaker6 Apr 7, 2023
83d81e4
remove comments
cbaker6 Apr 7, 2023
f672696
test CI on watchOS
cbaker6 Apr 7, 2023
741b0f2
Don't test watchOS on FHIR
cbaker6 Apr 7, 2023
2f7b8d4
revert FHIR tests back to iOS
cbaker6 Apr 7, 2023
3f5e441
add SPI and point to CareKit docs
cbaker6 Apr 7, 2023
92a6c02
update proj to latest Xcode
cbaker6 Apr 7, 2023
b5952ab
update proj to latest Xcode
cbaker6 Apr 7, 2023
3ed479a
update proj to latest Xcode
cbaker6 Apr 7, 2023
2fda297
update proj to latest Xcode
cbaker6 Apr 7, 2023
1a66556
Fix CareKitFHIR xcodeproj build and test on watchOS
cbaker6 Apr 7, 2023
5d2500b
Use fulfillment in async XCTest in newer Xcode
cbaker6 Apr 7, 2023
38be8ce
Make DailyPageViewController store publicly readable
cbaker6 Apr 8, 2023
4bf2d81
fix docs
cbaker6 Apr 8, 2023
863a5e8
fix OCKCDPostalAddress CoreData init
cbaker6 Apr 9, 2023
9434c08
remove unnecessary check
cbaker6 Apr 9, 2023
35b78d5
simplify SPI
cbaker6 Apr 9, 2023
e99114c
fix build warnings when testing
cbaker6 Apr 9, 2023
cee8e25
Make OCKWeekCalendarPageViewController store public readable
cbaker6 Apr 9, 2023
2b7741e
Bump min SPM to Swift 5.7
cbaker6 Apr 9, 2023
c37c9a4
build docs for each
cbaker6 Apr 9, 2023
c0b3dd1
nit
cbaker6 Apr 9, 2023
47482b7
remove external links in spi
cbaker6 Apr 9, 2023
032abb2
Set default value for calendar property in OCKScheduleElement
cbaker6 Apr 10, 2023
e7e9ffa
Add back tint color in #676
cbaker6 Apr 10, 2023
32c6bf0
Fix contact tintColor in ContactView
cbaker6 Apr 10, 2023
644424b
fix contact navbar tintColor
cbaker6 Apr 10, 2023
f8d0a81
fix contact navbar tintColor
cbaker6 Apr 10, 2023
38b9ef8
Encoding/decoding Calendar.current causes crash after delay
cbaker6 Apr 10, 2023
27f525c
Revery and test OCKScheduleElement
cbaker6 Apr 10, 2023
3a43129
revert decoding, seems to crash on Xcode 14.3, not 14.2
cbaker6 Apr 10, 2023
ff6ccbe
Add-ons to PR with CareKit 3.0 beta improvements (#691) (#7)
gavirawson-apple Apr 11, 2023
78f4bec
clean up
cbaker6 Apr 11, 2023
2712c6e
fix tests
cbaker6 Apr 11, 2023
05e292a
Merge remote-tracking branch 'origin/main' into fixCI
cbaker6 Apr 11, 2023
50b4d9f
test if self prevents crash as it works in debugger
cbaker6 Apr 11, 2023
6d65a07
revert
cbaker6 Apr 11, 2023
a742f62
Make calendar type property to skip encoding/decoding
cbaker6 Apr 12, 2023
e426d56
Call cancelStreamingTask on deinit
cbaker6 Apr 12, 2023
ada41bb
remove print statements in tests
cbaker6 Apr 12, 2023
ef51eff
testing single queue for startQuery streaming
cbaker6 Apr 12, 2023
708d0ec
revert
cbaker6 Apr 12, 2023
636aaae
Test holding stronger references from stream
cbaker6 Apr 13, 2023
7839f08
test if AsyncAlgorithms 0.1.0 fixes reference issues
cbaker6 Apr 13, 2023
38c496d
doc nits
cbaker6 Apr 16, 2023
951d081
fixes
cbaker6 Apr 20, 2023
5d10809
fix watchOS CareKitUI tests
cbaker6 Apr 20, 2023
fdfcbf3
Switch calendar to computed property
cbaker6 Apr 20, 2023
225341b
Add TestColorExtension to CareKitUITests in XC project
cbaker6 Apr 20, 2023
698176a
Save second KnowledgeVector increment to prevent data loss
cbaker6 Apr 22, 2023
b67404d
Update CareKitStore/CareKitStore/Structs/OCKScheduleElement.swift
cbaker6 Apr 25, 2023
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
22 changes: 13 additions & 9 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,25 @@ 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']
exclude:
- destination: 'platform=watchOS\ Simulator,OS=9.1,name=Apple\ Watch\ Series\ 5\ \(40mm\)'
scheme: 'CareKitUI'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this bit needed? Is CareKitUI not running on watchOS 9.1?

Copy link
Contributor Author

@cbaker6 cbaker6 Apr 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just all of the tests in the framework are for iOS, there are no current watchOS tests so I skipped it, it builds fine though

If we remove these lines, it will add ~5 minutes to the CI, but will automatically test CareKitUI for watchOS when tests are added in the future. I can remove the exclude if you want me to?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add this back

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/
cbaker6 marked this conversation as resolved.
Show resolved Hide resolved

# DocC
.docc-build
.docc-build
9 changes: 9 additions & 0 deletions .spi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 1
builder:
configs:
- documentation_targets: ["CareKit", "CareKitUI", "CareKitStore", "CareKitFHIR"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, where do the built docs end up?

Copy link
Contributor Author

@cbaker6 cbaker6 Apr 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SPI hosts them on their website, though you can keep building the docs on GitHub pages. You can see the ones I made for ParseCareKit (the version that works with the latest main of CareKit 2.x): https://swiftpackageindex.com/netreconlab/ParseCareKit/0.13.1/documentation/parsecarekit

Here's the Alpha to the version of ParseCareKit that works with CareKit 3.0.0 beta: https://swiftpackageindex.com/netreconlab/ParseCareKit/1.0.0-alpha.7/documentation/parsecarekit

The breadcrumbs on the site only show the latest, but all old versions remain hosted so devs can always view the docs for the version they are using. Here's an older version of my docs: https://swiftpackageindex.com/netreconlab/ParseCareKit/0.13.0/documentation/parsecarekit

Copy link
Contributor Author

@cbaker6 cbaker6 Apr 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't have to do anything special to release these other than having the .spi.yml file in the repo. I simply create my releases using the standard GitHub release process and SPI adds the documents (usually within ~1 hour of the release)

Note: I haven't had a multi-framework project, so I'm assuming I set this up correctly based on the SPI docs. I also ran the SPI verification and it passed. We can ask @finestructure if I setup this line correctly for documentations for multiple frameworks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Corey 👋 , yes, that's correct! The order determines the order in the drop-down menu and the first one is the one we show by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome Sven, thanks for looking at this!

platform: ios
- platform: ios
scheme: "CareKit"
- platform: watchos
scheme: "CareKit"
Comment on lines +5 to +9
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like SPI automatically infers a configuration based on our repo, can you walk me through why this file is explicitly needed?

Copy link
Contributor Author

@cbaker6 cbaker6 Apr 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can most of the time, but sometimes it can’t. The latest changes you pushed combined the targets, but it’s possible SPI can still make a mistake because there are multiple frameworks in one. You can see the builds for CareKit here: https://swiftpackageindex.com/carekit-apple/CareKit/builds

For the build profile, SPI only builds 1 framework (I believe) which is the one specified here.

Also, the docs won’t build without being told specifically to do so in the spi file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if need me to answer more questions from the comment added here: https://github.com/carekit-apple/CareKit/pull/691/files#r1162276983

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add macOS

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
29 changes: 21 additions & 8 deletions CareKit/CareKit.xcodeproj/project.pbxproj
cbaker6 marked this conversation as resolved.
Show resolved Hide resolved
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;
cbaker6 marked this conversation as resolved.
Show resolved Hide resolved
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;
cbaker6 marked this conversation as resolved.
Show resolved Hide resolved
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 = 13.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;
cbaker6 marked this conversation as resolved.
Show resolved Hide resolved
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,4";
cbaker6 marked this conversation as resolved.
Show resolved Hide resolved
};
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 = 13.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 @@ -1245,7 +1251,7 @@
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
WATCHOS_DEPLOYMENT_TARGET = 2.1;
WATCHOS_DEPLOYMENT_TARGET = 6.0;
};
name = Debug;
};
Expand Down Expand Up @@ -1321,6 +1327,7 @@
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
WATCHOS_DEPLOYMENT_TARGET = 6.0;
};
name = Release;
};
Expand All @@ -1338,6 +1345,7 @@
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;
Expand All @@ -1348,6 +1356,8 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11";
cbaker6 marked this conversation as resolved.
Show resolved Hide resolved
PRODUCT_BUNDLE_IDENTIFIER = org.carekit.CareKit;
PRODUCT_NAME = "$(PROJECT_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -1380,6 +1390,7 @@
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;
Expand All @@ -1390,6 +1401,8 @@
"@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 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)
cbaker6 marked this conversation as resolved.
Show resolved Hide resolved
///
/// See the `OCKAnyStoreProtocol` and the `OCKStore` for more information about
/// creating a CareKit store.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ final class CareStoreFetchRequestController<Result, Query>: ObservableObject {
)
}

deinit {
cancelStreamingTask()
cbaker6 marked this conversation as resolved.
Show resolved Hide resolved
}

/// 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
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
cbaker6 marked this conversation as resolved.
Show resolved Hide resolved

// MARK: - Life Cycle

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,16 @@ final class OCKContactViewResponder: NSObject,
action: #selector(dismissViewController)
)

/*
TODO: Remove in the future. Explicitly setting the tint color here to support
current developers that have a SwiftUI lifecycle app and wrap this view
controller in a `UIViewControllerRepresentable` implementation...Tint color
is not propagated...etc.
*/
let tintColor = contactViewController.determineTintColor(from: contactView)
cbaker6 marked this conversation as resolved.
Show resolved Hide resolved
contactViewController.view.tintColor = tintColor
contactViewController.navigationItem.rightBarButtonItem?.tintColor = tintColor

let navigationController = UINavigationController(rootViewController: contactViewController)
presenter?.present(navigationController, animated: true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,9 @@ internal extension UIViewController {
stackView.insertArrangedSubview(view, at: index, animated: animated)
didMove(toParent: containerViewController)
}

func determineTintColor(from view: UIView) -> UIColor {
self.view.window?.tintColor ?? view.tintColor
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ UIPageViewControllerDataSource, UIPageViewControllerDelegate {
return weekCalendarPageViewController.selectedDate
}

/// The store manager the view controller uses for synchronization
/// The store manager the view controller uses for synchronization.
@available(*, unavailable, renamed: "store")
public var storeManager: OCKSynchronizedStoreManager!

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

/// Page view managing ListViewControllers.
private let pageViewController = UIPageViewController(transitionStyle: .scroll, navigationOrientation: .horizontal, options: nil)
Expand Down
Loading