Skip to content

NearbyInteraction watchOS xcode13.0 beta1

Manuel de la Pena edited this page Aug 5, 2021 · 3 revisions

#NearbyInteraction.framework https://github.com/xamarin/xamarin-macios/pull/12351

diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIConfiguration.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIConfiguration.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIConfiguration.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIConfiguration.h	2021-06-02 07:35:43.000000000 -0400
@@ -0,0 +1,93 @@
+//
+//  NIConfiguration.h
+//  NearbyInteraction
+//
+//  Copyright © 2020 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <NearbyInteraction/NIExport.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ A type used to uniquely discover and identify a device in a nearby interaction session.
+*/
+API_AVAILABLE(ios(14.0), watchos(7.3)) API_UNAVAILABLE(macos, tvos)
+NI_EXPORT
+@interface NIDiscoveryToken : NSObject <NSCopying, NSSecureCoding>
+
+/** Unavailable */
+- (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
+
+@end
+
+/**
+ An object to describe and configure parameters to be used in a nearby interaction session.
+*/
+API_AVAILABLE(ios(14.0), watchos(7.3)) API_UNAVAILABLE(macos, tvos)
+NI_EXPORT
+@interface NIConfiguration : NSObject <NSCopying, NSSecureCoding>
+
+/** Unavailable */
+- (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
+
+@end
+
+/**
+ An object to describe and configure parameters to be used in a nearby interaction session for mutual relative positional measurements.
+ @discussion Devices engaged in a session run with an NINearbyPeerConfiguration are able to continuously generate positional measurements relative to one another.
+*/
+API_AVAILABLE(ios(14.0), watchos(7.3)) API_UNAVAILABLE(macos, tvos)
+NI_EXPORT
+@interface NINearbyPeerConfiguration : NIConfiguration
+
+/**
+ The discovery token identifiying the peer device for this session configuration.
+*/
+@property (nonatomic, copy, readonly) NIDiscoveryToken *peerDiscoveryToken;
+
+/**
+ Initializes a new configuration with the provided peer token.
+ @param peerToken A discovery token received from the peer for this session.
+ */
+- (instancetype)initWithPeerToken:(NIDiscoveryToken *)peerToken;
+
+/** Unavailable */
+- (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
+
+@end
+
+/**
+ A session configuration that enables interaction with supported accessories.
+*/
+API_AVAILABLE(ios(15.0), watchos(8.0)) API_UNAVAILABLE(tvos, macos)
+NI_EXPORT
+@interface NINearbyAccessoryConfiguration : NIConfiguration
+
+/**
+ The discovery token identifying the accessory device for this session configuration.
+ @discussion NINearbyObject updates for this accessory will contain this discovery token.
+*/
+@property (nonatomic, copy, readonly) NIDiscoveryToken *accessoryDiscoveryToken;
+
+/**
+Create a new nearby accessory configuration using data received from the accessory.
+
+@param data Configuration data received from the accessory.
+@param error An optional out error parameter that will be populated with an error if the provided data is invalid or unsupported.
+*/
+- (nullable instancetype)initWithData:(NSData *)data error:(NSError **)error;
+
+/** Unavailable */
+- (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
+
+@end
+
+
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIError.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIError.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIError.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIError.h	2021-06-02 07:35:43.000000000 -0400
@@ -0,0 +1,41 @@
+//
+//  NIError.h
+//  NearbyInteraction
+//
+//  Copyright © 2020 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <NearbyInteraction/NIExport.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+API_AVAILABLE(ios(14.0), watchos(7.3)) API_UNAVAILABLE(macos, tvos)
+NI_EXPORT NSErrorDomain const NIErrorDomain;
+
+/**
+ Error codes for nearby interaction session failures.
+ */
+API_AVAILABLE(ios(14.0), watchos(7.3)) API_UNAVAILABLE(macos, tvos)
+typedef NS_ERROR_ENUM(NIErrorDomain, NIErrorCode) {
+    /** The platform does not support this operation */
+    NIErrorCodeUnsupportedPlatform = -5889,
+    
+    /** Configuration is unsupported */
+    NIErrorCodeInvalidConfiguration = -5888,
+
+    /** The session has failed and cannot be restarted */
+    NIErrorCodeSessionFailed = -5887,
+    
+    /** The session has been active for over the allowed period */
+    NIErrorCodeResourceUsageTimeout = -5886,
+    
+    /** The maximum number of active sessions was exceeded */
+    NIErrorCodeActiveSessionsLimitExceeded = -5885,
+    
+    /** The user did not authorize the session */
+    NIErrorCodeUserDidNotAllow = -5884,
+};
+
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIExport.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIExport.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIExport.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIExport.h	2021-06-01 20:55:18.000000000 -0400
@@ -0,0 +1,13 @@
+//
+//  NIExport.h
+//  NearbyInteraction
+//
+//  Copyright © 2020 Apple Inc. All rights reserved.
+//
+
+#ifndef NIExport_h
+#define NIExport_h
+
+#define NI_EXPORT extern __attribute__((visibility ("default")))
+
+#endif /* NIExport_h */
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NINearbyObject.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NINearbyObject.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NINearbyObject.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NINearbyObject.h	2021-06-02 07:35:43.000000000 -0400
@@ -0,0 +1,56 @@
+//
+//  NINearbyObject.h
+//  NearbyInteraction
+//
+//  Copyright © 2020 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <NearbyInteraction/NIExport.h>
+#import <simd/simd.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@class NIDiscoveryToken;
+
+/** A sentinel value indicating that a distance measurement could not be produced */
+API_AVAILABLE(ios(14.0), watchos(7.3)) API_UNAVAILABLE(macos, tvos)
+NI_EXPORT float NINearbyObjectDistanceNotAvailable NS_SWIFT_UNAVAILABLE("Use optional value semantics");
+
+/** A sentinel value indicating that a direction measurement could not be produced */
+API_AVAILABLE(ios(14.0), watchos(7.3)) API_UNAVAILABLE(macos, tvos)
+NI_EXPORT simd_float3 NINearbyObjectDirectionNotAvailable NS_SWIFT_UNAVAILABLE("Use optional value semantics");
+
+/**
+ A nearby object with distance and direction measurements.
+*/
+API_AVAILABLE(ios(14.0), watchos(7.3)) API_UNAVAILABLE(macos, tvos)
+NI_EXPORT
+@interface NINearbyObject : NSObject <NSCopying, NSSecureCoding>
+
+/**
+ Nearby interaction discovery token
+ @discussion This discovery token will be equal to the token provided in the configuration with which the session was run.
+ */
+@property (nonatomic, readonly, copy) NIDiscoveryToken *discoveryToken;
+
+/**
+ Distance to the nearby object in meters. If not available in this update, the value of this property will be equal to NINearbyObjectDistanceNotAvailable in Objective C, or nil in Swift.
+ */
+@property (nonatomic, readonly) float distance NS_REFINED_FOR_SWIFT;
+
+/**
+ Unit vector representing the relative direction in the reference frame.
+ @discussion (x,y,z) representing a point on the unit sphere in the direction of the nearby object.
+ If not available in this update, the value of this property will be equal to NINearbyObjectDirectionNotAvailable in Objective C, or nil in Swift.
+*/
+@property (nonatomic, readonly) simd_float3 direction NS_REFINED_FOR_SWIFT;
+
+/** Unavailable */
+- (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
+@end
+
+
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NISession.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NISession.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NISession.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NISession.h	2021-06-02 07:35:43.000000000 -0400
@@ -0,0 +1,150 @@
+//
+//  NISession.h
+//  NearbyInteraction
+//
+//  Copyright © 2020 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <NearbyInteraction/NIConfiguration.h>
+#import <NearbyInteraction/NIExport.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@class NINearbyObject;
+
+@protocol NISessionDelegate;
+
+/**
+ Nearby interaction session.
+ */
+API_AVAILABLE(ios(14.0), watchos(7.3)) API_UNAVAILABLE(macos, tvos)
+NI_EXPORT
+@interface NISession : NSObject
+
+/**
+ Whether or not this device is capable of participating in a nearby interaction session.
+ */
+@property (class, nonatomic, readonly, getter=isSupported) BOOL supported;
+
+/**
+ A delegate for receiving NISession updates.
+ */
+@property (nonatomic, weak, nullable) id <NISessionDelegate> delegate;
+
+/**
+ The dispatch queue on which the delegate calls are performed.
+ @discussion If not provided or nil, delegate calls will be performed on the main queue.
+ */
+@property (nonatomic, strong, nullable) dispatch_queue_t delegateQueue;
+
+/**
+ A unique nearby interaction identifier for this session.
+
+ @discussion Copy this discoveryToken and share it with a peer device.
+ The discoveryToken is unique to this device and this session.
+*/
+@property (nonatomic, copy, nullable, readonly) NIDiscoveryToken *discoveryToken;
+
+/**
+ The nearby interaction configuration currently being used by the session.
+ */
+@property (nonatomic, copy, nullable, readonly) NIConfiguration *configuration;
+
+/**
+ Start a nearby interaction session.
+ @param configuration Nearby interaction configuration for this session.
+ Both devices must call -runWithConfiguration: with a valid configuration identifying the other device in order to receive nearby object updates.
+*/
+- (void)runWithConfiguration:(NIConfiguration *)configuration NS_SWIFT_NAME(run(_:));
+
+/**
+ Pause an ongoing nearby interaction session.
+ @discussion Paused sessions may be restarted by calling -runWithConfiguration:. The same local discoveryToken will be used.
+*/
+- (void)pause;
+
+/**
+ Invalidate an ongoing nearby interaction session.
+ @discussion Invalidate sessions you wish to terminate and do not intend to restart. A peer device in a nearby interaction session will receive a callback to -didRemoveNearbyObject:withReason: some time after a call to invalidate (see NINearbyObjectRemovalReason).
+ calling -runWithConfiguration: after invalidation will result in an error.
+*/
+- (void)invalidate;
+
+@end
+
+/**
+ Reasons to remove a nearby object.
+ */
+API_AVAILABLE(ios(14.0), watchos(7.3)) API_UNAVAILABLE(macos, tvos)
+typedef NS_ENUM(NSInteger, NINearbyObjectRemovalReason) {
+
+    /** The system has not received new activity from this object for over the allowed period. */
+    NINearbyObjectRemovalReasonTimeout,
+    
+    /** The peer device has signaled that it will no longer participate in the session.
+        This removal reason is delivered on a best effort basis and is not guaranteed to be received. */
+    NINearbyObjectRemovalReasonPeerEnded,
+} NS_SWIFT_NAME(NINearbyObject.RemovalReason);
+
+/**
+ Delegate for nearby interaction session updates.
+ */
+API_AVAILABLE(ios(14.0), watchos(7.3)) API_UNAVAILABLE(macos, tvos)
+@protocol NISessionDelegate <NSObject>
+
+@optional
+
+/**
+ This is called when new updates about nearby objects are available.
+ @param session The nearby interaction session being run.
+ @param nearbyObjects The nearby objects that have been updated.
+*/
+- (void)session:(NISession *)session didUpdateNearbyObjects:(NSArray<__kindof NINearbyObject *> *)nearbyObjects NS_SWIFT_NAME(session(_:didUpdate:));
+
+/**
+ This is called when the system is no longer attempting to interact with some nearby objects.
+ @discussion The system was unable to interact with a peer device for some time, or the peer device signaled that it is leaving the session. After this callback is received, the session with the peer is no longer active. To retry interacting with the peer, issue a new call to -runWithConfiguration:.
+ @param session The nearby interaction session that removed the nearby object(s).
+ @param nearbyObjects The nearby objects that were removed.
+ @param reason The reason the nearby object(s) were removed.  All objects in nearbyObjects are removed for the same reason. If multiple nearby objects are removed for different reasons, -didRemoveNearbyObjects:reason: will be called multiple times.
+*/
+- (void)session:(NISession *)session didRemoveNearbyObjects:(NSArray<__kindof NINearbyObject *> *)nearbyObjects withReason:(NINearbyObjectRemovalReason)reason NS_SWIFT_NAME(session(_:didRemove:reason:));
+
+/**
+ This is called when a session is suspended.
+ @discussion A session will be suspended in various app and system scenarios.
+ A suspended session may be run again only after -sessionSuspensionEnded: has been called.  Restart a session by issuing a new call to -runWithConfiguration:.
+ @param session The nearby interaction session that was suspended.
+*/
+- (void)sessionWasSuspended:(NISession *)session;
+
+/**
+ This is called when a session may be resumed.
+ @param session The nearby interaction session that was suspended.
+*/
+- (void)sessionSuspensionEnded:(NISession *)session;
+
+/**
+ This is called when a session is invalidated.
+ @param session The session that has become invalid. Your app should discard any references it has to this session.
+ @param error The error indicating the reason for invalidation of the session (see NIError.h).
+*/
+- (void)session:(NISession *)session didInvalidateWithError:(NSError *)error NS_SWIFT_NAME(session(_:didInvalidateWith:));
+
+/**
+Provides configuration data that needs to be shared with the accessory.
+@note Shareable configuration data is only provided when running an NINearbyAccessoryConfiguration.
+@discussion After invoking this callback, the session will go into a special preparedness state for a limited amount of time.
+The interaction on the accessory must start within this time window. If activity is not detected from the accessory, the session will call
+the -[session:didRemoveNearbyObjects:reason:] delegate callback. To restart the session, coordinate with the accessory and call -[runWithConfiguration] again.
+ 
+@param session The session which produced the configuration data.
+@param shareableConfigurationData The configuration data that needs to be shared with the accessory.
+@param object A representation of the accessory as a NINearbyObject. The discoveryToken property will be equal to the one in the configuration used to run the session.
+*/
+- (void)session:(NISession *)session didGenerateShareableConfigurationData:(NSData *)shareableConfigurationData forObject:(NINearbyObject *)object API_AVAILABLE(ios(15.0), watchos(8.0)) API_UNAVAILABLE(tvos, macos);
+
+@end
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NearbyInteraction.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NearbyInteraction.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NearbyInteraction.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NearbyInteraction.h	2021-06-01 20:55:18.000000000 -0400
@@ -0,0 +1,14 @@
+//
+//  NearbyInteraction.h
+//  NearbyInteraction
+//
+//  Copyright © 2020 Apple Inc. All rights reserved.
+//
+
+#import <NearbyInteraction/NIError.h>
+
+#import <NearbyInteraction/NIConfiguration.h>
+#import <NearbyInteraction/NINearbyObject.h>
+#import <NearbyInteraction/NISession.h>
+
+#import <NearbyInteraction/NIExport.h>
Clone this wiki locally