Skip to content

Commit

Permalink
feat: Allow building for macOS and visionOS (#123)
Browse files Browse the repository at this point in the history
* feat: Update packages

* allow building for macOS and visionOS
  • Loading branch information
cbaker6 authored Jul 6, 2024
1 parent 5625410 commit cd6d1b7
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 21 deletions.
12 changes: 8 additions & 4 deletions OCKSample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -944,8 +944,10 @@
PRODUCT_BUNDLE_IDENTIFIER = edu.uky.netrecon.ParseCarekitSample;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_TREAT_WARNINGS_AS_ERRORS = NO;
TARGETED_DEVICE_FAMILY = 1;
TARGETED_DEVICE_FAMILY = "1,2,7";
};
name = Release;
};
Expand Down Expand Up @@ -1181,8 +1183,10 @@
PRODUCT_BUNDLE_IDENTIFIER = edu.uky.netrecon.ParseCarekitSample;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_TREAT_WARNINGS_AS_ERRORS = NO;
TARGETED_DEVICE_FAMILY = 1;
TARGETED_DEVICE_FAMILY = "1,2,7";
};
name = Debug;
};
Expand Down Expand Up @@ -1233,15 +1237,15 @@
repositoryURL = "https://github.com/netreconlab/CareKitEssentials";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.3.0;
minimumVersion = "1.0.0-alpha.12";
};
};
70202EBF2807333900CF73FB /* XCRemoteSwiftPackageReference "CareKit" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/cbaker6/CareKit.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = "3.0.0-beta.2";
minimumVersion = "3.0.0-beta.10";
};
};
918FDEAD271B3F8F0045A0EF /* XCRemoteSwiftPackageReference "ParseCareKit" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,35 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/cbaker6/CareKit.git",
"state" : {
"revision" : "95135c84d3de05e8397bd3a493729876bffc060e",
"version" : "3.0.0-beta.8"
"revision" : "075d600052f168d49b542444577cf20033eb9666",
"version" : "3.0.0-beta.10"
}
},
{
"identity" : "carekitessentials",
"kind" : "remoteSourceControl",
"location" : "https://github.com/netreconlab/CareKitEssentials",
"state" : {
"revision" : "1e6e5bba9edc35fdcd3517291ab6c8828624f7db",
"version" : "0.3.0"
"revision" : "01f82f2797afbb53b15f92f92815532eb971b8f2",
"version" : "1.0.0-alpha.12"
}
},
{
"identity" : "fhirmodels",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/FHIRModels.git",
"state" : {
"revision" : "e115442fb3c5d44ffb1dc9b4e039b77fd143ad96",
"version" : "0.4.0"
"revision" : "861afd5816a98d38f86220eab2f812d76cad84a0",
"version" : "0.5.0"
}
},
{
"identity" : "parse-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/netreconlab/Parse-Swift.git",
"state" : {
"revision" : "fc516a6e48c1c150a0ecac94910bc8dcedfc2e71",
"version" : "5.8.1"
"revision" : "9b7a9602f8a90538639f5e55116c35b4dbeb10dc",
"version" : "5.9.3"
}
},
{
Expand All @@ -51,17 +51,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-async-algorithms",
"state" : {
"revision" : "9cfed92b026c524674ed869a4ff2dcfdeedf8a2a",
"version" : "0.1.0"
"revision" : "da4e36f86544cdf733a40d59b3a2267e3a7bbf36",
"version" : "1.0.0"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
"revision" : "937e904258d22af6e447a0b72c0bc67583ef64a2",
"version" : "1.0.4"
"revision" : "ee97538f5b81ae89698fd95938896dec5217b148",
"version" : "1.1.1"
}
}
],
Expand Down
2 changes: 2 additions & 0 deletions OCKSample/Main/Care/CareViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ class CareViewController: OCKDailyPageViewController {

listViewController.clear()

#if os(iOS)
// Only show the tip view on the current date
if isCurrentDay {
if Calendar.current.isDate(date, inSameDayAs: Date()) {
Expand All @@ -183,6 +184,7 @@ class CareViewController: OCKDailyPageViewController {
listViewController.appendView(tipView, animated: false)
}
}
#endif

// Display the rest of the cards
taskCards.forEach { (cards: [UIViewController]) in
Expand Down
4 changes: 4 additions & 0 deletions OCKSample/Main/Care/CustomCards/TipView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#if os(iOS)

import UIKit
import CareKit
import CareKitUI
Expand Down Expand Up @@ -115,3 +117,5 @@ class TipView: OCKView, OCKCardable {
directionalLayoutMargins = cachedStyle.dimension.directionalInsets1
}
}

#endif
10 changes: 8 additions & 2 deletions OCKSample/Main/Contact/ContactView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ struct ContactView: UIViewControllerRepresentable {
}

func createViewController() -> UIViewController {
OCKContactsListViewController(store: careStore,
contactViewSynchronizer: OCKDetailedContactViewSynchronizer())
#if os(iOS)
return OCKContactsListViewController(
store: careStore,
contactViewSynchronizer: OCKDetailedContactViewSynchronizer()
)
#else
return UIViewController()
#endif
}
}

Expand Down
2 changes: 1 addition & 1 deletion OCKSample/Utility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class Utility {
}
}

#if os(iOS)
#if os(iOS) || os(visionOS)
class func requestHealthKitPermissions() {
AppDelegateKey.defaultValue?.healthKitStore.requestHealthKitPermissionsForAllTasksInStore { error in
guard let error = error else {
Expand Down
2 changes: 1 addition & 1 deletion OCKSample/WatchConnectivity/LocalSyncSessionDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class LocalSessionDelegate: NSObject, SessionDelegate {
self.store = store
}

#if os(iOS)
#if os(iOS) || os(visionOS)
func sessionDidBecomeInactive(_ session: WCSession) {
Logger.localSessionDelegate.info("sessionDidBecomeInactive")
}
Expand Down
2 changes: 1 addition & 1 deletion OCKSample/WatchConnectivity/RemoteSessionDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class RemoteSessionDelegate: NSObject, SessionDelegate {
self.store = store
}

#if os(iOS)
#if os(iOS) || os(visionOS)
func sessionDidBecomeInactive(_ session: WCSession) {
Logger.remoteSessionDelegate.info("sessionDidBecomeInactive")
}
Expand Down

0 comments on commit cd6d1b7

Please sign in to comment.