Skip to content

SensorKit iOS xcode14.3 beta1

Alex Soto edited this page Mar 15, 2023 · 2 revisions

#SensorKit.framework https://github.com/xamarin/xamarin-macios/pull/17810

diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRDeviceUsageCategories.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRDeviceUsageCategories.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRDeviceUsageCategories.h	2022-11-10 19:15:17
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRDeviceUsageCategories.h	2023-02-12 14:12:40
@@ -42,11 +42,8 @@
 SR_EXTERN SRDeviceUsageCategoryKey const SRDeviceUsageCategoryShopping API_AVAILABLE(ios(14.0)) API_UNAVAILABLE(watchos) API_UNAVAILABLE(tvos, macos);
 SR_EXTERN SRDeviceUsageCategoryKey const SRDeviceUsageCategoryStickers API_AVAILABLE(ios(14.0)) API_UNAVAILABLE(watchos) API_UNAVAILABLE(tvos, macos);
 
-// ** NOTE **
-// This API has only been reviewed internally for the C release without an SDK
-// The final version will appear in the E release
 NS_SWIFT_SENDABLE // Immutable with no mutable subclasses
-SR_EXTERN API_AVAILABLE(ios(16.0)) API_UNAVAILABLE(watchos, macos) API_UNAVAILABLE(tvos)
+SR_EXTERN API_AVAILABLE(ios(16.4)) API_UNAVAILABLE(watchos) API_UNAVAILABLE(tvos, macos)
 /*!
  * @class SRSupplementalCategory
  *
@@ -54,8 +51,9 @@
  * A supplemental category to provide more context than just the app category
  *
  * @discussion
- * The app categories are very general. Providing a supplemental category will
- * allow more context about the specific app while not revealing the exact app name.
+ * The app categories from \c SRDeviceUsageCategoryKey are very general.
+ * Providing a supplemental category allows more context about the specific app while
+ * not revealing the exact app identity.
  */
 @interface SRSupplementalCategory : NSObject <NSCopying, NSSecureCoding>
 
@@ -64,7 +62,7 @@
  * @brief An opaque identifier for the supplemental category
  * @discussion More information about what this category represents can be found in Apple's developer documentation
  */
-@property (nonatomic, readonly) NSString *identifier;
+@property (nonatomic, readonly, copy) NSString *identifier;
 
 - (instancetype)init NS_UNAVAILABLE;
 + (instancetype)new NS_UNAVAILABLE;
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRKeyboardMetrics.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRKeyboardMetrics.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRKeyboardMetrics.h	2022-11-10 19:15:17
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRKeyboardMetrics.h	2023-02-12 14:09:33
@@ -31,6 +31,9 @@
 /// The input modes used during a keyboard session
 @property (readonly, copy) NSArray<NSString *> *inputModes API_AVAILABLE(ios(15.0)) API_UNAVAILABLE(watchos) API_UNAVAILABLE(tvos, macos);
 
+/// The keyboard session identifiers. These are the identifiers of the keyboard sessions that contributed to keyboard metrics sample to correlate current stream with another stream using the same keyboard session indentifiers
+@property (readonly, copy) NSArray<NSString *> *sessionIdentifiers API_AVAILABLE(ios(16.4)) API_UNAVAILABLE(watchos) API_UNAVAILABLE(tvos, macos);
+
 @end
 
 SR_EXTERN API_AVAILABLE(ios(14.0)) API_UNAVAILABLE(watchos) API_UNAVAILABLE(tvos, macos)
@@ -145,12 +148,8 @@
 /// The duration between touch down to touch down for any key
 @property (readonly, strong) SRKeyboardProbabilityMetric<NSUnitDuration *> *touchDownDown;
 
-/**
- * WARNING!!! Availability for touchUpDown metrics is not accurate,
- * since we're introducing these in C which doesn't have an SDK !!!
- */
-/// The duration between touch up to touch down for any key
-@property (readonly, strong) SRKeyboardProbabilityMetric<NSUnitDuration *> *touchUpDown API_AVAILABLE(ios(16.0)) API_UNAVAILABLE(watchos) API_UNAVAILABLE(tvos, macos);
+/// The duration between touch up and touch down for any key
+@property (readonly, strong) SRKeyboardProbabilityMetric<NSUnitDuration *> *touchUpDown API_AVAILABLE(ios(16.4)) API_UNAVAILABLE(watchos) API_UNAVAILABLE(tvos, macos);
 
 /// The duration between touchup on a character key and touch down on a word in the prediction bar
 @property (readonly, strong) SRKeyboardProbabilityMetric<NSUnitDuration *> *charKeyToPrediction;
@@ -251,12 +250,8 @@
 /// The duration between touch down and touch down of the character keys of all the long words in the session.
 @property (readonly, strong) NSArray<SRKeyboardProbabilityMetric<NSUnitDuration *> *> *longWordTouchDownDown;
 
-/**
- * WARNING!!! Availability for longWordTouchUpDown metrics is not accurate,
- * since we're introducing these in C which doesn't have an SDK !!!
- */
 /// The duration between touch up and touch down of the character keys of all the long words in the session.
-@property (readonly, strong) NSArray<SRKeyboardProbabilityMetric<NSUnitDuration *> *> *longWordTouchUpDown API_AVAILABLE(ios(16.0)) API_UNAVAILABLE(watchos) API_UNAVAILABLE(tvos, macos);
+@property (readonly, strong) NSArray<SRKeyboardProbabilityMetric<NSUnitDuration *> *> *longWordTouchUpDown API_AVAILABLE(ios(16.4)) API_UNAVAILABLE(watchos) API_UNAVAILABLE(tvos, macos);
 
 /// The duration between touchup of the delete key and touch down of a sequential delete key
 @property (readonly, strong) NSArray<SRKeyboardProbabilityMetric<NSUnitDuration *> *> *deleteToDeletes;
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRMediaEvent.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRMediaEvent.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRMediaEvent.h	1969-12-31 19:00:00
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRMediaEvent.h	2023-02-12 14:12:39
@@ -0,0 +1,41 @@
+//
+//  SRMediaEvent.h
+//  SensorKit
+//
+//  Copyright © 2022 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <SensorKit/SRDefines.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+typedef NS_ENUM(NSInteger, SRMediaEventType) {
+    SRMediaEventOnScreen = 1,
+    SRMediaEventOffScreen,
+} API_AVAILABLE(ios(16.4)) API_UNAVAILABLE(watchos) API_UNAVAILABLE(tvos, macos);
+
+NS_SWIFT_SENDABLE
+SR_EXTERN API_AVAILABLE(ios(16.4)) API_UNAVAILABLE(watchos) API_UNAVAILABLE(tvos, macos)
+@interface SRMediaEvent : NSObject <NSCopying, NSSecureCoding>
+
+/*!
+ * @property mediaIdentifier
+ *
+ * @brief Unique media identifier
+ *
+ * @discussion
+ * Unique media identifier to track a specific media object.
+ */
+@property (nonatomic, readonly, strong) NSString *mediaIdentifier;
+/*!
+ * @property eventType
+ *
+ * @brief Type of the event
+ *
+ * @discussion
+ * Type of media event (e.g., media has been displayed on a screen).
+ */
+@property (nonatomic, readonly, assign) SRMediaEventType eventType;
+@end
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRSensors.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRSensors.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRSensors.h	2022-11-12 15:57:52
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRSensors.h	2023-02-12 14:09:33
@@ -219,7 +219,7 @@
  * Ambient pressure sensor stream
  *
  * @discussion
- * This stream stores simple pressure and temperature masurements including:
+ * This stream stores simple pressure and temperature measurements including:
  * @textblock
  *   - Pressure and temperature
  *   - Date when metric was collected
@@ -228,4 +228,20 @@
  * Fetches from this stream return objects of type NSArray<CMRecordedPressureData *> * as defined in the CoreMotion framework.
  */
 SR_EXTERN SRSensor const SRSensorAmbientPressure API_AVAILABLE(ios(15.4)) API_UNAVAILABLE(watchos, macos) API_UNAVAILABLE(tvos);
+
+/*!
+ * @const SRSensorMediaEvents
+ *
+ * @brief
+ * Media events sensor stream
+ *
+ * @discussion
+ * This stream stores data about user interaction with photo and video content in messaging apps including:
+ * @textblock
+ *   - Event type
+ *   - Media identifier
+ * @/textblock
+ * Fetches from this stream return objects of type SRMediaEvent.
+ */
+SR_EXTERN SRSensor const SRSensorMediaEvents API_AVAILABLE(ios(16.4)) API_UNAVAILABLE(watchos, macos) API_UNAVAILABLE(tvos);
 NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRUsageReports.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRUsageReports.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRUsageReports.h	2022-11-10 19:17:35
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRUsageReports.h	2023-02-11 16:41:35
@@ -47,6 +47,9 @@
 /// Total amount of time the device was unlocked over this duration
 @property (readonly) NSTimeInterval totalUnlockDuration;
 
+/// Version of the algorithm used to produce the report
+@property (nonatomic, readonly, copy) NSString *version API_AVAILABLE(ios(16.4)) API_UNAVAILABLE(watchos) API_UNAVAILABLE(tvos, macos);
+
 @end
 
 typedef NS_ENUM(NSInteger, SRTextInputSessionType) {
@@ -104,7 +107,7 @@
  * @brief
  * Additional categories that describe this app
  */
-@property (readonly, copy) NSArray<SRSupplementalCategory *> *supplementalCategories API_AVAILABLE(ios(16.0)) API_UNAVAILABLE(watchos) API_UNAVAILABLE(tvos, macos);
+@property (nonatomic, readonly, copy) NSArray<SRSupplementalCategory *> *supplementalCategories API_AVAILABLE(ios(16.4)) API_UNAVAILABLE(watchos) API_UNAVAILABLE(tvos, macos);
 @end
 
 typedef NS_ENUM(NSInteger, SRNotificationEvent) {
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRWristDetection.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRWristDetection.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRWristDetection.h	2022-11-10 19:17:35
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SRWristDetection.h	2023-02-12 14:12:39
@@ -25,6 +25,27 @@
 @property(readonly) BOOL onWrist;
 @property(readonly) SRWristLocation wristLocation;
 @property(readonly) SRCrownOrientation crownOrientation;
+/*!
+ * @property onWristDate
+ *
+ * @brief Start date of the recent on-wrist state.
+ *
+ * @discussion
+ * - When the state changes from off-wrist to on-wrist, onWristDate would be updated to the current date, and offWristDate would remain the same.
+ * - When the state changes from on-wrist to off-wrist, offWristDate would be updated to the current date, and onWristDate would remain the same.
+ */
+@property (readonly, strong, nullable) NSDate *onWristDate API_AVAILABLE(ios(16.4)) API_UNAVAILABLE(watchos) API_UNAVAILABLE(tvos, macos);
+
+/*!
+ * @property offWristDate
+ *
+ * @brief Start date of the recent off-wrist state.
+ *
+ * @discussion
+ * - When the state changes from off-wrist to on-wrist, onWristDate would be updated to the current date, and offWristDate would remain the same.
+ * - When the state changes from on-wrist to off-wrist, offWristDate would be updated to the current date, and onWristDate would remain the same.
+ */
+@property (readonly, strong, nullable) NSDate *offWristDate API_AVAILABLE(ios(16.4)) API_UNAVAILABLE(watchos) API_UNAVAILABLE(tvos, macos);
 @end
 
 NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SensorKit.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SensorKit.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SensorKit.h	2022-11-05 08:49:10
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensorKit.framework/Headers/SensorKit.h	2023-02-10 15:52:59
@@ -25,3 +25,4 @@
 #import <SensorKit/SRDeletionRecord.h>
 #import <SensorKit/SRSensors+SRDeletionRecord.h>
 #import <SensorKit/SRWristDetection.h>
+#import <SensorKit/SRMediaEvent.h>
Clone this wiki locally