Compare commits
5 Commits
release/2.
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34a9f94481 | ||
|
|
e5a3e55eed | ||
|
|
d69c75bfcf | ||
|
|
d6525d3725 | ||
|
|
b316e4e263 |
@ -1,262 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 The WebRTC Project Authors. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
extern NSString * const kRTCAudioSessionErrorDomain;
|
||||
/** Method that requires lock was called without lock. */
|
||||
extern NSInteger const kRTCAudioSessionErrorLockRequired;
|
||||
/** Unknown configuration error occurred. */
|
||||
extern NSInteger const kRTCAudioSessionErrorConfiguration;
|
||||
|
||||
@class RTCAudioSession;
|
||||
@class RTCAudioSessionConfiguration;
|
||||
|
||||
// Surfaces AVAudioSession events. WebRTC will listen directly for notifications
|
||||
// from AVAudioSession and handle them before calling these delegate methods,
|
||||
// at which point applications can perform additional processing if required.
|
||||
RTC_EXPORT
|
||||
@protocol RTCAudioSessionDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
/** Called on a system notification thread when AVAudioSession starts an
|
||||
* interruption event.
|
||||
*/
|
||||
- (void)audioSessionDidBeginInterruption:(RTCAudioSession *)session;
|
||||
|
||||
/** Called on a system notification thread when AVAudioSession ends an
|
||||
* interruption event.
|
||||
*/
|
||||
- (void)audioSessionDidEndInterruption:(RTCAudioSession *)session
|
||||
shouldResumeSession:(BOOL)shouldResumeSession;
|
||||
|
||||
/** Called on a system notification thread when AVAudioSession changes the
|
||||
* route.
|
||||
*/
|
||||
- (void)audioSessionDidChangeRoute:(RTCAudioSession *)session
|
||||
reason:(AVAudioSessionRouteChangeReason)reason
|
||||
previousRoute:(AVAudioSessionRouteDescription *)previousRoute;
|
||||
|
||||
/** Called on a system notification thread when AVAudioSession media server
|
||||
* terminates.
|
||||
*/
|
||||
- (void)audioSessionMediaServerTerminated:(RTCAudioSession *)session;
|
||||
|
||||
/** Called on a system notification thread when AVAudioSession media server
|
||||
* restarts.
|
||||
*/
|
||||
- (void)audioSessionMediaServerReset:(RTCAudioSession *)session;
|
||||
|
||||
// TODO(tkchin): Maybe handle SilenceSecondaryAudioHintNotification.
|
||||
|
||||
- (void)audioSession:(RTCAudioSession *)session
|
||||
didChangeCanPlayOrRecord:(BOOL)canPlayOrRecord;
|
||||
|
||||
/** Called on a WebRTC thread when the audio device is notified to begin
|
||||
* playback or recording.
|
||||
*/
|
||||
- (void)audioSessionDidStartPlayOrRecord:(RTCAudioSession *)session;
|
||||
|
||||
/** Called on a WebRTC thread when the audio device is notified to stop
|
||||
* playback or recording.
|
||||
*/
|
||||
- (void)audioSessionDidStopPlayOrRecord:(RTCAudioSession *)session;
|
||||
|
||||
/** Called when the AVAudioSession output volume value changes. */
|
||||
- (void)audioSession:(RTCAudioSession *)audioSession
|
||||
didChangeOutputVolume:(float)outputVolume;
|
||||
|
||||
/** Called when the audio device detects a playout glitch. The argument is the
|
||||
* number of glitches detected so far in the current audio playout session.
|
||||
*/
|
||||
- (void)audioSession:(RTCAudioSession *)audioSession
|
||||
didDetectPlayoutGlitch:(int64_t)totalNumberOfGlitches;
|
||||
|
||||
/** Called when the audio session is about to change the active state.
|
||||
*/
|
||||
- (void)audioSession:(RTCAudioSession *)audioSession willSetActive:(BOOL)active;
|
||||
|
||||
/** Called after the audio session sucessfully changed the active state.
|
||||
*/
|
||||
- (void)audioSession:(RTCAudioSession *)audioSession didSetActive:(BOOL)active;
|
||||
|
||||
/** Called after the audio session failed to change the active state.
|
||||
*/
|
||||
- (void)audioSession:(RTCAudioSession *)audioSession
|
||||
failedToSetActive:(BOOL)active
|
||||
error:(NSError *)error;
|
||||
|
||||
@end
|
||||
|
||||
/** This is a protocol used to inform RTCAudioSession when the audio session
|
||||
* activation state has changed outside of RTCAudioSession. The current known use
|
||||
* case of this is when CallKit activates the audio session for the application
|
||||
*/
|
||||
RTC_EXPORT
|
||||
@protocol RTCAudioSessionActivationDelegate <NSObject>
|
||||
|
||||
/** Called when the audio session is activated outside of the app by iOS. */
|
||||
- (void)audioSessionDidActivate:(AVAudioSession *)session;
|
||||
|
||||
/** Called when the audio session is deactivated outside of the app by iOS. */
|
||||
- (void)audioSessionDidDeactivate:(AVAudioSession *)session;
|
||||
|
||||
@end
|
||||
|
||||
/** Proxy class for AVAudioSession that adds a locking mechanism similar to
|
||||
* AVCaptureDevice. This is used to that interleaving configurations between
|
||||
* WebRTC and the application layer are avoided.
|
||||
*
|
||||
* RTCAudioSession also coordinates activation so that the audio session is
|
||||
* activated only once. See |setActive:error:|.
|
||||
*/
|
||||
RTC_EXPORT
|
||||
@interface RTCAudioSession : NSObject <RTCAudioSessionActivationDelegate>
|
||||
|
||||
/** Convenience property to access the AVAudioSession singleton. Callers should
|
||||
* not call setters on AVAudioSession directly, but other method invocations
|
||||
* are fine.
|
||||
*/
|
||||
@property(nonatomic, readonly) AVAudioSession *session;
|
||||
|
||||
/** Our best guess at whether the session is active based on results of calls to
|
||||
* AVAudioSession.
|
||||
*/
|
||||
@property(nonatomic, readonly) BOOL isActive;
|
||||
/** Whether RTCAudioSession is currently locked for configuration. */
|
||||
@property(nonatomic, readonly) BOOL isLocked;
|
||||
|
||||
/** If YES, WebRTC will not initialize the audio unit automatically when an
|
||||
* audio track is ready for playout or recording. Instead, applications should
|
||||
* call setIsAudioEnabled. If NO, WebRTC will initialize the audio unit
|
||||
* as soon as an audio track is ready for playout or recording.
|
||||
*/
|
||||
@property(nonatomic, assign) BOOL useManualAudio;
|
||||
|
||||
/** This property is only effective if useManualAudio is YES.
|
||||
* Represents permission for WebRTC to initialize the VoIP audio unit.
|
||||
* When set to NO, if the VoIP audio unit used by WebRTC is active, it will be
|
||||
* stopped and uninitialized. This will stop incoming and outgoing audio.
|
||||
* When set to YES, WebRTC will initialize and start the audio unit when it is
|
||||
* needed (e.g. due to establishing an audio connection).
|
||||
* This property was introduced to work around an issue where if an AVPlayer is
|
||||
* playing audio while the VoIP audio unit is initialized, its audio would be
|
||||
* either cut off completely or played at a reduced volume. By preventing
|
||||
* the audio unit from being initialized until after the audio has completed,
|
||||
* we are able to prevent the abrupt cutoff.
|
||||
*/
|
||||
@property(nonatomic, assign) BOOL isAudioEnabled;
|
||||
|
||||
// Proxy properties.
|
||||
@property(readonly) NSString *category;
|
||||
@property(readonly) AVAudioSessionCategoryOptions categoryOptions;
|
||||
@property(readonly) NSString *mode;
|
||||
@property(readonly) BOOL secondaryAudioShouldBeSilencedHint;
|
||||
@property(readonly) AVAudioSessionRouteDescription *currentRoute;
|
||||
@property(readonly) NSInteger maximumInputNumberOfChannels;
|
||||
@property(readonly) NSInteger maximumOutputNumberOfChannels;
|
||||
@property(readonly) float inputGain;
|
||||
@property(readonly) BOOL inputGainSettable;
|
||||
@property(readonly) BOOL inputAvailable;
|
||||
@property(readonly, nullable)
|
||||
NSArray<AVAudioSessionDataSourceDescription *> * inputDataSources;
|
||||
@property(readonly, nullable)
|
||||
AVAudioSessionDataSourceDescription *inputDataSource;
|
||||
@property(readonly, nullable)
|
||||
NSArray<AVAudioSessionDataSourceDescription *> * outputDataSources;
|
||||
@property(readonly, nullable)
|
||||
AVAudioSessionDataSourceDescription *outputDataSource;
|
||||
@property(readonly) double sampleRate;
|
||||
@property(readonly) double preferredSampleRate;
|
||||
@property(readonly) NSInteger inputNumberOfChannels;
|
||||
@property(readonly) NSInteger outputNumberOfChannels;
|
||||
@property(readonly) float outputVolume;
|
||||
@property(readonly) NSTimeInterval inputLatency;
|
||||
@property(readonly) NSTimeInterval outputLatency;
|
||||
@property(readonly) NSTimeInterval IOBufferDuration;
|
||||
@property(readonly) NSTimeInterval preferredIOBufferDuration;
|
||||
|
||||
/** Default constructor. */
|
||||
+ (instancetype)sharedInstance;
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/** Adds a delegate, which is held weakly. */
|
||||
- (void)addDelegate:(id<RTCAudioSessionDelegate>)delegate;
|
||||
/** Removes an added delegate. */
|
||||
- (void)removeDelegate:(id<RTCAudioSessionDelegate>)delegate;
|
||||
|
||||
/** Request exclusive access to the audio session for configuration. This call
|
||||
* will block if the lock is held by another object.
|
||||
*/
|
||||
- (void)lockForConfiguration;
|
||||
/** Relinquishes exclusive access to the audio session. */
|
||||
- (void)unlockForConfiguration;
|
||||
|
||||
/** If |active|, activates the audio session if it isn't already active.
|
||||
* Successful calls must be balanced with a setActive:NO when activation is no
|
||||
* longer required. If not |active|, deactivates the audio session if one is
|
||||
* active and this is the last balanced call. When deactivating, the
|
||||
* AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation option is passed to
|
||||
* AVAudioSession.
|
||||
*/
|
||||
- (BOOL)setActive:(BOOL)active
|
||||
error:(NSError **)outError;
|
||||
|
||||
// The following methods are proxies for the associated methods on
|
||||
// AVAudioSession. |lockForConfiguration| must be called before using them
|
||||
// otherwise they will fail with kRTCAudioSessionErrorLockRequired.
|
||||
|
||||
- (BOOL)setCategory:(NSString *)category
|
||||
withOptions:(AVAudioSessionCategoryOptions)options
|
||||
error:(NSError **)outError;
|
||||
- (BOOL)setMode:(NSString *)mode error:(NSError **)outError;
|
||||
- (BOOL)setInputGain:(float)gain error:(NSError **)outError;
|
||||
- (BOOL)setPreferredSampleRate:(double)sampleRate error:(NSError **)outError;
|
||||
- (BOOL)setPreferredIOBufferDuration:(NSTimeInterval)duration
|
||||
error:(NSError **)outError;
|
||||
- (BOOL)setPreferredInputNumberOfChannels:(NSInteger)count
|
||||
error:(NSError **)outError;
|
||||
- (BOOL)setPreferredOutputNumberOfChannels:(NSInteger)count
|
||||
error:(NSError **)outError;
|
||||
- (BOOL)overrideOutputAudioPort:(AVAudioSessionPortOverride)portOverride
|
||||
error:(NSError **)outError;
|
||||
- (BOOL)setPreferredInput:(AVAudioSessionPortDescription *)inPort
|
||||
error:(NSError **)outError;
|
||||
- (BOOL)setInputDataSource:(AVAudioSessionDataSourceDescription *)dataSource
|
||||
error:(NSError **)outError;
|
||||
- (BOOL)setOutputDataSource:(AVAudioSessionDataSourceDescription *)dataSource
|
||||
error:(NSError **)outError;
|
||||
@end
|
||||
|
||||
@interface RTCAudioSession (Configuration)
|
||||
|
||||
/** Applies the configuration to the current session. Attempts to set all
|
||||
* properties even if previous ones fail. Only the last error will be
|
||||
* returned.
|
||||
* |lockForConfiguration| must be called first.
|
||||
*/
|
||||
- (BOOL)setConfiguration:(RTCAudioSessionConfiguration *)configuration
|
||||
error:(NSError **)outError;
|
||||
|
||||
/** Convenience method that calls both setConfiguration and setActive.
|
||||
* |lockForConfiguration| must be called first.
|
||||
*/
|
||||
- (BOOL)setConfiguration:(RTCAudioSessionConfiguration *)configuration
|
||||
active:(BOOL)active
|
||||
error:(NSError **)outError;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 The WebRTC Project Authors. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "WebRTC/RTCMacros.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
extern const int kRTCAudioSessionPreferredNumberOfChannels;
|
||||
extern const double kRTCAudioSessionHighPerformanceSampleRate;
|
||||
extern const double kRTCAudioSessionLowComplexitySampleRate;
|
||||
extern const double kRTCAudioSessionHighPerformanceIOBufferDuration;
|
||||
extern const double kRTCAudioSessionLowComplexityIOBufferDuration;
|
||||
|
||||
// Struct to hold configuration values.
|
||||
RTC_EXPORT
|
||||
@interface RTCAudioSessionConfiguration : NSObject
|
||||
|
||||
@property(nonatomic, strong) NSString *category;
|
||||
@property(nonatomic, assign) AVAudioSessionCategoryOptions categoryOptions;
|
||||
@property(nonatomic, strong) NSString *mode;
|
||||
@property(nonatomic, assign) double sampleRate;
|
||||
@property(nonatomic, assign) NSTimeInterval ioBufferDuration;
|
||||
@property(nonatomic, assign) NSInteger inputNumberOfChannels;
|
||||
@property(nonatomic, assign) NSInteger outputNumberOfChannels;
|
||||
|
||||
/** Initializes configuration to defaults. */
|
||||
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/** Returns the current configuration of the audio session. */
|
||||
+ (instancetype)currentConfiguration;
|
||||
/** Returns the configuration that WebRTC needs. */
|
||||
+ (instancetype)webRTCConfiguration;
|
||||
/** Provide a way to override the default configuration. */
|
||||
+ (void)setWebRTCConfiguration:(RTCAudioSessionConfiguration *)configuration;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
#import <WebRTC/RTCMediaSource.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCAudioSource : RTCMediaSource
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
// Sets the volume for the RTCMediaSource. |volume| is a gain value in the range
|
||||
// [0, 10].
|
||||
// Temporary fix to be able to modify volume of remote audio tracks.
|
||||
// TODO(kthelgason): Property stays here temporarily until a proper volume-api
|
||||
// is available on the surface exposed by webrtc.
|
||||
@property(nonatomic, assign) double volume;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
#import <WebRTC/RTCMediaStreamTrack.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class RTCAudioSource;
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCAudioTrack : RTCMediaStreamTrack
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/** The audio source for this audio track. */
|
||||
@property(nonatomic, readonly) RTCAudioSource *source;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright 2018 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCLogging.h>
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
// This class intercepts WebRTC logs and forwards them to a registered block.
|
||||
// This class is not threadsafe.
|
||||
RTC_EXPORT
|
||||
@interface RTCCallbackLogger : NSObject
|
||||
|
||||
// The severity level to capture. The default is kRTCLoggingSeverityInfo.
|
||||
@property(nonatomic, assign) RTCLoggingSeverity severity;
|
||||
|
||||
// The callback will be called on the same thread that does the logging, so
|
||||
// if the logging callback can be slow it may be a good idea to implement
|
||||
// dispatching to some other queue.
|
||||
- (void)start:(nullable void (^)(NSString*))callback;
|
||||
|
||||
- (void)stop;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC Project Authors. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
@class AVCaptureSession;
|
||||
|
||||
/** RTCCameraPreviewView is a view that renders local video from an
|
||||
* AVCaptureSession.
|
||||
*/
|
||||
RTC_EXPORT
|
||||
@interface RTCCameraPreviewView : UIView
|
||||
|
||||
/** The capture session being rendered in the view. Capture session
|
||||
* is assigned to AVCaptureVideoPreviewLayer async in the same
|
||||
* queue that the AVCaptureSession is started/stopped.
|
||||
*/
|
||||
@property(nonatomic, strong) AVCaptureSession *captureSession;
|
||||
|
||||
@end
|
||||
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
#import <WebRTC/RTCVideoCapturer.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
RTC_EXPORT
|
||||
// Camera capture that implements RTCVideoCapturer. Delivers frames to a RTCVideoCapturerDelegate
|
||||
// (usually RTCVideoSource).
|
||||
@interface RTCCameraVideoCapturer : RTCVideoCapturer
|
||||
|
||||
// Capture session that is used for capturing. Valid from initialization to dealloc.
|
||||
@property(readonly, nonatomic) AVCaptureSession *captureSession;
|
||||
|
||||
// Returns list of available capture devices that support video capture.
|
||||
+ (NSArray<AVCaptureDevice *> *)captureDevices;
|
||||
// Returns list of formats that are supported by this class for this device.
|
||||
+ (NSArray<AVCaptureDeviceFormat *> *)supportedFormatsForDevice:(AVCaptureDevice *)device;
|
||||
|
||||
// Returns the most efficient supported output pixel format for this capturer.
|
||||
- (FourCharCode)preferredOutputPixelFormat;
|
||||
|
||||
// Starts the capture session asynchronously and notifies callback on completion.
|
||||
// The device will capture video in the format given in the `format` parameter. If the pixel format
|
||||
// in `format` is supported by the WebRTC pipeline, the same pixel format will be used for the
|
||||
// output. Otherwise, the format returned by `preferredOutputPixelFormat` will be used.
|
||||
- (void)startCaptureWithDevice:(AVCaptureDevice *)device
|
||||
format:(AVCaptureDeviceFormat *)format
|
||||
fps:(NSInteger)fps
|
||||
completionHandler:(nullable void (^)(NSError *))completionHandler;
|
||||
// Stops the capture session asynchronously and notifies callback on completion.
|
||||
- (void)stopCaptureWithCompletionHandler:(nullable void (^)(void))completionHandler;
|
||||
|
||||
// Starts the capture session asynchronously.
|
||||
- (void)startCaptureWithDevice:(AVCaptureDevice *)device
|
||||
format:(AVCaptureDeviceFormat *)format
|
||||
fps:(NSInteger)fps;
|
||||
// Stops the capture session asynchronously.
|
||||
- (void)stopCapture;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,169 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
@class RTCIceServer;
|
||||
@class RTCIntervalRange;
|
||||
|
||||
/**
|
||||
* Represents the ice transport policy. This exposes the same states in C++,
|
||||
* which include one more state than what exists in the W3C spec.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, RTCIceTransportPolicy) {
|
||||
RTCIceTransportPolicyNone,
|
||||
RTCIceTransportPolicyRelay,
|
||||
RTCIceTransportPolicyNoHost,
|
||||
RTCIceTransportPolicyAll
|
||||
};
|
||||
|
||||
/** Represents the bundle policy. */
|
||||
typedef NS_ENUM(NSInteger, RTCBundlePolicy) {
|
||||
RTCBundlePolicyBalanced,
|
||||
RTCBundlePolicyMaxCompat,
|
||||
RTCBundlePolicyMaxBundle
|
||||
};
|
||||
|
||||
/** Represents the rtcp mux policy. */
|
||||
typedef NS_ENUM(NSInteger, RTCRtcpMuxPolicy) {
|
||||
RTCRtcpMuxPolicyNegotiate,
|
||||
RTCRtcpMuxPolicyRequire
|
||||
};
|
||||
|
||||
/** Represents the tcp candidate policy. */
|
||||
typedef NS_ENUM(NSInteger, RTCTcpCandidatePolicy) {
|
||||
RTCTcpCandidatePolicyEnabled,
|
||||
RTCTcpCandidatePolicyDisabled
|
||||
};
|
||||
|
||||
/** Represents the candidate network policy. */
|
||||
typedef NS_ENUM(NSInteger, RTCCandidateNetworkPolicy) {
|
||||
RTCCandidateNetworkPolicyAll,
|
||||
RTCCandidateNetworkPolicyLowCost
|
||||
};
|
||||
|
||||
/** Represents the continual gathering policy. */
|
||||
typedef NS_ENUM(NSInteger, RTCContinualGatheringPolicy) {
|
||||
RTCContinualGatheringPolicyGatherOnce,
|
||||
RTCContinualGatheringPolicyGatherContinually
|
||||
};
|
||||
|
||||
/** Represents the encryption key type. */
|
||||
typedef NS_ENUM(NSInteger, RTCEncryptionKeyType) {
|
||||
RTCEncryptionKeyTypeRSA,
|
||||
RTCEncryptionKeyTypeECDSA,
|
||||
};
|
||||
|
||||
/** Represents the chosen SDP semantics for the RTCPeerConnection. */
|
||||
typedef NS_ENUM(NSInteger, RTCSdpSemantics) {
|
||||
RTCSdpSemanticsPlanB,
|
||||
RTCSdpSemanticsUnifiedPlan,
|
||||
};
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCConfiguration : NSObject
|
||||
|
||||
/** An array of Ice Servers available to be used by ICE. */
|
||||
@property(nonatomic, copy) NSArray<RTCIceServer *> *iceServers;
|
||||
|
||||
/** Which candidates the ICE agent is allowed to use. The W3C calls it
|
||||
* |iceTransportPolicy|, while in C++ it is called |type|. */
|
||||
@property(nonatomic, assign) RTCIceTransportPolicy iceTransportPolicy;
|
||||
|
||||
/** The media-bundling policy to use when gathering ICE candidates. */
|
||||
@property(nonatomic, assign) RTCBundlePolicy bundlePolicy;
|
||||
|
||||
/** The rtcp-mux policy to use when gathering ICE candidates. */
|
||||
@property(nonatomic, assign) RTCRtcpMuxPolicy rtcpMuxPolicy;
|
||||
@property(nonatomic, assign) RTCTcpCandidatePolicy tcpCandidatePolicy;
|
||||
@property(nonatomic, assign) RTCCandidateNetworkPolicy candidateNetworkPolicy;
|
||||
@property(nonatomic, assign)
|
||||
RTCContinualGatheringPolicy continualGatheringPolicy;
|
||||
|
||||
/** By default, the PeerConnection will use a limited number of IPv6 network
|
||||
* interfaces, in order to avoid too many ICE candidate pairs being created
|
||||
* and delaying ICE completion.
|
||||
*
|
||||
* Can be set to INT_MAX to effectively disable the limit.
|
||||
*/
|
||||
@property(nonatomic, assign) int maxIPv6Networks;
|
||||
|
||||
/** Exclude link-local network interfaces
|
||||
* from considertaion for gathering ICE candidates.
|
||||
* Defaults to NO.
|
||||
*/
|
||||
@property(nonatomic, assign) BOOL disableLinkLocalNetworks;
|
||||
|
||||
@property(nonatomic, assign) int audioJitterBufferMaxPackets;
|
||||
@property(nonatomic, assign) BOOL audioJitterBufferFastAccelerate;
|
||||
@property(nonatomic, assign) int iceConnectionReceivingTimeout;
|
||||
@property(nonatomic, assign) int iceBackupCandidatePairPingInterval;
|
||||
|
||||
/** Key type used to generate SSL identity. Default is ECDSA. */
|
||||
@property(nonatomic, assign) RTCEncryptionKeyType keyType;
|
||||
|
||||
/** ICE candidate pool size as defined in JSEP. Default is 0. */
|
||||
@property(nonatomic, assign) int iceCandidatePoolSize;
|
||||
|
||||
/** Prune turn ports on the same network to the same turn server.
|
||||
* Default is NO.
|
||||
*/
|
||||
@property(nonatomic, assign) BOOL shouldPruneTurnPorts;
|
||||
|
||||
/** If set to YES, this means the ICE transport should presume TURN-to-TURN
|
||||
* candidate pairs will succeed, even before a binding response is received.
|
||||
*/
|
||||
@property(nonatomic, assign) BOOL shouldPresumeWritableWhenFullyRelayed;
|
||||
|
||||
/** If set to non-nil, controls the minimal interval between consecutive ICE
|
||||
* check packets.
|
||||
*/
|
||||
@property(nonatomic, copy, nullable) NSNumber *iceCheckMinInterval;
|
||||
|
||||
/** ICE Periodic Regathering
|
||||
* If set, WebRTC will periodically create and propose candidates without
|
||||
* starting a new ICE generation. The regathering happens continuously with
|
||||
* interval specified in milliseconds by the uniform distribution [a, b].
|
||||
*/
|
||||
@property(nonatomic, strong, nullable) RTCIntervalRange *iceRegatherIntervalRange;
|
||||
|
||||
/** Configure the SDP semantics used by this PeerConnection. Note that the
|
||||
* WebRTC 1.0 specification requires UnifiedPlan semantics. The
|
||||
* RTCRtpTransceiver API is only available with UnifiedPlan semantics.
|
||||
*
|
||||
* PlanB will cause RTCPeerConnection to create offers and answers with at
|
||||
* most one audio and one video m= section with multiple RTCRtpSenders and
|
||||
* RTCRtpReceivers specified as multiple a=ssrc lines within the section. This
|
||||
* will also cause RTCPeerConnection to ignore all but the first m= section of
|
||||
* the same media type.
|
||||
*
|
||||
* UnifiedPlan will cause RTCPeerConnection to create offers and answers with
|
||||
* multiple m= sections where each m= section maps to one RTCRtpSender and one
|
||||
* RTCRtpReceiver (an RTCRtpTransceiver), either both audio or both video. This
|
||||
* will also cause RTCPeerConnection to ignore all but the first a=ssrc lines
|
||||
* that form a Plan B stream.
|
||||
*
|
||||
* For users who wish to send multiple audio/video streams and need to stay
|
||||
* interoperable with legacy WebRTC implementations or use legacy APIs,
|
||||
* specify PlanB.
|
||||
*
|
||||
* For all other users, specify UnifiedPlan.
|
||||
*/
|
||||
@property(nonatomic, assign) RTCSdpSemantics sdpSemantics;
|
||||
|
||||
- (instancetype)init;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,134 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <AvailabilityMacros.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCDataBuffer : NSObject
|
||||
|
||||
/** NSData representation of the underlying buffer. */
|
||||
@property(nonatomic, readonly) NSData *data;
|
||||
|
||||
/** Indicates whether |data| contains UTF-8 or binary data. */
|
||||
@property(nonatomic, readonly) BOOL isBinary;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Initialize an RTCDataBuffer from NSData. |isBinary| indicates whether |data|
|
||||
* contains UTF-8 or binary data.
|
||||
*/
|
||||
- (instancetype)initWithData:(NSData *)data isBinary:(BOOL)isBinary;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@class RTCDataChannel;
|
||||
RTC_EXPORT
|
||||
@protocol RTCDataChannelDelegate <NSObject>
|
||||
|
||||
/** The data channel state changed. */
|
||||
- (void)dataChannelDidChangeState:(RTCDataChannel *)dataChannel;
|
||||
|
||||
/** The data channel successfully received a data buffer. */
|
||||
- (void)dataChannel:(RTCDataChannel *)dataChannel
|
||||
didReceiveMessageWithBuffer:(RTCDataBuffer *)buffer;
|
||||
|
||||
@optional
|
||||
/** The data channel's |bufferedAmount| changed. */
|
||||
- (void)dataChannel:(RTCDataChannel *)dataChannel
|
||||
didChangeBufferedAmount:(uint64_t)amount;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
/** Represents the state of the data channel. */
|
||||
typedef NS_ENUM(NSInteger, RTCDataChannelState) {
|
||||
RTCDataChannelStateConnecting,
|
||||
RTCDataChannelStateOpen,
|
||||
RTCDataChannelStateClosing,
|
||||
RTCDataChannelStateClosed,
|
||||
};
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCDataChannel : NSObject
|
||||
|
||||
/**
|
||||
* A label that can be used to distinguish this data channel from other data
|
||||
* channel objects.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSString *label;
|
||||
|
||||
/** Whether the data channel can send messages in unreliable mode. */
|
||||
@property(nonatomic, readonly) BOOL isReliable DEPRECATED_ATTRIBUTE;
|
||||
|
||||
/** Returns whether this data channel is ordered or not. */
|
||||
@property(nonatomic, readonly) BOOL isOrdered;
|
||||
|
||||
/** Deprecated. Use maxPacketLifeTime. */
|
||||
@property(nonatomic, readonly) NSUInteger maxRetransmitTime
|
||||
DEPRECATED_ATTRIBUTE;
|
||||
|
||||
/**
|
||||
* The length of the time window (in milliseconds) during which transmissions
|
||||
* and retransmissions may occur in unreliable mode.
|
||||
*/
|
||||
@property(nonatomic, readonly) uint16_t maxPacketLifeTime;
|
||||
|
||||
/**
|
||||
* The maximum number of retransmissions that are attempted in unreliable mode.
|
||||
*/
|
||||
@property(nonatomic, readonly) uint16_t maxRetransmits;
|
||||
|
||||
/**
|
||||
* The name of the sub-protocol used with this data channel, if any. Otherwise
|
||||
* this returns an empty string.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSString *protocol;
|
||||
|
||||
/**
|
||||
* Returns whether this data channel was negotiated by the application or not.
|
||||
*/
|
||||
@property(nonatomic, readonly) BOOL isNegotiated;
|
||||
|
||||
/** Deprecated. Use channelId. */
|
||||
@property(nonatomic, readonly) NSInteger streamId DEPRECATED_ATTRIBUTE;
|
||||
|
||||
/** The identifier for this data channel. */
|
||||
@property(nonatomic, readonly) int channelId;
|
||||
|
||||
/** The state of the data channel. */
|
||||
@property(nonatomic, readonly) RTCDataChannelState readyState;
|
||||
|
||||
/**
|
||||
* The number of bytes of application data that have been queued using
|
||||
* |sendData:| but that have not yet been transmitted to the network.
|
||||
*/
|
||||
@property(nonatomic, readonly) uint64_t bufferedAmount;
|
||||
|
||||
/** The delegate for this data channel. */
|
||||
@property(nonatomic, weak) id<RTCDataChannelDelegate> delegate;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/** Closes the data channel. */
|
||||
- (void)close;
|
||||
|
||||
/** Attempt to send |data| on this data channel's underlying data transport. */
|
||||
- (BOOL)sendData:(RTCDataBuffer *)data;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <AvailabilityMacros.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCDataChannelConfiguration : NSObject
|
||||
|
||||
/** Set to YES if ordered delivery is required. */
|
||||
@property(nonatomic, assign) BOOL isOrdered;
|
||||
|
||||
/** Deprecated. Use maxPacketLifeTime. */
|
||||
@property(nonatomic, assign) NSInteger maxRetransmitTimeMs DEPRECATED_ATTRIBUTE;
|
||||
|
||||
/**
|
||||
* Max period in milliseconds in which retransmissions will be sent. After this
|
||||
* time, no more retransmissions will be sent. -1 if unset.
|
||||
*/
|
||||
@property(nonatomic, assign) int maxPacketLifeTime;
|
||||
|
||||
/** The max number of retransmissions. -1 if unset. */
|
||||
@property(nonatomic, assign) int maxRetransmits;
|
||||
|
||||
/** Set to YES if the channel has been externally negotiated and we do not send
|
||||
* an in-band signalling in the form of an "open" message.
|
||||
*/
|
||||
@property(nonatomic, assign) BOOL isNegotiated;
|
||||
|
||||
/** Deprecated. Use channelId. */
|
||||
@property(nonatomic, assign) int streamId DEPRECATED_ATTRIBUTE;
|
||||
|
||||
/** The id of the data channel. */
|
||||
@property(nonatomic, assign) int channelId;
|
||||
|
||||
/** Set by the application and opaque to the WebRTC implementation. */
|
||||
@property(nonatomic) NSString *protocol;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
typedef NS_ENUM(NSInteger, RTCDispatcherQueueType) {
|
||||
// Main dispatcher queue.
|
||||
RTCDispatcherTypeMain,
|
||||
// Used for starting/stopping AVCaptureSession, and assigning
|
||||
// capture session to AVCaptureVideoPreviewLayer.
|
||||
RTCDispatcherTypeCaptureSession,
|
||||
// Used for operations on AVAudioSession.
|
||||
RTCDispatcherTypeAudioSession,
|
||||
};
|
||||
|
||||
/** Dispatcher that asynchronously dispatches blocks to a specific
|
||||
* shared dispatch queue.
|
||||
*/
|
||||
RTC_EXPORT
|
||||
@interface RTCDispatcher : NSObject
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/** Dispatch the block asynchronously on the queue for dispatchType.
|
||||
* @param dispatchType The queue type to dispatch on.
|
||||
* @param block The block to dispatch asynchronously.
|
||||
*/
|
||||
+ (void)dispatchAsyncOnType:(RTCDispatcherQueueType)dispatchType
|
||||
block:(dispatch_block_t)block;
|
||||
|
||||
/** Returns YES if run on queue for the dispatchType otherwise NO.
|
||||
* Useful for asserting that a method is run on a correct queue.
|
||||
*/
|
||||
+ (BOOL)isOnQueueForType:(RTCDispatcherQueueType)dispatchType;
|
||||
|
||||
@end
|
||||
@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
RTC_EXPORT
|
||||
@protocol RTCDtmfSender <NSObject>
|
||||
|
||||
/**
|
||||
* Returns true if this RTCDtmfSender is capable of sending DTMF. Otherwise
|
||||
* returns false. To be able to send DTMF, the associated RTCRtpSender must be
|
||||
* able to send packets, and a "telephone-event" codec must be negotiated.
|
||||
*/
|
||||
@property(nonatomic, readonly) BOOL canInsertDtmf;
|
||||
|
||||
/**
|
||||
* Queues a task that sends the DTMF tones. The tones parameter is treated
|
||||
* as a series of characters. The characters 0 through 9, A through D, #, and *
|
||||
* generate the associated DTMF tones. The characters a to d are equivalent
|
||||
* to A to D. The character ',' indicates a delay of 2 seconds before
|
||||
* processing the next character in the tones parameter.
|
||||
*
|
||||
* Unrecognized characters are ignored.
|
||||
*
|
||||
* @param duration The parameter indicates the duration to use for each
|
||||
* character passed in the tones parameter. The duration cannot be more
|
||||
* than 6000 or less than 70 ms.
|
||||
*
|
||||
* @param interToneGap The parameter indicates the gap between tones.
|
||||
* This parameter must be at least 50 ms but should be as short as
|
||||
* possible.
|
||||
*
|
||||
* If InsertDtmf is called on the same object while an existing task for this
|
||||
* object to generate DTMF is still running, the previous task is canceled.
|
||||
* Returns true on success and false on failure.
|
||||
*/
|
||||
- (BOOL)insertDtmf:(nonnull NSString *)tones
|
||||
duration:(NSTimeInterval)duration
|
||||
interToneGap:(NSTimeInterval)interToneGap;
|
||||
|
||||
/** The tones remaining to be played out */
|
||||
- (nonnull NSString *)remainingTones;
|
||||
|
||||
/**
|
||||
* The current tone duration value. This value will be the value last set via the
|
||||
* insertDtmf method, or the default value of 100 ms if insertDtmf was never called.
|
||||
*/
|
||||
- (NSTimeInterval)duration;
|
||||
|
||||
/**
|
||||
* The current value of the between-tone gap. This value will be the value last set
|
||||
* via the insertDtmf() method, or the default value of 50 ms if insertDtmf() was never
|
||||
* called.
|
||||
*/
|
||||
- (NSTimeInterval)interToneGap;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
#import <WebRTC/RTCVideoRenderer.h>
|
||||
#import <WebRTC/RTCVideoViewShading.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class RTCEAGLVideoView;
|
||||
|
||||
RTC_EXPORT
|
||||
@protocol RTCEAGLVideoViewDelegate<RTCVideoViewDelegate>
|
||||
@end
|
||||
|
||||
/**
|
||||
* RTCEAGLVideoView is an RTCVideoRenderer which renders video frames in its
|
||||
* bounds using OpenGLES 2.0 or OpenGLES 3.0.
|
||||
*/
|
||||
RTC_EXPORT
|
||||
@interface RTCEAGLVideoView : UIView <RTCVideoRenderer>
|
||||
|
||||
@property(nonatomic, weak) id<RTCVideoViewDelegate> delegate;
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
shader:(id<RTCVideoViewShading>)shader NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)aDecoder
|
||||
shader:(id<RTCVideoViewShading>)shader NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 The WebRTC Project Authors. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
/** The only valid value for the following if set is kRTCFieldTrialEnabledValue. */
|
||||
RTC_EXTERN NSString * const kRTCFieldTrialAudioSendSideBweKey;
|
||||
RTC_EXTERN NSString * const kRTCFieldTrialAudioSendSideBweForVideoKey;
|
||||
RTC_EXTERN NSString * const kRTCFieldTrialSendSideBweWithOverheadKey;
|
||||
RTC_EXTERN NSString * const kRTCFieldTrialFlexFec03AdvertisedKey;
|
||||
RTC_EXTERN NSString * const kRTCFieldTrialFlexFec03Key;
|
||||
RTC_EXTERN NSString * const kRTCFieldTrialImprovedBitrateEstimateKey;
|
||||
RTC_EXTERN NSString * const kRTCFieldTrialH264HighProfileKey;
|
||||
RTC_EXTERN NSString * const kRTCFieldTrialMinimizeResamplingOnMobileKey;
|
||||
|
||||
/** The valid value for field trials above. */
|
||||
RTC_EXTERN NSString * const kRTCFieldTrialEnabledValue;
|
||||
|
||||
/** Use a string returned by RTCFieldTrialMedianSlopeFilterValue as the value. */
|
||||
RTC_EXTERN NSString * const kRTCFieldTrialMedianSlopeFilterKey;
|
||||
RTC_EXTERN NSString *RTCFieldTrialMedianSlopeFilterValue(
|
||||
size_t windowSize, double thresholdGain);
|
||||
|
||||
/** Use a string returned by RTCFieldTrialTrendlineFilterValue as the value. */
|
||||
RTC_EXTERN NSString * const kRTCFieldTrialTrendlineFilterKey;
|
||||
/** Returns a valid value for kRTCFieldTrialTrendlineFilterKey. */
|
||||
RTC_EXTERN NSString *RTCFieldTrialTrendlineFilterValue(
|
||||
size_t windowSize, double smoothingCoeff, double thresholdGain);
|
||||
|
||||
/** Initialize field trials using a dictionary mapping field trial keys to their values. See above
|
||||
* for valid keys and values.
|
||||
* Must be called before any other call into WebRTC. See:
|
||||
* webrtc/system_wrappers/include/field_trial_default.h
|
||||
*/
|
||||
RTC_EXTERN void RTCInitFieldTrialDictionary(NSDictionary<NSString *, NSString *> *fieldTrials);
|
||||
@ -1,77 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
typedef NS_ENUM(NSUInteger, RTCFileLoggerSeverity) {
|
||||
RTCFileLoggerSeverityVerbose,
|
||||
RTCFileLoggerSeverityInfo,
|
||||
RTCFileLoggerSeverityWarning,
|
||||
RTCFileLoggerSeverityError
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, RTCFileLoggerRotationType) {
|
||||
RTCFileLoggerTypeCall,
|
||||
RTCFileLoggerTypeApp,
|
||||
};
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
// This class intercepts WebRTC logs and saves them to a file. The file size
|
||||
// will not exceed the given maximum bytesize. When the maximum bytesize is
|
||||
// reached, logs are rotated according to the rotationType specified.
|
||||
// For kRTCFileLoggerTypeCall, logs from the beginning and the end
|
||||
// are preserved while the middle section is overwritten instead.
|
||||
// For kRTCFileLoggerTypeApp, the oldest log is overwritten.
|
||||
// This class is not threadsafe.
|
||||
RTC_EXPORT
|
||||
@interface RTCFileLogger : NSObject
|
||||
|
||||
// The severity level to capture. The default is kRTCFileLoggerSeverityInfo.
|
||||
@property(nonatomic, assign) RTCFileLoggerSeverity severity;
|
||||
|
||||
// The rotation type for this file logger. The default is
|
||||
// kRTCFileLoggerTypeCall.
|
||||
@property(nonatomic, readonly) RTCFileLoggerRotationType rotationType;
|
||||
|
||||
// Disables buffering disk writes. Should be set before |start|. Buffering
|
||||
// is enabled by default for performance.
|
||||
@property(nonatomic, assign) BOOL shouldDisableBuffering;
|
||||
|
||||
// Default constructor provides default settings for dir path, file size and
|
||||
// rotation type.
|
||||
- (instancetype)init;
|
||||
|
||||
// Create file logger with default rotation type.
|
||||
- (instancetype)initWithDirPath:(NSString *)dirPath
|
||||
maxFileSize:(NSUInteger)maxFileSize;
|
||||
|
||||
- (instancetype)initWithDirPath:(NSString *)dirPath
|
||||
maxFileSize:(NSUInteger)maxFileSize
|
||||
rotationType:(RTCFileLoggerRotationType)rotationType
|
||||
NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
// Starts writing WebRTC logs to disk if not already started. Overwrites any
|
||||
// existing file(s).
|
||||
- (void)start;
|
||||
|
||||
// Stops writing WebRTC logs to disk. This method is also called on dealloc.
|
||||
- (void)stop;
|
||||
|
||||
// Returns the current contents of the logs, or nil if start has been called
|
||||
// without a stop.
|
||||
- (nullable NSData *)logData;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 The WebRTC Project Authors. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <WebRTC/RTCVideoCapturer.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Error passing block.
|
||||
*/
|
||||
typedef void (^RTCFileVideoCapturerErrorBlock)(NSError *error);
|
||||
|
||||
/**
|
||||
* Captures buffers from bundled video file.
|
||||
*
|
||||
* See @c RTCVideoCapturer for more info on capturers.
|
||||
*/
|
||||
RTC_EXPORT
|
||||
|
||||
NS_CLASS_AVAILABLE_IOS(10)
|
||||
@interface RTCFileVideoCapturer : RTCVideoCapturer
|
||||
|
||||
/**
|
||||
* Starts asynchronous capture of frames from video file.
|
||||
*
|
||||
* Capturing is not started if error occurs. Underlying error will be
|
||||
* relayed in the errorBlock if one is provided.
|
||||
* Successfully captured video frames will be passed to the delegate.
|
||||
*
|
||||
* @param nameOfFile The name of the bundled video file to be read.
|
||||
* @errorBlock block to be executed upon error.
|
||||
*/
|
||||
- (void)startCapturingFromFileNamed:(NSString *)nameOfFile
|
||||
onError:(__nullable RTCFileVideoCapturerErrorBlock)errorBlock;
|
||||
|
||||
/**
|
||||
* Immediately stops capture.
|
||||
*/
|
||||
- (void)stopCapture;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCIceCandidate : NSObject
|
||||
|
||||
/**
|
||||
* If present, the identifier of the "media stream identification" for the media
|
||||
* component this candidate is associated with.
|
||||
*/
|
||||
@property(nonatomic, readonly, nullable) NSString *sdpMid;
|
||||
|
||||
/**
|
||||
* The index (starting at zero) of the media description this candidate is
|
||||
* associated with in the SDP.
|
||||
*/
|
||||
@property(nonatomic, readonly) int sdpMLineIndex;
|
||||
|
||||
/** The SDP string for this candidate. */
|
||||
@property(nonatomic, readonly) NSString *sdp;
|
||||
|
||||
/** The URL of the ICE server which this candidate is gathered from. */
|
||||
@property(nonatomic, readonly, nullable) NSString *serverUrl;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Initialize an RTCIceCandidate from SDP.
|
||||
*/
|
||||
- (instancetype)initWithSdp:(NSString *)sdp
|
||||
sdpMLineIndex:(int)sdpMLineIndex
|
||||
sdpMid:(nullable NSString *)sdpMid
|
||||
NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,114 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
typedef NS_ENUM(NSUInteger, RTCTlsCertPolicy) {
|
||||
RTCTlsCertPolicySecure,
|
||||
RTCTlsCertPolicyInsecureNoCheck
|
||||
};
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCIceServer : NSObject
|
||||
|
||||
/** URI(s) for this server represented as NSStrings. */
|
||||
@property(nonatomic, readonly) NSArray<NSString *> *urlStrings;
|
||||
|
||||
/** Username to use if this RTCIceServer object is a TURN server. */
|
||||
@property(nonatomic, readonly, nullable) NSString *username;
|
||||
|
||||
/** Credential to use if this RTCIceServer object is a TURN server. */
|
||||
@property(nonatomic, readonly, nullable) NSString *credential;
|
||||
|
||||
/**
|
||||
* TLS certificate policy to use if this RTCIceServer object is a TURN server.
|
||||
*/
|
||||
@property(nonatomic, readonly) RTCTlsCertPolicy tlsCertPolicy;
|
||||
|
||||
/**
|
||||
If the URIs in |urls| only contain IP addresses, this field can be used
|
||||
to indicate the hostname, which may be necessary for TLS (using the SNI
|
||||
extension). If |urls| itself contains the hostname, this isn't necessary.
|
||||
*/
|
||||
@property(nonatomic, readonly, nullable) NSString *hostname;
|
||||
|
||||
/** List of protocols to be used in the TLS ALPN extension. */
|
||||
@property(nonatomic, readonly) NSArray<NSString *> *tlsAlpnProtocols;
|
||||
|
||||
/**
|
||||
List elliptic curves to be used in the TLS elliptic curves extension.
|
||||
Only curve names supported by OpenSSL should be used (eg. "P-256","X25519").
|
||||
*/
|
||||
@property(nonatomic, readonly) NSArray<NSString *> *tlsEllipticCurves;
|
||||
|
||||
- (nonnull instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/** Convenience initializer for a server with no authentication (e.g. STUN). */
|
||||
- (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings;
|
||||
|
||||
/**
|
||||
* Initialize an RTCIceServer with its associated URLs, optional username,
|
||||
* optional credential, and credentialType.
|
||||
*/
|
||||
- (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
|
||||
username:(nullable NSString *)username
|
||||
credential:(nullable NSString *)credential;
|
||||
|
||||
/**
|
||||
* Initialize an RTCIceServer with its associated URLs, optional username,
|
||||
* optional credential, and TLS cert policy.
|
||||
*/
|
||||
- (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
|
||||
username:(nullable NSString *)username
|
||||
credential:(nullable NSString *)credential
|
||||
tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy;
|
||||
|
||||
/**
|
||||
* Initialize an RTCIceServer with its associated URLs, optional username,
|
||||
* optional credential, TLS cert policy and hostname.
|
||||
*/
|
||||
- (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
|
||||
username:(nullable NSString *)username
|
||||
credential:(nullable NSString *)credential
|
||||
tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy
|
||||
hostname:(nullable NSString *)hostname;
|
||||
|
||||
/**
|
||||
* Initialize an RTCIceServer with its associated URLs, optional username,
|
||||
* optional credential, TLS cert policy, hostname and ALPN protocols.
|
||||
*/
|
||||
- (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
|
||||
username:(nullable NSString *)username
|
||||
credential:(nullable NSString *)credential
|
||||
tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy
|
||||
hostname:(nullable NSString *)hostname
|
||||
tlsAlpnProtocols:(NSArray<NSString *> *)tlsAlpnProtocols;
|
||||
|
||||
/**
|
||||
* Initialize an RTCIceServer with its associated URLs, optional username,
|
||||
* optional credential, TLS cert policy, hostname, ALPN protocols and
|
||||
* elliptic curves.
|
||||
*/
|
||||
- (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
|
||||
username:(nullable NSString *)username
|
||||
credential:(nullable NSString *)credential
|
||||
tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy
|
||||
hostname:(nullable NSString *)hostname
|
||||
tlsAlpnProtocols:(nullable NSArray<NSString *> *)tlsAlpnProtocols
|
||||
tlsEllipticCurves:(nullable NSArray<NSString *> *)tlsEllipticCurves
|
||||
NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface RTCIntervalRange : NSObject
|
||||
|
||||
@property(nonatomic, readonly) NSInteger min;
|
||||
@property(nonatomic, readonly) NSInteger max;
|
||||
|
||||
- (instancetype)init;
|
||||
- (instancetype)initWithMin:(NSInteger)min
|
||||
max:(NSInteger)max
|
||||
NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/** This does not currently conform to the spec. */
|
||||
RTC_EXPORT
|
||||
@interface RTCLegacyStatsReport : NSObject
|
||||
|
||||
/** Time since 1970-01-01T00:00:00Z in milliseconds. */
|
||||
@property(nonatomic, readonly) CFTimeInterval timestamp;
|
||||
|
||||
/** The type of stats held by this object. */
|
||||
@property(nonatomic, readonly) NSString *type;
|
||||
|
||||
/** The identifier for this object. */
|
||||
@property(nonatomic, readonly) NSString *reportId;
|
||||
|
||||
/** A dictionary holding the actual stats. */
|
||||
@property(nonatomic, readonly) NSDictionary<NSString *, NSString *> *values;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
// Subset of rtc::LoggingSeverity.
|
||||
typedef NS_ENUM(NSInteger, RTCLoggingSeverity) {
|
||||
RTCLoggingSeverityVerbose,
|
||||
RTCLoggingSeverityInfo,
|
||||
RTCLoggingSeverityWarning,
|
||||
RTCLoggingSeverityError,
|
||||
};
|
||||
|
||||
// Wrapper for C++ RTC_LOG(sev) macros.
|
||||
// Logs the log string to the webrtc logstream for the given severity.
|
||||
RTC_EXTERN void RTCLogEx(RTCLoggingSeverity severity, NSString* log_string);
|
||||
|
||||
// Wrapper for rtc::LogMessage::LogToDebug.
|
||||
// Sets the minimum severity to be logged to console.
|
||||
RTC_EXTERN void RTCSetMinDebugLogLevel(RTCLoggingSeverity severity);
|
||||
|
||||
// Returns the filename with the path prefix removed.
|
||||
RTC_EXTERN NSString* RTCFileName(const char* filePath);
|
||||
|
||||
// Some convenience macros.
|
||||
|
||||
#define RTCLogString(format, ...) \
|
||||
[NSString stringWithFormat:@"(%@:%d %s): " format, \
|
||||
RTCFileName(__FILE__), \
|
||||
__LINE__, \
|
||||
__FUNCTION__, \
|
||||
##__VA_ARGS__]
|
||||
|
||||
#define RTCLogFormat(severity, format, ...) \
|
||||
do { \
|
||||
NSString* log_string = RTCLogString(format, ##__VA_ARGS__); \
|
||||
RTCLogEx(severity, log_string); \
|
||||
} while (false)
|
||||
|
||||
#define RTCLogVerbose(format, ...) \
|
||||
RTCLogFormat(RTCLoggingSeverityVerbose, format, ##__VA_ARGS__) \
|
||||
|
||||
#define RTCLogInfo(format, ...) \
|
||||
RTCLogFormat(RTCLoggingSeverityInfo, format, ##__VA_ARGS__) \
|
||||
|
||||
#define RTCLogWarning(format, ...) \
|
||||
RTCLogFormat(RTCLoggingSeverityWarning, format, ##__VA_ARGS__) \
|
||||
|
||||
#define RTCLogError(format, ...) \
|
||||
RTCLogFormat(RTCLoggingSeverityError, format, ##__VA_ARGS__) \
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
#define RTCLogDebug(format, ...) RTCLogInfo(format, ##__VA_ARGS__)
|
||||
#else
|
||||
#define RTCLogDebug(format, ...) \
|
||||
do { \
|
||||
} while (false)
|
||||
#endif
|
||||
|
||||
#define RTCLog(format, ...) RTCLogInfo(format, ##__VA_ARGS__)
|
||||
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "WebRTC/RTCVideoRenderer.h"
|
||||
|
||||
// Check if metal is supported in WebRTC.
|
||||
// NOTE: Currently arm64 == Metal.
|
||||
#if defined(__aarch64__)
|
||||
#define RTC_SUPPORTS_METAL
|
||||
#endif
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* RTCMTLVideoView is thin wrapper around MTKView.
|
||||
*
|
||||
* It has id<RTCVideoRenderer> property that renders video frames in the view's
|
||||
* bounds using Metal.
|
||||
* NOTE: always check if metal is available on the running device via
|
||||
* RTC_SUPPORTS_METAL macro before initializing this class.
|
||||
*/
|
||||
NS_CLASS_AVAILABLE_IOS(9)
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCMTLVideoView : UIView <RTCVideoRenderer>
|
||||
|
||||
@property(nonatomic, weak) id<RTCVideoViewDelegate> delegate;
|
||||
|
||||
- (void)setVideoContentMode:(UIViewContentMode)mode;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 The WebRTC Project Authors. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef SDK_OBJC_FRAMEWORK_HEADERS_WEBRTC_RTCMACROS_H_
|
||||
#define SDK_OBJC_FRAMEWORK_HEADERS_WEBRTC_RTCMACROS_H_
|
||||
|
||||
#define RTC_EXPORT __attribute__((visibility("default")))
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#define RTC_EXTERN extern "C" RTC_EXPORT
|
||||
#else
|
||||
#define RTC_EXTERN extern RTC_EXPORT
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
#define RTC_FWD_DECL_OBJC_CLASS(classname) @class classname
|
||||
#else
|
||||
#define RTC_FWD_DECL_OBJC_CLASS(classname) typedef struct objc_object classname
|
||||
#endif
|
||||
|
||||
#endif // SDK_OBJC_FRAMEWORK_HEADERS_WEBRTC_RTCMACROS_H_
|
||||
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/** Constraint keys for media sources. */
|
||||
RTC_EXTERN NSString * const kRTCMediaConstraintsMinAspectRatio;
|
||||
RTC_EXTERN NSString * const kRTCMediaConstraintsMaxAspectRatio;
|
||||
RTC_EXTERN NSString * const kRTCMediaConstraintsMaxWidth;
|
||||
RTC_EXTERN NSString * const kRTCMediaConstraintsMinWidth;
|
||||
RTC_EXTERN NSString * const kRTCMediaConstraintsMaxHeight;
|
||||
RTC_EXTERN NSString * const kRTCMediaConstraintsMinHeight;
|
||||
RTC_EXTERN NSString * const kRTCMediaConstraintsMaxFrameRate;
|
||||
RTC_EXTERN NSString * const kRTCMediaConstraintsMinFrameRate;
|
||||
/** The value for this key should be a base64 encoded string containing
|
||||
* the data from the serialized configuration proto.
|
||||
*/
|
||||
RTC_EXTERN NSString * const kRTCMediaConstraintsAudioNetworkAdaptorConfig;
|
||||
|
||||
/** Constraint keys for generating offers and answers. */
|
||||
RTC_EXTERN NSString * const kRTCMediaConstraintsIceRestart;
|
||||
RTC_EXTERN NSString * const kRTCMediaConstraintsOfferToReceiveAudio;
|
||||
RTC_EXTERN NSString * const kRTCMediaConstraintsOfferToReceiveVideo;
|
||||
RTC_EXTERN NSString * const kRTCMediaConstraintsVoiceActivityDetection;
|
||||
|
||||
/** Constraint values for Boolean parameters. */
|
||||
RTC_EXTERN NSString * const kRTCMediaConstraintsValueTrue;
|
||||
RTC_EXTERN NSString * const kRTCMediaConstraintsValueFalse;
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCMediaConstraints : NSObject
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/** Initialize with mandatory and/or optional constraints. */
|
||||
- (instancetype)initWithMandatoryConstraints:
|
||||
(nullable NSDictionary<NSString *, NSString *> *)mandatory
|
||||
optionalConstraints:
|
||||
(nullable NSDictionary<NSString *, NSString *> *)optional
|
||||
NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
typedef NS_ENUM(NSInteger, RTCSourceState) {
|
||||
RTCSourceStateInitializing,
|
||||
RTCSourceStateLive,
|
||||
RTCSourceStateEnded,
|
||||
RTCSourceStateMuted,
|
||||
};
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCMediaSource : NSObject
|
||||
|
||||
/** The current state of the RTCMediaSource. */
|
||||
@property(nonatomic, readonly) RTCSourceState state;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class RTCAudioTrack;
|
||||
@class RTCPeerConnectionFactory;
|
||||
@class RTCVideoTrack;
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCMediaStream : NSObject
|
||||
|
||||
/** The audio tracks in this stream. */
|
||||
@property(nonatomic, strong, readonly) NSArray<RTCAudioTrack *> *audioTracks;
|
||||
|
||||
/** The video tracks in this stream. */
|
||||
@property(nonatomic, strong, readonly) NSArray<RTCVideoTrack *> *videoTracks;
|
||||
|
||||
/** An identifier for this media stream. */
|
||||
@property(nonatomic, readonly) NSString *streamId;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/** Adds the given audio track to this media stream. */
|
||||
- (void)addAudioTrack:(RTCAudioTrack *)audioTrack;
|
||||
|
||||
/** Adds the given video track to this media stream. */
|
||||
- (void)addVideoTrack:(RTCVideoTrack *)videoTrack;
|
||||
|
||||
/** Removes the given audio track to this media stream. */
|
||||
- (void)removeAudioTrack:(RTCAudioTrack *)audioTrack;
|
||||
|
||||
/** Removes the given video track to this media stream. */
|
||||
- (void)removeVideoTrack:(RTCVideoTrack *)videoTrack;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
/**
|
||||
* Represents the state of the track. This exposes the same states in C++.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, RTCMediaStreamTrackState) {
|
||||
RTCMediaStreamTrackStateLive,
|
||||
RTCMediaStreamTrackStateEnded
|
||||
};
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
RTC_EXTERN NSString * const kRTCMediaStreamTrackKindAudio;
|
||||
RTC_EXTERN NSString * const kRTCMediaStreamTrackKindVideo;
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCMediaStreamTrack : NSObject
|
||||
|
||||
/**
|
||||
* The kind of track. For example, "audio" if this track represents an audio
|
||||
* track and "video" if this track represents a video track.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSString *kind;
|
||||
|
||||
/** An identifier string. */
|
||||
@property(nonatomic, readonly) NSString *trackId;
|
||||
|
||||
/** The enabled state of the track. */
|
||||
@property(nonatomic, assign) BOOL isEnabled;
|
||||
|
||||
/** The state of the track. */
|
||||
@property(nonatomic, readonly) RTCMediaStreamTrackState readyState;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
#import <WebRTC/RTCMetricsSampleInfo.h>
|
||||
|
||||
/**
|
||||
* Enables gathering of metrics (which can be fetched with
|
||||
* RTCGetAndResetMetrics). Must be called before any other call into WebRTC.
|
||||
*/
|
||||
RTC_EXTERN void RTCEnableMetrics(void);
|
||||
|
||||
/** Gets and clears native histograms. */
|
||||
RTC_EXTERN NSArray<RTCMetricsSampleInfo *> *RTCGetAndResetMetrics(void);
|
||||
|
||||
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCMetricsSampleInfo : NSObject
|
||||
|
||||
/**
|
||||
* Example of RTCMetricsSampleInfo:
|
||||
* name: "WebRTC.Video.InputFramesPerSecond"
|
||||
* min: 1
|
||||
* max: 100
|
||||
* bucketCount: 50
|
||||
* samples: [29]:2 [30]:1
|
||||
*/
|
||||
|
||||
/** The name of the histogram. */
|
||||
@property(nonatomic, readonly) NSString *name;
|
||||
|
||||
/** The minimum bucket value. */
|
||||
@property(nonatomic, readonly) int min;
|
||||
|
||||
/** The maximum bucket value. */
|
||||
@property(nonatomic, readonly) int max;
|
||||
|
||||
/** The number of buckets. */
|
||||
@property(nonatomic, readonly) int bucketCount;
|
||||
|
||||
/** A dictionary holding the samples <value, # of events>. */
|
||||
@property(nonatomic, readonly) NSDictionary<NSNumber *, NSNumber *> *samples;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,323 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
@class RTCConfiguration;
|
||||
@class RTCDataChannel;
|
||||
@class RTCDataChannelConfiguration;
|
||||
@class RTCIceCandidate;
|
||||
@class RTCMediaConstraints;
|
||||
@class RTCMediaStream;
|
||||
@class RTCMediaStreamTrack;
|
||||
@class RTCPeerConnectionFactory;
|
||||
@class RTCRtpReceiver;
|
||||
@class RTCRtpSender;
|
||||
@class RTCRtpTransceiver;
|
||||
@class RTCRtpTransceiverInit;
|
||||
@class RTCSessionDescription;
|
||||
@class RTCLegacyStatsReport;
|
||||
|
||||
typedef NS_ENUM(NSInteger, RTCRtpMediaType);
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
extern NSString * const kRTCPeerConnectionErrorDomain;
|
||||
extern int const kRTCSessionDescriptionErrorCode;
|
||||
|
||||
/** Represents the signaling state of the peer connection. */
|
||||
typedef NS_ENUM(NSInteger, RTCSignalingState) {
|
||||
RTCSignalingStateStable,
|
||||
RTCSignalingStateHaveLocalOffer,
|
||||
RTCSignalingStateHaveLocalPrAnswer,
|
||||
RTCSignalingStateHaveRemoteOffer,
|
||||
RTCSignalingStateHaveRemotePrAnswer,
|
||||
// Not an actual state, represents the total number of states.
|
||||
RTCSignalingStateClosed,
|
||||
};
|
||||
|
||||
/** Represents the ice connection state of the peer connection. */
|
||||
typedef NS_ENUM(NSInteger, RTCIceConnectionState) {
|
||||
RTCIceConnectionStateNew,
|
||||
RTCIceConnectionStateChecking,
|
||||
RTCIceConnectionStateConnected,
|
||||
RTCIceConnectionStateCompleted,
|
||||
RTCIceConnectionStateFailed,
|
||||
RTCIceConnectionStateDisconnected,
|
||||
RTCIceConnectionStateClosed,
|
||||
RTCIceConnectionStateCount,
|
||||
};
|
||||
|
||||
/** Represents the ice gathering state of the peer connection. */
|
||||
typedef NS_ENUM(NSInteger, RTCIceGatheringState) {
|
||||
RTCIceGatheringStateNew,
|
||||
RTCIceGatheringStateGathering,
|
||||
RTCIceGatheringStateComplete,
|
||||
};
|
||||
|
||||
/** Represents the stats output level. */
|
||||
typedef NS_ENUM(NSInteger, RTCStatsOutputLevel) {
|
||||
RTCStatsOutputLevelStandard,
|
||||
RTCStatsOutputLevelDebug,
|
||||
};
|
||||
|
||||
@class RTCPeerConnection;
|
||||
|
||||
RTC_EXPORT
|
||||
@protocol RTCPeerConnectionDelegate <NSObject>
|
||||
|
||||
/** Called when the SignalingState changed. */
|
||||
- (void)peerConnection:(RTCPeerConnection *)peerConnection
|
||||
didChangeSignalingState:(RTCSignalingState)stateChanged;
|
||||
|
||||
/** Called when media is received on a new stream from remote peer. */
|
||||
- (void)peerConnection:(RTCPeerConnection *)peerConnection
|
||||
didAddStream:(RTCMediaStream *)stream;
|
||||
|
||||
/** Called when a remote peer closes a stream.
|
||||
* This is not called when RTCSdpSemanticsUnifiedPlan is specified.
|
||||
*/
|
||||
- (void)peerConnection:(RTCPeerConnection *)peerConnection
|
||||
didRemoveStream:(RTCMediaStream *)stream;
|
||||
|
||||
/** Called when negotiation is needed, for example ICE has restarted. */
|
||||
- (void)peerConnectionShouldNegotiate:(RTCPeerConnection *)peerConnection;
|
||||
|
||||
/** Called any time the IceConnectionState changes. */
|
||||
- (void)peerConnection:(RTCPeerConnection *)peerConnection
|
||||
didChangeIceConnectionState:(RTCIceConnectionState)newState;
|
||||
|
||||
/** Called any time the IceGatheringState changes. */
|
||||
- (void)peerConnection:(RTCPeerConnection *)peerConnection
|
||||
didChangeIceGatheringState:(RTCIceGatheringState)newState;
|
||||
|
||||
/** New ice candidate has been found. */
|
||||
- (void)peerConnection:(RTCPeerConnection *)peerConnection
|
||||
didGenerateIceCandidate:(RTCIceCandidate *)candidate;
|
||||
|
||||
/** Called when a group of local Ice candidates have been removed. */
|
||||
- (void)peerConnection:(RTCPeerConnection *)peerConnection
|
||||
didRemoveIceCandidates:(NSArray<RTCIceCandidate *> *)candidates;
|
||||
|
||||
/** New data channel has been opened. */
|
||||
- (void)peerConnection:(RTCPeerConnection *)peerConnection
|
||||
didOpenDataChannel:(RTCDataChannel *)dataChannel;
|
||||
|
||||
/** Called when signaling indicates a transceiver will be receiving media from
|
||||
* the remote endpoint.
|
||||
* This is only called with RTCSdpSemanticsUnifiedPlan specified.
|
||||
*/
|
||||
@optional
|
||||
- (void)peerConnection:(RTCPeerConnection *)peerConnection
|
||||
didStartReceivingOnTransceiver:(RTCRtpTransceiver *)transceiver;
|
||||
|
||||
/** Called when a receiver and its track are created. */
|
||||
@optional
|
||||
- (void)peerConnection:(RTCPeerConnection *)peerConnection
|
||||
didAddReceiver:(RTCRtpReceiver *)rtpReceiver
|
||||
streams:(NSArray<RTCMediaStream *> *)mediaStreams;
|
||||
|
||||
@end
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCPeerConnection : NSObject
|
||||
|
||||
/** The object that will be notifed about events such as state changes and
|
||||
* streams being added or removed.
|
||||
*/
|
||||
@property(nonatomic, weak, nullable) id<RTCPeerConnectionDelegate> delegate;
|
||||
/** This property is not available with RTCSdpSemanticsUnifiedPlan. Please use
|
||||
* |senders| instead.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSArray<RTCMediaStream *> *localStreams;
|
||||
@property(nonatomic, readonly, nullable)
|
||||
RTCSessionDescription *localDescription;
|
||||
@property(nonatomic, readonly, nullable)
|
||||
RTCSessionDescription *remoteDescription;
|
||||
@property(nonatomic, readonly) RTCSignalingState signalingState;
|
||||
@property(nonatomic, readonly) RTCIceConnectionState iceConnectionState;
|
||||
@property(nonatomic, readonly) RTCIceGatheringState iceGatheringState;
|
||||
@property(nonatomic, readonly, copy) RTCConfiguration *configuration;
|
||||
|
||||
/** Gets all RTCRtpSenders associated with this peer connection.
|
||||
* Note: reading this property returns different instances of RTCRtpSender.
|
||||
* Use isEqual: instead of == to compare RTCRtpSender instances.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSArray<RTCRtpSender *> *senders;
|
||||
|
||||
/** Gets all RTCRtpReceivers associated with this peer connection.
|
||||
* Note: reading this property returns different instances of RTCRtpReceiver.
|
||||
* Use isEqual: instead of == to compare RTCRtpReceiver instances.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSArray<RTCRtpReceiver *> *receivers;
|
||||
|
||||
/** Gets all RTCRtpTransceivers associated with this peer connection.
|
||||
* Note: reading this property returns different instances of
|
||||
* RTCRtpTransceiver. Use isEqual: instead of == to compare RTCRtpTransceiver
|
||||
* instances.
|
||||
* This is only available with RTCSdpSemanticsUnifiedPlan specified.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSArray<RTCRtpTransceiver *> *transceivers;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/** Sets the PeerConnection's global configuration to |configuration|.
|
||||
* Any changes to STUN/TURN servers or ICE candidate policy will affect the
|
||||
* next gathering phase, and cause the next call to createOffer to generate
|
||||
* new ICE credentials. Note that the BUNDLE and RTCP-multiplexing policies
|
||||
* cannot be changed with this method.
|
||||
*/
|
||||
- (BOOL)setConfiguration:(RTCConfiguration *)configuration;
|
||||
|
||||
/** Terminate all media and close the transport. */
|
||||
- (void)close;
|
||||
|
||||
/** Provide a remote candidate to the ICE Agent. */
|
||||
- (void)addIceCandidate:(RTCIceCandidate *)candidate;
|
||||
|
||||
/** Remove a group of remote candidates from the ICE Agent. */
|
||||
- (void)removeIceCandidates:(NSArray<RTCIceCandidate *> *)candidates;
|
||||
|
||||
/** Add a new media stream to be sent on this peer connection.
|
||||
* This method is not supported with RTCSdpSemanticsUnifiedPlan. Please use
|
||||
* addTrack instead.
|
||||
*/
|
||||
- (void)addStream:(RTCMediaStream *)stream;
|
||||
|
||||
/** Remove the given media stream from this peer connection.
|
||||
* This method is not supported with RTCSdpSemanticsUnifiedPlan. Please use
|
||||
* removeTrack instead.
|
||||
*/
|
||||
- (void)removeStream:(RTCMediaStream *)stream;
|
||||
|
||||
/** Add a new media stream track to be sent on this peer connection, and return
|
||||
* the newly created RTCRtpSender. The RTCRtpSender will be associated with
|
||||
* the streams specified in the |streamIds| list.
|
||||
*
|
||||
* Errors: If an error occurs, returns nil. An error can occur if:
|
||||
* - A sender already exists for the track.
|
||||
* - The peer connection is closed.
|
||||
*/
|
||||
- (RTCRtpSender *)addTrack:(RTCMediaStreamTrack *)track streamIds:(NSArray<NSString *> *)streamIds;
|
||||
|
||||
/** With PlanB semantics, removes an RTCRtpSender from this peer connection.
|
||||
*
|
||||
* With UnifiedPlan semantics, sets sender's track to null and removes the
|
||||
* send component from the associated RTCRtpTransceiver's direction.
|
||||
*
|
||||
* Returns YES on success.
|
||||
*/
|
||||
- (BOOL)removeTrack:(RTCRtpSender *)sender;
|
||||
|
||||
/** addTransceiver creates a new RTCRtpTransceiver and adds it to the set of
|
||||
* transceivers. Adding a transceiver will cause future calls to CreateOffer
|
||||
* to add a media description for the corresponding transceiver.
|
||||
*
|
||||
* The initial value of |mid| in the returned transceiver is nil. Setting a
|
||||
* new session description may change it to a non-nil value.
|
||||
*
|
||||
* https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-addtransceiver
|
||||
*
|
||||
* Optionally, an RtpTransceiverInit structure can be specified to configure
|
||||
* the transceiver from construction. If not specified, the transceiver will
|
||||
* default to having a direction of kSendRecv and not be part of any streams.
|
||||
*
|
||||
* These methods are only available when Unified Plan is enabled (see
|
||||
* RTCConfiguration).
|
||||
*/
|
||||
|
||||
/** Adds a transceiver with a sender set to transmit the given track. The kind
|
||||
* of the transceiver (and sender/receiver) will be derived from the kind of
|
||||
* the track.
|
||||
*/
|
||||
- (RTCRtpTransceiver *)addTransceiverWithTrack:(RTCMediaStreamTrack *)track;
|
||||
- (RTCRtpTransceiver *)addTransceiverWithTrack:(RTCMediaStreamTrack *)track
|
||||
init:(RTCRtpTransceiverInit *)init;
|
||||
|
||||
/** Adds a transceiver with the given kind. Can either be RTCRtpMediaTypeAudio
|
||||
* or RTCRtpMediaTypeVideo.
|
||||
*/
|
||||
- (RTCRtpTransceiver *)addTransceiverOfType:(RTCRtpMediaType)mediaType;
|
||||
- (RTCRtpTransceiver *)addTransceiverOfType:(RTCRtpMediaType)mediaType
|
||||
init:(RTCRtpTransceiverInit *)init;
|
||||
|
||||
/** Generate an SDP offer. */
|
||||
- (void)offerForConstraints:(RTCMediaConstraints *)constraints
|
||||
completionHandler:(nullable void (^)
|
||||
(RTCSessionDescription * _Nullable sdp,
|
||||
NSError * _Nullable error))completionHandler;
|
||||
|
||||
/** Generate an SDP answer. */
|
||||
- (void)answerForConstraints:(RTCMediaConstraints *)constraints
|
||||
completionHandler:(nullable void (^)
|
||||
(RTCSessionDescription * _Nullable sdp,
|
||||
NSError * _Nullable error))completionHandler;
|
||||
|
||||
/** Apply the supplied RTCSessionDescription as the local description. */
|
||||
- (void)setLocalDescription:(RTCSessionDescription *)sdp
|
||||
completionHandler:
|
||||
(nullable void (^)(NSError * _Nullable error))completionHandler;
|
||||
|
||||
/** Apply the supplied RTCSessionDescription as the remote description. */
|
||||
- (void)setRemoteDescription:(RTCSessionDescription *)sdp
|
||||
completionHandler:
|
||||
(nullable void (^)(NSError * _Nullable error))completionHandler;
|
||||
|
||||
/** Limits the bandwidth allocated for all RTP streams sent by this
|
||||
* PeerConnection. Nil parameters will be unchanged. Setting
|
||||
* |currentBitrateBps| will force the available bitrate estimate to the given
|
||||
* value. Returns YES if the parameters were successfully updated.
|
||||
*/
|
||||
- (BOOL)setBweMinBitrateBps:(nullable NSNumber *)minBitrateBps
|
||||
currentBitrateBps:(nullable NSNumber *)currentBitrateBps
|
||||
maxBitrateBps:(nullable NSNumber *)maxBitrateBps;
|
||||
|
||||
/** Start or stop recording an Rtc EventLog. */
|
||||
- (BOOL)startRtcEventLogWithFilePath:(NSString *)filePath
|
||||
maxSizeInBytes:(int64_t)maxSizeInBytes;
|
||||
- (void)stopRtcEventLog;
|
||||
|
||||
@end
|
||||
|
||||
@interface RTCPeerConnection (Media)
|
||||
|
||||
/** Create an RTCRtpSender with the specified kind and media stream ID.
|
||||
* See RTCMediaStreamTrack.h for available kinds.
|
||||
* This method is not supported with RTCSdpSemanticsUnifiedPlan. Please use
|
||||
* addTransceiver instead.
|
||||
*/
|
||||
- (RTCRtpSender *)senderWithKind:(NSString *)kind streamId:(NSString *)streamId;
|
||||
|
||||
@end
|
||||
|
||||
@interface RTCPeerConnection (DataChannel)
|
||||
|
||||
/** Create a new data channel with the given label and configuration. */
|
||||
- (nullable RTCDataChannel *)dataChannelForLabel:(NSString *)label
|
||||
configuration:(RTCDataChannelConfiguration *)configuration;
|
||||
|
||||
@end
|
||||
|
||||
@interface RTCPeerConnection (Stats)
|
||||
|
||||
/** Gather stats for the given RTCMediaStreamTrack. If |mediaStreamTrack| is nil
|
||||
* statistics are gathered for all tracks.
|
||||
*/
|
||||
- (void)statsForTrack:
|
||||
(nullable RTCMediaStreamTrack *)mediaStreamTrack
|
||||
statsOutputLevel:(RTCStatsOutputLevel)statsOutputLevel
|
||||
completionHandler:
|
||||
(nullable void (^)(NSArray<RTCLegacyStatsReport *> *stats))completionHandler;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,86 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class RTCAudioSource;
|
||||
@class RTCAudioTrack;
|
||||
@class RTCConfiguration;
|
||||
@class RTCMediaConstraints;
|
||||
@class RTCMediaStream;
|
||||
@class RTCPeerConnection;
|
||||
@class RTCVideoSource;
|
||||
@class RTCVideoTrack;
|
||||
@class RTCPeerConnectionFactoryOptions;
|
||||
@protocol RTCPeerConnectionDelegate;
|
||||
@protocol RTCVideoDecoderFactory;
|
||||
@protocol RTCVideoEncoderFactory;
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCPeerConnectionFactory : NSObject
|
||||
|
||||
/* Initialize object with default H264 video encoder/decoder factories */
|
||||
- (instancetype)init;
|
||||
|
||||
/* Initialize object with injectable video encoder/decoder factories */
|
||||
- (instancetype)initWithEncoderFactory:(nullable id<RTCVideoEncoderFactory>)encoderFactory
|
||||
decoderFactory:(nullable id<RTCVideoDecoderFactory>)decoderFactory;
|
||||
|
||||
/** Initialize an RTCAudioSource with constraints. */
|
||||
- (RTCAudioSource *)audioSourceWithConstraints:(nullable RTCMediaConstraints *)constraints;
|
||||
|
||||
/** Initialize an RTCAudioTrack with an id. Convenience ctor to use an audio source with no
|
||||
* constraints.
|
||||
*/
|
||||
- (RTCAudioTrack *)audioTrackWithTrackId:(NSString *)trackId;
|
||||
|
||||
/** Initialize an RTCAudioTrack with a source and an id. */
|
||||
- (RTCAudioTrack *)audioTrackWithSource:(RTCAudioSource *)source
|
||||
trackId:(NSString *)trackId;
|
||||
|
||||
/** Initialize a generic RTCVideoSource. The RTCVideoSource should be passed to a RTCVideoCapturer
|
||||
* implementation, e.g. RTCCameraVideoCapturer, in order to produce frames.
|
||||
*/
|
||||
- (RTCVideoSource *)videoSource;
|
||||
|
||||
/** Initialize an RTCVideoTrack with a source and an id. */
|
||||
- (RTCVideoTrack *)videoTrackWithSource:(RTCVideoSource *)source
|
||||
trackId:(NSString *)trackId;
|
||||
|
||||
/** Initialize an RTCMediaStream with an id. */
|
||||
- (RTCMediaStream *)mediaStreamWithStreamId:(NSString *)streamId;
|
||||
|
||||
/** Initialize an RTCPeerConnection with a configuration, constraints, and
|
||||
* delegate.
|
||||
*/
|
||||
- (RTCPeerConnection *)peerConnectionWithConfiguration:
|
||||
(RTCConfiguration *)configuration
|
||||
constraints:
|
||||
(RTCMediaConstraints *)constraints
|
||||
delegate:
|
||||
(nullable id<RTCPeerConnectionDelegate>)delegate;
|
||||
|
||||
/** Set the options to be used for subsequently created RTCPeerConnections */
|
||||
- (void)setOptions:(nonnull RTCPeerConnectionFactoryOptions *)options;
|
||||
|
||||
/** Start an AecDump recording. This API call will likely change in the future. */
|
||||
- (BOOL)startAecDumpWithFilePath:(NSString *)filePath
|
||||
maxSizeInBytes:(int64_t)maxSizeInBytes;
|
||||
|
||||
/* Stop an active AecDump recording */
|
||||
- (void)stopAecDump;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCPeerConnectionFactoryOptions : NSObject
|
||||
|
||||
@property(nonatomic, assign) BOOL disableEncryption;
|
||||
|
||||
@property(nonatomic, assign) BOOL disableNetworkMonitor;
|
||||
|
||||
@property(nonatomic, assign) BOOL ignoreLoopbackNetworkAdapter;
|
||||
|
||||
@property(nonatomic, assign) BOOL ignoreVPNNetworkAdapter;
|
||||
|
||||
@property(nonatomic, assign) BOOL ignoreCellularNetworkAdapter;
|
||||
|
||||
@property(nonatomic, assign) BOOL ignoreWiFiNetworkAdapter;
|
||||
|
||||
@property(nonatomic, assign) BOOL ignoreEthernetNetworkAdapter;
|
||||
|
||||
@property(nonatomic, assign) BOOL enableAes128Sha1_32CryptoCipher;
|
||||
|
||||
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
RTC_EXTERN const NSString * const kRTCRtxCodecName;
|
||||
RTC_EXTERN const NSString * const kRTCRedCodecName;
|
||||
RTC_EXTERN const NSString * const kRTCUlpfecCodecName;
|
||||
RTC_EXTERN const NSString * const kRTCFlexfecCodecName;
|
||||
RTC_EXTERN const NSString * const kRTCOpusCodecName;
|
||||
RTC_EXTERN const NSString * const kRTCIsacCodecName;
|
||||
RTC_EXTERN const NSString * const kRTCL16CodecName;
|
||||
RTC_EXTERN const NSString * const kRTCG722CodecName;
|
||||
RTC_EXTERN const NSString * const kRTCIlbcCodecName;
|
||||
RTC_EXTERN const NSString * const kRTCPcmuCodecName;
|
||||
RTC_EXTERN const NSString * const kRTCPcmaCodecName;
|
||||
RTC_EXTERN const NSString * const kRTCDtmfCodecName;
|
||||
RTC_EXTERN const NSString * const kRTCComfortNoiseCodecName;
|
||||
RTC_EXTERN const NSString * const kRTCVp8CodecName;
|
||||
RTC_EXTERN const NSString * const kRTCVp9CodecName;
|
||||
RTC_EXTERN const NSString * const kRTCH264CodecName;
|
||||
|
||||
/** Defined in http://w3c.github.io/webrtc-pc/#idl-def-RTCRtpCodecParameters */
|
||||
RTC_EXPORT
|
||||
@interface RTCRtpCodecParameters : NSObject
|
||||
|
||||
/** The RTP payload type. */
|
||||
@property(nonatomic, assign) int payloadType;
|
||||
|
||||
/**
|
||||
* The codec MIME subtype. Valid types are listed in:
|
||||
* http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-2
|
||||
*
|
||||
* Several supported types are represented by the constants above.
|
||||
*/
|
||||
@property(nonatomic, readonly, nonnull) NSString *name;
|
||||
|
||||
/**
|
||||
* The media type of this codec. Equivalent to MIME top-level type.
|
||||
*
|
||||
* Valid values are kRTCMediaStreamTrackKindAudio and
|
||||
* kRTCMediaStreamTrackKindVideo.
|
||||
*/
|
||||
@property(nonatomic, readonly, nonnull) NSString *kind;
|
||||
|
||||
/** The codec clock rate expressed in Hertz. */
|
||||
@property(nonatomic, readonly, nullable) NSNumber *clockRate;
|
||||
|
||||
/**
|
||||
* The number of channels (mono=1, stereo=2).
|
||||
* Set to null for video codecs.
|
||||
**/
|
||||
@property(nonatomic, readonly, nullable) NSNumber *numChannels;
|
||||
|
||||
/** The "format specific parameters" field from the "a=fmtp" line in the SDP */
|
||||
@property(nonatomic, readonly, nonnull) NSDictionary *parameters;
|
||||
|
||||
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCRtpEncodingParameters : NSObject
|
||||
|
||||
/** Controls whether the encoding is currently transmitted. */
|
||||
@property(nonatomic, assign) BOOL isActive;
|
||||
|
||||
/** The maximum bitrate to use for the encoding, or nil if there is no
|
||||
* limit.
|
||||
*/
|
||||
@property(nonatomic, copy, nullable) NSNumber *maxBitrateBps;
|
||||
|
||||
/** The SSRC being used by this encoding. */
|
||||
@property(nonatomic, readonly, nullable) NSNumber *ssrc;
|
||||
|
||||
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
#import <WebRTC/RTCRtpCodecParameters.h>
|
||||
#import <WebRTC/RTCRtpEncodingParameters.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCRtpParameters : NSObject
|
||||
|
||||
/** A unique identifier for the last set of parameters applied. */
|
||||
@property(nonatomic, copy) NSString *transactionId;
|
||||
|
||||
/** The currently active encodings in the order of preference. */
|
||||
@property(nonatomic, copy) NSArray<RTCRtpEncodingParameters *> *encodings;
|
||||
|
||||
/** The negotiated set of send codecs in order of preference. */
|
||||
@property(nonatomic, copy) NSArray<RTCRtpCodecParameters *> *codecs;
|
||||
|
||||
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
#import <WebRTC/RTCMediaStreamTrack.h>
|
||||
#import <WebRTC/RTCRtpParameters.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/** Represents the media type of the RtpReceiver. */
|
||||
typedef NS_ENUM(NSInteger, RTCRtpMediaType) {
|
||||
RTCRtpMediaTypeAudio,
|
||||
RTCRtpMediaTypeVideo,
|
||||
RTCRtpMediaTypeData,
|
||||
};
|
||||
|
||||
@class RTCRtpReceiver;
|
||||
|
||||
RTC_EXPORT
|
||||
@protocol RTCRtpReceiverDelegate <NSObject>
|
||||
|
||||
/** Called when the first RTP packet is received.
|
||||
*
|
||||
* Note: Currently if there are multiple RtpReceivers of the same media type,
|
||||
* they will all call OnFirstPacketReceived at once.
|
||||
*
|
||||
* For example, if we create three audio receivers, A/B/C, they will listen to
|
||||
* the same signal from the underneath network layer. Whenever the first audio packet
|
||||
* is received, the underneath signal will be fired. All the receivers A/B/C will be
|
||||
* notified and the callback of the receiver's delegate will be called.
|
||||
*
|
||||
* The process is the same for video receivers.
|
||||
*/
|
||||
- (void)rtpReceiver:(RTCRtpReceiver *)rtpReceiver
|
||||
didReceiveFirstPacketForMediaType:(RTCRtpMediaType)mediaType;
|
||||
|
||||
@end
|
||||
|
||||
RTC_EXPORT
|
||||
@protocol RTCRtpReceiver <NSObject>
|
||||
|
||||
/** A unique identifier for this receiver. */
|
||||
@property(nonatomic, readonly) NSString *receiverId;
|
||||
|
||||
/** The currently active RTCRtpParameters, as defined in
|
||||
* https://www.w3.org/TR/webrtc/#idl-def-RTCRtpParameters.
|
||||
*
|
||||
* The WebRTC specification only defines RTCRtpParameters in terms of senders,
|
||||
* but this API also applies them to receivers, similar to ORTC:
|
||||
* http://ortc.org/wp-content/uploads/2016/03/ortc.html#rtcrtpparameters*.
|
||||
*/
|
||||
@property(nonatomic, readonly) RTCRtpParameters *parameters;
|
||||
|
||||
/** The RTCMediaStreamTrack associated with the receiver.
|
||||
* Note: reading this property returns a new instance of
|
||||
* RTCMediaStreamTrack. Use isEqual: instead of == to compare
|
||||
* RTCMediaStreamTrack instances.
|
||||
*/
|
||||
@property(nonatomic, readonly, nullable) RTCMediaStreamTrack *track;
|
||||
|
||||
/** The delegate for this RtpReceiver. */
|
||||
@property(nonatomic, weak) id<RTCRtpReceiverDelegate> delegate;
|
||||
|
||||
@end
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCRtpReceiver : NSObject <RTCRtpReceiver>
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCDtmfSender.h>
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
#import <WebRTC/RTCMediaStreamTrack.h>
|
||||
#import <WebRTC/RTCRtpParameters.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
RTC_EXPORT
|
||||
@protocol RTCRtpSender <NSObject>
|
||||
|
||||
/** A unique identifier for this sender. */
|
||||
@property(nonatomic, readonly) NSString *senderId;
|
||||
|
||||
/** The currently active RTCRtpParameters, as defined in
|
||||
* https://www.w3.org/TR/webrtc/#idl-def-RTCRtpParameters.
|
||||
*/
|
||||
@property(nonatomic, copy) RTCRtpParameters *parameters;
|
||||
|
||||
/** The RTCMediaStreamTrack associated with the sender.
|
||||
* Note: reading this property returns a new instance of
|
||||
* RTCMediaStreamTrack. Use isEqual: instead of == to compare
|
||||
* RTCMediaStreamTrack instances.
|
||||
*/
|
||||
@property(nonatomic, copy, nullable) RTCMediaStreamTrack *track;
|
||||
|
||||
/** The RTCDtmfSender accociated with the RTP sender. */
|
||||
@property(nonatomic, readonly, nullable) id<RTCDtmfSender> dtmfSender;
|
||||
|
||||
@end
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCRtpSender : NSObject <RTCRtpSender>
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,128 +0,0 @@
|
||||
/*
|
||||
* Copyright 2018 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
#import <WebRTC/RTCRtpReceiver.h>
|
||||
#import <WebRTC/RTCRtpSender.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/** https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverdirection */
|
||||
typedef NS_ENUM(NSInteger, RTCRtpTransceiverDirection) {
|
||||
RTCRtpTransceiverDirectionSendRecv,
|
||||
RTCRtpTransceiverDirectionSendOnly,
|
||||
RTCRtpTransceiverDirectionRecvOnly,
|
||||
RTCRtpTransceiverDirectionInactive,
|
||||
};
|
||||
|
||||
/** Structure for initializing an RTCRtpTransceiver in a call to
|
||||
* RTCPeerConnection.addTransceiver.
|
||||
* https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit
|
||||
*/
|
||||
@interface RTCRtpTransceiverInit : NSObject
|
||||
|
||||
/** Direction of the RTCRtpTransceiver. See RTCRtpTransceiver.direction. */
|
||||
@property(nonatomic) RTCRtpTransceiverDirection direction;
|
||||
|
||||
/** The added RTCRtpTransceiver will be added to these streams. */
|
||||
@property(nonatomic) NSArray<NSString *> *streamIds;
|
||||
|
||||
/** TODO(bugs.webrtc.org/7600): Not implemented. */
|
||||
@property(nonatomic) NSArray<RTCRtpEncodingParameters *> *sendEncodings;
|
||||
|
||||
@end
|
||||
|
||||
@class RTCRtpTransceiver;
|
||||
|
||||
/** The RTCRtpTransceiver maps to the RTCRtpTransceiver defined by the WebRTC
|
||||
* specification. A transceiver represents a combination of an RTCRtpSender
|
||||
* and an RTCRtpReceiver that share a common mid. As defined in JSEP, an
|
||||
* RTCRtpTransceiver is said to be associated with a media description if its
|
||||
* mid property is non-nil; otherwise, it is said to be disassociated.
|
||||
* JSEP: https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-24
|
||||
*
|
||||
* Note that RTCRtpTransceivers are only supported when using
|
||||
* RTCPeerConnection with Unified Plan SDP.
|
||||
*
|
||||
* WebRTC specification for RTCRtpTransceiver, the JavaScript analog:
|
||||
* https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver
|
||||
*/
|
||||
RTC_EXPORT
|
||||
@protocol RTCRtpTransceiver <NSObject>
|
||||
|
||||
/** Media type of the transceiver. The sender and receiver will also have this
|
||||
* type.
|
||||
*/
|
||||
@property(nonatomic, readonly) RTCRtpMediaType mediaType;
|
||||
|
||||
/** The mid attribute is the mid negotiated and present in the local and
|
||||
* remote descriptions. Before negotiation is complete, the mid value may be
|
||||
* nil. After rollbacks, the value may change from a non-nil value to nil.
|
||||
* https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-mid
|
||||
*/
|
||||
@property(nonatomic, readonly) NSString *mid;
|
||||
|
||||
/** The sender attribute exposes the RTCRtpSender corresponding to the RTP
|
||||
* media that may be sent with the transceiver's mid. The sender is always
|
||||
* present, regardless of the direction of media.
|
||||
* https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-sender
|
||||
*/
|
||||
@property(nonatomic, readonly) RTCRtpSender *sender;
|
||||
|
||||
/** The receiver attribute exposes the RTCRtpReceiver corresponding to the RTP
|
||||
* media that may be received with the transceiver's mid. The receiver is
|
||||
* always present, regardless of the direction of media.
|
||||
* https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-receiver
|
||||
*/
|
||||
@property(nonatomic, readonly) RTCRtpReceiver *receiver;
|
||||
|
||||
/** The isStopped attribute indicates that the sender of this transceiver will
|
||||
* no longer send, and that the receiver will no longer receive. It is true if
|
||||
* either stop has been called or if setting the local or remote description
|
||||
* has caused the RTCRtpTransceiver to be stopped.
|
||||
* https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stopped
|
||||
*/
|
||||
@property(nonatomic, readonly) BOOL isStopped;
|
||||
|
||||
/** The direction attribute indicates the preferred direction of this
|
||||
* transceiver, which will be used in calls to createOffer and createAnswer.
|
||||
* An update of directionality does not take effect immediately. Instead,
|
||||
* future calls to createOffer and createAnswer mark the corresponding media
|
||||
* descriptions as sendrecv, sendonly, recvonly, or inactive.
|
||||
* https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction
|
||||
*/
|
||||
@property(nonatomic) RTCRtpTransceiverDirection direction;
|
||||
|
||||
/** The currentDirection attribute indicates the current direction negotiated
|
||||
* for this transceiver. If this transceiver has never been represented in an
|
||||
* offer/answer exchange, or if the transceiver is stopped, the value is not
|
||||
* present and this method returns NO.
|
||||
* https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-currentdirection
|
||||
*/
|
||||
- (BOOL)currentDirection:(RTCRtpTransceiverDirection *)currentDirectionOut;
|
||||
|
||||
/** The stop method irreversibly stops the RTCRtpTransceiver. The sender of
|
||||
* this transceiver will no longer send, the receiver will no longer receive.
|
||||
* https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stop
|
||||
*/
|
||||
- (void)stop;
|
||||
|
||||
@end
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCRtpTransceiver : NSObject <RTCRtpTransceiver>
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
/**
|
||||
* Initialize and clean up the SSL library. Failure is fatal. These call the
|
||||
* corresponding functions in webrtc/rtc_base/ssladapter.h.
|
||||
*/
|
||||
RTC_EXTERN BOOL RTCInitializeSSL(void);
|
||||
RTC_EXTERN BOOL RTCCleanupSSL(void);
|
||||
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
/**
|
||||
* Represents the session description type. This exposes the same types that are
|
||||
* in C++, which doesn't include the rollback type that is in the W3C spec.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, RTCSdpType) {
|
||||
RTCSdpTypeOffer,
|
||||
RTCSdpTypePrAnswer,
|
||||
RTCSdpTypeAnswer,
|
||||
};
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCSessionDescription : NSObject
|
||||
|
||||
/** The type of session description. */
|
||||
@property(nonatomic, readonly) RTCSdpType type;
|
||||
|
||||
/** The SDP string representation of this session description. */
|
||||
@property(nonatomic, readonly) NSString *sdp;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/** Initialize a session description with a type and SDP string. */
|
||||
- (instancetype)initWithType:(RTCSdpType)type sdp:(NSString *)sdp
|
||||
NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
+ (NSString *)stringForType:(RTCSdpType)type;
|
||||
|
||||
+ (RTCSdpType)typeForString:(NSString *)string;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 The WebRTC Project Authors. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
RTC_EXTERN void RTCSetupInternalTracer(void);
|
||||
/** Starts capture to specified file. Must be a valid writable path.
|
||||
* Returns YES if capture starts.
|
||||
*/
|
||||
RTC_EXTERN BOOL RTCStartInternalCapture(NSString *filePath);
|
||||
RTC_EXTERN void RTCStopInternalCapture(void);
|
||||
RTC_EXTERN void RTCShutdownInternalTracer(void);
|
||||
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <WebRTC/RTCVideoFrame.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class RTCVideoCapturer;
|
||||
|
||||
RTC_EXPORT
|
||||
@protocol RTCVideoCapturerDelegate <NSObject>
|
||||
- (void)capturer:(RTCVideoCapturer *)capturer didCaptureVideoFrame:(RTCVideoFrame *)frame;
|
||||
@end
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCVideoCapturer : NSObject
|
||||
|
||||
@property(nonatomic, weak) id<RTCVideoCapturerDelegate> delegate;
|
||||
|
||||
- (instancetype)initWithDelegate:(id<RTCVideoCapturerDelegate>)delegate;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,186 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
#import <WebRTC/RTCVideoFrame.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
RTC_EXPORT extern NSString *const kRTCVideoCodecVp8Name;
|
||||
RTC_EXPORT extern NSString *const kRTCVideoCodecVp9Name;
|
||||
RTC_EXPORT extern NSString *const kRTCVideoCodecH264Name;
|
||||
RTC_EXPORT extern NSString *const kRTCLevel31ConstrainedHigh;
|
||||
RTC_EXPORT extern NSString *const kRTCLevel31ConstrainedBaseline;
|
||||
RTC_EXPORT extern NSString *const kRTCMaxSupportedH264ProfileLevelConstrainedHigh;
|
||||
RTC_EXPORT extern NSString *const kRTCMaxSupportedH264ProfileLevelConstrainedBaseline;
|
||||
|
||||
/** Represents an encoded frame's type. */
|
||||
typedef NS_ENUM(NSUInteger, RTCFrameType) {
|
||||
RTCFrameTypeEmptyFrame = 0,
|
||||
RTCFrameTypeAudioFrameSpeech = 1,
|
||||
RTCFrameTypeAudioFrameCN = 2,
|
||||
RTCFrameTypeVideoFrameKey = 3,
|
||||
RTCFrameTypeVideoFrameDelta = 4,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, RTCVideoContentType) {
|
||||
RTCVideoContentTypeUnspecified,
|
||||
RTCVideoContentTypeScreenshare,
|
||||
};
|
||||
|
||||
/** Represents an encoded frame. Corresponds to webrtc::EncodedImage. */
|
||||
RTC_EXPORT
|
||||
@interface RTCEncodedImage : NSObject
|
||||
|
||||
@property(nonatomic, strong) NSData *buffer;
|
||||
@property(nonatomic, assign) int32_t encodedWidth;
|
||||
@property(nonatomic, assign) int32_t encodedHeight;
|
||||
@property(nonatomic, assign) uint32_t timeStamp;
|
||||
@property(nonatomic, assign) int64_t captureTimeMs;
|
||||
@property(nonatomic, assign) int64_t ntpTimeMs;
|
||||
@property(nonatomic, assign) uint8_t flags;
|
||||
@property(nonatomic, assign) int64_t encodeStartMs;
|
||||
@property(nonatomic, assign) int64_t encodeFinishMs;
|
||||
@property(nonatomic, assign) RTCFrameType frameType;
|
||||
@property(nonatomic, assign) RTCVideoRotation rotation;
|
||||
@property(nonatomic, assign) BOOL completeFrame;
|
||||
@property(nonatomic, strong) NSNumber *qp;
|
||||
@property(nonatomic, assign) RTCVideoContentType contentType;
|
||||
|
||||
@end
|
||||
|
||||
/** Information for header. Corresponds to webrtc::RTPFragmentationHeader. */
|
||||
RTC_EXPORT
|
||||
@interface RTCRtpFragmentationHeader : NSObject
|
||||
|
||||
@property(nonatomic, strong) NSArray<NSNumber *> *fragmentationOffset;
|
||||
@property(nonatomic, strong) NSArray<NSNumber *> *fragmentationLength;
|
||||
@property(nonatomic, strong) NSArray<NSNumber *> *fragmentationTimeDiff;
|
||||
@property(nonatomic, strong) NSArray<NSNumber *> *fragmentationPlType;
|
||||
|
||||
@end
|
||||
|
||||
/** Implement this protocol to pass codec specific info from the encoder.
|
||||
* Corresponds to webrtc::CodecSpecificInfo.
|
||||
*/
|
||||
RTC_EXPORT
|
||||
@protocol RTCCodecSpecificInfo <NSObject>
|
||||
|
||||
@end
|
||||
|
||||
/** Callback block for encoder. */
|
||||
typedef BOOL (^RTCVideoEncoderCallback)(RTCEncodedImage *frame,
|
||||
id<RTCCodecSpecificInfo> info,
|
||||
RTCRtpFragmentationHeader *header);
|
||||
|
||||
/** Callback block for decoder. */
|
||||
typedef void (^RTCVideoDecoderCallback)(RTCVideoFrame *frame);
|
||||
|
||||
typedef NS_ENUM(NSUInteger, RTCVideoCodecMode) {
|
||||
RTCVideoCodecModeRealtimeVideo,
|
||||
RTCVideoCodecModeScreensharing,
|
||||
};
|
||||
|
||||
/** Holds information to identify a codec. Corresponds to webrtc::SdpVideoFormat. */
|
||||
RTC_EXPORT
|
||||
@interface RTCVideoCodecInfo : NSObject <NSCoding>
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
- (instancetype)initWithName:(NSString *)name;
|
||||
|
||||
- (instancetype)initWithName:(NSString *)name
|
||||
parameters:(nullable NSDictionary<NSString *, NSString *> *)parameters
|
||||
NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (BOOL)isEqualToCodecInfo:(RTCVideoCodecInfo *)info;
|
||||
|
||||
@property(nonatomic, readonly) NSString *name;
|
||||
@property(nonatomic, readonly) NSDictionary<NSString *, NSString *> *parameters;
|
||||
|
||||
@end
|
||||
|
||||
/** Settings for encoder. Corresponds to webrtc::VideoCodec. */
|
||||
RTC_EXPORT
|
||||
@interface RTCVideoEncoderSettings : NSObject
|
||||
|
||||
@property(nonatomic, strong) NSString *name;
|
||||
|
||||
@property(nonatomic, assign) unsigned short width;
|
||||
@property(nonatomic, assign) unsigned short height;
|
||||
|
||||
@property(nonatomic, assign) unsigned int startBitrate; // kilobits/sec.
|
||||
@property(nonatomic, assign) unsigned int maxBitrate;
|
||||
@property(nonatomic, assign) unsigned int minBitrate;
|
||||
@property(nonatomic, assign) unsigned int targetBitrate;
|
||||
|
||||
@property(nonatomic, assign) uint32_t maxFramerate;
|
||||
|
||||
@property(nonatomic, assign) unsigned int qpMax;
|
||||
@property(nonatomic, assign) RTCVideoCodecMode mode;
|
||||
|
||||
@end
|
||||
|
||||
/** QP thresholds for encoder. Corresponds to webrtc::VideoEncoder::QpThresholds. */
|
||||
RTC_EXPORT
|
||||
@interface RTCVideoEncoderQpThresholds : NSObject
|
||||
|
||||
- (instancetype)initWithThresholdsLow:(NSInteger)low high:(NSInteger)high;
|
||||
|
||||
@property(nonatomic, readonly) NSInteger low;
|
||||
@property(nonatomic, readonly) NSInteger high;
|
||||
|
||||
@end
|
||||
|
||||
/** Protocol for encoder implementations. */
|
||||
RTC_EXPORT
|
||||
@protocol RTCVideoEncoder <NSObject>
|
||||
|
||||
- (void)setCallback:(RTCVideoEncoderCallback)callback;
|
||||
- (NSInteger)startEncodeWithSettings:(RTCVideoEncoderSettings *)settings
|
||||
numberOfCores:(int)numberOfCores;
|
||||
- (NSInteger)releaseEncoder;
|
||||
- (NSInteger)encode:(RTCVideoFrame *)frame
|
||||
codecSpecificInfo:(nullable id<RTCCodecSpecificInfo>)info
|
||||
frameTypes:(NSArray<NSNumber *> *)frameTypes;
|
||||
- (int)setBitrate:(uint32_t)bitrateKbit framerate:(uint32_t)framerate;
|
||||
- (NSString *)implementationName;
|
||||
|
||||
/** Returns QP scaling settings for encoder. The quality scaler adjusts the resolution in order to
|
||||
* keep the QP from the encoded images within the given range. Returning nil from this function
|
||||
* disables quality scaling. */
|
||||
- (RTCVideoEncoderQpThresholds *)scalingSettings;
|
||||
|
||||
@end
|
||||
|
||||
/** Protocol for decoder implementations. */
|
||||
RTC_EXPORT
|
||||
@protocol RTCVideoDecoder <NSObject>
|
||||
|
||||
- (void)setCallback:(RTCVideoDecoderCallback)callback;
|
||||
- (NSInteger)startDecodeWithSettings:(RTCVideoEncoderSettings *)settings
|
||||
numberOfCores:(int)numberOfCores
|
||||
DEPRECATED_MSG_ATTRIBUTE("use startDecodeWithNumberOfCores: instead");
|
||||
- (NSInteger)releaseDecoder;
|
||||
- (NSInteger)decode:(RTCEncodedImage *)encodedImage
|
||||
missingFrames:(BOOL)missingFrames
|
||||
codecSpecificInfo:(nullable id<RTCCodecSpecificInfo>)info
|
||||
renderTimeMs:(int64_t)renderTimeMs;
|
||||
- (NSString *)implementationName;
|
||||
|
||||
// TODO(andersc): Make non-optional when `startDecodeWithSettings:numberOfCores:` is removed.
|
||||
@optional
|
||||
- (NSInteger)startDecodeWithNumberOfCores:(int)numberOfCores;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
#import <WebRTC/RTCVideoCodec.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/** RTCVideoEncoderFactory is an Objective-C version of webrtc::VideoEncoderFactory. */
|
||||
RTC_EXPORT
|
||||
@protocol RTCVideoEncoderFactory <NSObject>
|
||||
|
||||
- (nullable id<RTCVideoEncoder>)createEncoder:(RTCVideoCodecInfo *)info;
|
||||
- (NSArray<RTCVideoCodecInfo *> *)supportedCodecs; // TODO(andersc): "supportedFormats" instead?
|
||||
|
||||
@end
|
||||
|
||||
/** RTCVideoDecoderFactory is an Objective-C version of webrtc::VideoDecoderFactory. */
|
||||
RTC_EXPORT
|
||||
@protocol RTCVideoDecoderFactory <NSObject>
|
||||
|
||||
- (nullable id<RTCVideoDecoder>)createDecoder:(RTCVideoCodecInfo *)info;
|
||||
- (NSArray<RTCVideoCodecInfo *> *)supportedCodecs; // TODO(andersc): "supportedFormats" instead?
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - Default factories
|
||||
|
||||
/** These codec factories include support for all codecs bundled with WebRTC. If using custom
|
||||
* codecs, create custom implementations of RTCVideoEncoderFactory and RTCVideoDecoderFactory.
|
||||
*/
|
||||
RTC_EXPORT
|
||||
@interface RTCDefaultVideoEncoderFactory : NSObject <RTCVideoEncoderFactory>
|
||||
|
||||
@property(nonatomic, retain) RTCVideoCodecInfo *preferredCodec;
|
||||
|
||||
+ (NSArray<RTCVideoCodecInfo *> *)supportedCodecs;
|
||||
|
||||
@end
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCDefaultVideoDecoderFactory : NSObject <RTCVideoDecoderFactory>
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
#import <WebRTC/RTCVideoCodecFactory.h>
|
||||
|
||||
/** Class for H264 specific config. */
|
||||
typedef NS_ENUM(NSUInteger, RTCH264PacketizationMode) {
|
||||
RTCH264PacketizationModeNonInterleaved = 0, // Mode 1 - STAP-A, FU-A is allowed
|
||||
RTCH264PacketizationModeSingleNalUnit // Mode 0 - only single NALU allowed
|
||||
};
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCCodecSpecificInfoH264 : NSObject <RTCCodecSpecificInfo>
|
||||
|
||||
@property(nonatomic, assign) RTCH264PacketizationMode packetizationMode;
|
||||
|
||||
@end
|
||||
|
||||
/** Encoder. */
|
||||
RTC_EXPORT
|
||||
@interface RTCVideoEncoderH264 : NSObject<RTCVideoEncoder>
|
||||
|
||||
- (instancetype)initWithCodecInfo:(RTCVideoCodecInfo *)codecInfo;
|
||||
|
||||
@end
|
||||
|
||||
/** Decoder. */
|
||||
RTC_EXPORT
|
||||
@interface RTCVideoDecoderH264 : NSObject<RTCVideoDecoder>
|
||||
@end
|
||||
|
||||
/** Encoder factory. */
|
||||
RTC_EXPORT
|
||||
@interface RTCVideoEncoderFactoryH264 : NSObject<RTCVideoEncoderFactory>
|
||||
@end
|
||||
|
||||
/** Decoder factory. */
|
||||
RTC_EXPORT
|
||||
@interface RTCVideoDecoderFactoryH264 : NSObject<RTCVideoDecoderFactory>
|
||||
@end
|
||||
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
#import <WebRTC/RTCVideoCodec.h>
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCVideoDecoderVP8 : NSObject
|
||||
|
||||
/* This returns a VP8 decoder that can be returned from a RTCVideoDecoderFactory injected into
|
||||
* RTCPeerConnectionFactory. Even though it implements the RTCVideoDecoder protocol, it can not be
|
||||
* used independently from the RTCPeerConnectionFactory.
|
||||
*/
|
||||
+ (id<RTCVideoDecoder>)vp8Decoder;
|
||||
|
||||
@end
|
||||
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
#import <WebRTC/RTCVideoCodec.h>
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCVideoDecoderVP9 : NSObject
|
||||
|
||||
/* This returns a VP9 decoder that can be returned from a RTCVideoDecoderFactory injected into
|
||||
* RTCPeerConnectionFactory. Even though it implements the RTCVideoDecoder protocol, it can not be
|
||||
* used independently from the RTCPeerConnectionFactory.
|
||||
*/
|
||||
+ (id<RTCVideoDecoder>)vp9Decoder;
|
||||
|
||||
@end
|
||||
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
#import <WebRTC/RTCVideoCodec.h>
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCVideoEncoderVP8 : NSObject
|
||||
|
||||
/* This returns a VP8 encoder that can be returned from a RTCVideoEncoderFactory injected into
|
||||
* RTCPeerConnectionFactory. Even though it implements the RTCVideoEncoder protocol, it can not be
|
||||
* used independently from the RTCPeerConnectionFactory.
|
||||
*/
|
||||
+ (id<RTCVideoEncoder>)vp8Encoder;
|
||||
|
||||
@end
|
||||
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
#import <WebRTC/RTCVideoCodec.h>
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCVideoEncoderVP9 : NSObject
|
||||
|
||||
/* This returns a VP9 encoder that can be returned from a RTCVideoEncoderFactory injected into
|
||||
* RTCPeerConnectionFactory. Even though it implements the RTCVideoEncoder protocol, it can not be
|
||||
* used independently from the RTCPeerConnectionFactory.
|
||||
*/
|
||||
+ (id<RTCVideoEncoder>)vp9Encoder;
|
||||
|
||||
@end
|
||||
@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSInteger, RTCVideoRotation) {
|
||||
RTCVideoRotation_0 = 0,
|
||||
RTCVideoRotation_90 = 90,
|
||||
RTCVideoRotation_180 = 180,
|
||||
RTCVideoRotation_270 = 270,
|
||||
};
|
||||
|
||||
@protocol RTCVideoFrameBuffer;
|
||||
|
||||
// RTCVideoFrame is an ObjectiveC version of webrtc::VideoFrame.
|
||||
RTC_EXPORT
|
||||
@interface RTCVideoFrame : NSObject
|
||||
|
||||
/** Width without rotation applied. */
|
||||
@property(nonatomic, readonly) int width;
|
||||
|
||||
/** Height without rotation applied. */
|
||||
@property(nonatomic, readonly) int height;
|
||||
@property(nonatomic, readonly) RTCVideoRotation rotation;
|
||||
|
||||
/** Timestamp in nanoseconds. */
|
||||
@property(nonatomic, readonly) int64_t timeStampNs;
|
||||
|
||||
/** Timestamp 90 kHz. */
|
||||
@property(nonatomic, assign) int32_t timeStamp;
|
||||
|
||||
@property(nonatomic, readonly) id<RTCVideoFrameBuffer> buffer;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
- (instancetype)new NS_UNAVAILABLE;
|
||||
|
||||
/** Initialize an RTCVideoFrame from a pixel buffer, rotation, and timestamp.
|
||||
* Deprecated - initialize with a RTCCVPixelBuffer instead
|
||||
*/
|
||||
- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer
|
||||
rotation:(RTCVideoRotation)rotation
|
||||
timeStampNs:(int64_t)timeStampNs
|
||||
DEPRECATED_MSG_ATTRIBUTE("use initWithBuffer instead");
|
||||
|
||||
/** Initialize an RTCVideoFrame from a pixel buffer combined with cropping and
|
||||
* scaling. Cropping will be applied first on the pixel buffer, followed by
|
||||
* scaling to the final resolution of scaledWidth x scaledHeight.
|
||||
*/
|
||||
- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer
|
||||
scaledWidth:(int)scaledWidth
|
||||
scaledHeight:(int)scaledHeight
|
||||
cropWidth:(int)cropWidth
|
||||
cropHeight:(int)cropHeight
|
||||
cropX:(int)cropX
|
||||
cropY:(int)cropY
|
||||
rotation:(RTCVideoRotation)rotation
|
||||
timeStampNs:(int64_t)timeStampNs
|
||||
DEPRECATED_MSG_ATTRIBUTE("use initWithBuffer instead");
|
||||
|
||||
/** Initialize an RTCVideoFrame from a frame buffer, rotation, and timestamp.
|
||||
*/
|
||||
- (instancetype)initWithBuffer:(id<RTCVideoFrameBuffer>)frameBuffer
|
||||
rotation:(RTCVideoRotation)rotation
|
||||
timeStampNs:(int64_t)timeStampNs;
|
||||
|
||||
/** Return a frame that is guaranteed to be I420, i.e. it is possible to access
|
||||
* the YUV data on it.
|
||||
*/
|
||||
- (RTCVideoFrame *)newI420VideoFrame;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,116 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol RTCI420Buffer;
|
||||
|
||||
// RTCVideoFrameBuffer is an ObjectiveC version of webrtc::VideoFrameBuffer.
|
||||
RTC_EXPORT
|
||||
@protocol RTCVideoFrameBuffer <NSObject>
|
||||
|
||||
@property(nonatomic, readonly) int width;
|
||||
@property(nonatomic, readonly) int height;
|
||||
|
||||
- (id<RTCI420Buffer>)toI420;
|
||||
|
||||
@end
|
||||
|
||||
/** Protocol for RTCVideoFrameBuffers containing YUV planar data. */
|
||||
@protocol RTCYUVPlanarBuffer <RTCVideoFrameBuffer>
|
||||
|
||||
@property(nonatomic, readonly) int chromaWidth;
|
||||
@property(nonatomic, readonly) int chromaHeight;
|
||||
@property(nonatomic, readonly) const uint8_t *dataY;
|
||||
@property(nonatomic, readonly) const uint8_t *dataU;
|
||||
@property(nonatomic, readonly) const uint8_t *dataV;
|
||||
@property(nonatomic, readonly) int strideY;
|
||||
@property(nonatomic, readonly) int strideU;
|
||||
@property(nonatomic, readonly) int strideV;
|
||||
|
||||
- (instancetype)initWithWidth:(int)width
|
||||
height:(int)height
|
||||
dataY:(const uint8_t *)dataY
|
||||
dataU:(const uint8_t *)dataU
|
||||
dataV:(const uint8_t *)dataV;
|
||||
- (instancetype)initWithWidth:(int)width height:(int)height;
|
||||
- (instancetype)initWithWidth:(int)width
|
||||
height:(int)height
|
||||
strideY:(int)strideY
|
||||
strideU:(int)strideU
|
||||
strideV:(int)strideV;
|
||||
|
||||
@end
|
||||
|
||||
/** Extension of the YUV planar data buffer with mutable data access */
|
||||
@protocol RTCMutableYUVPlanarBuffer <RTCYUVPlanarBuffer>
|
||||
|
||||
@property(nonatomic, readonly) uint8_t *mutableDataY;
|
||||
@property(nonatomic, readonly) uint8_t *mutableDataU;
|
||||
@property(nonatomic, readonly) uint8_t *mutableDataV;
|
||||
|
||||
@end
|
||||
|
||||
/** Protocol for RTCYUVPlanarBuffers containing I420 data */
|
||||
@protocol RTCI420Buffer <RTCYUVPlanarBuffer>
|
||||
@end
|
||||
|
||||
/** Extension of the I420 buffer with mutable data access */
|
||||
@protocol RTCMutableI420Buffer <RTCI420Buffer, RTCMutableYUVPlanarBuffer>
|
||||
@end
|
||||
|
||||
/** RTCVideoFrameBuffer containing a CVPixelBufferRef */
|
||||
RTC_EXPORT
|
||||
@interface RTCCVPixelBuffer : NSObject <RTCVideoFrameBuffer>
|
||||
|
||||
@property(nonatomic, readonly) CVPixelBufferRef pixelBuffer;
|
||||
@property(nonatomic, readonly) int cropX;
|
||||
@property(nonatomic, readonly) int cropY;
|
||||
@property(nonatomic, readonly) int cropWidth;
|
||||
@property(nonatomic, readonly) int cropHeight;
|
||||
|
||||
+ (NSSet<NSNumber *> *)supportedPixelFormats;
|
||||
|
||||
- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer;
|
||||
- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer
|
||||
adaptedWidth:(int)adaptedWidth
|
||||
adaptedHeight:(int)adaptedHeight
|
||||
cropWidth:(int)cropWidth
|
||||
cropHeight:(int)cropHeight
|
||||
cropX:(int)cropX
|
||||
cropY:(int)cropY;
|
||||
|
||||
- (BOOL)requiresCropping;
|
||||
- (BOOL)requiresScalingToWidth:(int)width height:(int)height;
|
||||
- (int)bufferSizeForCroppingAndScalingToWidth:(int)width height:(int)height;
|
||||
|
||||
/** The minimum size of the |tmpBuffer| must be the number of bytes returned from the
|
||||
* bufferSizeForCroppingAndScalingToWidth:height: method.
|
||||
* If that size is 0, the |tmpBuffer| may be nil.
|
||||
*/
|
||||
- (BOOL)cropAndScaleTo:(CVPixelBufferRef)outputPixelBuffer
|
||||
withTempBuffer:(nullable uint8_t *)tmpBuffer;
|
||||
|
||||
@end
|
||||
|
||||
/** RTCI420Buffer implements the RTCI420Buffer protocol */
|
||||
RTC_EXPORT
|
||||
@interface RTCI420Buffer : NSObject <RTCI420Buffer>
|
||||
@end
|
||||
|
||||
/** Mutable version of RTCI420Buffer */
|
||||
RTC_EXPORT
|
||||
@interface RTCMutableI420Buffer : RTCI420Buffer <RTCMutableI420Buffer>
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#if TARGET_OS_IPHONE
|
||||
#import <UIKit/UIKit.h>
|
||||
#endif
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class RTCVideoFrame;
|
||||
|
||||
RTC_EXPORT
|
||||
@protocol RTCVideoRenderer <NSObject>
|
||||
|
||||
/** The size of the frame. */
|
||||
- (void)setSize:(CGSize)size;
|
||||
|
||||
/** The frame to be displayed. */
|
||||
- (void)renderFrame:(nullable RTCVideoFrame *)frame;
|
||||
|
||||
@end
|
||||
|
||||
RTC_EXPORT
|
||||
@protocol RTCVideoViewDelegate
|
||||
|
||||
- (void)videoView:(id<RTCVideoRenderer>)videoView didChangeVideoSize:(CGSize)size;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
#import <WebRTC/RTCMediaSource.h>
|
||||
#import <WebRTC/RTCVideoCapturer.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
RTC_EXPORT
|
||||
|
||||
@interface RTCVideoSource : RTCMediaSource <RTCVideoCapturerDelegate>
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Calling this function will cause frames to be scaled down to the
|
||||
* requested resolution. Also, frames will be cropped to match the
|
||||
* requested aspect ratio, and frames will be dropped to match the
|
||||
* requested fps. The requested aspect ratio is orientation agnostic and
|
||||
* will be adjusted to maintain the input orientation, so it doesn't
|
||||
* matter if e.g. 1280x720 or 720x1280 is requested.
|
||||
*/
|
||||
- (void)adaptOutputFormatToWidth:(int)width height:(int)height fps:(int)fps;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <WebRTC/RTCMediaStreamTrack.h>
|
||||
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol RTCVideoRenderer;
|
||||
@class RTCPeerConnectionFactory;
|
||||
@class RTCVideoSource;
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCVideoTrack : RTCMediaStreamTrack
|
||||
|
||||
/** The video source for this video track. */
|
||||
@property(nonatomic, readonly) RTCVideoSource *source;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/** Register a renderer that will render all frames received on this track. */
|
||||
- (void)addRenderer:(id<RTCVideoRenderer>)renderer;
|
||||
|
||||
/** Deregister a renderer. */
|
||||
- (void)removeRenderer:(id<RTCVideoRenderer>)renderer;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <WebRTC/RTCVideoFrame.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* RTCVideoViewShading provides a way for apps to customize the OpenGL(ES) shaders used in
|
||||
* rendering for the RTCEAGLVideoView/RTCNSGLVideoView.
|
||||
*/
|
||||
RTC_EXPORT
|
||||
@protocol RTCVideoViewShading <NSObject>
|
||||
|
||||
/** Callback for I420 frames. Each plane is given as a texture. */
|
||||
- (void)applyShadingForFrameWithWidth:(int)width
|
||||
height:(int)height
|
||||
rotation:(RTCVideoRotation)rotation
|
||||
yPlane:(GLuint)yPlane
|
||||
uPlane:(GLuint)uPlane
|
||||
vPlane:(GLuint)vPlane;
|
||||
|
||||
/** Callback for NV12 frames. Each plane is given as a texture. */
|
||||
- (void)applyShadingForFrameWithWidth:(int)width
|
||||
height:(int)height
|
||||
rotation:(RTCVideoRotation)rotation
|
||||
yPlane:(GLuint)yPlane
|
||||
uvPlane:(GLuint)uvPlane;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,81 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
typedef NS_ENUM(NSInteger, RTCDeviceType) {
|
||||
RTCDeviceTypeUnknown,
|
||||
RTCDeviceTypeIPhone1G,
|
||||
RTCDeviceTypeIPhone3G,
|
||||
RTCDeviceTypeIPhone3GS,
|
||||
RTCDeviceTypeIPhone4,
|
||||
RTCDeviceTypeIPhone4Verizon,
|
||||
RTCDeviceTypeIPhone4S,
|
||||
RTCDeviceTypeIPhone5GSM,
|
||||
RTCDeviceTypeIPhone5GSM_CDMA,
|
||||
RTCDeviceTypeIPhone5CGSM,
|
||||
RTCDeviceTypeIPhone5CGSM_CDMA,
|
||||
RTCDeviceTypeIPhone5SGSM,
|
||||
RTCDeviceTypeIPhone5SGSM_CDMA,
|
||||
RTCDeviceTypeIPhone6Plus,
|
||||
RTCDeviceTypeIPhone6,
|
||||
RTCDeviceTypeIPhone6S,
|
||||
RTCDeviceTypeIPhone6SPlus,
|
||||
RTCDeviceTypeIPhone7,
|
||||
RTCDeviceTypeIPhone7Plus,
|
||||
RTCDeviceTypeIPhoneSE,
|
||||
RTCDeviceTypeIPhone8,
|
||||
RTCDeviceTypeIPhone8Plus,
|
||||
RTCDeviceTypeIPhoneX,
|
||||
RTCDeviceTypeIPodTouch1G,
|
||||
RTCDeviceTypeIPodTouch2G,
|
||||
RTCDeviceTypeIPodTouch3G,
|
||||
RTCDeviceTypeIPodTouch4G,
|
||||
RTCDeviceTypeIPodTouch5G,
|
||||
RTCDeviceTypeIPodTouch6G,
|
||||
RTCDeviceTypeIPad,
|
||||
RTCDeviceTypeIPad2Wifi,
|
||||
RTCDeviceTypeIPad2GSM,
|
||||
RTCDeviceTypeIPad2CDMA,
|
||||
RTCDeviceTypeIPad2Wifi2,
|
||||
RTCDeviceTypeIPadMiniWifi,
|
||||
RTCDeviceTypeIPadMiniGSM,
|
||||
RTCDeviceTypeIPadMiniGSM_CDMA,
|
||||
RTCDeviceTypeIPad3Wifi,
|
||||
RTCDeviceTypeIPad3GSM_CDMA,
|
||||
RTCDeviceTypeIPad3GSM,
|
||||
RTCDeviceTypeIPad4Wifi,
|
||||
RTCDeviceTypeIPad4GSM,
|
||||
RTCDeviceTypeIPad4GSM_CDMA,
|
||||
RTCDeviceTypeIPad5,
|
||||
RTCDeviceTypeIPad6,
|
||||
RTCDeviceTypeIPadAirWifi,
|
||||
RTCDeviceTypeIPadAirCellular,
|
||||
RTCDeviceTypeIPadAirWifiCellular,
|
||||
RTCDeviceTypeIPadAir2,
|
||||
RTCDeviceTypeIPadMini2GWifi,
|
||||
RTCDeviceTypeIPadMini2GCellular,
|
||||
RTCDeviceTypeIPadMini2GWifiCellular,
|
||||
RTCDeviceTypeIPadMini3,
|
||||
RTCDeviceTypeIPadMini4,
|
||||
RTCDeviceTypeIPadPro9Inch,
|
||||
RTCDeviceTypeIPadPro12Inch,
|
||||
RTCDeviceTypeIPadPro12Inch2,
|
||||
RTCDeviceTypeIPadPro10Inch,
|
||||
RTCDeviceTypeSimulatori386,
|
||||
RTCDeviceTypeSimulatorx86_64,
|
||||
};
|
||||
|
||||
@interface UIDevice (RTCDevice)
|
||||
|
||||
+ (RTCDeviceType)deviceType;
|
||||
+ (BOOL)isIOS11OrLater;
|
||||
|
||||
@end
|
||||
@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright 2018 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <WebRTC/RTCAudioSession.h>
|
||||
#import <WebRTC/RTCVideoCodec.h>
|
||||
#import <WebRTC/RTCVideoCodecFactory.h>
|
||||
#import <WebRTC/RTCAudioSessionConfiguration.h>
|
||||
#import <WebRTC/RTCAudioSource.h>
|
||||
#import <WebRTC/RTCAudioTrack.h>
|
||||
#import <WebRTC/RTCCameraVideoCapturer.h>
|
||||
#import <WebRTC/RTCCameraPreviewView.h>
|
||||
#import <WebRTC/RTCConfiguration.h>
|
||||
#import <WebRTC/RTCDataChannel.h>
|
||||
#import <WebRTC/RTCDataChannelConfiguration.h>
|
||||
#import <WebRTC/RTCDispatcher.h>
|
||||
#import <WebRTC/RTCEAGLVideoView.h>
|
||||
#import <WebRTC/RTCFieldTrials.h>
|
||||
#import <WebRTC/RTCFileVideoCapturer.h>
|
||||
#import <WebRTC/RTCIceCandidate.h>
|
||||
#import <WebRTC/RTCIceServer.h>
|
||||
#import <WebRTC/RTCIntervalRange.h>
|
||||
#import <WebRTC/RTCLegacyStatsReport.h>
|
||||
#import <WebRTC/RTCLogging.h>
|
||||
#import <WebRTC/RTCMacros.h>
|
||||
#import <WebRTC/RTCMediaConstraints.h>
|
||||
#import <WebRTC/RTCMediaSource.h>
|
||||
#import <WebRTC/RTCMediaStream.h>
|
||||
#import <WebRTC/RTCMediaStreamTrack.h>
|
||||
#import <WebRTC/RTCMetrics.h>
|
||||
#import <WebRTC/RTCMetricsSampleInfo.h>
|
||||
#import <WebRTC/RTCPeerConnection.h>
|
||||
#import <WebRTC/RTCPeerConnectionFactory.h>
|
||||
#import <WebRTC/RTCPeerConnectionFactoryOptions.h>
|
||||
#import <WebRTC/RTCRtpCodecParameters.h>
|
||||
#import <WebRTC/RTCRtpEncodingParameters.h>
|
||||
#import <WebRTC/RTCRtpParameters.h>
|
||||
#import <WebRTC/RTCRtpReceiver.h>
|
||||
#import <WebRTC/RTCRtpSender.h>
|
||||
#import <WebRTC/RTCRtpTransceiver.h>
|
||||
#import <WebRTC/RTCDtmfSender.h>
|
||||
#import <WebRTC/RTCSSLAdapter.h>
|
||||
#import <WebRTC/RTCSessionDescription.h>
|
||||
#import <WebRTC/RTCTracing.h>
|
||||
#import <WebRTC/RTCVideoCapturer.h>
|
||||
#import <WebRTC/RTCVideoCodecH264.h>
|
||||
#import <WebRTC/RTCVideoFrame.h>
|
||||
#import <WebRTC/RTCVideoFrameBuffer.h>
|
||||
#import <WebRTC/RTCVideoRenderer.h>
|
||||
#import <WebRTC/RTCVideoSource.h>
|
||||
#import <WebRTC/RTCVideoTrack.h>
|
||||
#import <WebRTC/RTCVideoViewShading.h>
|
||||
#import <WebRTC/UIDevice+RTCDevice.h>
|
||||
#import <WebRTC/RTCVideoDecoderVP8.h>
|
||||
#import <WebRTC/RTCVideoDecoderVP9.h>
|
||||
#import <WebRTC/RTCVideoEncoderVP8.h>
|
||||
#import <WebRTC/RTCVideoEncoderVP9.h>
|
||||
#import <WebRTC/RTCCallbackLogger.h>
|
||||
#import <WebRTC/RTCFileLogger.h>
|
||||
#import <WebRTC/RTCMTLVideoView.h>
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -1,6 +0,0 @@
|
||||
framework module WebRTC {
|
||||
umbrella header "WebRTC.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
Binary file not shown.
@ -1,35 +0,0 @@
|
||||
## WebRTC Build Details
|
||||
|
||||
To track down potential future issues, we log some of our build environment details.
|
||||
|
||||
webrtc git branch:
|
||||
(HEAD detached at 202c6e9519)
|
||||
|
||||
webrtc git sha:
|
||||
202c6e951949a913609151ebce91ff4437d8c4f1
|
||||
|
||||
build_script git sha:
|
||||
e799057d050b88545b625de79770a4c6186accc7
|
||||
|
||||
xcodebuild -version:
|
||||
Xcode 9.4.1
|
||||
Build version 9F2000
|
||||
|
||||
xcode-select -p:
|
||||
/Applications/Xcode.app/Contents/Developer
|
||||
|
||||
gcc -v:
|
||||
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/c++/4.2.1
|
||||
Apple LLVM version 9.1.0 (clang-902.0.39.2)
|
||||
Target: x86_64-apple-darwin17.6.0
|
||||
Thread model: posix
|
||||
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
|
||||
|
||||
osx_version_details:
|
||||
ProductName: Mac OS X
|
||||
ProductVersion: 10.13.5
|
||||
BuildVersion: 17F77
|
||||
|
||||
hostname:
|
||||
oak.local
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
* PromiseKit version: **major version is enough unless you have a build issue**
|
||||
* Xcode version: **only required for build issues**
|
||||
* CocoaPods version: **only required for build issues**
|
||||
* Carthage version: **only required for build issues**
|
||||
|
||||
> Please format your code in triple backticks and delete this line before submitting your ticket. Failure to remove this line may result in mockery.
|
||||
6
Checkouts/PromiseKit/.gitignore
vendored
6
Checkouts/PromiseKit/.gitignore
vendored
@ -1,6 +0,0 @@
|
||||
*.xcodeproj/**/xcuserdata/
|
||||
*.xcscmblueprint
|
||||
/Carthage
|
||||
/Cartfile.resolved
|
||||
/.build
|
||||
.DS_Store
|
||||
63
Checkouts/PromiseKit/.gitmodules
vendored
63
Checkouts/PromiseKit/.gitmodules
vendored
@ -1,63 +0,0 @@
|
||||
[submodule "Extensions/Foundation"]
|
||||
path = Extensions/Foundation
|
||||
url = https://github.com/PromiseKit/Foundation.git
|
||||
[submodule "Extensions/UIKit"]
|
||||
path = Extensions/UIKit
|
||||
url = https://github.com/PromiseKit/UIKit.git
|
||||
[submodule "Extensions/Accounts"]
|
||||
path = Extensions/Accounts
|
||||
url = https://github.com/PromiseKit/Accounts.git
|
||||
[submodule "Extensions/MessagesUI"]
|
||||
path = Extensions/MessagesUI
|
||||
url = https://github.com/PromiseKit/MessagesUI.git
|
||||
[submodule "Extensions/WatchConnectivity"]
|
||||
path = Extensions/WatchConnectivity
|
||||
url = https://github.com/PromiseKit/WatchConnectivity.git
|
||||
[submodule "Extensions/Photos"]
|
||||
path = Extensions/Photos
|
||||
url = https://github.com/PromiseKit/Photos.git
|
||||
[submodule "Extensions/MapKit"]
|
||||
path = Extensions/MapKit
|
||||
url = https://github.com/PromiseKit/MapKit.git
|
||||
[submodule "Extensions/CloudKit"]
|
||||
path = Extensions/CloudKit
|
||||
url = https://github.com/PromiseKit/CloudKit.git
|
||||
[submodule "Extensions/AddressBook"]
|
||||
path = Extensions/AddressBook
|
||||
url = https://github.com/PromiseKit/AddressBook.git
|
||||
[submodule "Extensions/AssetsLibrary"]
|
||||
path = Extensions/AssetsLibrary
|
||||
url = https://github.com/PromiseKit/AssetsLibrary.git
|
||||
[submodule "Extensions/CoreLocation"]
|
||||
path = Extensions/CoreLocation
|
||||
url = https://github.com/PromiseKit/CoreLocation.git
|
||||
[submodule "Extensions/QuartzCore"]
|
||||
path = Extensions/QuartzCore
|
||||
url = https://github.com/PromiseKit/QuartzCore.git
|
||||
[submodule "Extensions/Social"]
|
||||
path = Extensions/Social
|
||||
url = https://github.com/PromiseKit/Social.git
|
||||
[submodule "Extensions/StoreKit"]
|
||||
path = Extensions/StoreKit
|
||||
url = https://github.com/PromiseKit/StoreKit.git
|
||||
[submodule "Extensions/Bolts"]
|
||||
path = Extensions/Bolts
|
||||
url = https://github.com/PromiseKit/Bolts.git
|
||||
[submodule "Extensions/CoreBluetooth"]
|
||||
path = Extensions/CoreBluetooth
|
||||
url = https://github.com/PromiseKit/CoreBluetooth.git
|
||||
[submodule "Extensions/EventKit"]
|
||||
path = Extensions/EventKit
|
||||
url = https://github.com/PromiseKit/EventKit.git
|
||||
[submodule "Extensions/SystemConfiguration"]
|
||||
path = Extensions/SystemConfiguration
|
||||
url = https://github.com/PromiseKit/SystemConfiguration
|
||||
[submodule "Extensions/Alamofire"]
|
||||
path = Extensions/Alamofire
|
||||
url = https://github.com/PromiseKit/Alamofire
|
||||
[submodule "Extensions/OMGHTTPURLRQ"]
|
||||
path = Extensions/OMGHTTPURLRQ
|
||||
url = https://github.com/PromiseKit/OMGHTTPURLRQ
|
||||
[submodule "Extensions/AVFoundation"]
|
||||
path = Extensions/AVFoundation
|
||||
url = https://github.com/PromiseKit/AVFoundation
|
||||
@ -1,29 +0,0 @@
|
||||
module: PromiseKit
|
||||
author: Max Howell
|
||||
author_url: http://mxcl.github.io
|
||||
github_url: https://github.com/mxcl/PromiseKit
|
||||
exclude:
|
||||
- README.markdown
|
||||
- Sources/dispatch_promise.m
|
||||
- Sources/DispatchQueue+Promise.swift
|
||||
- Sources/URLDataPromise.swift
|
||||
- Sources/Zalgo.swift
|
||||
- Sources/Error.swift
|
||||
root_url: http://promisekit.org/docs/handbook/
|
||||
theme: fullwidth
|
||||
hide_documentation_coverage: true
|
||||
skip_undocumented: true
|
||||
|
||||
custom_categories:
|
||||
- name: Classes
|
||||
children:
|
||||
- Promise
|
||||
- AnyPromise
|
||||
|
||||
- name: Functions
|
||||
children:
|
||||
- when(fulfilled:)
|
||||
- when(resolved:)
|
||||
- firstly(execute:)
|
||||
- race(promises:)
|
||||
- after(interval:)
|
||||
@ -1,129 +0,0 @@
|
||||
matrix:
|
||||
include:
|
||||
- os: osx
|
||||
language: objective-c
|
||||
osx_image: xcode9.1
|
||||
env: SWFT=4.0 PLAT=macOS
|
||||
- os: osx
|
||||
language: objective-c
|
||||
osx_image: xcode9.1
|
||||
env: SWFT=4.0 PLAT=iOS
|
||||
- os: osx
|
||||
language: objective-c
|
||||
osx_image: xcode9.1
|
||||
env: SWFT=4.0 PLAT=tvOS
|
||||
- os: osx
|
||||
language: objective-c
|
||||
osx_image: xcode9.1
|
||||
env: SWFT=4.0 PLAT=watchOS
|
||||
|
||||
- os: osx
|
||||
language: objective-c
|
||||
osx_image: xcode9.1
|
||||
env: SWFT=3.2 PLAT=macOS
|
||||
- os: osx
|
||||
language: objective-c
|
||||
osx_image: xcode9.1
|
||||
env: SWFT=3.2 PLAT=iOS
|
||||
- os: osx
|
||||
language: objective-c
|
||||
osx_image: xcode9.1
|
||||
env: SWFT=3.2 PLAT=tvOS
|
||||
- os: osx
|
||||
language: objective-c
|
||||
osx_image: xcode9.1
|
||||
env: SWFT=3.2 PLAT=watchOS
|
||||
|
||||
- os: osx
|
||||
language: objective-c
|
||||
osx_image: xcode8.3
|
||||
env: SWFT=3.1 PLAT=macOS
|
||||
- os: osx
|
||||
language: objective-c
|
||||
osx_image: xcode8.3
|
||||
env: SWFT=3.1 PLAT=iOS
|
||||
- os: osx
|
||||
language: objective-c
|
||||
osx_image: xcode8.3
|
||||
env: SWFT=3.1 PLAT=tvOS
|
||||
- os: osx
|
||||
language: objective-c
|
||||
osx_image: xcode8.3
|
||||
env: SWFT=3.1 PLAT=watchOS
|
||||
|
||||
- os: osx
|
||||
language: objective-c
|
||||
osx_image: xcode8.2
|
||||
env: SWFT=3.0 PLAT=macOS
|
||||
- os: osx
|
||||
language: objective-c
|
||||
osx_image: xcode8.2
|
||||
env: SWFT=3.0 PLAT=iOS
|
||||
- os: osx
|
||||
language: objective-c
|
||||
osx_image: xcode8.2
|
||||
env: SWFT=3.0 PLAT=tvOS
|
||||
- os: osx
|
||||
language: objective-c
|
||||
osx_image: xcode8.2
|
||||
env: SWFT=3.0 PLAT=watchOS
|
||||
|
||||
- os: osx
|
||||
language: objective-c
|
||||
osx_image: xcode8.1
|
||||
env: SWFT=3.0 PLAT=macOS
|
||||
- os: osx
|
||||
language: objective-c
|
||||
osx_image: xcode8.1
|
||||
env: SWFT=3.0 PLAT=iOS
|
||||
- os: osx
|
||||
language: objective-c
|
||||
osx_image: xcode8.1
|
||||
env: SWFT=3.0 PLAT=tvOS
|
||||
- os: osx
|
||||
language: objective-c
|
||||
osx_image: xcode8.1
|
||||
env: SWFT=3.0 PLAT=watchOS
|
||||
|
||||
- os: linux
|
||||
dist: trusty
|
||||
sudo: required
|
||||
services: docker
|
||||
env: DOCKER_IMAGE=swift:3.1
|
||||
|
||||
#TODO please help us test Linux with Swift 3.0, 3.2 and 4.0
|
||||
|
||||
before_install:
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
|
||||
docker pull $DOCKER_IMAGE;
|
||||
fi;
|
||||
case $PLAT in
|
||||
iOS)
|
||||
NAME="iPhone SE";;
|
||||
tvOS)
|
||||
NAME="Apple TV 1080p";;
|
||||
watchOS)
|
||||
NAME="Apple Watch - 38mm";;
|
||||
esac;
|
||||
if [ -n "$NAME" ]; then
|
||||
export UUID=$(instruments -s | ruby -e "ARGF.each_line{ |ln| ln =~ /$NAME .* \[(.*)\]/; if \$1; puts(\$1); exit; end }");
|
||||
fi
|
||||
script:
|
||||
- set -o pipefail;
|
||||
case $PLAT in
|
||||
macOS)
|
||||
xcodebuild -scheme PromiseKit -quiet build SWIFT_VERSION=$SWFT -enableCodeCoverage YES | xcpretty;
|
||||
xcodebuild -scheme PromiseKit -quiet test;;
|
||||
iOS|tvOS)
|
||||
open -b com.apple.iphonesimulator --args -CurrentDeviceUDID "$UUID";
|
||||
xcodebuild -scheme PromiseKit -quiet -destination "id=$UUID" build SWIFT_VERSION=$SWFT -enableCodeCoverage YES | xcpretty;
|
||||
xcodebuild -scheme PromiseKit -quiet -destination "id=$UUID" test;;
|
||||
watchOS)
|
||||
xcodebuild -scheme PromiseKit -quiet -destination "id=$UUID" -quiet clean build SWIFT_VERSION=$SWFT | xcpretty;;
|
||||
*)
|
||||
docker-compose run PromiseKit;;
|
||||
esac
|
||||
after_success:
|
||||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
||||
bash <(curl -s https://codecov.io/bash);
|
||||
fi
|
||||
@ -1,75 +0,0 @@
|
||||
# [4.0.0](https://github.com/mxcl/PromiseKit/releases/tag/4.0.0)
|
||||
|
||||
* [PromiseKit 4 announcement post](http://promisekit.org/news/2016/09/PromiseKit-4.0-Released/).
|
||||
|
||||
# [3.4.3](https://github.com/mxcl/PromiseKit/releases/tag/3.4.3) Aug 7th, 2016
|
||||
|
||||
* Fix regression to UIViewController extension introduced in 3.4.0
|
||||
|
||||
# [3.2.1](https://github.com/mxcl/PromiseKit/releases/tag/3.2.1) Jul 10th, 2016
|
||||
|
||||
* Critical fix for archiving projects using our NSNotificationCenter Swift extension
|
||||
* Additional fixes from the community
|
||||
|
||||
# [3.2.0](https://github.com/mxcl/PromiseKit/releases/tag/3.2.0) May 20th, 2016
|
||||
|
||||
* A new EventKit category
|
||||
* Ability to change the global queue for promises
|
||||
* Ability to define a custom queue for `error`
|
||||
* Documentation and other various fixes
|
||||
|
||||
# [3.1.1](https://github.com/mxcl/PromiseKit/releases/tag/3.1.1) Apr 6th, 2016
|
||||
|
||||
* Temporary aliases to disambiguate `error` the property and function
|
||||
* Fix for edge cases when dismissing a promised view controller
|
||||
* Various minor fixes
|
||||
|
||||
# [3.1.0](https://github.com/mxcl/PromiseKit/releases/tag/3.1.0) Mar 26th, 2016
|
||||
|
||||
* Swift 2.2 support plus additional improvements from the community.
|
||||
|
||||
# [3.0.3](https://github.com/mxcl/PromiseKit/releases/tag/3.0.3) Feb 29th, 2016
|
||||
|
||||
* AnyPromise bridging to NSString and objc BOOL plus additional improvements from the community.
|
||||
|
||||
# [3.0.2](https://github.com/mxcl/PromiseKit/releases/tag/3.0.2) Jan 31st, 2016
|
||||
|
||||
* tvOS support
|
||||
|
||||
# [3.0.1](https://github.com/mxcl/PromiseKit/releases/tag/3.0.1) Jan 14th, 2016
|
||||
|
||||
* Minor fixes and improvements from the community.
|
||||
|
||||
# [3.0.0](https://github.com/mxcl/PromiseKit/releases/tag/3.0.0) Oct 1st, 2015
|
||||
|
||||
In Swift 2.0 `catch` and `defer` became reserved keywords mandating we rename our functions with these names. This forced a major semantic version change on PromiseKit and thus we took the opportunity to make other minor (source compatibility breaking) improvements.
|
||||
|
||||
Thus if you cannot afford to adapt to PromiseKit 3 but still want to use Xcode-7.0/Swift-2.0 we provide a [minimal changes branch] where `catch` and `defer` are renamed `catch_` and `defer_` and all other changes are the bare minimum to make PromiseKit 2 compile against Swift 2.
|
||||
|
||||
If you still are using Xcode 6 and Swift 1.2 then use PromiseKit 2.
|
||||
|
||||
[minimal changes branch]: https://github.com/mxcl/PromiseKit/tree/swift-2.0-minimal-changes
|
||||
|
||||
# [2.0](https://github.com/mxcl/PromiseKit/releases/tag/2.0.0) May 14th, 2015
|
||||
|
||||
[PromiseKit 2 announcement post](http://promisekit.org/news/2015/05/PromiseKit-2.0-Released/).
|
||||
|
||||
# [1.5.0](https://github.com/mxcl/PromiseKit/releases/tag/1.5.0)
|
||||
|
||||
Swift 1.2 support. Xcode 6.3 required.
|
||||
|
||||
# [1.4.1](https://github.com/mxcl/PromiseKit/releases/tag/1.4.1)
|
||||
|
||||
* Added a `race()` function to the Swift branch.
|
||||
* Improved the zalgoness of `thenUnleashZalgo()`.
|
||||
* Split the Swift CocoaPods out so it is completely modular like the objc version.
|
||||
|
||||
# [1.4.0](https://github.com/mxcl/PromiseKit/releases/tag/1.4.0)
|
||||
|
||||
Fixes abound. An additional set of features is a series of new constructors designed to make wrapping existing asynchronous systems easier. Check out `promiseWithAdapter` and company at [cocoadocs.org].
|
||||
|
||||
[cocoadocs.org]: (http://cocoadocs.org/docsets/PromiseKit/1.4.0/)
|
||||
|
||||
# [1.3.1](https://github.com/mxcl/PromiseKit/releases/tag/1.3.1)
|
||||
|
||||
The 1.3.1 tag has been pushed, but only for Carthage users. CocoaPods will skip this version most likely with a 1.3.2 release in the near future.
|
||||
@ -1,69 +0,0 @@
|
||||
# Common Misusage
|
||||
|
||||
## Doubling Up Promises
|
||||
|
||||
Don’t do this:
|
||||
|
||||
```swift
|
||||
func toggleNetworkSpinnerWithPromise<T>(funcToCall: () -> Promise<T>) -> Promise<T> {
|
||||
return Promise { fulfill, reject in
|
||||
firstly {
|
||||
setNetworkActivityIndicatorVisible(true)
|
||||
return funcToCall()
|
||||
}.then { result in
|
||||
fulfill(result)
|
||||
}.always {
|
||||
setNetworkActivityIndicatorVisible(false)
|
||||
}.catch { err in
|
||||
reject(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Do this:
|
||||
|
||||
```swift
|
||||
func toggleNetworkSpinnerWithPromise<T>(funcToCall: () -> Promise<T>) -> Promise<T> {
|
||||
return firstly {
|
||||
setNetworkActivityIndicatorVisible(true)
|
||||
return funcToCall()
|
||||
}.always {
|
||||
setNetworkActivityIndicatorVisible(false)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You already *had* a promise, you don’t need to wrap it in another promise.
|
||||
|
||||
|
||||
## Optionals in Promises
|
||||
|
||||
Mostly when we see `Promise<Item?>` it implies a misuse of promises, for
|
||||
example:
|
||||
|
||||
```swift
|
||||
return firstly {
|
||||
getItems()
|
||||
}.then { items -> Promise<[Item]?> in
|
||||
guard !items.isEmpty else {
|
||||
return Promise(value: nil)
|
||||
}
|
||||
return Promise(value: items)
|
||||
}
|
||||
```
|
||||
|
||||
The second `then` chooses to return `nil` in some circumstances. This imposes
|
||||
the `nil` check on the consumer of this promise. Instead create an specific
|
||||
error type for this condition:
|
||||
|
||||
```swift
|
||||
return firstly {
|
||||
getItems()
|
||||
}.then { items -> Promise<[Item]> in
|
||||
guard !items.isEmpty else {
|
||||
throw MyError.emptyItems
|
||||
}
|
||||
return items
|
||||
}
|
||||
```
|
||||
@ -1,431 +0,0 @@
|
||||
# Common Patterns
|
||||
|
||||
One feature of promises that makes them so useful is that thet are composable;
|
||||
enabling complex, yet safe asynchronous patterns that would otherwise be quite
|
||||
intimidating with traditional methods.
|
||||
|
||||
|
||||
## Chaining
|
||||
|
||||
The most common pattern with promises is chaining:
|
||||
|
||||
```swift
|
||||
firstly {
|
||||
fetch()
|
||||
}.then {
|
||||
map($0)
|
||||
}.then {
|
||||
set($0)
|
||||
return animate()
|
||||
}.ensure {
|
||||
cleanup()
|
||||
}.catch {
|
||||
handle(error: $0)
|
||||
}
|
||||
```
|
||||
|
||||
If you return a promise in a `then` the next `then` *waits* on that promise
|
||||
before continuing. This is the essence of promises.
|
||||
|
||||
Composing promises is easy, and they thus encourage you to develop great apps
|
||||
without fear for the typical spaghetti (and associated refactoring pains) of
|
||||
asynchronous systems that use completion handlers.
|
||||
|
||||
|
||||
## APIs That Use Promises
|
||||
|
||||
Promises are composable, return them instead of providing completion blocks:
|
||||
|
||||
```swift
|
||||
class MyRestAPI {
|
||||
func user() -> Promise<User> {
|
||||
return URLSession.shared.dataTask(url).asDictionary().then { dict in
|
||||
return User(dict: dict)
|
||||
}
|
||||
}
|
||||
|
||||
func avatar() -> Promise<UIImage> {
|
||||
return user().then { user in
|
||||
URLSession.shared.dataTask(user.imageUrl)
|
||||
}.then {
|
||||
UIImage(data: $0)
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This way, your asynchronous systems can easily be engaged in chains all over
|
||||
your apps.
|
||||
|
||||
|
||||
## Background Work
|
||||
|
||||
```swift
|
||||
class MyRestAPI {
|
||||
func avatar() -> Promise<UIImage> {
|
||||
let bgq = DispatchQueue.global(qos: .userInitiated)
|
||||
|
||||
return user().then(on: bgq) { user in
|
||||
URLSession.shared.dataTask(user.imageUrl)
|
||||
}.then(on: bgq) {
|
||||
UIImage(data: $0)
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
All PromiseKit handlers take an `on` parameter allowing you to choose the queue
|
||||
the handler executes upon. The default is always the main queue.
|
||||
|
||||
PromiseKit is *entirely* thread safe.
|
||||
|
||||
|
||||
## Failing Chains
|
||||
|
||||
If an error occurs mid chain, simply throw:
|
||||
|
||||
```swift
|
||||
foo().then { baz in
|
||||
return bar(baz)
|
||||
}.then { result in
|
||||
if result.isBad { throw MyError.myIssue }
|
||||
//…
|
||||
return doOtherThing()
|
||||
}
|
||||
```
|
||||
|
||||
The error will surface at the next `catch` handler.
|
||||
|
||||
Thus if you call a throwing function, you don't have to wrap it in a `do`:
|
||||
|
||||
```swift
|
||||
foo().then { baz in
|
||||
return bar(baz)
|
||||
}.then { result in
|
||||
return try doOtherThing()
|
||||
}.catch { error in
|
||||
// if doOtherThing() throws, we end up here
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Abstracting Away Asychronicity
|
||||
|
||||
```switch
|
||||
var fetch = API.fetch()
|
||||
|
||||
override func viewDidAppear() {
|
||||
fetch.then { items in
|
||||
//…
|
||||
}
|
||||
}
|
||||
|
||||
func buttonPressed() {
|
||||
fetch.then { items in
|
||||
//…
|
||||
}
|
||||
}
|
||||
|
||||
func refresh() {
|
||||
// ensure only one fetch operation happens at a time
|
||||
|
||||
if fetch.isResolved {
|
||||
startSpinner()
|
||||
fetch = API.fetch().ensure {
|
||||
stopSpinner()
|
||||
}
|
||||
}
|
||||
return fetch
|
||||
}
|
||||
```
|
||||
|
||||
With promises you don’t need to worry about *when* your asynchronous operation
|
||||
finishes: act like it already has.
|
||||
|
||||
> Above we can see that you can call `then` as many times on a promise as you
|
||||
> like, they will all be executed in the order they were added.
|
||||
|
||||
|
||||
## Chaining Sequences
|
||||
|
||||
When you have a series of tasks to perform on an array of data:
|
||||
|
||||
```swift
|
||||
// fade all visible table cells one by one in a “cascading” effect
|
||||
|
||||
let fade = Promise()
|
||||
for cell in tableView.visibleCells {
|
||||
fade = fade.then {
|
||||
UIView.promise(animateWithDuration:0.1) {
|
||||
cell.alpha = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
fade.then {
|
||||
//finish
|
||||
}
|
||||
```
|
||||
|
||||
Note *usually* you want `when()` since `when` executes all the promises in
|
||||
parallel and thus is much faster to complete. Use the above pattern in
|
||||
situations where tasks *must* be done sequentially; animation is a good example.
|
||||
|
||||
|
||||
## Timeout
|
||||
|
||||
```swift
|
||||
let fetches: [Promise<T>] = makeFetches()
|
||||
let timeout = after(seconds: 4)
|
||||
|
||||
race(when(fulfilled: fetches).asVoid(), timeout).then {
|
||||
//…
|
||||
}
|
||||
```
|
||||
|
||||
`race` continues as soon as one of the promises it watches finishes.
|
||||
|
||||
> Common pitfalls: ensure the promises you pass to `race` are the same type.
|
||||
> The easiest way to ensure this is using `asVoid()`.
|
||||
|
||||
> Please note if any promise you pass rejects, then `race` will be rejected.
|
||||
|
||||
|
||||
## Cancellation
|
||||
|
||||
Promises don’t have a `cancel` function, but they do support cancellation via a
|
||||
special error type that conforms to the `CancellableError` protocol.
|
||||
|
||||
```swift
|
||||
func foo() -> (Promise<Void>, cancel: () -> Void) {
|
||||
var cancelme = false
|
||||
|
||||
let promise = Promise<Void> { fulfill, reject in
|
||||
let task = Task(…)
|
||||
let cancel = {
|
||||
cancelme = true
|
||||
task.cancel()
|
||||
reject(NSError.cancelledError)
|
||||
}
|
||||
task.completion = { value in
|
||||
guard !cancelme else { reject(NSError.cancelledError) }
|
||||
fulfill(value)
|
||||
task.start()
|
||||
}
|
||||
|
||||
return (promise, cancel)
|
||||
}
|
||||
```
|
||||
|
||||
> Promises don’t have a cancel function because you don’t want code outside of
|
||||
> your control to be able to cancel your operations *unless* you explicitly want
|
||||
> that. In cases where you want it, then it varies how it should work depending
|
||||
> on how the underlying task supports cancellation. Thus we have provided
|
||||
> primitives but not concrete API.
|
||||
|
||||
Cancelled chains do not call a `catch` handler by default. However you can
|
||||
intercept cancellation if you like:
|
||||
|
||||
```swift
|
||||
foo.then {
|
||||
//…
|
||||
}.catch(policy: .allErrorsIncludingCancellation) {
|
||||
// cancelled errors are handled *as well*
|
||||
}
|
||||
```
|
||||
|
||||
**Important**, canceling the chain is *not* the same as canceling the underlying
|
||||
asynchronous task. Promises are a wrapper around asynchronicity but they have no
|
||||
control over the underlying tasks. If you need to cancel the underlying task you
|
||||
need to cancel the underlying task!
|
||||
|
||||
## Retry / Polling
|
||||
|
||||
```swift
|
||||
func attempt<T>(interdelay: DispatchTimeInterval = .seconds(2), maxRepeat: Int = 3, body: @escaping () -> Promise<T>) -> Promise<T> {
|
||||
var attempts = 0
|
||||
func attempt() -> Promise<T> {
|
||||
attempts += 1
|
||||
return body().recover { error -> Promise<T> in
|
||||
guard attempts < maxRepeat else { throw error }
|
||||
|
||||
return after(interval: interdelay).then {
|
||||
return attempt()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return attempt()
|
||||
}
|
||||
|
||||
attempt{ flakeyTask() }.then {
|
||||
//…
|
||||
}.catch { _ in
|
||||
// we attempted three times but still failed
|
||||
}
|
||||
```
|
||||
|
||||
Probably you should supplement the above so that you only re-attempt for
|
||||
specific error conditions.
|
||||
|
||||
|
||||
## Wrapping Delegate Systems
|
||||
|
||||
Be careful with Promises and delegate systems as they are not always suited.
|
||||
Promises complete *once* where most delegate systems call their callbacks many
|
||||
times. This is why, for example, there is no PromiseKit extension for a
|
||||
`UIButton`.
|
||||
|
||||
A good example of an appropriate time to wrap delegation is when you need a
|
||||
single `CLLocation` lookup:
|
||||
|
||||
```swift
|
||||
extension CLLocationManager {
|
||||
static func promise() -> Promise<CLLocation> {
|
||||
return PMKCLLocationManagerProxy().promise
|
||||
}
|
||||
}
|
||||
|
||||
class PMKCLLocationManagerProxy: NSObject, CLLocationManagerDelegate {
|
||||
private let (promise, fulfill, reject) = Promise<[CLLocation]>.pending()
|
||||
private var retainCycle: PMKCLLocationManagerProxy?
|
||||
private let manager = CLLocationManager()
|
||||
|
||||
init() {
|
||||
super.init()
|
||||
retainCycle = self
|
||||
manager.delegate = self // does not retain hence the `retainCycle` property
|
||||
|
||||
promise.ensure {
|
||||
// ensure we break the retain cycle
|
||||
self.retainCycle = nil
|
||||
}
|
||||
}
|
||||
|
||||
@objc fileprivate func locationManager(_: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
|
||||
fulfill(locations)
|
||||
}
|
||||
|
||||
@objc func locationManager(_: CLLocationManager, didFailWithError error: Error) {
|
||||
reject(error)
|
||||
}
|
||||
}
|
||||
|
||||
// use:
|
||||
|
||||
CLLocationManager.promise().then { locations in
|
||||
//…
|
||||
}.catch { error in
|
||||
//…
|
||||
}
|
||||
```
|
||||
|
||||
> Please note, we provide this promise with our CoreLocation extensions at
|
||||
> https://github.com/PromiseKit/CoreLocation
|
||||
|
||||
|
||||
## Recovery
|
||||
|
||||
Sometimes you don’t want an error to cascade, instead you have a default value:
|
||||
|
||||
```
|
||||
CLLocationManager.promise().recover { error -> CLLocation in
|
||||
guard error == MyError.airplaneMode else {
|
||||
throw error
|
||||
}
|
||||
return CLLocation.savannah
|
||||
}.then { location in
|
||||
//…
|
||||
}
|
||||
```
|
||||
|
||||
Be careful not to ignore all errors; recover only those errors that make sense.
|
||||
|
||||
|
||||
## Promises for modal view-controllers
|
||||
|
||||
```swift
|
||||
class ViewController: UIViewController {
|
||||
|
||||
private let (promise, seal) = Promise<…>.pending()
|
||||
|
||||
func show(in: UIViewController) -> Promise<…> {
|
||||
in.show(self, sender: in)
|
||||
return promise
|
||||
}
|
||||
|
||||
func done() {
|
||||
dismiss(animated: true)
|
||||
seal(…)
|
||||
}
|
||||
}
|
||||
|
||||
// use:
|
||||
|
||||
ViewController().show(in: self).then {
|
||||
//…
|
||||
}.catch { error in
|
||||
//…
|
||||
}
|
||||
```
|
||||
|
||||
This is the best approach we have found, which is a pity as it requires the
|
||||
presentee to control the presentation and the presentee to be dismiss itself
|
||||
explicitly.
|
||||
|
||||
Nothing seemingly can beat Storyboard segues for decoupling an app's router.
|
||||
|
||||
|
||||
## Saving previous results
|
||||
|
||||
Let’s say you have:
|
||||
|
||||
|
||||
```swift
|
||||
login().then { username in
|
||||
fetch(avatar: username)
|
||||
}.then { image in
|
||||
//…
|
||||
}
|
||||
```
|
||||
|
||||
In the second `then` how can you access `username` as well as `image`?
|
||||
|
||||
The most obvious way is with nesting:
|
||||
|
||||
```swift
|
||||
login().then { username in
|
||||
fetch(avatar: username).then { image in
|
||||
// we have image and username
|
||||
}
|
||||
}.then {
|
||||
// the chain still continues as you'd expect
|
||||
}
|
||||
```
|
||||
|
||||
However you could instead use Swift tuples:
|
||||
|
||||
```swift
|
||||
login().then { username in
|
||||
fetch(avatar: username).then { ($0, username) }
|
||||
}.then { image, username in
|
||||
//…
|
||||
}
|
||||
```
|
||||
|
||||
The above is a quick transforming `then` that simply maps the `Promise<String>`
|
||||
into `Promise<(UIImage, String)>`.
|
||||
|
||||
|
||||
## Waiting on multiple promises whatever their result
|
||||
|
||||
Use `when(resolved:)`:
|
||||
|
||||
```swift
|
||||
when(resolved: a, b).then { (results: [Result<T>]) in
|
||||
// `Result` is an enum of `.fulfilled` or `.rejected`
|
||||
}
|
||||
```
|
||||
|
||||
Generally you don't want this, people ask for it a lot, but usually they
|
||||
actually just want to use `recover` on one of the promises. Usually you don't
|
||||
want to ignore errors. Errors happen, they should be handled.
|
||||
@ -1,131 +0,0 @@
|
||||
# Image Cache with Promises
|
||||
|
||||
Here is an example of a simple image cache that uses promises to simplify the
|
||||
state machine:
|
||||
|
||||
```swift
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
/**
|
||||
* Small (10 images)
|
||||
* Thread-safe
|
||||
* Consolidates multiple requests to the same URLs
|
||||
* Removes stale entries (FIXME well, strictly we may delete while fetching from cache, but this is unlikely and non-fatal)
|
||||
* Completely _ignores_ server caching headers!
|
||||
*/
|
||||
|
||||
private let q = DispatchQueue(label: "org.promisekit.cache.image")
|
||||
private var active: [URL: Promise<Data>] = [:]
|
||||
private var cleanup = Promise()
|
||||
|
||||
|
||||
public func fetch(image url: URL) -> Promise<Data> {
|
||||
var promise: Promise<Data>?
|
||||
q.sync {
|
||||
promise = active[url]
|
||||
}
|
||||
if let promise = promise {
|
||||
return promise
|
||||
}
|
||||
|
||||
q.sync(flags: .barrier) {
|
||||
promise = Promise(.start) {
|
||||
|
||||
let dst = try url.cacheDestination()
|
||||
|
||||
guard !FileManager.default.isReadableFile(atPath: dst.path) else {
|
||||
return Promise(dst)
|
||||
}
|
||||
|
||||
return Promise { seal in
|
||||
URLSession.shared.downloadTask(with: url) { tmpurl, _, error in
|
||||
do {
|
||||
guard let tmpurl = tmpurl else { throw error ?? E.unexpectedError }
|
||||
try FileManager.default.moveItem(at: tmpurl, to: dst)
|
||||
seal.fulfill(dst)
|
||||
} catch {
|
||||
seal.reject(error)
|
||||
}
|
||||
}.resume()
|
||||
}
|
||||
|
||||
}.then(on: .global(QoS: .userInitiated)) {
|
||||
try Data(contentsOf: $0)
|
||||
}
|
||||
|
||||
active[url] = promise
|
||||
|
||||
if cleanup.isFulfilled {
|
||||
cleanup = promise!.asVoid().then(on: .global(QoS: .utility), execute: docleanup)
|
||||
}
|
||||
}
|
||||
|
||||
return promise!
|
||||
}
|
||||
|
||||
public func cached(image url: URL) -> Data? {
|
||||
guard let dst = try? url.cacheDestination() else {
|
||||
return nil
|
||||
}
|
||||
return try? Data(contentsOf: dst)
|
||||
}
|
||||
|
||||
|
||||
public func cache(destination remoteUrl: URL) throws -> URL {
|
||||
return try remoteUrl.cacheDestination()
|
||||
}
|
||||
|
||||
private func cache() throws -> URL {
|
||||
guard let dst = FileManager.default.docs?
|
||||
.appendingPathComponent("Library")
|
||||
.appendingPathComponent("Caches")
|
||||
.appendingPathComponent("cache.img")
|
||||
else {
|
||||
throw E.unexpectedError
|
||||
}
|
||||
|
||||
try FileManager.default.createDirectory(at: dst, withIntermediateDirectories: true, attributes: [:])
|
||||
|
||||
return dst
|
||||
}
|
||||
|
||||
private extension URL {
|
||||
func cacheDestination() throws -> URL {
|
||||
|
||||
var fn = String(hashValue)
|
||||
let ext = pathExtension
|
||||
|
||||
// many of Apple's functions don’t recognize file type
|
||||
// unless we preserve the file extension
|
||||
if !ext.isEmpty {
|
||||
fn += ".\(ext)"
|
||||
}
|
||||
|
||||
return try cache().appendingPathComponent(fn)
|
||||
}
|
||||
}
|
||||
|
||||
enum E: Error {
|
||||
case unexpectedError
|
||||
case noCreationTime
|
||||
}
|
||||
|
||||
private func docleanup() throws {
|
||||
var contents = try FileManager.default
|
||||
.contentsOfDirectory(at: try cache(), includingPropertiesForKeys: [.creationDateKey])
|
||||
.map { url -> (Date, URL) in
|
||||
guard let date = try url.resourceValues(forKeys: [.creationDateKey]).creationDate else {
|
||||
throw E.noCreationTime
|
||||
}
|
||||
return (date, url)
|
||||
}.sorted(by: {
|
||||
$0.0 > $1.0
|
||||
})
|
||||
|
||||
while contents.count > 10 {
|
||||
let rm = contents.popLast()!.1
|
||||
try FileManager.default.removeItem(at: rm)
|
||||
}
|
||||
}
|
||||
````
|
||||
@ -1,20 +0,0 @@
|
||||
Promise(.pending) { seal in
|
||||
URLSession.shared.dataTask(with: rq, completionHandler: { data, rsp, error in
|
||||
if let data = data {
|
||||
seal.fulfill(data)
|
||||
} else if let error = error {
|
||||
if case URLError.badServerResponse = error, let rsp = rsp as? HTTPURLResponse {
|
||||
seal.reject(Error.badResponse(rsp.statusCode))
|
||||
} else {
|
||||
seal.reject(error)
|
||||
}
|
||||
} else {
|
||||
seal.reject(PMKError.invalidCallingConvention)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
enum Error: Swift.Error {
|
||||
case badUrl
|
||||
case badResponse(Int)
|
||||
}
|
||||
@ -1,205 +0,0 @@
|
||||
# FAQ
|
||||
|
||||
## Do I need to worry about retain cycles?
|
||||
|
||||
Generally no, provided the promise completes then all handlers are released thus
|
||||
any references to `self` are also released.
|
||||
|
||||
This does mean that if your chain contains side-effects that you would typically
|
||||
not want to happen after, say, a view controller is popped then you should still
|
||||
use `weak self` (and check for `self == nil`) to prevent any such side-effects.
|
||||
|
||||
[This stackoverflow question](https://stackoverflow.com/questions/39281214/should-i-use-weak-self-in-promisekit-blocks)
|
||||
has some good discussion on the topic.
|
||||
|
||||
## Where should I put my `catch`?
|
||||
|
||||
`catch` deliberately terminates the chain, you should place low in your promise
|
||||
heirarchy: at as root a point as possible. Typically this would be your view
|
||||
controllers where your `catch` can then display a message to the user.
|
||||
|
||||
This means you should be writing one catch for many `then`s and be returning
|
||||
promises without there being `catch` handlers.
|
||||
|
||||
This is obviously a guideline, do what is necessary.
|
||||
|
||||
## How do branched chains work?
|
||||
|
||||
If you have a promise:
|
||||
|
||||
```
|
||||
let promise = foo()
|
||||
```
|
||||
|
||||
And you call `then` twice:
|
||||
|
||||
```
|
||||
promise.then {
|
||||
// branch A
|
||||
}
|
||||
|
||||
promise.then {
|
||||
// branch B
|
||||
}
|
||||
```
|
||||
|
||||
You now have a branched chain. When `promise` resolves both chains receive its
|
||||
value. However the two chains are entirely separate and Swift will prompt you
|
||||
to ensure both have `catch` handlers.
|
||||
|
||||
Probably however you can ignore the catch for one, but be careful in these
|
||||
situations as Swift cannot help you ensure your chains are error handled.
|
||||
|
||||
```
|
||||
promise.then {
|
||||
// branch A
|
||||
}.catch { error in
|
||||
//…
|
||||
}
|
||||
|
||||
_ = promise.then {
|
||||
print("foo")
|
||||
|
||||
// ignoring errors here as print cannot error and we handle errors above
|
||||
}
|
||||
```
|
||||
|
||||
It may be safer to recombine the two branches into a single chain again:
|
||||
|
||||
```
|
||||
let p1 = promise.then {
|
||||
// branch A
|
||||
}
|
||||
|
||||
let p2 = promise.then {
|
||||
// branch B
|
||||
}
|
||||
|
||||
when(fulfilled: p1, p2).catch { error in
|
||||
//…
|
||||
}
|
||||
```
|
||||
|
||||
> It's worth noting that you can add multiple `catch` handlers to a promise too,
|
||||
> and indeed, both will be called if the chain is rejected.
|
||||
|
||||
## Is PromiseKit “heavy”?
|
||||
|
||||
No, PromiseKit is hardly any sources in fact, it is “light-weight”. Any
|
||||
“weight” relative to other promise implementations is 6 years of bug fixes or
|
||||
important things like [Zalgo prevention](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony)
|
||||
that hobby-project implementations don’t consider.
|
||||
|
||||
## Why is debugging hard?
|
||||
|
||||
Because promises always execute via `dispatch` the backtraces you get have less
|
||||
information than is often required to trace the path of execution.
|
||||
|
||||
One solution is (during debugging) to turn off the dispatch:
|
||||
|
||||
```swift
|
||||
// Swift
|
||||
DispatchQueue.default = zalgo
|
||||
|
||||
//ObjC
|
||||
PMKSetDefaultDispatchQueue(zalgo)
|
||||
```
|
||||
|
||||
Don’t leave this is on, we always dispatch to avoid you accidentally writing
|
||||
a common bug pattern: http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony
|
||||
|
||||
## Where is `all()`?
|
||||
|
||||
Some promise libraries provide `all`, we provide `when`, it is the same. `when`
|
||||
was chosen as it is the more common choice which we also think reads better.
|
||||
|
||||
|
||||
## How can I test APIs that return promises?
|
||||
|
||||
You need to use `XCTestExpectation`.
|
||||
|
||||
## Is PromiseKit thread-safe?
|
||||
|
||||
Yes, entirely.
|
||||
|
||||
However the code *you* write in your `then`s might not be!
|
||||
|
||||
Just make sure you don’t access state outside the chain from concurrent queues.
|
||||
By default PromiseKit handlers run on the `main` thread, which is serial, so
|
||||
typically you won't have to worry about this.
|
||||
|
||||
## Why are there separate classes for Objective-C and Swift?
|
||||
|
||||
`Promise<T>` is generic and and thus cannot be represented by Objective-C.
|
||||
|
||||
## Does PromiseKit conform to Promises/A+?
|
||||
|
||||
Yes, we have tests that prove this.
|
||||
|
||||
## How do PromiseKit and RxSwift differ?
|
||||
|
||||
https://github.com/mxcl/PromiseKit/issues/484
|
||||
|
||||
## Why can’t I return from a catch like I can in Javascript?
|
||||
|
||||
Swift demands functions with one purpose, thus we have two error handlers:
|
||||
|
||||
* `catch`: ends the chain and handles errors
|
||||
* `recover`: attempts to recover from errors in a chain
|
||||
|
||||
You want `recover`.
|
||||
|
||||
## When do promises “start”?
|
||||
|
||||
Often people are confused about when Promises “start”. Is it immediately? Is it
|
||||
later? Is it when you call then?
|
||||
|
||||
The answer is: promises do not choose when the underlying task they represent
|
||||
starts. That is up to that task. For example here is the code for a simple
|
||||
promise that wraps Alamofire:
|
||||
|
||||
|
||||
```swift
|
||||
func foo() -> Promise<Any>
|
||||
return Promise { fulfill, reject in
|
||||
Alamofire.request(rq).responseJSON { rsp in
|
||||
if let error = rsp.error {
|
||||
reject(error)
|
||||
} else {
|
||||
fulfill(rsp.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Who chooses when this promise starts? The answer is: Alamofire does and in this
|
||||
case, it “starts” immediately when `foo()` is called.
|
||||
|
||||
## What is a good way to use Firebase with PromiseKit
|
||||
|
||||
There is no good way to use Firebase with PromiseKit. See the next question for rationale.
|
||||
|
||||
The best option is to embed your chain in your firebase handler:
|
||||
|
||||
```
|
||||
foo.observe(.value) { snapshot in
|
||||
firstly {
|
||||
bar(with: snapshot)
|
||||
}.then {
|
||||
baz()
|
||||
}.then {
|
||||
baffle()
|
||||
}.catch {
|
||||
//…
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## I need my `then` to fire multiple times
|
||||
|
||||
Then we’re afraid that you cannot use PromiseKit for that event. Promises only resolve `once`, this is the fundamental nature of promises and is considered a feature since it gives you guarantees about the flow of your chains.
|
||||
|
||||
## My question was not answered
|
||||
|
||||
[Please open a ticket](https://github.com/mxcl/PromiseKit/issues/new).
|
||||
@ -1,348 +0,0 @@
|
||||
# `then`
|
||||
|
||||
Here is a typical promise chain:
|
||||
|
||||
```swift
|
||||
firstly {
|
||||
login()
|
||||
}.then { creds in
|
||||
fetch(avatar: creds.user)
|
||||
}.then { image in
|
||||
self.imageView = image
|
||||
}
|
||||
```
|
||||
|
||||
If this code used completion handlers it would look like this:
|
||||
|
||||
```swift
|
||||
login { creds, error in
|
||||
if let creds = creds {
|
||||
fetch(avatar: creds.user) { image, error in
|
||||
if let image = image else {
|
||||
self.imageView = image
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
`then` *is* just another way to do completion handlers, but it is also quite a bit more. At this
|
||||
initial stage of our understanding it merely helps readability. The promise chain above is easy
|
||||
to read, one asynchronous operation leads into the other, read line by line. It's as close to
|
||||
procedural code as we can easily get with the current state of Swift.
|
||||
|
||||
Let’s compare the signatures of the two login methods:
|
||||
|
||||
```swift
|
||||
func login() -> Promise<Creds>
|
||||
|
||||
// compared with:
|
||||
|
||||
func login(completion: (Creds?, Error?) -> Void)
|
||||
// ^^ ugh. Optionals. Double optionals.
|
||||
```
|
||||
|
||||
The distinction is that with promises your functions returns *promises*. So for each handler in our
|
||||
chain we return a promise. By doing this we can call `then`. Each `then` waits on its promise, so the
|
||||
chains resolve procedurally, one at a time.
|
||||
|
||||
A Promise represents the future value of an asynchronous task. It has a type
|
||||
that represents the type of object it wraps. In the above example `login` is a
|
||||
function that returns a `Promise` that *will* represent an instance of `Creds`.
|
||||
|
||||
---
|
||||
|
||||
You may notice that unlike the completion pattern, the promise chain appear to
|
||||
ignore errors, this is not the case, instead it is the opposite: the promise
|
||||
chain makes error handling more accessible and harder to ignore.
|
||||
|
||||
|
||||
# `catch`
|
||||
|
||||
With promises, errors cascade ensuring your apps are robust and the code,
|
||||
clearer:
|
||||
|
||||
```swift
|
||||
firstly {
|
||||
login()
|
||||
}.then { creds in
|
||||
fetch(avatar: creds.user)
|
||||
}.then { image in
|
||||
self.imageView = image
|
||||
}.catch {
|
||||
// any errors in the whole chain land here
|
||||
}
|
||||
```
|
||||
|
||||
> In fact, Swift emits a warning if you forget to `catch` a chain. But we'll
|
||||
> talk about that more later.
|
||||
|
||||
Promises each are objects that represent individual asychnronous tasks. If those
|
||||
tasks fail their promises become *rejected*. Chains that contain rejected
|
||||
promises skip all subsequent `then`s, instead the next `catch` is executed
|
||||
(strictly, *any* subsequent `catch` handlers).
|
||||
|
||||
For fun let’s compare this pattern with a completion handler equivalent:
|
||||
|
||||
```swift
|
||||
func handle(error: Error) {
|
||||
//…
|
||||
}
|
||||
|
||||
login { creds, error in
|
||||
guard let creds = creds else { return handle(error: error!) }
|
||||
fetch(avatar: creds.user) { image, error in
|
||||
guard let image = image else { return handle(error: error!) }
|
||||
self.imageView.image = image
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Use of `guard` and a consolidated error handler help, but the promise chain’s
|
||||
readability speaks for itself.
|
||||
|
||||
|
||||
# `always`
|
||||
|
||||
We have learned to compose asynchronicity. Next let’s extend our primitives:
|
||||
|
||||
```swift
|
||||
firstly {
|
||||
UIApplication.shared.isNetworkActivityIndicatorVisible = true
|
||||
return login()
|
||||
}.then {
|
||||
fetch(avatar: $0.user)
|
||||
}.then {
|
||||
self.imageView = $0
|
||||
}.always {
|
||||
UIApplication.shared.isNetworkActivityIndicatorVisible = false
|
||||
}.catch {
|
||||
//…
|
||||
}
|
||||
```
|
||||
|
||||
Whatever the outcome in your chain—failure or success—your `always`
|
||||
handler is called.
|
||||
|
||||
For fun let’s compare this pattern with a completion handler equivalent:
|
||||
|
||||
```swift
|
||||
UIApplication.shared.isNetworkActivityIndicatorVisible = true
|
||||
|
||||
func handle(error: Error) {
|
||||
UIApplication.shared.isNetworkActivityIndicatorVisible = false
|
||||
//…
|
||||
}
|
||||
|
||||
login { creds, error in
|
||||
guard let creds = creds else { return handle(error: error!) }
|
||||
fetch(avatar: creds.user) { image, error in
|
||||
guard let image = image else { return handle(error: error!) }
|
||||
self.imageView.image = image
|
||||
UIApplication.shared.isNetworkActivityIndicatorVisible = false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Here it would be trivial for somebody to amend this code and not unset the activity indicator leading to a bug. With
|
||||
promises this is almost impossible, the Swift compiler will resist you supplementing the chain without promises, you
|
||||
almost won’t need to review the pull-requests.
|
||||
|
||||
|
||||
# `when`
|
||||
|
||||
With completion handlers reacting to multiple asycnhronous operations is either
|
||||
slow or hard. Slow means doing it serially:
|
||||
|
||||
```swift
|
||||
operation1 { result1 in
|
||||
operation2 { result2 in
|
||||
finish(result1, result2)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The fast (*parallel*) path code makes the code less clear:
|
||||
|
||||
```swift
|
||||
var result1: …!
|
||||
var result2: …!
|
||||
let group = DispatchGroup()
|
||||
group.enter()
|
||||
group.enter()
|
||||
operation1 {
|
||||
result1 = $0
|
||||
group.leave()
|
||||
}
|
||||
operation2 {
|
||||
result2 = $0
|
||||
group.leave()
|
||||
}
|
||||
group.completion = {
|
||||
finish(result1, result2)
|
||||
}
|
||||
```
|
||||
|
||||
Promises are easier:
|
||||
|
||||
```swift
|
||||
firstly {
|
||||
when(fulfilled: operation1(), operation2())
|
||||
}.then { result1, result2 in
|
||||
//…
|
||||
}
|
||||
```
|
||||
|
||||
`when` takes promises, waits for them to resolve and returns a promise with the results.
|
||||
|
||||
And of course, if any of them fail the chain calls the next `catch`, like *any* promise chain.
|
||||
|
||||
|
||||
# PromiseKit Extensions
|
||||
|
||||
When we made PromiseKit we understood that we wanted to *only* use promises, thus, wherever possible, we offer
|
||||
extensions on top of Apple’s APIs that add promises. For example:
|
||||
|
||||
```swift
|
||||
firstly {
|
||||
CLLocationManager.promise()
|
||||
}.then { location in
|
||||
CLGeocoder.reverseGeocode(location)
|
||||
}.then { placemarks in
|
||||
self.placemark.text = "\(placemarks.first)"
|
||||
}
|
||||
```
|
||||
|
||||
To use these you need to specify subspecs:
|
||||
|
||||
```ruby
|
||||
pod "PromiseKit"
|
||||
pod "PromiseKit/CoreLocation"
|
||||
pod "PromiseKit/MapKit"
|
||||
```
|
||||
|
||||
All our extensions are available at the [PromiseKit organization](https://github.com/PromiseKit) and you should go there
|
||||
to see what is available and to read the sources so that you can read the documentation. We have copiously documented every
|
||||
file and every function.
|
||||
|
||||
|
||||
# Making Promises
|
||||
|
||||
You can get a long way with our extensions, but sometimes you have to start chains of your own. Maybe you have a third party
|
||||
API that doesn’t provide promises, or maybe you wrote your own asynchronous system. Either way, we provide the starting point,
|
||||
and if you were to look at the code of our extensions, you would see it is the same method below as we use ourselves.
|
||||
|
||||
Let’s say we have a method:
|
||||
|
||||
```swift
|
||||
func fetch(completion: (String?, Error?) -> Void)
|
||||
```
|
||||
|
||||
How do we convert this to a promise? Well, it's easy:
|
||||
|
||||
```swift
|
||||
func fetch() -> Promise<String> {
|
||||
return PromiseKit.wrap(fetch) }
|
||||
}
|
||||
```
|
||||
|
||||
For more complicated situations use the root-resolver:
|
||||
|
||||
```swift
|
||||
func fetch() -> Promise<String> {
|
||||
return Promise { fulfill, reject in
|
||||
foo { result, error in
|
||||
if let result = result {
|
||||
fulfill(result)
|
||||
} else if let error = error {
|
||||
reject(error)
|
||||
} else {
|
||||
reject(PMKError.invalidCallingConvention)
|
||||
// ^^ we provide this error so that all paths are handled, even
|
||||
// this path which technically should never happen (but might!)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Note with the above example `PromiseKit.wrap(foo)` *would* have worked.
|
||||
Only use the root-resolver when wrap doesn’t work *or* you need to handle
|
||||
non-typical scenarios.
|
||||
|
||||
# Supplement
|
||||
|
||||
## `firstly`
|
||||
|
||||
Above we kept using `firstly`, but what is it? Well, it is just [syntactic sugar](https://en.wikipedia.org/wiki/Syntactic_sugar),
|
||||
you don’t need it, but it helps make your chains more readable. Instead of:
|
||||
|
||||
```swift
|
||||
firstly {
|
||||
login()
|
||||
}.then { creds in
|
||||
//…
|
||||
}
|
||||
```
|
||||
|
||||
You could just do:
|
||||
|
||||
```swift
|
||||
login().then { creds in
|
||||
//…
|
||||
}
|
||||
```
|
||||
|
||||
Here is a key understanding: `login()` returns `Promise` and all `Promise` have a `then` function.
|
||||
|
||||
Thus, indeed, `firstly` returns `Promise` and, indeed, `then` returns `Promise`, but don’t worry too much about these details. To start
|
||||
with learn the *patterns*, then, when you are ready to advance, learn the underlying architecture.
|
||||
|
||||
## `when` variants
|
||||
|
||||
`when` is one of PromiseKit’s more useful functions, and thus we offer several variants.
|
||||
|
||||
* The default `when` and the one you should typically use is `when(fulfilled:)` this variant waits on all its promises, but if any fail, it fails, and thus the chain *rejects*. It is important to note that all promises in the when *continue*. Promises have *no* control over the tasks they represent, promises are merely are wrapper around tasks.
|
||||
* We provide `when(resolved:)`. This variant waits even if one or more of its promises fails, consequently the result of this promise is an array of `Result<T>`, and consequently this variant requires that all its promises have the same generic type. See our advanced patterns guide for work arounds for this limitation.
|
||||
* We provide `race`, this variant allows you to *race* several promises, whichever finishes first is the result. See our advanced patterns guide for typical usage.
|
||||
|
||||
|
||||
## Swift Closure Inference
|
||||
|
||||
Swift will automatically infer returns and return types for one line closures,
|
||||
thus these are the same:
|
||||
|
||||
```swift
|
||||
foo.then {
|
||||
bar($0)
|
||||
}
|
||||
|
||||
// is the same as:
|
||||
|
||||
foo.then { baz -> Promise<String> in
|
||||
return bar(baz)
|
||||
}
|
||||
```
|
||||
|
||||
Our documentation often omits the `return` for clarity.
|
||||
|
||||
However this is a blessing and a curse, as the Swift compiler often will fail
|
||||
to infer return types. See our [Troubleshooting Guide](Troubleshooting.md) if
|
||||
you require further assistance.
|
||||
|
||||
|
||||
# Further Reading
|
||||
|
||||
The above is the 90% you will use. We **strongly** suggest reading the
|
||||
[sources], though strictly we are only suggesting you read the function
|
||||
documentation, don't worry about the internals. There are numerous little
|
||||
functions that may be useful to you and the documentation for all of the above
|
||||
is more thorough at the source.
|
||||
|
||||
In Xcode don’t forget to `⌥` click on PromiseKit functions to get at this
|
||||
documentation while you are developing.
|
||||
|
||||
Otherwise return to our [contents page](/Documentation).
|
||||
|
||||
|
||||
[sources]: https://github.com/mxcl/PromiseKit/tree/master/Sources
|
||||
@ -1,180 +0,0 @@
|
||||
# Xcode 8 or 9 / Swift 3 or 4
|
||||
|
||||
We recommend CocoaPods.
|
||||
|
||||
## CocoaPods
|
||||
|
||||
```ruby
|
||||
use_frameworks!
|
||||
pod "PromiseKit", "~> 4.4"
|
||||
```
|
||||
|
||||
Since CocoaPods 1.0 you will (probably) need to add the `pod` line to a `target`,
|
||||
eg:
|
||||
|
||||
```ruby
|
||||
use_frameworks!
|
||||
|
||||
target "MyTarget" do
|
||||
pod "PromiseKit", "~> 4.4"
|
||||
end
|
||||
```
|
||||
|
||||
## Carthage
|
||||
|
||||
```ruby
|
||||
github "mxcl/PromiseKit" ~> 4.4
|
||||
```
|
||||
|
||||
## SwiftPM
|
||||
|
||||
```ruby
|
||||
package.dependencies.append(
|
||||
.Package(url: "https://github.com/mxcl/PromiseKit", majorVersion: 4)
|
||||
)
|
||||
```
|
||||
|
||||
## Manually
|
||||
|
||||
You can just drop `PromiseKit.xcodeproj` into your project and then add
|
||||
`PromiseKit.framework` to your app’s embedded frameworks.
|
||||
|
||||
|
||||
# PromiseKit vs. Xcode
|
||||
|
||||
PromiseKit contains Swift, so there have been rev-lock issues with Xcode:
|
||||
|
||||
| PromiseKit | Swift | Xcode | CI Status | Release Notes |
|
||||
| ---------- | -------- | -------- | ------------ | ----------------- |
|
||||
| 5 | 3.x, 4.x | 8.x, 9.x | ![ci-master] | In beta |
|
||||
| 4 | 3.x, 4.x | 8.x, 9.x | ![ci-master] | [2016/09][news-4] |
|
||||
| 3 | 2.x | 7.x, 8.0 | ![ci-swift2] | [2015/10][news-3] |
|
||||
| 2 | 1.x | 7.x | Unsupported | [2015/10][news-3] |
|
||||
| 1† | *N/A* | * | ![ci-legacy] | – |
|
||||
|
||||
|
||||
† PromiseKit 1 is pure Objective-C and thus can be used with any Xcode, it is
|
||||
also your only choice if you need to support iOS 7 or below.
|
||||
|
||||
---
|
||||
|
||||
We also maintain a series of branches to aid migration for PromiseKit 2:
|
||||
|
||||
| Xcode | Swift | PromiseKit | Branch | CI Status |
|
||||
| ----- | ----- | -----------| --------------------------- | --------- |
|
||||
| 8.0 | 2.3 | 2 | [swift-2.3-minimal-changes] | ![ci-23] |
|
||||
| 7.3 | 2.2 | 2 | [swift-2.2-minimal-changes] | ![ci-22] |
|
||||
| 7.2 | 2.2 | 2 | [swift-2.2-minimal-changes] | ![ci-22] |
|
||||
| 7.1 | 2.1 | 2 | [swift-2.0-minimal-changes] | ![ci-20] |
|
||||
| 7.0 | 2.0 | 2 | [swift-2.0-minimal-changes] | ![ci-20] |
|
||||
|
||||
We do **not** usually backport fixes to these branches, but pull-requests are welcome.
|
||||
|
||||
|
||||
## Xcode 8 / Swift 2.3 or Xcode 7
|
||||
|
||||
```ruby
|
||||
# CocoaPods
|
||||
swift_version = "2.3"
|
||||
pod "PromiseKit", "~> 3.5"
|
||||
|
||||
# Carthage
|
||||
github "mxcl/PromiseKit" ~> 3.5
|
||||
```
|
||||
|
||||
|
||||
# PromiseKit 5
|
||||
|
||||
[PromiseKit 5 is experimental and under active development](https://github.com/mxcl/PromiseKit/tree/experimental-5.x).
|
||||
|
||||
|
||||
[travis]: https://travis-ci.org/mxcl/PromiseKit
|
||||
[ci-master]: https://travis-ci.org/mxcl/PromiseKit.svg?branch=master
|
||||
[ci-legacy]: https://travis-ci.org/mxcl/PromiseKit.svg?branch=legacy-1.x
|
||||
[ci-swift2]: https://travis-ci.org/mxcl/PromiseKit.svg?branch=swift-2.x
|
||||
[ci-23]: https://travis-ci.org/mxcl/PromiseKit.svg?branch=swift-2.3-minimal-changes
|
||||
[ci-22]: https://travis-ci.org/mxcl/PromiseKit.svg?branch=swift-2.2-minimal-changes
|
||||
[ci-20]: https://travis-ci.org/mxcl/PromiseKit.svg?branch=swift-2.0-minimal-changes
|
||||
[news-2]: http://promisekit.org/news/2015/05/PromiseKit-2.0-Released/
|
||||
[news-3]: https://github.com/mxcl/PromiseKit/blob/master/CHANGELOG.markdown#300-oct-1st-2015
|
||||
[news-4]: http://promisekit.org/news/2016/09/PromiseKit-4.0-Released/
|
||||
[swift-2.3-minimal-changes]: https://github.com/mxcl/PromiseKit/tree/swift-2.3-minimal-changes
|
||||
[swift-2.2-minimal-changes]: https://github.com/mxcl/PromiseKit/tree/swift-2.2-minimal-changes
|
||||
[swift-2.0-minimal-changes]: https://github.com/mxcl/PromiseKit/tree/swift-2.0-minimal-changes
|
||||
|
||||
|
||||
# Using Git Submodules for PromiseKit’s Extensions
|
||||
|
||||
> Please note, this is a more advanced technique
|
||||
|
||||
If you use CocoaPods and a few PromiseKit extensions then importing PromiseKit
|
||||
causes that module to import all the extension frameworks. Thus if you have an
|
||||
app and a few app-extensions (eg. iOS app, iOS watch extension, iOS Today
|
||||
extension) then all your final products that use PromiseKit will have forced
|
||||
dependencies on all the Apple frameworks that PromiseKit provides extensions
|
||||
for.
|
||||
|
||||
This isn’t that bad, but every framework that loads is overhead and startup
|
||||
time.
|
||||
|
||||
It’s better and worse with Carthage since we build individual micro-frameworks
|
||||
for each PromiseKit-extension, so at least all your final products only link
|
||||
against the Apple frameworks that they actually need. However, Apple have
|
||||
advised that apps only link against “about 12” frameworks for performance
|
||||
reasons, so for Carthage, we are worse off for this metric.
|
||||
|
||||
The solution is to instead only import CorePromise:
|
||||
|
||||
```ruby
|
||||
# CocoaPods
|
||||
pod "PromiseKit/CorePromise"
|
||||
|
||||
# Carthage
|
||||
github "mxcl/PromiseKit"
|
||||
# ^^ for Carthage *only* have this
|
||||
```
|
||||
|
||||
And to use the extensions you need via `git submodules`:
|
||||
|
||||
```
|
||||
git submodule init
|
||||
git submodule add https://github.com/PromiseKit/UIKit Submodules/PMKUIKit
|
||||
```
|
||||
|
||||
Then in Xcode you can add these sources to your targets on a per-target basis.
|
||||
|
||||
Then when you `pod update`, ensure you also update your submodules:
|
||||
|
||||
pod update && git submodule update --recursive --remote
|
||||
|
||||
|
||||
|
||||
# Release History
|
||||
|
||||
## [4.0](https://github.com/mxcl/PromiseKit/releases/tag/4.0.0)
|
||||
|
||||
* [PromiseKit 4 announcement post](http://promisekit.org/news/2016/09/PromiseKit-4.0-Released/).
|
||||
|
||||
## [3.0](https://github.com/mxcl/PromiseKit/releases/tag/3.0.0) Oct 1st, 2015
|
||||
|
||||
In Swift 2.0 `catch` and `defer` became reserved keywords mandating we rename
|
||||
our functions with these names. This forced a major semantic version change on
|
||||
PromiseKit and thus we took the opportunity to make other minor (source
|
||||
compatibility breaking) improvements.
|
||||
|
||||
Thus if you cannot afford to adapt to PromiseKit 3 but still want to use
|
||||
Xcode-7.0/Swift-2.0 we provide a [minimal changes branch] where `catch` and
|
||||
`defer` are renamed `catch_` and `defer_` and all other changes are the bare
|
||||
minimum to make PromiseKit 2 compile against Swift 2.
|
||||
|
||||
If you still are using Xcode 6 and Swift 1.2 then use PromiseKit 2.
|
||||
|
||||
[minimal changes branch]: https://github.com/mxcl/PromiseKit/tree/swift-2.0-minimal-changes
|
||||
|
||||
## [2.0](https://github.com/mxcl/PromiseKit/releases/tag/2.0.0) May 14th, 2015
|
||||
|
||||
[PromiseKit 2 announcement post](http://promisekit.org/news/2015/05/PromiseKit-2.0-Released/).
|
||||
|
||||
## [1.5](https://github.com/mxcl/PromiseKit/releases/tag/1.5.0)
|
||||
|
||||
Swift 1.2 support. Xcode 6.3 required.
|
||||
@ -1,172 +0,0 @@
|
||||
# Objective-C
|
||||
|
||||
PromiseKit has two promise classes:
|
||||
|
||||
* `Promise<T>` (Swift)
|
||||
* `AnyPromise` (Objective-C)
|
||||
|
||||
Each is designed to be an approproate promise implementation for the strong
|
||||
points of its language:
|
||||
|
||||
* `Promise<T>` is strict, defined and precise.
|
||||
* `AnyPromise` is loose and dynamic.
|
||||
|
||||
Unlike most libraries we have extensive bridging support, you can use PromiseKit
|
||||
in mixed projects with mixed language targets and mixed language libraries.
|
||||
|
||||
|
||||
# Using PromiseKit with Objective-C
|
||||
|
||||
`AnyPromise` is our promise class for Objective-C. It behaves almost identically to `Promise<T>` (our Swift promise class).
|
||||
|
||||
```objc
|
||||
myPromise.then(^(NSString *bar){
|
||||
return anotherPromise;
|
||||
}).then(^{
|
||||
//…
|
||||
}).catch(^(NSError *error){
|
||||
//…
|
||||
});
|
||||
```
|
||||
|
||||
You make new promises using `promiseWithResolverBlock`:
|
||||
|
||||
```objc
|
||||
- (AnyPromise *)myPromise {
|
||||
return [AnyPromise promiseWithResolverBlock:^(PMKResolver resolve){
|
||||
resolve(foo); // if foo is an NSError, rejects, else, resolves
|
||||
}];
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
You reject promises by throwing errors:
|
||||
|
||||
```objc
|
||||
myPromise.then(^{
|
||||
@throw [NSError errorWithDomain:domain code:code userInfo:nil];
|
||||
}).catch(^(NSError *error){
|
||||
//…
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
One important feature is the syntactic flexability of your handlers:
|
||||
|
||||
```objc
|
||||
myPromise.then(^{
|
||||
// no parameters is fine
|
||||
});
|
||||
|
||||
myPromise.then(^(id foo){
|
||||
// one parameter is fine
|
||||
});
|
||||
|
||||
myPromise.then(^(id a, id b, id c){
|
||||
// up to three parameter is fine, no crash!
|
||||
});
|
||||
|
||||
myPromise.then(^{
|
||||
return @1; // return anything or nothing, it's fine, no crash
|
||||
});
|
||||
```
|
||||
|
||||
We do runtime inspection of the block you pass to achieve this magic.
|
||||
|
||||
---
|
||||
|
||||
Another important distinction is that the equivalent function to Swift’s `recover` is combined with `AnyPromise`’s `catch`. This is typical to other “dynamic” promise implementations and thus achieves our goal that `AnyPromise` is loose and dynamic while `Promise<T>` is strict and specific.
|
||||
|
||||
A sometimes unexpected consequence of this is that returning nothing from a `catch` *resolves* the returned promise:
|
||||
|
||||
```objc
|
||||
myPromise.catch(^{
|
||||
[UIAlertView …];
|
||||
}).then(^{
|
||||
// always executes!
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Another important distinction is that the `value` property returns even if the promise is rejected, in that case it returns the `NSError` object with which the promise was rejected.
|
||||
|
||||
|
||||
# Bridging Between Objective-C & Swift
|
||||
|
||||
Let’s say you have:
|
||||
|
||||
```objc
|
||||
@interface Foo
|
||||
- (AnyPromise *)myPromise;
|
||||
@end
|
||||
```
|
||||
|
||||
Ensure this interface is included in your bridging header.
|
||||
|
||||
You can now use this in your Swift code:
|
||||
|
||||
```swift
|
||||
let foo = Foo()
|
||||
foo.myPromise.then { (obj: AnyObject?) -> Int in
|
||||
// it is not necessary to specify the type of `obj`
|
||||
// we just do that for demonstrative purposes
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Let’s say you have:
|
||||
|
||||
```swift
|
||||
@objc class Foo: NSObject {
|
||||
func stringPromise() -> Promise<String>
|
||||
func barPromise() -> Promise<Bar>
|
||||
}
|
||||
|
||||
@objc class Bar: NSObject { /*…*/ }
|
||||
```
|
||||
|
||||
Ensure that your project is generating a `…-Swift.h` header so your Objective-C can see your Swift code.
|
||||
|
||||
If you built this and opened the `…-Swift.h` header you would only see this:
|
||||
|
||||
```objc
|
||||
@interface Foo
|
||||
@end
|
||||
|
||||
@interface Bar
|
||||
@end
|
||||
```
|
||||
|
||||
This is because Objective-C cannot import Swift objects that are generic. Thus we need to write some stubs:
|
||||
|
||||
```swift
|
||||
@objc class Foo: NSObject {
|
||||
@objc func stringPromise() -> AnyPromise {
|
||||
return AnyPromise(stringPromise())
|
||||
}
|
||||
@objc func barPromise() -> AnyPromise {
|
||||
return AnyPromise(barPromise())
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If we built this and opened our generated header we would now see:
|
||||
|
||||
```objc
|
||||
@interface Foo
|
||||
- (AnyPromise *)stringPromise;
|
||||
- (AnyPromise *)barPromise;
|
||||
@end
|
||||
|
||||
@interface Bar
|
||||
@end
|
||||
```
|
||||
|
||||
Perfect.
|
||||
|
||||
Note that AnyPromise can only bridge objects that conform to `AnyObject` or derive `NSObject`. This is a limitation of Objective-C.
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
# Contents
|
||||
|
||||
* [README](/README.md)
|
||||
* Handbook
|
||||
* [Getting Started](GettingStarted.md)
|
||||
* [Promises: Common Patterns](CommonPatterns.md)
|
||||
* [Frequently Asked Questions](FAQ.md)
|
||||
* Manual
|
||||
* [Installation Guide](Installation.md)
|
||||
* [Objective-C Guide](ObjectiveC.md)
|
||||
* [Troubleshooting](Troubleshooting.md)
|
||||
* [Appendix](Appendix.md)
|
||||
@ -1,126 +0,0 @@
|
||||
# Troubleshooting
|
||||
|
||||
Sadly, Swift often gives misleading diagnostic messages for compile errors with
|
||||
PromiseKit.
|
||||
|
||||
## Compile Errors
|
||||
|
||||
### Cannot convert return expression of type … to return type AnyPromise
|
||||
|
||||
Specify the return type for the closure. DON’T return `AnyPromise` (unless you
|
||||
wanted to).
|
||||
|
||||
### Missing return in a closure expected to return AnyPromise
|
||||
|
||||
Specify the return type for the closure. DON’T return `AnyPromise` (unless you
|
||||
wanted to).
|
||||
|
||||
### Ambiguous *bar*
|
||||
|
||||
Specify the return type for the closure.
|
||||
|
||||
### Confusing Errors
|
||||
|
||||
The best one I saw lately was *`UIImage` is not convertible to `UIImage?`*…
|
||||
|
||||
Swift’s diagnostic reporting will be flat-out misleading and wrong inside
|
||||
complicated closures, and with PromiseKit we have a lot of those.
|
||||
|
||||
When specifying the `return` types doesn’t help try the advice in the next
|
||||
section:
|
||||
|
||||
## Pain Free Swift Promises
|
||||
|
||||
The best way is to appease Swift is to decompose your chains into separated
|
||||
local functions. For example:
|
||||
|
||||
```swift
|
||||
func foo() -> Promise<Int>
|
||||
func step1() -> Promise<String> {
|
||||
// many
|
||||
// lines
|
||||
// of
|
||||
// code
|
||||
}
|
||||
|
||||
func step2() -> Promise<Int> {
|
||||
// many
|
||||
// lines
|
||||
// of
|
||||
// code
|
||||
}
|
||||
|
||||
return firstly {
|
||||
step1()
|
||||
}.then {
|
||||
step2()
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Otherwise try to always have your chain return to something that specifies the
|
||||
promise type. This is easy when you are writing functions that return promises,
|
||||
and in general this is what you should aim for anyway: because it makes your
|
||||
promises more composable.
|
||||
|
||||
When you return promises from functions that specify the return type Swift can
|
||||
infer the types properly and it makes writing chains that much easier.
|
||||
|
||||
## Neither `catch` or `then` are called in my chain
|
||||
|
||||
Check something didn’t throw a `CancellableError`. Easiest way is to amend your
|
||||
`catch`:
|
||||
|
||||
```swift
|
||||
foo.then {
|
||||
//…
|
||||
}.catch(policy: .allErrorsIncludingCancellation) {
|
||||
// cancelled errors are handled *as well*
|
||||
}
|
||||
```
|
||||
|
||||
## `Pending Promise Deallocated!`
|
||||
|
||||
If you see this warning you have a path in your `Promise` initializer where
|
||||
neither `fulfill` or `reject` are called:
|
||||
|
||||
```swift
|
||||
Promise<String> { fulfill, reject in
|
||||
task { value, error in
|
||||
if let value = value as? String {
|
||||
fulfill(value)
|
||||
} else if let error = error {
|
||||
reject(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
There are two missing paths here and if either occur the promise will soon be
|
||||
deallocated without resolving. This will show itself as a bug in your app,
|
||||
probably the awful: infinite spinner.
|
||||
|
||||
So let’s be thorough:
|
||||
|
||||
```swift
|
||||
Promise<String> { fulfill, reject in
|
||||
task { value, error in
|
||||
if let value = value as? String {
|
||||
fulfill(value)
|
||||
} else if let error = error {
|
||||
reject(error)
|
||||
} else if value != nil {
|
||||
reject(MyError.valueNotString)
|
||||
} else {
|
||||
// should never happen, but we have an `PMKError` for task being called with `nil`, `nil`
|
||||
reject(PMKError.invalidCallingConvention)
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If this seems tedious it shouldn’t. You would have to be this thorough without promises too, the difference is without promises you wouldn’t get a warning in the console letting you know your mistake!
|
||||
|
||||
## Slow Compilation / Compiler Cannot Solve in Reasonable Time
|
||||
|
||||
Add return types to your closures.
|
||||
@ -1,5 +0,0 @@
|
||||
*.xcodeproj/**/xcuserdata/
|
||||
*.xcscmblueprint
|
||||
/Carthage
|
||||
/Cartfile.resolved
|
||||
/.build
|
||||
@ -1,21 +0,0 @@
|
||||
os: osx
|
||||
language: objective-c
|
||||
matrix:
|
||||
include:
|
||||
- osx_image: xcode8.2
|
||||
env: SWFT=3.0
|
||||
- osx_image: xcode8.3
|
||||
env: SWFT=3.1
|
||||
- osx_image: xcode9
|
||||
env: SWIFT=3.2
|
||||
- osx_image: xcode9
|
||||
env: SWFT=4.0
|
||||
before_install:
|
||||
- export UUID=$(instruments -s | ruby -e "ARGF.each_line{ |ln| ln =~ /iPhone SE .* \[(.*)\]/; if \$1; puts(\$1); exit; end }");
|
||||
install:
|
||||
- carthage bootstrap --platform iOS
|
||||
script:
|
||||
- set -o pipefail;
|
||||
open -a "simulator" --args -CurrentDeviceUDID "$UUID";
|
||||
xcodebuild -scheme PMKAVFoundation SWIFT_VERSION=$SWFT -destination "id=$UUID" -quiet clean build;
|
||||
xcodebuild -scheme PMKAVFoundation -destination "id=$UUID" -quiet test
|
||||
@ -1 +0,0 @@
|
||||
github "mxcl/PromiseKit" ~> 4.0
|
||||
@ -1,7 +0,0 @@
|
||||
// Created by Kevin Ballard on 12/14/15.
|
||||
// Copyright © 2015 Postmates. All rights reserved.
|
||||
|
||||
FRAMEWORK_SEARCH_PATHS[sdk=macosx*] = $(SRCROOT)/Carthage/Build/Mac/ $(inherited)
|
||||
FRAMEWORK_SEARCH_PATHS[sdk=iphone*] = $(SRCROOT)/Carthage/Build/iOS/ $(inherited)
|
||||
FRAMEWORK_SEARCH_PATHS[sdk=watch*] = $(SRCROOT)/Carthage/Build/watchOS/ $(inherited)
|
||||
FRAMEWORK_SEARCH_PATHS[sdk=appletv*] = $(SRCROOT)/Carthage/Build/tvOS/ $(inherited)
|
||||
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@ -1,451 +0,0 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
63C7FFF71D5C020D003BAE60 /* PMKAVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63C7FFA71D5BEE09003BAE60 /* PMKAVFoundation.framework */; };
|
||||
63DD7EF81D7E7411000F279D /* TestAVFoundation.m in Sources */ = {isa = PBXBuildFile; fileRef = 63DD7EF61D7E7411000F279D /* TestAVFoundation.m */; };
|
||||
63DD7EF91D7E7411000F279D /* TestAVFoundation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63DD7EF71D7E7411000F279D /* TestAVFoundation.swift */; };
|
||||
63DD7EFD1D7E7419000F279D /* AVAudioSession+AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 63DD7EFA1D7E7419000F279D /* AVAudioSession+AnyPromise.h */; };
|
||||
63DD7EFE1D7E7419000F279D /* AVAudioSession+AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 63DD7EFB1D7E7419000F279D /* AVAudioSession+AnyPromise.m */; };
|
||||
63DD7EFF1D7E7419000F279D /* AVAudioSession+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63DD7EFC1D7E7419000F279D /* AVAudioSession+Promise.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
63C7FFF81D5C020D003BAE60 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 63C7FF9E1D5BEE09003BAE60 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 63C7FFA61D5BEE09003BAE60;
|
||||
remoteInfo = PMKFoundation;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
63167B891D5C23B4007A96B0 /* Cartfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Cartfile; sourceTree = "<group>"; };
|
||||
63BF28101D5C257100F62C66 /* Carthage.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Carthage.xcconfig; sourceTree = "<group>"; };
|
||||
63C700091D5C0253003BAE60 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
63C7FFA71D5BEE09003BAE60 /* PMKAVFoundation.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PMKAVFoundation.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
63C7FFF21D5C020D003BAE60 /* PMKAVTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PMKAVTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
63DD7EF61D7E7411000F279D /* TestAVFoundation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TestAVFoundation.m; path = Tests/TestAVFoundation.m; sourceTree = SOURCE_ROOT; };
|
||||
63DD7EF71D7E7411000F279D /* TestAVFoundation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TestAVFoundation.swift; path = Tests/TestAVFoundation.swift; sourceTree = SOURCE_ROOT; };
|
||||
63DD7EFA1D7E7419000F279D /* AVAudioSession+AnyPromise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "AVAudioSession+AnyPromise.h"; path = "Sources/AVAudioSession+AnyPromise.h"; sourceTree = SOURCE_ROOT; };
|
||||
63DD7EFB1D7E7419000F279D /* AVAudioSession+AnyPromise.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "AVAudioSession+AnyPromise.m"; path = "Sources/AVAudioSession+AnyPromise.m"; sourceTree = SOURCE_ROOT; };
|
||||
63DD7EFC1D7E7419000F279D /* AVAudioSession+Promise.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "AVAudioSession+Promise.swift"; path = "Sources/AVAudioSession+Promise.swift"; sourceTree = SOURCE_ROOT; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
63C7FFEF1D5C020D003BAE60 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
63C7FFF71D5C020D003BAE60 /* PMKAVFoundation.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
63C7FF9D1D5BEE09003BAE60 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
63167B891D5C23B4007A96B0 /* Cartfile */,
|
||||
63BF28101D5C257100F62C66 /* Carthage.xcconfig */,
|
||||
63C700091D5C0253003BAE60 /* Info.plist */,
|
||||
63C7FFA91D5BEE09003BAE60 /* Sources */,
|
||||
63C7FFF31D5C020D003BAE60 /* Tests */,
|
||||
63C7FFA81D5BEE09003BAE60 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
63C7FFA81D5BEE09003BAE60 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
63C7FFA71D5BEE09003BAE60 /* PMKAVFoundation.framework */,
|
||||
63C7FFF21D5C020D003BAE60 /* PMKAVTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
63C7FFA91D5BEE09003BAE60 /* Sources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
63DD7EFA1D7E7419000F279D /* AVAudioSession+AnyPromise.h */,
|
||||
63DD7EFB1D7E7419000F279D /* AVAudioSession+AnyPromise.m */,
|
||||
63DD7EFC1D7E7419000F279D /* AVAudioSession+Promise.swift */,
|
||||
);
|
||||
name = Sources;
|
||||
path = "PMK+UIKit";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
63C7FFF31D5C020D003BAE60 /* Tests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
63DD7EF61D7E7411000F279D /* TestAVFoundation.m */,
|
||||
63DD7EF71D7E7411000F279D /* TestAVFoundation.swift */,
|
||||
);
|
||||
name = Tests;
|
||||
path = PMKTests/NS;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
63C7FFA41D5BEE09003BAE60 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
63DD7EFD1D7E7419000F279D /* AVAudioSession+AnyPromise.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
63C7FFA61D5BEE09003BAE60 /* PMKAVFoundation */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 63C7FFAF1D5BEE09003BAE60 /* Build configuration list for PBXNativeTarget "PMKAVFoundation" */;
|
||||
buildPhases = (
|
||||
63C7FFA21D5BEE09003BAE60 /* Sources */,
|
||||
63C7FFA41D5BEE09003BAE60 /* Headers */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = PMKAVFoundation;
|
||||
productName = "PMK+UIKit";
|
||||
productReference = 63C7FFA71D5BEE09003BAE60 /* PMKAVFoundation.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
63C7FFF11D5C020D003BAE60 /* PMKAVTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 63C7FFFA1D5C020D003BAE60 /* Build configuration list for PBXNativeTarget "PMKAVTests" */;
|
||||
buildPhases = (
|
||||
63C7FFEE1D5C020D003BAE60 /* Sources */,
|
||||
63C7FFEF1D5C020D003BAE60 /* Frameworks */,
|
||||
638F9B161D5EEEDC00717B37 /* Embed Carthage Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
63C7FFF91D5C020D003BAE60 /* PBXTargetDependency */,
|
||||
);
|
||||
name = PMKAVTests;
|
||||
productName = PMKTests/NS;
|
||||
productReference = 63C7FFF21D5C020D003BAE60 /* PMKAVTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
63C7FF9E1D5BEE09003BAE60 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0800;
|
||||
LastUpgradeCheck = 0900;
|
||||
ORGANIZATIONNAME = "Max Howell";
|
||||
TargetAttributes = {
|
||||
63C7FFA61D5BEE09003BAE60 = {
|
||||
CreatedOnToolsVersion = 8.0;
|
||||
LastSwiftMigration = 0900;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
63C7FFF11D5C020D003BAE60 = {
|
||||
CreatedOnToolsVersion = 8.0;
|
||||
LastSwiftMigration = 0900;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 63C7FFA11D5BEE09003BAE60 /* Build configuration list for PBXProject "PMKAVFoundation" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 63C7FF9D1D5BEE09003BAE60;
|
||||
productRefGroup = 63C7FFA81D5BEE09003BAE60 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
63C7FFA61D5BEE09003BAE60 /* PMKAVFoundation */,
|
||||
63C7FFF11D5C020D003BAE60 /* PMKAVTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
638F9B161D5EEEDC00717B37 /* Embed Carthage Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
PromiseKit,
|
||||
);
|
||||
name = "Embed Carthage Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "case \"$PLATFORM_NAME\" in\nmacosx) plat=Mac;;\niphone*) plat=iOS;;\nwatch*) plat=watchOS;;\nappletv*) plat=tvOS;;\n*) echo \"error: Unknown PLATFORM_NAME: $PLATFORM_NAME\"; exit 1;;\nesac\nfor (( n = 0; n < SCRIPT_INPUT_FILE_COUNT; n++ )); do\nVAR=SCRIPT_INPUT_FILE_$n\nframework=$(basename \"${!VAR}\")\nexport SCRIPT_INPUT_FILE_$n=\"$SRCROOT\"/Carthage/Build/$plat/\"$framework\".framework\ndone\n\n/usr/local/bin/carthage copy-frameworks || exit\n\nfor (( n = 0; n < SCRIPT_INPUT_FILE_COUNT; n++ )); do\nVAR=SCRIPT_INPUT_FILE_$n\nsource=${!VAR}.dSYM\ndest=${BUILT_PRODUCTS_DIR}/$(basename \"$source\")\nditto \"$source\" \"$dest\" || exit\ndone";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
63C7FFA21D5BEE09003BAE60 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
63DD7EFF1D7E7419000F279D /* AVAudioSession+Promise.swift in Sources */,
|
||||
63DD7EFE1D7E7419000F279D /* AVAudioSession+AnyPromise.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
63C7FFEE1D5C020D003BAE60 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
63DD7EF81D7E7411000F279D /* TestAVFoundation.m in Sources */,
|
||||
63DD7EF91D7E7411000F279D /* TestAVFoundation.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
63C7FFF91D5C020D003BAE60 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 63C7FFA61D5BEE09003BAE60 /* PMKAVFoundation */;
|
||||
targetProxy = 63C7FFF81D5C020D003BAE60 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
63C7FFAD1D5BEE09003BAE60 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 63BF28101D5C257100F62C66 /* Carthage.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVES = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.promisekit.Foundation;
|
||||
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
TARGETED_DEVICE_FAMILY = "1,2,3,4";
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
WATCHOS_DEPLOYMENT_TARGET = 2.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
63C7FFAE1D5BEE09003BAE60 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 63BF28101D5C257100F62C66 /* Carthage.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVES = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.promisekit.Foundation;
|
||||
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
TARGETED_DEVICE_FAMILY = "1,2,3,4";
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
WATCHOS_DEPLOYMENT_TARGET = 2.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
63C7FFB01D5BEE09003BAE60 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.promisekit.Accounts;
|
||||
PRODUCT_MODULE_NAME = "${TARGET_NAME}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
63C7FFB11D5BEE09003BAE60 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.promisekit.Accounts;
|
||||
PRODUCT_MODULE_NAME = "${TARGET_NAME}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
63C7FFFB1D5C020D003BAE60 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
GCC_WARN_INHIBIT_ALL_WARNINGS = YES;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_SUPPRESS_WARNINGS = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
63C7FFFC1D5C020D003BAE60 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
GCC_WARN_INHIBIT_ALL_WARNINGS = YES;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_SUPPRESS_WARNINGS = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
63C7FFA11D5BEE09003BAE60 /* Build configuration list for PBXProject "PMKAVFoundation" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
63C7FFAD1D5BEE09003BAE60 /* Debug */,
|
||||
63C7FFAE1D5BEE09003BAE60 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
63C7FFAF1D5BEE09003BAE60 /* Build configuration list for PBXNativeTarget "PMKAVFoundation" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
63C7FFB01D5BEE09003BAE60 /* Debug */,
|
||||
63C7FFB11D5BEE09003BAE60 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
63C7FFFA1D5C020D003BAE60 /* Build configuration list for PBXNativeTarget "PMKAVTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
63C7FFFB1D5C020D003BAE60 /* Debug */,
|
||||
63C7FFFC1D5C020D003BAE60 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 63C7FF9E1D5BEE09003BAE60 /* Project object */;
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:/Users/mxcl/Dropbox/Source/PMKX/AVFoundation/PMKAVFoundation.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
@ -1,115 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0900"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "NO"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "63C7FFF11D5C020D003BAE60"
|
||||
BuildableName = "PMKAVTests.xctest"
|
||||
BlueprintName = "PMKAVTests"
|
||||
ReferencedContainer = "container:PMKAVFoundation.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "63C7FFA61D5BEE09003BAE60"
|
||||
BuildableName = "PMKAVFoundation.framework"
|
||||
BlueprintName = "PMKAVFoundation"
|
||||
ReferencedContainer = "container:PMKAVFoundation.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "63C7FFF11D5C020D003BAE60"
|
||||
BuildableName = "PMKAVTests.xctest"
|
||||
BlueprintName = "PMKAVTests"
|
||||
ReferencedContainer = "container:PMKAVFoundation.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "63C7FFA61D5BEE09003BAE60"
|
||||
BuildableName = "PMKAVFoundation.framework"
|
||||
BlueprintName = "PMKAVFoundation"
|
||||
ReferencedContainer = "container:PMKAVFoundation.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "63C7FFA61D5BEE09003BAE60"
|
||||
BuildableName = "PMKAVFoundation.framework"
|
||||
BlueprintName = "PMKAVFoundation"
|
||||
ReferencedContainer = "container:PMKAVFoundation.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "63C7FFA61D5BEE09003BAE60"
|
||||
BuildableName = "PMKAVFoundation.framework"
|
||||
BlueprintName = "PMKAVFoundation"
|
||||
ReferencedContainer = "container:PMKAVFoundation.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@ -1,34 +0,0 @@
|
||||
# PromiseKit AVFoundation Extensions ![Build Status]
|
||||
|
||||
This project adds promises to Apple’s AVFoundation framework.
|
||||
|
||||
## CococaPods
|
||||
|
||||
```ruby
|
||||
pod "PromiseKit/AVFoundation" ~> 4.0
|
||||
```
|
||||
|
||||
The extensions are built into `PromiseKit.framework` thus nothing else is needed.
|
||||
|
||||
## Carthage
|
||||
|
||||
```ruby
|
||||
github "PromiseKit/AVFoundation" ~> 1.0
|
||||
```
|
||||
|
||||
The extensions are built into their own framework:
|
||||
|
||||
```swift
|
||||
// swift
|
||||
import PromiseKit
|
||||
import PMKAVFoundation
|
||||
```
|
||||
|
||||
```objc
|
||||
// objc
|
||||
@import PromiseKit;
|
||||
@import PMKAVFoundation;
|
||||
```
|
||||
|
||||
|
||||
[Build Status]: https://travis-ci.org/PromiseKit/AVFoundation.svg?branch=master
|
||||
@ -1,30 +0,0 @@
|
||||
//
|
||||
// AVFoundation+AnyPromise.h
|
||||
//
|
||||
// Created by Matthew Loseke on 6/21/14.
|
||||
//
|
||||
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
#import <PromiseKit/AnyPromise.h>
|
||||
|
||||
/**
|
||||
To import the `AVAudioSession` category:
|
||||
|
||||
use_frameworks!
|
||||
pod "PromiseKit/AVFoundation"
|
||||
|
||||
And then in your sources:
|
||||
|
||||
#import <PromiseKit/PromiseKit.h>
|
||||
*/
|
||||
@interface AVAudioSession (PromiseKit)
|
||||
|
||||
/**
|
||||
Wraps `-requestRecordPermission:`, thens the `BOOL granted` parameter
|
||||
passed to the wrapped completion block. This promise cannot fail.
|
||||
|
||||
@see requestRecordPermission:
|
||||
*/
|
||||
- (AnyPromise *)requestRecordPermission;
|
||||
|
||||
@end
|
||||
@ -1,21 +0,0 @@
|
||||
//
|
||||
// AVAudioSession+PromiseKit.m
|
||||
//
|
||||
// Created by Matthew Loseke on 6/21/14.
|
||||
//
|
||||
|
||||
#import "AVAudioSession+AnyPromise.h"
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@implementation AVAudioSession (PromiseKit)
|
||||
|
||||
- (AnyPromise *)requestRecordPermission {
|
||||
return [AnyPromise promiseWithResolverBlock:^(PMKResolver resolve) {
|
||||
[[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL granted) {
|
||||
resolve(@(granted));
|
||||
}];
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
@ -1,23 +0,0 @@
|
||||
import AVFoundation
|
||||
import Foundation
|
||||
#if !COCOAPODS
|
||||
import PromiseKit
|
||||
#endif
|
||||
|
||||
/**
|
||||
To import the `AVAudioSession` category:
|
||||
|
||||
use_frameworks!
|
||||
pod "PromiseKit/AVFoundation"
|
||||
|
||||
And then in your sources:
|
||||
|
||||
import PromiseKit
|
||||
*/
|
||||
extension AVAudioSession {
|
||||
public func requestRecordPermission() -> Promise<Bool> {
|
||||
return Promise { fulfill, _ in
|
||||
requestRecordPermission(fulfill)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
#import "AVAudioSession+AnyPromise.h"
|
||||
@import AVFoundation;
|
||||
@import XCTest;
|
||||
|
||||
@implementation Test_AVAudioSession_ObjC: XCTestCase
|
||||
|
||||
- (void)test {
|
||||
id ex = [self expectationWithDescription:@""];
|
||||
|
||||
[[AVAudioSession new] requestRecordPermission].then(^{
|
||||
[ex fulfill];
|
||||
});
|
||||
|
||||
[self waitForExpectationsWithTimeout:1 handler:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
@ -1,16 +0,0 @@
|
||||
import PMKAVFoundation
|
||||
import AVFoundation
|
||||
import PromiseKit
|
||||
import XCTest
|
||||
|
||||
class Test_AVAudioSession_Swift: XCTestCase {
|
||||
func test() {
|
||||
let ex = expectation(description: "")
|
||||
|
||||
AVAudioSession().requestRecordPermission().then { _ in
|
||||
ex.fulfill()
|
||||
}
|
||||
|
||||
waitForExpectations(timeout: 1)
|
||||
}
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
*.xcodeproj/**/xcuserdata/
|
||||
*.xcscmblueprint
|
||||
/Carthage
|
||||
/Cartfile.resolved
|
||||
/.build
|
||||
@ -1,42 +0,0 @@
|
||||
os: osx
|
||||
language: objective-c
|
||||
matrix:
|
||||
include:
|
||||
- osx_image: xcode8.2
|
||||
env: PLAT=macOS SWFT=3.0
|
||||
- osx_image: xcode8.2
|
||||
env: PLAT=iOS SWFT=3.0
|
||||
- osx_image: xcode8.3
|
||||
env: PLAT=macOS SWFT=3.1
|
||||
- osx_image: xcode8.3
|
||||
env: PLAT=iOS SWFT=3.1
|
||||
- osx_image: xcode9
|
||||
env: PLAT=macOS SWFT=3.2
|
||||
- osx_image: xcode9
|
||||
env: PLAT=iOS SWFT=3.2
|
||||
- osx_image: xcode9
|
||||
env: PLAT=macOS SWFT=4.0
|
||||
- osx_image: xcode9
|
||||
env: PLAT=iOS SWFT=4.0
|
||||
before_install:
|
||||
- if [ $PLAT == "iOS" ]; then
|
||||
export UUID=$(instruments -s | ruby -e "ARGF.each_line{ |ln| ln =~ /iPhone SE .* \[(.*)\]/; if \$1; puts(\$1); exit; end }");
|
||||
fi
|
||||
install:
|
||||
- case $PLAT in
|
||||
macOS)
|
||||
carthage bootstrap --platform Mac;;
|
||||
*)
|
||||
carthage bootstrap --platform $PLAT;;
|
||||
esac;
|
||||
script:
|
||||
- set -o pipefail;
|
||||
case $PLAT in
|
||||
macOS)
|
||||
xcodebuild -scheme PMKAccounts -quiet clean build SWIFT_VERSION=$SWFT;
|
||||
xcodebuild -scheme PMKAccounts -quiet test;;
|
||||
iOS)
|
||||
open -b com.apple.iphonesimulator --args -CurrentDeviceUDID "$UUID";
|
||||
xcodebuild -scheme PMKAccounts -destination "id=$UUID" -quiet clean build SWIFT_VERSION=$SWFT;
|
||||
xcodebuild -scheme PMKAccounts -destination "id=$UUID" -quiet test;;
|
||||
esac
|
||||
@ -1 +0,0 @@
|
||||
github "mxcl/PromiseKit" ~> 4.0
|
||||
@ -1,7 +0,0 @@
|
||||
// Created by Kevin Ballard on 12/14/15.
|
||||
// Copyright © 2015 Postmates. All rights reserved.
|
||||
|
||||
FRAMEWORK_SEARCH_PATHS[sdk=macosx*] = $(SRCROOT)/Carthage/Build/Mac/ $(inherited)
|
||||
FRAMEWORK_SEARCH_PATHS[sdk=iphone*] = $(SRCROOT)/Carthage/Build/iOS/ $(inherited)
|
||||
FRAMEWORK_SEARCH_PATHS[sdk=watch*] = $(SRCROOT)/Carthage/Build/watchOS/ $(inherited)
|
||||
FRAMEWORK_SEARCH_PATHS[sdk=appletv*] = $(SRCROOT)/Carthage/Build/tvOS/ $(inherited)
|
||||
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@ -1,443 +0,0 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
63167B841D5C2332007A96B0 /* ACAccountStore+AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 63167B811D5C2332007A96B0 /* ACAccountStore+AnyPromise.h */; };
|
||||
63167B851D5C2332007A96B0 /* ACAccountStore+AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 63167B821D5C2332007A96B0 /* ACAccountStore+AnyPromise.m */; };
|
||||
63167B861D5C2332007A96B0 /* ACAccountStore+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63167B831D5C2332007A96B0 /* ACAccountStore+Promise.swift */; };
|
||||
63167B881D5C233C007A96B0 /* TestAccounts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63167B871D5C233C007A96B0 /* TestAccounts.swift */; };
|
||||
63C7FFF71D5C020D003BAE60 /* PMKAccounts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63C7FFA71D5BEE09003BAE60 /* PMKAccounts.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
63C7FFF81D5C020D003BAE60 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 63C7FF9E1D5BEE09003BAE60 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 63C7FFA61D5BEE09003BAE60;
|
||||
remoteInfo = PMKFoundation;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
63167B811D5C2332007A96B0 /* ACAccountStore+AnyPromise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ACAccountStore+AnyPromise.h"; path = "Sources/ACAccountStore+AnyPromise.h"; sourceTree = SOURCE_ROOT; };
|
||||
63167B821D5C2332007A96B0 /* ACAccountStore+AnyPromise.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "ACAccountStore+AnyPromise.m"; path = "Sources/ACAccountStore+AnyPromise.m"; sourceTree = SOURCE_ROOT; };
|
||||
63167B831D5C2332007A96B0 /* ACAccountStore+Promise.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "ACAccountStore+Promise.swift"; path = "Sources/ACAccountStore+Promise.swift"; sourceTree = SOURCE_ROOT; };
|
||||
63167B871D5C233C007A96B0 /* TestAccounts.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TestAccounts.swift; path = Tests/TestAccounts.swift; sourceTree = SOURCE_ROOT; };
|
||||
63167B891D5C23B4007A96B0 /* Cartfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Cartfile; sourceTree = "<group>"; };
|
||||
63BF28101D5C257100F62C66 /* Carthage.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Carthage.xcconfig; sourceTree = "<group>"; };
|
||||
63C700091D5C0253003BAE60 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
63C7FFA71D5BEE09003BAE60 /* PMKAccounts.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PMKAccounts.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
63C7FFF21D5C020D003BAE60 /* PMKACTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PMKACTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
63C7FFEF1D5C020D003BAE60 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
63C7FFF71D5C020D003BAE60 /* PMKAccounts.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
63C7FF9D1D5BEE09003BAE60 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
63167B891D5C23B4007A96B0 /* Cartfile */,
|
||||
63BF28101D5C257100F62C66 /* Carthage.xcconfig */,
|
||||
63C700091D5C0253003BAE60 /* Info.plist */,
|
||||
63C7FFA91D5BEE09003BAE60 /* Sources */,
|
||||
63C7FFF31D5C020D003BAE60 /* Tests */,
|
||||
63C7FFA81D5BEE09003BAE60 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
63C7FFA81D5BEE09003BAE60 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
63C7FFA71D5BEE09003BAE60 /* PMKAccounts.framework */,
|
||||
63C7FFF21D5C020D003BAE60 /* PMKACTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
63C7FFA91D5BEE09003BAE60 /* Sources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
63167B811D5C2332007A96B0 /* ACAccountStore+AnyPromise.h */,
|
||||
63167B821D5C2332007A96B0 /* ACAccountStore+AnyPromise.m */,
|
||||
63167B831D5C2332007A96B0 /* ACAccountStore+Promise.swift */,
|
||||
);
|
||||
path = Sources;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
63C7FFF31D5C020D003BAE60 /* Tests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
63167B871D5C233C007A96B0 /* TestAccounts.swift */,
|
||||
);
|
||||
path = Tests;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
63C7FFA41D5BEE09003BAE60 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
63167B841D5C2332007A96B0 /* ACAccountStore+AnyPromise.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
63C7FFA61D5BEE09003BAE60 /* PMKAccounts */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 63C7FFAF1D5BEE09003BAE60 /* Build configuration list for PBXNativeTarget "PMKAccounts" */;
|
||||
buildPhases = (
|
||||
63C7FFA21D5BEE09003BAE60 /* Sources */,
|
||||
63C7FFA41D5BEE09003BAE60 /* Headers */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = PMKAccounts;
|
||||
productName = "PMK+UIKit";
|
||||
productReference = 63C7FFA71D5BEE09003BAE60 /* PMKAccounts.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
63C7FFF11D5C020D003BAE60 /* PMKACTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 63C7FFFA1D5C020D003BAE60 /* Build configuration list for PBXNativeTarget "PMKACTests" */;
|
||||
buildPhases = (
|
||||
63C7FFEE1D5C020D003BAE60 /* Sources */,
|
||||
63C7FFEF1D5C020D003BAE60 /* Frameworks */,
|
||||
638F9B161D5EEEDC00717B37 /* Embed Carthage Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
63C7FFF91D5C020D003BAE60 /* PBXTargetDependency */,
|
||||
);
|
||||
name = PMKACTests;
|
||||
productName = PMKTests/NS;
|
||||
productReference = 63C7FFF21D5C020D003BAE60 /* PMKACTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
63C7FF9E1D5BEE09003BAE60 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0800;
|
||||
LastUpgradeCheck = 0900;
|
||||
ORGANIZATIONNAME = "Max Howell";
|
||||
TargetAttributes = {
|
||||
63C7FFA61D5BEE09003BAE60 = {
|
||||
CreatedOnToolsVersion = 8.0;
|
||||
LastSwiftMigration = 0800;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
63C7FFF11D5C020D003BAE60 = {
|
||||
CreatedOnToolsVersion = 8.0;
|
||||
LastSwiftMigration = 0900;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 63C7FFA11D5BEE09003BAE60 /* Build configuration list for PBXProject "PMKAccounts" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 63C7FF9D1D5BEE09003BAE60;
|
||||
productRefGroup = 63C7FFA81D5BEE09003BAE60 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
63C7FFA61D5BEE09003BAE60 /* PMKAccounts */,
|
||||
63C7FFF11D5C020D003BAE60 /* PMKACTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
638F9B161D5EEEDC00717B37 /* Embed Carthage Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
PromiseKit,
|
||||
);
|
||||
name = "Embed Carthage Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "case \"$PLATFORM_NAME\" in\nmacosx) plat=Mac;;\niphone*) plat=iOS;;\nwatch*) plat=watchOS;;\nappletv*) plat=tvOS;;\n*) echo \"error: Unknown PLATFORM_NAME: $PLATFORM_NAME\"; exit 1;;\nesac\nfor (( n = 0; n < SCRIPT_INPUT_FILE_COUNT; n++ )); do\nVAR=SCRIPT_INPUT_FILE_$n\nframework=$(basename \"${!VAR}\")\nexport SCRIPT_INPUT_FILE_$n=\"$SRCROOT\"/Carthage/Build/$plat/\"$framework\".framework\ndone\n\n/usr/local/bin/carthage copy-frameworks || exit\n\nfor (( n = 0; n < SCRIPT_INPUT_FILE_COUNT; n++ )); do\nVAR=SCRIPT_INPUT_FILE_$n\nsource=${!VAR}.dSYM\ndest=${BUILT_PRODUCTS_DIR}/$(basename \"$source\")\nditto \"$source\" \"$dest\" || exit\ndone";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
63C7FFA21D5BEE09003BAE60 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
63167B851D5C2332007A96B0 /* ACAccountStore+AnyPromise.m in Sources */,
|
||||
63167B861D5C2332007A96B0 /* ACAccountStore+Promise.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
63C7FFEE1D5C020D003BAE60 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
63167B881D5C233C007A96B0 /* TestAccounts.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
63C7FFF91D5C020D003BAE60 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 63C7FFA61D5BEE09003BAE60 /* PMKAccounts */;
|
||||
targetProxy = 63C7FFF81D5C020D003BAE60 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
63C7FFAD1D5BEE09003BAE60 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 63BF28101D5C257100F62C66 /* Carthage.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVES = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.promisekit.Foundation;
|
||||
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx";
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
TARGETED_DEVICE_FAMILY = "1,2,3,4";
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
WATCHOS_DEPLOYMENT_TARGET = 2.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
63C7FFAE1D5BEE09003BAE60 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 63BF28101D5C257100F62C66 /* Carthage.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVES = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.promisekit.Foundation;
|
||||
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
TARGETED_DEVICE_FAMILY = "1,2,3,4";
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
WATCHOS_DEPLOYMENT_TARGET = 2.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
63C7FFB01D5BEE09003BAE60 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.promisekit.Accounts;
|
||||
PRODUCT_MODULE_NAME = "${TARGET_NAME}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
63C7FFB11D5BEE09003BAE60 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.promisekit.Accounts;
|
||||
PRODUCT_MODULE_NAME = "${TARGET_NAME}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
63C7FFFB1D5C020D003BAE60 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
GCC_WARN_INHIBIT_ALL_WARNINGS = YES;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_SUPPRESS_WARNINGS = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
63C7FFFC1D5C020D003BAE60 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
GCC_WARN_INHIBIT_ALL_WARNINGS = YES;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_SUPPRESS_WARNINGS = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
63C7FFA11D5BEE09003BAE60 /* Build configuration list for PBXProject "PMKAccounts" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
63C7FFAD1D5BEE09003BAE60 /* Debug */,
|
||||
63C7FFAE1D5BEE09003BAE60 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
63C7FFAF1D5BEE09003BAE60 /* Build configuration list for PBXNativeTarget "PMKAccounts" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
63C7FFB01D5BEE09003BAE60 /* Debug */,
|
||||
63C7FFB11D5BEE09003BAE60 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
63C7FFFA1D5C020D003BAE60 /* Build configuration list for PBXNativeTarget "PMKACTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
63C7FFFB1D5C020D003BAE60 /* Debug */,
|
||||
63C7FFFC1D5C020D003BAE60 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 63C7FF9E1D5BEE09003BAE60 /* Project object */;
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:/Users/mxcl/Desktop/PMK+UIKit/PMKFoundation.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user