mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
fixing screenshare cmake issue for mac
This commit is contained in:
parent
60d074932c
commit
aeab06de53
118 changed files with 6 additions and 8835 deletions
|
@ -185,7 +185,7 @@ if (BUILD_TOOLS AND NPM_EXECUTABLE)
|
|||
add_dependencies(resources jsdoc)
|
||||
endif()
|
||||
|
||||
add_dependencies(${TARGET_NAME} resources)
|
||||
add_dependencies(${TARGET_NAME} resources screenshare)
|
||||
|
||||
if (WIN32)
|
||||
# These are external plugins, but we need to do the 'add dependency' here so that their
|
||||
|
@ -323,6 +323,10 @@ if (APPLE)
|
|||
COMMAND "${CMAKE_COMMAND}" -E copy_directory
|
||||
"${CMAKE_SOURCE_DIR}/scripts"
|
||||
"${RESOURCES_DEV_DIR}/scripts"
|
||||
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_directory
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../screenshare/hifi-screenshare-darwin-x64/hifi-screenshare.app"
|
||||
"${RESOURCES_DEV_DIR}/hifi-screenshare.app"
|
||||
# copy JSDoc files beside the executable
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_directory
|
||||
"${CMAKE_SOURCE_DIR}/tools/jsdoc/out"
|
||||
|
@ -347,7 +351,7 @@ if (APPLE)
|
|||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
||||
"${PROJECT_SOURCE_DIR}/resources/serverless/redirect.json"
|
||||
"${RESOURCES_DEV_DIR}/serverless/redirect.json"
|
||||
)
|
||||
)
|
||||
|
||||
# call the fixup_interface macro to add required bundling commands for installation
|
||||
fixup_interface()
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/Headers
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/Mantle
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/Modules
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/Resources
|
|
@ -1,172 +0,0 @@
|
|||
//
|
||||
// MTLJSONAdapter.h
|
||||
// Mantle
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2013-02-12.
|
||||
// Copyright (c) 2013 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class MTLModel;
|
||||
|
||||
// A MTLModel object that supports being parsed from and serialized to JSON.
|
||||
@protocol MTLJSONSerializing
|
||||
@required
|
||||
|
||||
// Specifies how to map property keys to different key paths in JSON.
|
||||
//
|
||||
// Subclasses overriding this method should combine their values with those of
|
||||
// `super`.
|
||||
//
|
||||
// Any property keys not present in the dictionary are assumed to match the JSON
|
||||
// key that should be used. Any keys associated with NSNull will not participate
|
||||
// in JSON serialization.
|
||||
//
|
||||
// Returns a dictionary mapping property keys to JSON key paths (as strings) or
|
||||
// NSNull values.
|
||||
+ (NSDictionary *)JSONKeyPathsByPropertyKey;
|
||||
|
||||
@optional
|
||||
|
||||
// Specifies how to convert a JSON value to the given property key. If
|
||||
// reversible, the transformer will also be used to convert the property value
|
||||
// back to JSON.
|
||||
//
|
||||
// If the receiver implements a `+<key>JSONTransformer` method, MTLJSONAdapter
|
||||
// will use the result of that method instead.
|
||||
//
|
||||
// Returns a value transformer, or nil if no transformation should be performed.
|
||||
+ (NSValueTransformer *)JSONTransformerForKey:(NSString *)key;
|
||||
|
||||
// Overridden to parse the receiver as a different class, based on information
|
||||
// in the provided dictionary.
|
||||
//
|
||||
// This is mostly useful for class clusters, where the abstract base class would
|
||||
// be passed into -[MTLJSONAdapter initWithJSONDictionary:modelClass:], but
|
||||
// a subclass should be instantiated instead.
|
||||
//
|
||||
// JSONDictionary - The JSON dictionary that will be parsed.
|
||||
//
|
||||
// Returns the class that should be parsed (which may be the receiver), or nil
|
||||
// to abort parsing (e.g., if the data is invalid).
|
||||
+ (Class)classForParsingJSONDictionary:(NSDictionary *)JSONDictionary;
|
||||
|
||||
@end
|
||||
|
||||
// The domain for errors originating from MTLJSONAdapter.
|
||||
extern NSString * const MTLJSONAdapterErrorDomain;
|
||||
|
||||
// +classForParsingJSONDictionary: returned nil for the given dictionary.
|
||||
extern const NSInteger MTLJSONAdapterErrorNoClassFound;
|
||||
|
||||
// The provided JSONDictionary is not valid.
|
||||
extern const NSInteger MTLJSONAdapterErrorInvalidJSONDictionary;
|
||||
|
||||
// The model's implementation of +JSONKeyPathsByPropertyKey included a key which
|
||||
// does not actually exist in +propertyKeys.
|
||||
extern const NSInteger MTLJSONAdapterErrorInvalidJSONMapping;
|
||||
|
||||
// Converts a MTLModel object to and from a JSON dictionary.
|
||||
@interface MTLJSONAdapter : NSObject
|
||||
|
||||
// The model object that the receiver was initialized with, or that the receiver
|
||||
// parsed from a JSON dictionary.
|
||||
@property (nonatomic, strong, readonly) MTLModel<MTLJSONSerializing> *model;
|
||||
|
||||
// Attempts to parse a JSON dictionary into a model object.
|
||||
//
|
||||
// modelClass - The MTLModel subclass to attempt to parse from the JSON.
|
||||
// This class must conform to <MTLJSONSerializing>. This
|
||||
// argument must not be nil.
|
||||
// JSONDictionary - A dictionary representing JSON data. This should match the
|
||||
// format returned by NSJSONSerialization. If this argument is
|
||||
// nil, the method returns nil.
|
||||
// error - If not NULL, this may be set to an error that occurs during
|
||||
// parsing or initializing an instance of `modelClass`.
|
||||
//
|
||||
// Returns an instance of `modelClass` upon success, or nil if a parsing error
|
||||
// occurred.
|
||||
+ (id)modelOfClass:(Class)modelClass fromJSONDictionary:(NSDictionary *)JSONDictionary error:(NSError **)error;
|
||||
|
||||
// Attempts to parse an array of JSON dictionary objects into a model objects
|
||||
// of a specific class.
|
||||
//
|
||||
// modelClass - The MTLModel subclass to attempt to parse from the JSON. This
|
||||
// class must conform to <MTLJSONSerializing>. This argument must
|
||||
// not be nil.
|
||||
// JSONArray - A array of dictionaries representing JSON data. This should
|
||||
// match the format returned by NSJSONSerialization. If this
|
||||
// argument is nil, the method returns nil.
|
||||
// error - If not NULL, this may be set to an error that occurs during
|
||||
// parsing or initializing an any of the instances of
|
||||
// `modelClass`.
|
||||
//
|
||||
// Returns an array of `modelClass` instances upon success, or nil if a parsing
|
||||
// error occurred.
|
||||
+ (NSArray *)modelsOfClass:(Class)modelClass fromJSONArray:(NSArray *)JSONArray error:(NSError **)error;
|
||||
|
||||
// Converts a model into a JSON representation.
|
||||
//
|
||||
// model - The model to use for JSON serialization. This argument must not be
|
||||
// nil.
|
||||
//
|
||||
// Returns a JSON dictionary, or nil if a serialization error occurred.
|
||||
+ (NSDictionary *)JSONDictionaryFromModel:(MTLModel<MTLJSONSerializing> *)model;
|
||||
|
||||
// Converts a array of models into a JSON representation.
|
||||
//
|
||||
// models - The array of models to use for JSON serialization. This argument
|
||||
// must not be nil.
|
||||
//
|
||||
// Returns a JSON array, or nil if a serialization error occurred for any
|
||||
// model.
|
||||
+ (NSArray *)JSONArrayFromModels:(NSArray *)models;
|
||||
|
||||
// Initializes the receiver by attempting to parse a JSON dictionary into
|
||||
// a model object.
|
||||
//
|
||||
// JSONDictionary - A dictionary representing JSON data. This should match the
|
||||
// format returned by NSJSONSerialization. If this argument is
|
||||
// nil, the method returns nil and an error with code
|
||||
// MTLJSONAdapterErrorInvalidJSONDictionary.
|
||||
// modelClass - The MTLModel subclass to attempt to parse from the JSON.
|
||||
// This class must conform to <MTLJSONSerializing>. This
|
||||
// argument must not be nil.
|
||||
// error - If not NULL, this may be set to an error that occurs during
|
||||
// parsing or initializing an instance of `modelClass`.
|
||||
//
|
||||
// Returns an initialized adapter upon success, or nil if a parsing error
|
||||
// occurred.
|
||||
- (id)initWithJSONDictionary:(NSDictionary *)JSONDictionary modelClass:(Class)modelClass error:(NSError **)error;
|
||||
|
||||
// Initializes the receiver with an existing model.
|
||||
//
|
||||
// model - The model to use for JSON serialization. This argument must not be
|
||||
// nil.
|
||||
- (id)initWithModel:(MTLModel<MTLJSONSerializing> *)model;
|
||||
|
||||
// Serializes the receiver's `model` into JSON.
|
||||
//
|
||||
// Returns a JSON dictionary, or nil if a serialization error occurred.
|
||||
- (NSDictionary *)JSONDictionary;
|
||||
|
||||
// Looks up the JSON key path in the model's +propertyKeys.
|
||||
//
|
||||
// Subclasses may override this method to customize the adapter's seralizing
|
||||
// behavior. You should not call this method directly.
|
||||
//
|
||||
// key - The property key to retrieve the corresponding JSON key path for. This
|
||||
// argument must not be nil.
|
||||
//
|
||||
// Returns a key path to use, or nil to omit the property from JSON.
|
||||
- (NSString *)JSONKeyPathForPropertyKey:(NSString *)key;
|
||||
|
||||
@end
|
||||
|
||||
@interface MTLJSONAdapter (Deprecated)
|
||||
|
||||
+ (id)modelOfClass:(Class)modelClass fromJSONDictionary:(NSDictionary *)JSONDictionary __attribute__((deprecated("Replaced by +modelOfClass:fromJSONDictionary:error:")));
|
||||
- (id)initWithJSONDictionary:(NSDictionary *)JSONDictionary modelClass:(Class)modelClass __attribute__((deprecated("Replaced by -initWithJSONDictionary:modelClass:error:")));
|
||||
|
||||
@end
|
|
@ -1,215 +0,0 @@
|
|||
//
|
||||
// MTLManagedObjectAdapter.h
|
||||
// Mantle
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2013-03-29.
|
||||
// Copyright (c) 2013 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <CoreData/CoreData.h>
|
||||
|
||||
@class MTLModel;
|
||||
|
||||
// A MTLModel object that supports being serialized to and from Core Data as an
|
||||
// NSManagedObject.
|
||||
@protocol MTLManagedObjectSerializing
|
||||
@required
|
||||
|
||||
// The name of the Core Data entity that the receiver serializes to and
|
||||
// deserializes from.
|
||||
//
|
||||
// This method must not return nil.
|
||||
+ (NSString *)managedObjectEntityName;
|
||||
|
||||
// Specifies how to map property keys to different keys on the receiver's
|
||||
// +managedObjectEntity.
|
||||
//
|
||||
// Entity attributes will be mapped to and from the receiver's properties using
|
||||
// +entityAttributeTransformerForKey:. Entity relationships will be mapped to
|
||||
// and from MTLModel objects using +relationshipModelClassesByPropertyKey.
|
||||
// Fetched properties are not supported.
|
||||
//
|
||||
// Subclasses overriding this method should combine their values with those of
|
||||
// `super`.
|
||||
//
|
||||
// Any property keys not present in the dictionary are assumed to match the
|
||||
// entity key that should be used. Any keys associated with NSNull will not
|
||||
// participate in managed object serialization.
|
||||
//
|
||||
// Returns a dictionary mapping property keys to entity keys (as strings) or
|
||||
// NSNull values.
|
||||
+ (NSDictionary *)managedObjectKeysByPropertyKey;
|
||||
|
||||
@optional
|
||||
|
||||
// Specifies a set of property keys used by the adapter to check for an already
|
||||
// existing managed object when converting the MTLModel to its related
|
||||
// NSManagedObject.
|
||||
//
|
||||
// The adapter will first map any keys provided by this method to the correct
|
||||
// keys in managedObjectKeysByPropertyKey.
|
||||
//
|
||||
// The adapter will then perform a fetch request in the provided context for a
|
||||
// managed object that matches the MTLModel's managedObjectEntityName and has
|
||||
// equal values set for the property keys on the MTLModel.
|
||||
//
|
||||
// The managed object returned by the fetch request will then be set with all
|
||||
// values from the MTLModel that the managed object is being converted from.
|
||||
//
|
||||
// If a property value of our MTLModel is yet another MTLModel which needs to be
|
||||
// converted to a managed object, the class for that MTLModel can also implement
|
||||
// this method to perform its own uniqing.
|
||||
//
|
||||
// For example:
|
||||
// 1. An MTLModel subclass has id_number = 10.
|
||||
// 2. An NSManagedObject accessible to the adapter's context has idnumber = 10.
|
||||
// 3. managedObjectKeysByPropertyKey returns @{@"id_number" : @"idnumber"}
|
||||
// 4. propertyKeysForManagedObjectUniquing returns
|
||||
// [NSSet setWithObject:@"id_number"];
|
||||
// 5. Then our fetch request may return this managed object (or another managed
|
||||
// object with idnumber = 10).
|
||||
//
|
||||
// NOTE: If multiple managed objects follow the same uniquing criteria only one
|
||||
// of them will be set with our MTLModel's values.
|
||||
+ (NSSet *)propertyKeysForManagedObjectUniquing;
|
||||
|
||||
// Specifies how to convert the given property key to a managed object
|
||||
// attribute. If reversible, the transformer will also be used to convert the
|
||||
// managed object attribute back to the property.
|
||||
//
|
||||
// If the receiver implements a `+<key>EntityAttributeTransformer` method,
|
||||
// MTLManagedObjectAdapter will use the result of that method instead.
|
||||
//
|
||||
// Returns a value transformer, or nil if no transformation should be performed.
|
||||
+ (NSValueTransformer *)entityAttributeTransformerForKey:(NSString *)key;
|
||||
|
||||
// Specifies the MTLModel subclasses that should be deserialized to the
|
||||
// receiver's property keys when a property key corresponds to an entity
|
||||
// relationship.
|
||||
//
|
||||
// In other words, the dictionary returned by this method is used to decode
|
||||
// managed object relationships into MTLModels (or NSArrays or NSSets thereof)
|
||||
// set on the receiver.
|
||||
//
|
||||
// If a property key is omitted from the returned dictionary, but present in
|
||||
// +managedObjectKeysByPropertyKey, and the receiver's +managedObjectEntity has
|
||||
// a relationship at the corresponding key, an exception will be thrown during
|
||||
// deserialization.
|
||||
//
|
||||
// Subclasses overriding this method should combine their values with those of
|
||||
// `super`.
|
||||
//
|
||||
// Returns a dictionary mapping property keys to the Class objects that should
|
||||
// be used.
|
||||
+ (NSDictionary *)relationshipModelClassesByPropertyKey;
|
||||
|
||||
// Overridden to deserialize a different class instead of the receiver, based on
|
||||
// information in the provided object.
|
||||
//
|
||||
// This is mostly useful for class clusters, where the abstract base class would
|
||||
// be passed into +[MTLManagedObjectAdapter
|
||||
// modelOfClass:fromManagedObject:error:], but a subclass should be instantiated
|
||||
// instead.
|
||||
//
|
||||
// managedObject - The object that will be deserialized.
|
||||
//
|
||||
// Returns the class that should be instantiated (which may be the receiver), or
|
||||
// nil to abort parsing (e.g., if the data is invalid).
|
||||
+ (Class)classForDeserializingManagedObject:(NSManagedObject *)managedObject;
|
||||
|
||||
// Overriden when merging the value of the given key on the receiver with the
|
||||
// value of the same key from the given `NSManagedObject` requires custom
|
||||
// handling.
|
||||
//
|
||||
// By default, this method is not implemented, and precedence will be given to
|
||||
// the value of the receiving model implicitly.
|
||||
//
|
||||
// When implemented, this method is called when an existing `NSManagedObject`
|
||||
// is found for the receiving model, before updating the `NSManagedObject`'s
|
||||
// properties.
|
||||
//
|
||||
// When implementing, you should use `+managedObjectKeysByPropertyKey` to map
|
||||
// the given `key` to the appropriate `NSManagedObject` property.
|
||||
- (void)mergeValueForKey:(NSString *)key fromManagedObject:(NSManagedObject *)managedObject;
|
||||
|
||||
// Overriden when merging values on the receiver with the given
|
||||
// `NSManagedObject` requires custom handling.
|
||||
//
|
||||
// By default, this method is not implemented, and precedence will be given to
|
||||
// the values of the receiving model implicitly.
|
||||
//
|
||||
// When implemented, this method is called when an existing `NSManagedObject`
|
||||
// is found for the receiving model, before updating the `NSManagedObject`'s
|
||||
// properties.
|
||||
//
|
||||
// When implementing, you should use `+managedObjectKeysByPropertyKey` to map
|
||||
// the given `key` to the appropriate `NSManagedObject` property.
|
||||
//
|
||||
// If you have also implemented `mergeValueForKey:fromManagedObject:` you have
|
||||
// to make sure to call `mergeValueForKey:fromManagedObject:` from this method
|
||||
// when appropriate.
|
||||
- (void)mergeValuesForKeysFromManagedObject:(NSManagedObject *)managedObject;
|
||||
|
||||
@end
|
||||
|
||||
// The domain for errors originating from MTLManagedObjectAdapter.
|
||||
extern NSString * const MTLManagedObjectAdapterErrorDomain;
|
||||
|
||||
// +classForDeserializingManagedObject: returned nil for the given object.
|
||||
extern const NSInteger MTLManagedObjectAdapterErrorNoClassFound;
|
||||
|
||||
// An NSManagedObject failed to initialize.
|
||||
extern const NSInteger MTLManagedObjectAdapterErrorInitializationFailed;
|
||||
|
||||
// The managed object key specified by +managedObjectKeysByPropertyKey does not
|
||||
// exist in the NSEntityDescription.
|
||||
extern const NSInteger MTLManagedObjectAdapterErrorInvalidManagedObjectKey;
|
||||
|
||||
// The managed object property specified has a type that isn't supported by
|
||||
// MTLManagedObjectAdapter.
|
||||
extern const NSInteger MTLManagedObjectAdapterErrorUnsupportedManagedObjectPropertyType;
|
||||
|
||||
// The fetch request to find an existing managed object based on
|
||||
// `+propertyKeysForManagedObjectUniquing` failed.
|
||||
extern const NSInteger MTLManagedObjectAdapterErrorUniqueFetchRequestFailed;
|
||||
|
||||
// A MTLModel property cannot be serialized to or deserialized from an
|
||||
// NSManagedObject relationship.
|
||||
//
|
||||
// For a to-one relationship, this means that the property does not contain
|
||||
// a MTLModel, or the MTLModel does not conform to <MTLManagedObjectSerializing>.
|
||||
//
|
||||
// For a to-many relationship, this means that the property does not contain an
|
||||
// NSArray or NSSet of MTLModel<MTLManagedObjectSerializing> instances.
|
||||
extern const NSInteger MTLManagedObjectAdapterErrorUnsupportedRelationshipClass;
|
||||
|
||||
// The model's implementation of +managedObjectKeysByPropertyKey included a key
|
||||
// which does not actually exist in +propertyKeys.
|
||||
extern const NSInteger MTLManagedObjectAdapterErrorInvalidManagedObjectMapping;
|
||||
|
||||
// Converts a MTLModel object to and from an NSManagedObject.
|
||||
@interface MTLManagedObjectAdapter : NSObject
|
||||
|
||||
// Attempts to deserialize an NSManagedObject into a MTLModel object.
|
||||
//
|
||||
// modelClass - The MTLModel subclass to return. This class must conform to
|
||||
// <MTLManagedObjectSerializing>. This argument must not be nil.
|
||||
// managedObject - The managed object to deserialize. If this argument is nil,
|
||||
// the method returns nil.
|
||||
// error - If not NULL, this may be set to an error that occurs during
|
||||
// deserialization or initializing an instance of `modelClass`.
|
||||
//
|
||||
// Returns an instance of `modelClass` upon success, or nil if an error
|
||||
// occurred.
|
||||
+ (id)modelOfClass:(Class)modelClass fromManagedObject:(NSManagedObject *)managedObject error:(NSError **)error;
|
||||
|
||||
// Serializes a MTLModel into an NSManagedObject.
|
||||
//
|
||||
// model - The model object to serialize. This argument must not be nil.
|
||||
// context - The context into which to insert the created managed object. This
|
||||
// argument must not be nil.
|
||||
// error - If not NULL, this may be set to an error that occurs during
|
||||
// serialization or insertion.
|
||||
+ (id)managedObjectFromModel:(MTLModel<MTLManagedObjectSerializing> *)model insertingIntoContext:(NSManagedObjectContext *)context error:(NSError **)error;
|
||||
|
||||
@end
|
|
@ -1,128 +0,0 @@
|
|||
//
|
||||
// MTLModel+NSCoding.h
|
||||
// Mantle
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2013-02-12.
|
||||
// Copyright (c) 2013 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MTLModel.h"
|
||||
|
||||
// Defines how a MTLModel property key should be encoded into an archive.
|
||||
//
|
||||
// MTLModelEncodingBehaviorExcluded - The property should never be encoded.
|
||||
// MTLModelEncodingBehaviorUnconditional - The property should always be
|
||||
// encoded.
|
||||
// MTLModelEncodingBehaviorConditional - The object should be encoded only
|
||||
// if unconditionally encoded elsewhere.
|
||||
// This should only be used for object
|
||||
// properties.
|
||||
typedef enum : NSUInteger {
|
||||
MTLModelEncodingBehaviorExcluded = 0,
|
||||
MTLModelEncodingBehaviorUnconditional,
|
||||
MTLModelEncodingBehaviorConditional,
|
||||
} MTLModelEncodingBehavior;
|
||||
|
||||
// Implements default archiving and unarchiving behaviors for MTLModel.
|
||||
@interface MTLModel (NSCoding) <NSCoding>
|
||||
|
||||
// Initializes the receiver from an archive.
|
||||
//
|
||||
// This will decode the original +modelVersion of the archived object, then
|
||||
// invoke -decodeValueForKey:withCoder:modelVersion: for each of the receiver's
|
||||
// +propertyKeys.
|
||||
//
|
||||
// Returns an initialized model object, or nil if a decoding error occurred.
|
||||
- (id)initWithCoder:(NSCoder *)coder;
|
||||
|
||||
// Archives the receiver using the given coder.
|
||||
//
|
||||
// This will encode the receiver's +modelVersion, then the receiver's properties
|
||||
// according to the behaviors specified in +encodingBehaviorsByPropertyKey.
|
||||
- (void)encodeWithCoder:(NSCoder *)coder;
|
||||
|
||||
// Determines how the +propertyKeys of the class are encoded into an archive.
|
||||
// The values of this dictionary should be boxed MTLModelEncodingBehavior
|
||||
// values.
|
||||
//
|
||||
// Any keys not present in the dictionary will be excluded from the archive.
|
||||
//
|
||||
// Subclasses overriding this method should combine their values with those of
|
||||
// `super`.
|
||||
//
|
||||
// Returns a dictionary mapping the receiver's +propertyKeys to default encoding
|
||||
// behaviors. If a property is an object with `weak` semantics, the default
|
||||
// behavior is MTLModelEncodingBehaviorConditional; otherwise, the default is
|
||||
// MTLModelEncodingBehaviorUnconditional.
|
||||
+ (NSDictionary *)encodingBehaviorsByPropertyKey;
|
||||
|
||||
// Determines the classes that are allowed to be decoded for each of the
|
||||
// receiver's properties when using <NSSecureCoding>. The values of this
|
||||
// dictionary should be NSArrays of Class objects.
|
||||
//
|
||||
// If any encodable keys (as determined by +encodingBehaviorsByPropertyKey) are
|
||||
// not present in the dictionary, an exception will be thrown during secure
|
||||
// encoding or decoding.
|
||||
//
|
||||
// Subclasses overriding this method should combine their values with those of
|
||||
// `super`.
|
||||
//
|
||||
// Returns a dictionary mapping the receiver's encodable keys (as determined by
|
||||
// +encodingBehaviorsByPropertyKey) to default allowed classes, based on the
|
||||
// type that each property is declared as. If type of an encodable property
|
||||
// cannot be determined (e.g., it is declared as `id`), it will be omitted from
|
||||
// the dictionary, and subclasses must provide a valid value to prevent an
|
||||
// exception being thrown during encoding/decoding.
|
||||
+ (NSDictionary *)allowedSecureCodingClassesByPropertyKey;
|
||||
|
||||
// Decodes the value of the given property key from an archive.
|
||||
//
|
||||
// By default, this method looks for a `-decode<Key>WithCoder:modelVersion:`
|
||||
// method on the receiver, and invokes it if found.
|
||||
//
|
||||
// If the custom method is not implemented and `coder` does not require secure
|
||||
// coding, `-[NSCoder decodeObjectForKey:]` will be invoked with the given
|
||||
// `key`.
|
||||
//
|
||||
// If the custom method is not implemented and `coder` requires secure coding,
|
||||
// `-[NSCoder decodeObjectOfClasses:forKey:]` will be invoked with the
|
||||
// information from +allowedSecureCodingClassesByPropertyKey and the given `key`. The
|
||||
// receiver must conform to <NSSecureCoding> for this to work correctly.
|
||||
//
|
||||
// key - The property key to decode the value for. This argument cannot
|
||||
// be nil.
|
||||
// coder - The NSCoder representing the archive being decoded. This
|
||||
// argument cannot be nil.
|
||||
// modelVersion - The version of the original model object that was encoded.
|
||||
//
|
||||
// Returns the decoded and boxed value, or nil if the key was not present.
|
||||
- (id)decodeValueForKey:(NSString *)key withCoder:(NSCoder *)coder modelVersion:(NSUInteger)modelVersion;
|
||||
|
||||
// The version of this MTLModel subclass.
|
||||
//
|
||||
// This version number is saved in archives so that later model changes can be
|
||||
// made backwards-compatible with old versions.
|
||||
//
|
||||
// Subclasses should override this method to return a higher version number
|
||||
// whenever a breaking change is made to the model.
|
||||
//
|
||||
// Returns 0.
|
||||
+ (NSUInteger)modelVersion;
|
||||
|
||||
@end
|
||||
|
||||
// This method must be overridden to support archives created by older versions
|
||||
// of Mantle (before the `MTLModel+NSCoding` interface existed).
|
||||
@interface MTLModel (OldArchiveSupport)
|
||||
|
||||
// Converts an archived external representation to a dictionary suitable for
|
||||
// passing to -initWithDictionary:.
|
||||
//
|
||||
// externalRepresentation - The decoded external representation of the receiver.
|
||||
// fromVersion - The model version at the time the external
|
||||
// representation was encoded.
|
||||
//
|
||||
// Returns nil by default, indicating that conversion failed.
|
||||
+ (NSDictionary *)dictionaryValueFromArchivedExternalRepresentation:(NSDictionary *)externalRepresentation version:(NSUInteger)fromVersion;
|
||||
|
||||
@end
|
|
@ -1,125 +0,0 @@
|
|||
//
|
||||
// MTLModel.h
|
||||
// Mantle
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2012-09-11.
|
||||
// Copyright (c) 2012 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
// An abstract base class for model objects, using reflection to provide
|
||||
// sensible default behaviors.
|
||||
//
|
||||
// The default implementations of <NSCopying>, -hash, and -isEqual: make use of
|
||||
// the +propertyKeys method.
|
||||
@interface MTLModel : NSObject <NSCopying>
|
||||
|
||||
// Returns a new instance of the receiver initialized using
|
||||
// -initWithDictionary:error:.
|
||||
+ (instancetype)modelWithDictionary:(NSDictionary *)dictionaryValue error:(NSError **)error;
|
||||
|
||||
// Initializes the receiver with default values.
|
||||
//
|
||||
// This is the designated initializer for this class.
|
||||
- (instancetype)init;
|
||||
|
||||
// Initializes the receiver using key-value coding, setting the keys and values
|
||||
// in the given dictionary.
|
||||
//
|
||||
// Subclass implementations may override this method, calling the super
|
||||
// implementation, in order to perform further processing and initialization
|
||||
// after deserialization.
|
||||
//
|
||||
// dictionaryValue - Property keys and values to set on the receiver. Any NSNull
|
||||
// values will be converted to nil before being used. KVC
|
||||
// validation methods will automatically be invoked for all of
|
||||
// the properties given. If nil, this method is equivalent to
|
||||
// -init.
|
||||
// error - If not NULL, this may be set to any error that occurs
|
||||
// (like a KVC validation error).
|
||||
//
|
||||
// Returns an initialized model object, or nil if validation failed.
|
||||
- (instancetype)initWithDictionary:(NSDictionary *)dictionaryValue error:(NSError **)error;
|
||||
|
||||
// Returns the keys for all @property declarations, except for `readonly`
|
||||
// properties without ivars, or properties on MTLModel itself.
|
||||
+ (NSSet *)propertyKeys;
|
||||
|
||||
// A dictionary representing the properties of the receiver.
|
||||
//
|
||||
// The default implementation combines the values corresponding to all
|
||||
// +propertyKeys into a dictionary, with any nil values represented by NSNull.
|
||||
//
|
||||
// This property must never be nil.
|
||||
@property (nonatomic, copy, readonly) NSDictionary *dictionaryValue;
|
||||
|
||||
// Merges the value of the given key on the receiver with the value of the same
|
||||
// key from the given model object, giving precedence to the other model object.
|
||||
//
|
||||
// By default, this method looks for a `-merge<Key>FromModel:` method on the
|
||||
// receiver, and invokes it if found. If not found, and `model` is not nil, the
|
||||
// value for the given key is taken from `model`.
|
||||
- (void)mergeValueForKey:(NSString *)key fromModel:(MTLModel *)model;
|
||||
|
||||
// Merges the values of the given model object into the receiver, using
|
||||
// -mergeValueForKey:fromModel: for each key in +propertyKeys.
|
||||
//
|
||||
// `model` must be an instance of the receiver's class or a subclass thereof.
|
||||
- (void)mergeValuesForKeysFromModel:(MTLModel *)model;
|
||||
|
||||
// Compares the receiver with another object for equality.
|
||||
//
|
||||
// The default implementation is equivalent to comparing both models'
|
||||
// -dictionaryValue.
|
||||
//
|
||||
// Note that this may lead to infinite loops if the receiver holds a circular
|
||||
// reference to another MTLModel and both use the default behavior.
|
||||
// It is recommended to override -isEqual: in this scenario.
|
||||
- (BOOL)isEqual:(id)object;
|
||||
|
||||
// A string that describes the contents of the receiver.
|
||||
//
|
||||
// The default implementation is based on the receiver's class and its
|
||||
// -dictionaryValue.
|
||||
//
|
||||
// Note that this may lead to infinite loops if the receiver holds a circular
|
||||
// reference to another MTLModel and both use the default behavior.
|
||||
// It is recommended to override -description in this scenario.
|
||||
- (NSString *)description;
|
||||
|
||||
@end
|
||||
|
||||
// Implements validation logic for MTLModel.
|
||||
@interface MTLModel (Validation)
|
||||
|
||||
// Validates the model.
|
||||
//
|
||||
// The default implementation simply invokes -validateValue:forKey:error: with
|
||||
// all +propertyKeys and their current value. If -validateValue:forKey:error:
|
||||
// returns a new value, the property is set to that new value.
|
||||
//
|
||||
// error - If not NULL, this may be set to any error that occurs during
|
||||
// validation
|
||||
//
|
||||
// Returns YES if the model is valid, or NO if the validation failed.
|
||||
- (BOOL)validate:(NSError **)error;
|
||||
|
||||
@end
|
||||
|
||||
@interface MTLModel (Unavailable)
|
||||
|
||||
+ (instancetype)modelWithDictionary:(NSDictionary *)dictionaryValue __attribute__((deprecated("Replaced by +modelWithDictionary:error:")));
|
||||
- (instancetype)initWithDictionary:(NSDictionary *)dictionaryValue __attribute__((deprecated("Replaced by -initWithDictionary:error:")));
|
||||
|
||||
+ (instancetype)modelWithExternalRepresentation:(NSDictionary *)externalRepresentation __attribute__((deprecated("Replaced by -[MTLJSONAdapter initWithJSONDictionary:modelClass:]")));
|
||||
- (instancetype)initWithExternalRepresentation:(NSDictionary *)externalRepresentation __attribute__((deprecated("Replaced by -[MTLJSONAdapter initWithJSONDictionary:modelClass:]")));
|
||||
|
||||
@property (nonatomic, copy, readonly) NSDictionary *externalRepresentation __attribute__((deprecated("Replaced by MTLJSONAdapter.JSONDictionary")));
|
||||
|
||||
+ (NSDictionary *)externalRepresentationKeyPathsByPropertyKey __attribute__((deprecated("Replaced by +JSONKeyPathsByPropertyKey in <MTLJSONSerializing>")));
|
||||
+ (NSValueTransformer *)transformerForKey:(NSString *)key __attribute__((deprecated("Replaced by +JSONTransformerForKey: in <MTLJSONSerializing>")));
|
||||
|
||||
+ (NSDictionary *)migrateExternalRepresentation:(NSDictionary *)externalRepresentation fromVersion:(NSUInteger)fromVersion __attribute__((deprecated("Replaced by -decodeValueForKey:withCoder:modelVersion:")));
|
||||
|
||||
@end
|
|
@ -1,29 +0,0 @@
|
|||
//
|
||||
// MTLValueTransformer.h
|
||||
// Mantle
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2012-09-11.
|
||||
// Copyright (c) 2012 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef id (^MTLValueTransformerBlock)(id);
|
||||
|
||||
//
|
||||
// A value transformer supporting block-based transformation.
|
||||
//
|
||||
@interface MTLValueTransformer : NSValueTransformer
|
||||
|
||||
// Returns a transformer which transforms values using the given block. Reverse
|
||||
// transformations will not be allowed.
|
||||
+ (instancetype)transformerWithBlock:(MTLValueTransformerBlock)transformationBlock;
|
||||
|
||||
// Returns a transformer which transforms values using the given block, for
|
||||
// forward or reverse transformations.
|
||||
+ (instancetype)reversibleTransformerWithBlock:(MTLValueTransformerBlock)transformationBlock;
|
||||
|
||||
// Returns a transformer which transforms values using the given blocks.
|
||||
+ (instancetype)reversibleTransformerWithForwardBlock:(MTLValueTransformerBlock)forwardBlock reverseBlock:(MTLValueTransformerBlock)reverseBlock;
|
||||
|
||||
@end
|
|
@ -1,26 +0,0 @@
|
|||
//
|
||||
// Mantle.h
|
||||
// Mantle
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2012-09-04.
|
||||
// Copyright (c) 2012 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
//! Project version number for Mantle.
|
||||
FOUNDATION_EXPORT double MantleVersionNumber;
|
||||
|
||||
//! Project version string for Mantle.
|
||||
FOUNDATION_EXPORT const unsigned char MantleVersionString[];
|
||||
|
||||
#import <Mantle/MTLJSONAdapter.h>
|
||||
#import <Mantle/MTLManagedObjectAdapter.h>
|
||||
#import <Mantle/MTLModel.h>
|
||||
#import <Mantle/MTLModel+NSCoding.h>
|
||||
#import <Mantle/MTLValueTransformer.h>
|
||||
#import <Mantle/NSArray+MTLManipulationAdditions.h>
|
||||
#import <Mantle/NSDictionary+MTLManipulationAdditions.h>
|
||||
#import <Mantle/NSObject+MTLComparisonAdditions.h>
|
||||
#import <Mantle/NSValueTransformer+MTLInversionAdditions.h>
|
||||
#import <Mantle/NSValueTransformer+MTLPredefinedTransformerAdditions.h>
|
|
@ -1,28 +0,0 @@
|
|||
//
|
||||
// NSArray+MTLManipulationAdditions.h
|
||||
// Mantle
|
||||
//
|
||||
// Created by Josh Abernathy on 9/19/12.
|
||||
// Copyright (c) 2012 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSArray (MTLManipulationAdditions)
|
||||
|
||||
// The first object in the array or nil if the array is empty.
|
||||
// Forwards to `firstObject` which has been first declared in iOS7, but works with iOS4/10.6.
|
||||
@property (nonatomic, readonly, strong) id mtl_firstObject;
|
||||
|
||||
// Returns a new array without all instances of the given object.
|
||||
- (NSArray *)mtl_arrayByRemovingObject:(id)object;
|
||||
|
||||
// Returns a new array without the first object. If the array is empty, it
|
||||
// returns the empty array.
|
||||
- (NSArray *)mtl_arrayByRemovingFirstObject;
|
||||
|
||||
// Returns a new array without the last object. If the array is empty, it
|
||||
// returns the empty array.
|
||||
- (NSArray *)mtl_arrayByRemovingLastObject;
|
||||
|
||||
@end
|
|
@ -1,25 +0,0 @@
|
|||
//
|
||||
// NSDictionary+MTLManipulationAdditions.h
|
||||
// Mantle
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2012-09-24.
|
||||
// Copyright (c) 2012 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSDictionary (MTLManipulationAdditions)
|
||||
|
||||
// Merges the keys and values from the given dictionary into the receiver. If
|
||||
// both the receiver and `dictionary` have a given key, the value from
|
||||
// `dictionary` is used.
|
||||
//
|
||||
// Returns a new dictionary containing the entries of the receiver combined with
|
||||
// those of `dictionary`.
|
||||
- (NSDictionary *)mtl_dictionaryByAddingEntriesFromDictionary:(NSDictionary *)dictionary;
|
||||
|
||||
// Creates a new dictionary with all the entries for the given keys removed from
|
||||
// the receiver.
|
||||
- (NSDictionary *)mtl_dictionaryByRemovingEntriesWithKeys:(NSSet *)keys;
|
||||
|
||||
@end
|
|
@ -1,15 +0,0 @@
|
|||
//
|
||||
// NSObject+MTLComparisonAdditions.h
|
||||
// Mantle
|
||||
//
|
||||
// Created by Josh Vera on 10/26/12.
|
||||
// Copyright (c) 2012 GitHub. All rights reserved.
|
||||
//
|
||||
// Portions copyright (c) 2011 Bitswift. All rights reserved.
|
||||
// See the LICENSE file for more information.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
// Returns whether both objects are identical or equal via -isEqual:
|
||||
BOOL MTLEqualObjects(id obj1, id obj2);
|
|
@ -1,21 +0,0 @@
|
|||
//
|
||||
// NSValueTransformer+MTLInversionAdditions.h
|
||||
// Mantle
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2013-05-18.
|
||||
// Copyright (c) 2013 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSValueTransformer (MTLInversionAdditions)
|
||||
|
||||
// Flips the direction of the receiver's transformation, such that
|
||||
// -transformedValue: will become -reverseTransformedValue:, and vice-versa.
|
||||
//
|
||||
// The receiver must allow reverse transformation.
|
||||
//
|
||||
// Returns an inverted transformer.
|
||||
- (NSValueTransformer *)mtl_invertedTransformer;
|
||||
|
||||
@end
|
|
@ -1,84 +0,0 @@
|
|||
//
|
||||
// NSValueTransformer+MTLPredefinedTransformerAdditions.h
|
||||
// Mantle
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2012-09-27.
|
||||
// Copyright (c) 2012 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
// The name for a value transformer that converts strings into URLs and back.
|
||||
extern NSString * const MTLURLValueTransformerName;
|
||||
|
||||
// Ensure an NSNumber is backed by __NSCFBoolean/CFBooleanRef
|
||||
//
|
||||
// NSJSONSerialization, and likely other serialization libraries, ordinarily
|
||||
// serialize NSNumbers as numbers, and thus booleans would be serialized as
|
||||
// 0/1. The exception is when the NSNumber is backed by __NSCFBoolean, which,
|
||||
// though very much an implementation detail, is detected and serialized as a
|
||||
// proper boolean.
|
||||
extern NSString * const MTLBooleanValueTransformerName;
|
||||
|
||||
@interface NSValueTransformer (MTLPredefinedTransformerAdditions)
|
||||
|
||||
// Creates a reversible transformer to convert a JSON dictionary into a MTLModel
|
||||
// object, and vice-versa.
|
||||
//
|
||||
// modelClass - The MTLModel subclass to attempt to parse from the JSON. This
|
||||
// class must conform to <MTLJSONSerializing>. This argument must
|
||||
// not be nil.
|
||||
//
|
||||
// Returns a reversible transformer which uses MTLJSONAdapter for transforming
|
||||
// values back and forth.
|
||||
+ (NSValueTransformer *)mtl_JSONDictionaryTransformerWithModelClass:(Class)modelClass;
|
||||
|
||||
// Creates a reversible transformer to convert an array of JSON dictionaries
|
||||
// into an array of MTLModel objects, and vice-versa.
|
||||
//
|
||||
// modelClass - The MTLModel subclass to attempt to parse from each JSON
|
||||
// dictionary. This class must conform to <MTLJSONSerializing>.
|
||||
// This argument must not be nil.
|
||||
//
|
||||
// Returns a reversible transformer which uses MTLJSONAdapter for transforming
|
||||
// array elements back and forth.
|
||||
+ (NSValueTransformer *)mtl_JSONArrayTransformerWithModelClass:(Class)modelClass;
|
||||
|
||||
// A reversible value transformer to transform between the keys and objects of a
|
||||
// dictionary.
|
||||
//
|
||||
// dictionary - The dictionary whose keys and values should be
|
||||
// transformed between. This argument must not be nil.
|
||||
// defaultValue - The result to fall back to, in case no key matching the
|
||||
// input value was found during a forward transformation.
|
||||
// reverseDefaultValue - The result to fall back to, in case no value matching
|
||||
// the input value was found during a reverse
|
||||
// transformation.
|
||||
//
|
||||
// Can for example be used for transforming between enum values and their string
|
||||
// representation.
|
||||
//
|
||||
// NSValueTransformer *valueTransformer = [NSValueTransformer mtl_valueMappingTransformerWithDictionary:@{
|
||||
// @"foo": @(EnumDataTypeFoo),
|
||||
// @"bar": @(EnumDataTypeBar),
|
||||
// } defaultValue: @(EnumDataTypeUndefined) reverseDefaultValue: @"undefined"];
|
||||
//
|
||||
// Returns a transformer that will map from keys to values in dictionary
|
||||
// for forward transformation, and from values to keys for reverse
|
||||
// transformations. If no matching key or value can be found, the respective
|
||||
// default value is returned.
|
||||
+ (NSValueTransformer *)mtl_valueMappingTransformerWithDictionary:(NSDictionary *)dictionary defaultValue:(id)defaultValue reverseDefaultValue:(id)reverseDefaultValue;
|
||||
|
||||
// Returns a value transformer created by calling
|
||||
// `+mtl_valueMappingTransformerWithDictionary:defaultValue:reverseDefaultValue:`
|
||||
// with a default value of `nil` and a reverse default value of `nil`.
|
||||
+ (NSValueTransformer *)mtl_valueMappingTransformerWithDictionary:(NSDictionary *)dictionary;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSValueTransformer (UnavailableMTLPredefinedTransformerAdditions)
|
||||
|
||||
+ (NSValueTransformer *)mtl_externalRepresentationTransformerWithModelClass:(Class)modelClass __attribute__((deprecated("Replaced by +mtl_JSONDictionaryTransformerWithModelClass:")));
|
||||
+ (NSValueTransformer *)mtl_externalRepresentationArrayTransformerWithModelClass:(Class)modelClass __attribute__((deprecated("Replaced by +mtl_JSONArrayTransformerWithModelClass:")));
|
||||
|
||||
@end
|
Binary file not shown.
|
@ -1,6 +0,0 @@
|
|||
framework module Mantle {
|
||||
umbrella header "Mantle.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
|
@ -1,45 +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>BuildMachineOSBuild</key>
|
||||
<string>14C1514</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Mantle</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.mantle.Mantle</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Mantle</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string></string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>6C131e</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>14A383</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.10</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0620</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>6C131e</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1 +0,0 @@
|
|||
A
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/Headers
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/Modules
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/ReactiveCocoa
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/Resources
|
|
@ -1,68 +0,0 @@
|
|||
//
|
||||
// EXTKeyPathCoding.h
|
||||
// extobjc
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 19.06.12.
|
||||
// Copyright (C) 2012 Justin Spahr-Summers.
|
||||
// Released under the MIT license.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "metamacros.h"
|
||||
|
||||
/**
|
||||
* \@keypath allows compile-time verification of key paths. Given a real object
|
||||
* receiver and key path:
|
||||
*
|
||||
* @code
|
||||
|
||||
NSString *UTF8StringPath = @keypath(str.lowercaseString.UTF8String);
|
||||
// => @"lowercaseString.UTF8String"
|
||||
|
||||
NSString *versionPath = @keypath(NSObject, version);
|
||||
// => @"version"
|
||||
|
||||
NSString *lowercaseStringPath = @keypath(NSString.new, lowercaseString);
|
||||
// => @"lowercaseString"
|
||||
|
||||
* @endcode
|
||||
*
|
||||
* ... the macro returns an \c NSString containing all but the first path
|
||||
* component or argument (e.g., @"lowercaseString.UTF8String", @"version").
|
||||
*
|
||||
* In addition to simply creating a key path, this macro ensures that the key
|
||||
* path is valid at compile-time (causing a syntax error if not), and supports
|
||||
* refactoring, such that changing the name of the property will also update any
|
||||
* uses of \@keypath.
|
||||
*/
|
||||
#define keypath(...) \
|
||||
metamacro_if_eq(1, metamacro_argcount(__VA_ARGS__))(keypath1(__VA_ARGS__))(keypath2(__VA_ARGS__))
|
||||
|
||||
#define keypath1(PATH) \
|
||||
(((void)(NO && ((void)PATH, NO)), strchr(# PATH, '.') + 1))
|
||||
|
||||
#define keypath2(OBJ, PATH) \
|
||||
(((void)(NO && ((void)OBJ.PATH, NO)), # PATH))
|
||||
|
||||
/**
|
||||
* \@collectionKeypath allows compile-time verification of key paths across collections NSArray/NSSet etc. Given a real object
|
||||
* receiver, collection object receiver and related keypaths:
|
||||
*
|
||||
* @code
|
||||
|
||||
NSString *employessFirstNamePath = @collectionKeypath(department.employees, Employee.new, firstName)
|
||||
// => @"employees.firstName"
|
||||
|
||||
NSString *employessFirstNamePath = @collectionKeypath(Department.new, employees, Employee.new, firstName)
|
||||
// => @"employees.firstName"
|
||||
|
||||
* @endcode
|
||||
*
|
||||
*/
|
||||
#define collectionKeypath(...) \
|
||||
metamacro_if_eq(3, metamacro_argcount(__VA_ARGS__))(collectionKeypath3(__VA_ARGS__))(collectionKeypath4(__VA_ARGS__))
|
||||
|
||||
#define collectionKeypath3(PATH, COLLECTION_OBJECT, COLLECTION_PATH) ([[NSString stringWithFormat:@"%s.%s",keypath(PATH), keypath(COLLECTION_OBJECT, COLLECTION_PATH)] UTF8String])
|
||||
|
||||
#define collectionKeypath4(OBJ, PATH, COLLECTION_OBJECT, COLLECTION_PATH) ([[NSString stringWithFormat:@"%s.%s",keypath(OBJ, PATH), keypath(COLLECTION_OBJECT, COLLECTION_PATH)] UTF8String])
|
||||
|
|
@ -1,118 +0,0 @@
|
|||
//
|
||||
// EXTScope.h
|
||||
// extobjc
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2011-05-04.
|
||||
// Copyright (C) 2012 Justin Spahr-Summers.
|
||||
// Released under the MIT license.
|
||||
//
|
||||
|
||||
#import "metamacros.h"
|
||||
|
||||
/**
|
||||
* \@onExit defines some code to be executed when the current scope exits. The
|
||||
* code must be enclosed in braces and terminated with a semicolon, and will be
|
||||
* executed regardless of how the scope is exited, including from exceptions,
|
||||
* \c goto, \c return, \c break, and \c continue.
|
||||
*
|
||||
* Provided code will go into a block to be executed later. Keep this in mind as
|
||||
* it pertains to memory management, restrictions on assignment, etc. Because
|
||||
* the code is used within a block, \c return is a legal (though perhaps
|
||||
* confusing) way to exit the cleanup block early.
|
||||
*
|
||||
* Multiple \@onExit statements in the same scope are executed in reverse
|
||||
* lexical order. This helps when pairing resource acquisition with \@onExit
|
||||
* statements, as it guarantees teardown in the opposite order of acquisition.
|
||||
*
|
||||
* @note This statement cannot be used within scopes defined without braces
|
||||
* (like a one line \c if). In practice, this is not an issue, since \@onExit is
|
||||
* a useless construct in such a case anyways.
|
||||
*/
|
||||
#define onExit \
|
||||
rac_keywordify \
|
||||
__strong rac_cleanupBlock_t metamacro_concat(rac_exitBlock_, __LINE__) __attribute__((cleanup(rac_executeCleanupBlock), unused)) = ^
|
||||
|
||||
/**
|
||||
* Creates \c __weak shadow variables for each of the variables provided as
|
||||
* arguments, which can later be made strong again with #strongify.
|
||||
*
|
||||
* This is typically used to weakly reference variables in a block, but then
|
||||
* ensure that the variables stay alive during the actual execution of the block
|
||||
* (if they were live upon entry).
|
||||
*
|
||||
* See #strongify for an example of usage.
|
||||
*/
|
||||
#define weakify(...) \
|
||||
rac_keywordify \
|
||||
metamacro_foreach_cxt(rac_weakify_,, __weak, __VA_ARGS__)
|
||||
|
||||
/**
|
||||
* Like #weakify, but uses \c __unsafe_unretained instead, for targets or
|
||||
* classes that do not support weak references.
|
||||
*/
|
||||
#define unsafeify(...) \
|
||||
rac_keywordify \
|
||||
metamacro_foreach_cxt(rac_weakify_,, __unsafe_unretained, __VA_ARGS__)
|
||||
|
||||
/**
|
||||
* Strongly references each of the variables provided as arguments, which must
|
||||
* have previously been passed to #weakify.
|
||||
*
|
||||
* The strong references created will shadow the original variable names, such
|
||||
* that the original names can be used without issue (and a significantly
|
||||
* reduced risk of retain cycles) in the current scope.
|
||||
*
|
||||
* @code
|
||||
|
||||
id foo = [[NSObject alloc] init];
|
||||
id bar = [[NSObject alloc] init];
|
||||
|
||||
@weakify(foo, bar);
|
||||
|
||||
// this block will not keep 'foo' or 'bar' alive
|
||||
BOOL (^matchesFooOrBar)(id) = ^ BOOL (id obj){
|
||||
// but now, upon entry, 'foo' and 'bar' will stay alive until the block has
|
||||
// finished executing
|
||||
@strongify(foo, bar);
|
||||
|
||||
return [foo isEqual:obj] || [bar isEqual:obj];
|
||||
};
|
||||
|
||||
* @endcode
|
||||
*/
|
||||
#define strongify(...) \
|
||||
rac_keywordify \
|
||||
_Pragma("clang diagnostic push") \
|
||||
_Pragma("clang diagnostic ignored \"-Wshadow\"") \
|
||||
metamacro_foreach(rac_strongify_,, __VA_ARGS__) \
|
||||
_Pragma("clang diagnostic pop")
|
||||
|
||||
/*** implementation details follow ***/
|
||||
typedef void (^rac_cleanupBlock_t)();
|
||||
|
||||
static inline void rac_executeCleanupBlock (__strong rac_cleanupBlock_t *block) {
|
||||
(*block)();
|
||||
}
|
||||
|
||||
#define rac_weakify_(INDEX, CONTEXT, VAR) \
|
||||
CONTEXT __typeof__(VAR) metamacro_concat(VAR, _weak_) = (VAR);
|
||||
|
||||
#define rac_strongify_(INDEX, VAR) \
|
||||
__strong __typeof__(VAR) VAR = metamacro_concat(VAR, _weak_);
|
||||
|
||||
// Details about the choice of backing keyword:
|
||||
//
|
||||
// The use of @try/@catch/@finally can cause the compiler to suppress
|
||||
// return-type warnings.
|
||||
// The use of @autoreleasepool {} is not optimized away by the compiler,
|
||||
// resulting in superfluous creation of autorelease pools.
|
||||
//
|
||||
// Since neither option is perfect, and with no other alternatives, the
|
||||
// compromise is to use @autorelease in DEBUG builds to maintain compiler
|
||||
// analysis, and to use @try/@catch otherwise to avoid insertion of unnecessary
|
||||
// autorelease pools.
|
||||
#if DEBUG
|
||||
#define rac_keywordify autoreleasepool {}
|
||||
#else
|
||||
#define rac_keywordify try {} @catch (...) {}
|
||||
#endif
|
|
@ -1,20 +0,0 @@
|
|||
//
|
||||
// NSArray+RACSequenceAdditions.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2012-10-29.
|
||||
// Copyright (c) 2012 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RACSequence;
|
||||
|
||||
@interface NSArray (RACSequenceAdditions)
|
||||
|
||||
/// Creates and returns a sequence corresponding to the receiver.
|
||||
///
|
||||
/// Mutating the receiver will not affect the sequence after it's been created.
|
||||
@property (nonatomic, copy, readonly) RACSequence *rac_sequence;
|
||||
|
||||
@end
|
|
@ -1,22 +0,0 @@
|
|||
//
|
||||
// NSControl+RACCommandSupport.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 3/3/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@class RACCommand;
|
||||
|
||||
@interface NSControl (RACCommandSupport)
|
||||
|
||||
/// Sets the control's command. When the control is clicked, the command is
|
||||
/// executed with the sender of the event. The control's enabledness is bound
|
||||
/// to the command's `canExecute`.
|
||||
///
|
||||
/// Note: this will reset the control's target and action.
|
||||
@property (nonatomic, strong) RACCommand *rac_command;
|
||||
|
||||
@end
|
|
@ -1,24 +0,0 @@
|
|||
//
|
||||
// NSControl+RACTextSignalSupport.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2013-03-08.
|
||||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@class RACSignal;
|
||||
|
||||
@interface NSControl (RACTextSignalSupport)
|
||||
|
||||
/// Observes a text-based control for changes.
|
||||
///
|
||||
/// Using this method on a control without editable text is considered undefined
|
||||
/// behavior.
|
||||
///
|
||||
/// Returns a signal which sends the current string value of the receiver, then
|
||||
/// the new value any time it changes.
|
||||
- (RACSignal *)rac_textSignal;
|
||||
|
||||
@end
|
|
@ -1,22 +0,0 @@
|
|||
//
|
||||
// NSData+RACSupport.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 5/11/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RACScheduler;
|
||||
@class RACSignal;
|
||||
|
||||
@interface NSData (RACSupport)
|
||||
|
||||
// Read the data at the URL using -[NSData initWithContentsOfURL:options:error:].
|
||||
// Sends the data or the error.
|
||||
//
|
||||
// scheduler - cannot be nil.
|
||||
+ (RACSignal *)rac_readContentsOfURL:(NSURL *)URL options:(NSDataReadingOptions)options scheduler:(RACScheduler *)scheduler;
|
||||
|
||||
@end
|
|
@ -1,31 +0,0 @@
|
|||
//
|
||||
// NSDictionary+RACSequenceAdditions.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2012-10-29.
|
||||
// Copyright (c) 2012 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RACSequence;
|
||||
|
||||
@interface NSDictionary (RACSequenceAdditions)
|
||||
|
||||
/// Creates and returns a sequence of RACTuple key/value pairs. The key will be
|
||||
/// the first element in the tuple, and the value will be the second.
|
||||
///
|
||||
/// Mutating the receiver will not affect the sequence after it's been created.
|
||||
@property (nonatomic, copy, readonly) RACSequence *rac_sequence;
|
||||
|
||||
/// Creates and returns a sequence corresponding to the keys in the receiver.
|
||||
///
|
||||
/// Mutating the receiver will not affect the sequence after it's been created.
|
||||
@property (nonatomic, copy, readonly) RACSequence *rac_keySequence;
|
||||
|
||||
/// Creates and returns a sequence corresponding to the values in the receiver.
|
||||
///
|
||||
/// Mutating the receiver will not affect the sequence after it's been created.
|
||||
@property (nonatomic, copy, readonly) RACSequence *rac_valueSequence;
|
||||
|
||||
@end
|
|
@ -1,20 +0,0 @@
|
|||
//
|
||||
// NSEnumerator+RACSequenceAdditions.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Uri Baghin on 07/01/2013.
|
||||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RACSequence;
|
||||
|
||||
@interface NSEnumerator (RACSequenceAdditions)
|
||||
|
||||
/// Creates and returns a sequence corresponding to the receiver.
|
||||
///
|
||||
/// The receiver is exhausted lazily as the sequence is enumerated.
|
||||
@property (nonatomic, copy, readonly) RACSequence *rac_sequence;
|
||||
|
||||
@end
|
|
@ -1,19 +0,0 @@
|
|||
//
|
||||
// NSFileHandle+RACSupport.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 5/10/12.
|
||||
// Copyright (c) 2012 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RACSignal;
|
||||
|
||||
@interface NSFileHandle (RACSupport)
|
||||
|
||||
// Read any available data in the background and send it. Completes when data
|
||||
// length is <= 0.
|
||||
- (RACSignal *)rac_readInBackground;
|
||||
|
||||
@end
|
|
@ -1,21 +0,0 @@
|
|||
//
|
||||
// NSIndexSet+RACSequenceAdditions.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Sergey Gavrilyuk on 12/17/13.
|
||||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RACSequence;
|
||||
|
||||
@interface NSIndexSet (RACSequenceAdditions)
|
||||
|
||||
/// Creates and returns a sequence of indexes (as `NSNumber`s) corresponding to
|
||||
/// the receiver.
|
||||
///
|
||||
/// Mutating the receiver will not affect the sequence after it's been created.
|
||||
@property (nonatomic, copy, readonly) RACSequence *rac_sequence;
|
||||
|
||||
@end
|
|
@ -1,18 +0,0 @@
|
|||
//
|
||||
// NSNotificationCenter+RACSupport.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 5/10/12.
|
||||
// Copyright (c) 2012 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RACSignal;
|
||||
|
||||
@interface NSNotificationCenter (RACSupport)
|
||||
|
||||
// Sends the NSNotification every time the notification is posted.
|
||||
- (RACSignal *)rac_addObserverForName:(NSString *)notificationName object:(id)object;
|
||||
|
||||
@end
|
|
@ -1,40 +0,0 @@
|
|||
//
|
||||
// NSObject+RACAppKitBindings.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 4/17/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@class RACChannelTerminal;
|
||||
|
||||
@interface NSObject (RACAppKitBindings)
|
||||
|
||||
/// Invokes -rac_channelToBinding:options: without any options.
|
||||
- (RACChannelTerminal *)rac_channelToBinding:(NSString *)binding;
|
||||
|
||||
/// Applies a Cocoa binding to the receiver, then exposes a RACChannel-based
|
||||
/// interface for manipulating it.
|
||||
///
|
||||
/// Creating two of the same bindings on the same object will result in undefined
|
||||
/// behavior.
|
||||
///
|
||||
/// binding - The name of the binding. This must not be nil.
|
||||
/// options - Any options to pass to Cocoa Bindings. This may be nil.
|
||||
///
|
||||
/// Returns a RACChannelTerminal which will send future values from the receiver,
|
||||
/// and update the receiver when values are sent to the terminal.
|
||||
- (RACChannelTerminal *)rac_channelToBinding:(NSString *)binding options:(NSDictionary *)options;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSObject (RACAppKitBindingsDeprecated)
|
||||
|
||||
- (void)rac_bind:(NSString *)binding toObject:(id)object withKeyPath:(NSString *)keyPath __attribute__((deprecated("Use -rac_bind:options: instead")));
|
||||
- (void)rac_bind:(NSString *)binding toObject:(id)object withKeyPath:(NSString *)keyPath nilValue:(id)nilValue __attribute__((deprecated("Use -rac_bind:options: instead")));
|
||||
- (void)rac_bind:(NSString *)binding toObject:(id)object withKeyPath:(NSString *)keyPath transform:(id (^)(id value))transformBlock __attribute__((deprecated("Use -rac_bind:options: instead")));
|
||||
- (void)rac_bind:(NSString *)binding toObject:(id)object withNegatedKeyPath:(NSString *)keyPath __attribute__((deprecated("Use -rac_bind:options: instead")));
|
||||
|
||||
@end
|
|
@ -1,34 +0,0 @@
|
|||
//
|
||||
// NSObject+RACDeallocating.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Kazuo Koga on 2013/03/15.
|
||||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RACCompoundDisposable;
|
||||
@class RACDisposable;
|
||||
@class RACSignal;
|
||||
|
||||
@interface NSObject (RACDeallocating)
|
||||
|
||||
/// The compound disposable which will be disposed of when the receiver is
|
||||
/// deallocated.
|
||||
@property (atomic, readonly, strong) RACCompoundDisposable *rac_deallocDisposable;
|
||||
|
||||
/// Returns a signal that will complete immediately before the receiver is fully
|
||||
/// deallocated. If already deallocated when the signal is subscribed to,
|
||||
/// a `completed` event will be sent immediately.
|
||||
- (RACSignal *)rac_willDeallocSignal;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSObject (RACDeallocatingDeprecated)
|
||||
|
||||
- (RACSignal *)rac_didDeallocSignal __attribute__((deprecated("Use -rac_willDeallocSignal")));
|
||||
|
||||
- (void)rac_addDeallocDisposable:(RACDisposable *)disposable __attribute__((deprecated("Add disposables to -rac_deallocDisposable instead")));
|
||||
|
||||
@end
|
|
@ -1,61 +0,0 @@
|
|||
//
|
||||
// NSObject+RACLifting.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 10/13/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RACSignal;
|
||||
|
||||
@interface NSObject (RACLifting)
|
||||
|
||||
/// Lifts the selector on the receiver into the reactive world. The selector will
|
||||
/// be invoked whenever any signal argument sends a value, but only after each
|
||||
/// signal has sent an initial value.
|
||||
///
|
||||
/// It will replay the most recently sent value to new subscribers.
|
||||
///
|
||||
/// This does not support C arrays or unions.
|
||||
///
|
||||
/// selector - The selector on self to invoke.
|
||||
/// firstSignal - The signal corresponding to the first method argument. This
|
||||
/// must not be nil.
|
||||
/// ... - A list of RACSignals corresponding to the remaining arguments.
|
||||
/// There must be a non-nil signal for each method argument.
|
||||
///
|
||||
/// Examples
|
||||
///
|
||||
/// [button rac_liftSelector:@selector(setTitleColor:forState:) withSignals:textColorSignal, [RACSignal return:@(UIControlStateNormal)], nil];
|
||||
///
|
||||
/// Returns a signal which sends the return value from each invocation of the
|
||||
/// selector. If the selector returns void, it instead sends RACUnit.defaultUnit.
|
||||
/// It completes only after all the signal arguments complete.
|
||||
- (RACSignal *)rac_liftSelector:(SEL)selector withSignals:(RACSignal *)firstSignal, ... NS_REQUIRES_NIL_TERMINATION;
|
||||
|
||||
/// Like -rac_liftSelector:withSignals:, but accepts an array instead of
|
||||
/// a variadic list of arguments.
|
||||
- (RACSignal *)rac_liftSelector:(SEL)selector withSignalsFromArray:(NSArray *)signals;
|
||||
|
||||
/// Like -rac_liftSelector:withSignals:, but accepts a signal sending tuples of
|
||||
/// arguments instead of a variadic list of arguments.
|
||||
- (RACSignal *)rac_liftSelector:(SEL)selector withSignalOfArguments:(RACSignal *)arguments;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSObject (RACLiftingDeprecated)
|
||||
|
||||
- (RACSignal *)rac_liftSelector:(SEL)selector withObjects:(id)arg, ... __attribute__((deprecated("Use -rac_liftSelector:withSignals: instead")));
|
||||
- (RACSignal *)rac_liftSelector:(SEL)selector withObjectsFromArray:(NSArray *)args __attribute__((deprecated("Use -rac_liftSelector:withSignalsFromArray: instead")));
|
||||
- (RACSignal *)rac_liftBlock:(id)block withArguments:(id)arg, ... NS_REQUIRES_NIL_TERMINATION __attribute__((deprecated("Use +combineLatest:reduce: instead")));
|
||||
- (RACSignal *)rac_liftBlock:(id)block withArgumentsFromArray:(NSArray *)args __attribute__((deprecated("Use +combineLatest:reduce: instead")));
|
||||
|
||||
@end
|
||||
|
||||
@interface NSObject (RACLiftingUnavailable)
|
||||
|
||||
- (instancetype)rac_lift __attribute__((unavailable("Use -rac_liftSelector:withSignals: instead")));
|
||||
|
||||
@end
|
|
@ -1,105 +0,0 @@
|
|||
//
|
||||
// NSObject+RACPropertySubscribing.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 3/2/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "EXTKeyPathCoding.h"
|
||||
#import "metamacros.h"
|
||||
|
||||
/// Creates a signal which observes `KEYPATH` on `TARGET` for changes.
|
||||
///
|
||||
/// In either case, the observation continues until `TARGET` _or self_ is
|
||||
/// deallocated. If any intermediate object is deallocated instead, it will be
|
||||
/// assumed to have been set to nil.
|
||||
///
|
||||
/// Make sure to `@strongify(self)` when using this macro within a block! The
|
||||
/// macro will _always_ reference `self`, which can silently introduce a retain
|
||||
/// cycle within a block. As a result, you should make sure that `self` is a weak
|
||||
/// reference (e.g., created by `@weakify` and `@strongify`) before the
|
||||
/// expression that uses `RACObserve`.
|
||||
///
|
||||
/// Examples
|
||||
///
|
||||
/// // Observes self, and doesn't stop until self is deallocated.
|
||||
/// RACSignal *selfSignal = RACObserve(self, arrayController.items);
|
||||
///
|
||||
/// // Observes the array controller, and stops when self _or_ the array
|
||||
/// // controller is deallocated.
|
||||
/// RACSignal *arrayControllerSignal = RACObserve(self.arrayController, items);
|
||||
///
|
||||
/// // Observes obj.arrayController, and stops when self _or_ the array
|
||||
/// // controller is deallocated.
|
||||
/// RACSignal *signal2 = RACObserve(obj.arrayController, items);
|
||||
///
|
||||
/// @weakify(self);
|
||||
/// RACSignal *signal3 = [anotherSignal flattenMap:^(NSArrayController *arrayController) {
|
||||
/// // Avoids a retain cycle because of RACObserve implicitly referencing
|
||||
/// // self.
|
||||
/// @strongify(self);
|
||||
/// return RACObserve(arrayController, items);
|
||||
/// }];
|
||||
///
|
||||
/// Returns a signal which sends the current value of the key path on
|
||||
/// subscription, then sends the new value every time it changes, and sends
|
||||
/// completed if self or observer is deallocated.
|
||||
#define RACObserve(TARGET, KEYPATH) \
|
||||
({ \
|
||||
__weak id target_ = (TARGET); \
|
||||
[target_ rac_valuesForKeyPath:@keypath(TARGET, KEYPATH) observer:self]; \
|
||||
})
|
||||
|
||||
@class RACDisposable;
|
||||
@class RACSignal;
|
||||
|
||||
@interface NSObject (RACPropertySubscribing)
|
||||
|
||||
/// Creates a signal to observe the value at the given key path.
|
||||
///
|
||||
/// The initial value is sent on subscription, the subsequent values are sent
|
||||
/// from whichever thread the change occured on, even if it doesn't have a valid
|
||||
/// scheduler.
|
||||
///
|
||||
/// Returns a signal that immediately sends the receiver's current value at the
|
||||
/// given keypath, then any changes thereafter.
|
||||
- (RACSignal *)rac_valuesForKeyPath:(NSString *)keyPath observer:(__weak NSObject *)observer;
|
||||
|
||||
/// Creates a signal to observe the changes of the given key path.
|
||||
///
|
||||
/// The initial value is sent on subscription, the subsequent values are sent
|
||||
/// from whichever thread the change occured on, even if it doesn't have a valid
|
||||
/// scheduler.
|
||||
///
|
||||
/// Returns a signal that sends tuples containing the current value at the key
|
||||
/// path and the change dictionary for each KVO callback.
|
||||
- (RACSignal *)rac_valuesAndChangesForKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options observer:(__weak NSObject *)observer;
|
||||
|
||||
@end
|
||||
|
||||
#define RACAble(...) \
|
||||
metamacro_if_eq(1, metamacro_argcount(__VA_ARGS__)) \
|
||||
(_RACAbleObject(self, __VA_ARGS__)) \
|
||||
(_RACAbleObject(__VA_ARGS__))
|
||||
|
||||
#define _RACAbleObject(object, property) [object rac_signalForKeyPath:@keypath(object, property) observer:self]
|
||||
|
||||
#define RACAbleWithStart(...) \
|
||||
metamacro_if_eq(1, metamacro_argcount(__VA_ARGS__)) \
|
||||
(_RACAbleWithStartObject(self, __VA_ARGS__)) \
|
||||
(_RACAbleWithStartObject(__VA_ARGS__))
|
||||
|
||||
#define _RACAbleWithStartObject(object, property) [object rac_signalWithStartingValueForKeyPath:@keypath(object, property) observer:self]
|
||||
|
||||
@interface NSObject (RACPropertySubscribingDeprecated)
|
||||
|
||||
+ (RACSignal *)rac_signalFor:(NSObject *)object keyPath:(NSString *)keyPath observer:(NSObject *)observer __attribute__((deprecated("Use -rac_valuesForKeyPath:observer: or RACObserve() instead.")));
|
||||
+ (RACSignal *)rac_signalWithStartingValueFor:(NSObject *)object keyPath:(NSString *)keyPath observer:(NSObject *)observer __attribute__((deprecated("Use -rac_valuesForKeyPath:observer: or RACObserve() instead.")));
|
||||
+ (RACSignal *)rac_signalWithChangesFor:(NSObject *)object keyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options observer:(NSObject *)observer __attribute__((deprecated("Use -rac_valuesAndChangesForKeyPath:options:observer: instead.")));
|
||||
- (RACSignal *)rac_signalForKeyPath:(NSString *)keyPath observer:(NSObject *)observer __attribute__((deprecated("Use -rac_valuesForKeyPath:observer: or RACObserve() instead.")));
|
||||
- (RACSignal *)rac_signalWithStartingValueForKeyPath:(NSString *)keyPath observer:(NSObject *)observer __attribute__((deprecated("Use -rac_valuesForKeyPath:observer: or RACObserve() instead.")));
|
||||
- (RACDisposable *)rac_deriveProperty:(NSString *)keyPath from:(RACSignal *)signal __attribute__((deprecated("Use -[RACSignal setKeyPath:onObject:] instead")));
|
||||
|
||||
@end
|
|
@ -1,79 +0,0 @@
|
|||
//
|
||||
// NSObject+RACSelectorSignal.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 3/18/13.
|
||||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RACSignal;
|
||||
|
||||
/// The domain for any errors originating from -rac_signalForSelector:.
|
||||
extern NSString * const RACSelectorSignalErrorDomain;
|
||||
|
||||
/// -rac_signalForSelector: was going to add a new method implementation for
|
||||
/// `selector`, but another thread added an implementation before it was able to.
|
||||
///
|
||||
/// This will _not_ occur for cases where a method implementation exists before
|
||||
/// -rac_signalForSelector: is invoked.
|
||||
extern const NSInteger RACSelectorSignalErrorMethodSwizzlingRace;
|
||||
|
||||
@interface NSObject (RACSelectorSignal)
|
||||
|
||||
/// Creates a signal associated with the receiver, which will send a tuple of the
|
||||
/// method's arguments each time the given selector is invoked.
|
||||
///
|
||||
/// If the selector is already implemented on the receiver, the existing
|
||||
/// implementation will be invoked _before_ the signal fires.
|
||||
///
|
||||
/// If the selector is not yet implemented on the receiver, the injected
|
||||
/// implementation will have a `void` return type and accept only object
|
||||
/// arguments. Invoking the added implementation with non-object values, or
|
||||
/// expecting a return value, will result in undefined behavior.
|
||||
///
|
||||
/// This is useful for changing an event or delegate callback into a signal. For
|
||||
/// example, on an NSView:
|
||||
///
|
||||
/// [[view rac_signalForSelector:@selector(mouseDown:)] subscribeNext:^(RACTuple *args) {
|
||||
/// NSEvent *event = args.first;
|
||||
/// NSLog(@"mouse button pressed: %@", event);
|
||||
/// }];
|
||||
///
|
||||
/// selector - The selector for whose invocations are to be observed. If it
|
||||
/// doesn't exist, it will be implemented to accept object arguments
|
||||
/// and return void. This cannot have C arrays or unions as arguments
|
||||
/// or C arrays, unions, structs, complex or vector types as return
|
||||
/// type.
|
||||
///
|
||||
/// Returns a signal which will send a tuple of arguments upon each invocation of
|
||||
/// the selector, then completes when the receiver is deallocated. `next` events
|
||||
/// will be sent synchronously from the thread that invoked the method. If
|
||||
/// a runtime call fails, the signal will send an error in the
|
||||
/// RACSelectorSignalErrorDomain.
|
||||
- (RACSignal *)rac_signalForSelector:(SEL)selector;
|
||||
|
||||
/// Behaves like -rac_signalForSelector:, but if the selector is not yet
|
||||
/// implemented on the receiver, its method signature is looked up within
|
||||
/// `protocol`, and may accept non-object arguments.
|
||||
///
|
||||
/// If the selector is not yet implemented and has a return value, the injected
|
||||
/// method will return all zero bits (equal to `nil`, `NULL`, 0, 0.0f, etc.).
|
||||
///
|
||||
/// selector - The selector for whose invocations are to be observed. If it
|
||||
/// doesn't exist, it will be implemented using information from
|
||||
/// `protocol`, and may accept non-object arguments and return
|
||||
/// a value. This cannot have C arrays or unions as arguments or
|
||||
/// return type.
|
||||
/// protocol - The protocol in which `selector` is declared. This will be used
|
||||
/// for type information if the selector is not already implemented on
|
||||
/// the receiver. This must not be `NULL`, and `selector` must exist
|
||||
/// in this protocol.
|
||||
///
|
||||
/// Returns a signal which will send a tuple of arguments on each invocation of
|
||||
/// the selector, or an error in RACSelectorSignalErrorDomain if a runtime
|
||||
/// call fails.
|
||||
- (RACSignal *)rac_signalForSelector:(SEL)selector fromProtocol:(Protocol *)protocol;
|
||||
|
||||
@end
|
|
@ -1,20 +0,0 @@
|
|||
//
|
||||
// NSOrderedSet+RACSequenceAdditions.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2012-10-29.
|
||||
// Copyright (c) 2012 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RACSequence;
|
||||
|
||||
@interface NSOrderedSet (RACSequenceAdditions)
|
||||
|
||||
/// Creates and returns a sequence corresponding to the receiver.
|
||||
///
|
||||
/// Mutating the receiver will not affect the sequence after it's been created.
|
||||
@property (nonatomic, copy, readonly) RACSequence *rac_sequence;
|
||||
|
||||
@end
|
|
@ -1,20 +0,0 @@
|
|||
//
|
||||
// NSSet+RACSequenceAdditions.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2012-10-29.
|
||||
// Copyright (c) 2012 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RACSequence;
|
||||
|
||||
@interface NSSet (RACSequenceAdditions)
|
||||
|
||||
/// Creates and returns a sequence corresponding to the receiver.
|
||||
///
|
||||
/// Mutating the receiver will not affect the sequence after it's been created.
|
||||
@property (nonatomic, copy, readonly) RACSequence *rac_sequence;
|
||||
|
||||
@end
|
|
@ -1,21 +0,0 @@
|
|||
//
|
||||
// NSString+RACSequenceAdditions.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2012-10-29.
|
||||
// Copyright (c) 2012 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RACSequence;
|
||||
|
||||
@interface NSString (RACSequenceAdditions)
|
||||
|
||||
/// Creates and returns a sequence containing strings corresponding to each
|
||||
/// composed character sequence in the receiver.
|
||||
///
|
||||
/// Mutating the receiver will not affect the sequence after it's been created.
|
||||
@property (nonatomic, copy, readonly) RACSequence *rac_sequence;
|
||||
|
||||
@end
|
|
@ -1,22 +0,0 @@
|
|||
//
|
||||
// NSString+RACSupport.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 5/11/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RACScheduler;
|
||||
@class RACSignal;
|
||||
|
||||
@interface NSString (RACSupport)
|
||||
|
||||
// Reads in the contents of the file using +[NSString stringWithContentsOfURL:usedEncoding:error:].
|
||||
// Note that encoding won't be valid until the signal completes successfully.
|
||||
//
|
||||
// scheduler - cannot be nil.
|
||||
+ (RACSignal *)rac_readContentsOfURL:(NSURL *)URL usedEncoding:(NSStringEncoding *)encoding scheduler:(RACScheduler *)scheduler;
|
||||
|
||||
@end
|
|
@ -1,19 +0,0 @@
|
|||
//
|
||||
// NSText+RACSignalSupport.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2013-03-08.
|
||||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@class RACSignal;
|
||||
|
||||
@interface NSText (RACSignalSupport)
|
||||
|
||||
/// Returns a signal which sends the current `string` of the receiver, then the
|
||||
/// new value any time it changes.
|
||||
- (RACSignal *)rac_textSignal;
|
||||
|
||||
@end
|
|
@ -1,25 +0,0 @@
|
|||
//
|
||||
// NSURLConnection+RACSupport.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2013-10-01.
|
||||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RACSignal;
|
||||
|
||||
@interface NSURLConnection (RACSupport)
|
||||
|
||||
// Lazily loads data for the given request in the background.
|
||||
//
|
||||
// request - The URL request to load. This must not be nil.
|
||||
//
|
||||
// Returns a signal which will begin loading the request upon each subscription,
|
||||
// then send a `RACTuple` of the received `NSURLResponse` and downloaded
|
||||
// `NSData`, and complete on a background thread. If any errors occur, the
|
||||
// returned signal will error out.
|
||||
+ (RACSignal *)rac_sendAsynchronousRequest:(NSURLRequest *)request;
|
||||
|
||||
@end
|
|
@ -1,27 +0,0 @@
|
|||
//
|
||||
// NSUserDefaults+RACSupport.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Matt Diephouse on 12/19/13.
|
||||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RACChannelTerminal;
|
||||
|
||||
@interface NSUserDefaults (RACSupport)
|
||||
|
||||
/// Creates and returns a terminal for binding the user defaults key.
|
||||
///
|
||||
/// **Note:** The value in the user defaults is *asynchronously* updated with
|
||||
/// values sent to the channel.
|
||||
///
|
||||
/// key - The user defaults key to create the channel terminal for.
|
||||
///
|
||||
/// Returns a channel terminal that sends the value of the user defaults key
|
||||
/// upon subscription, sends an updated value whenever the default changes, and
|
||||
/// updates the default asynchronously with values it receives.
|
||||
- (RACChannelTerminal *)rac_channelTerminalForKey:(NSString *)key;
|
||||
|
||||
@end
|
|
@ -1,70 +0,0 @@
|
|||
//
|
||||
// RACBacktrace.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2012-08-20.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#ifdef RAC_DEBUG_BACKTRACE
|
||||
|
||||
extern void rac_dispatch_async(dispatch_queue_t queue, dispatch_block_t block);
|
||||
extern void rac_dispatch_barrier_async(dispatch_queue_t queue, dispatch_block_t block);
|
||||
extern void rac_dispatch_after(dispatch_time_t time, dispatch_queue_t queue, dispatch_block_t block);
|
||||
extern void rac_dispatch_async_f(dispatch_queue_t queue, void *context, dispatch_function_t function);
|
||||
extern void rac_dispatch_barrier_async_f(dispatch_queue_t queue, void *context, dispatch_function_t function);
|
||||
extern void rac_dispatch_after_f(dispatch_time_t time, dispatch_queue_t queue, void *context, dispatch_function_t function);
|
||||
|
||||
#define dispatch_async rac_dispatch_async
|
||||
#define dispatch_barrier_async rac_dispatch_barrier_async
|
||||
#define dispatch_after rac_dispatch_after
|
||||
#define dispatch_async_f rac_dispatch_async_f
|
||||
#define dispatch_barrier_async_f rac_dispatch_barrier_async_f
|
||||
#define dispatch_after_f rac_dispatch_after_f
|
||||
|
||||
/// Preserves backtraces across asynchronous calls.
|
||||
///
|
||||
/// On OS X, you can enable the automatic capturing of asynchronous backtraces
|
||||
/// (in Debug builds) by setting the `DYLD_INSERT_LIBRARIES` environment variable
|
||||
/// to `@executable_path/../Frameworks/ReactiveCocoa.framework/ReactiveCocoa` in
|
||||
/// your scheme's Run action settings.
|
||||
///
|
||||
/// On iOS, your project and RAC will automatically use the `rac_` GCD functions
|
||||
/// (declared above) for asynchronous work. Unfortunately, unlike OS X, it's
|
||||
/// impossible to capture backtraces inside NSOperationQueue or other code
|
||||
/// outside of your project.
|
||||
///
|
||||
/// Once backtraces are being captured, you can `po [RACBacktrace backtrace]` in
|
||||
/// the debugger to print them out at any time. You can even set up an alias in
|
||||
/// ~/.lldbinit to do so:
|
||||
///
|
||||
/// command alias racbt po [RACBacktrace backtrace]
|
||||
///
|
||||
@interface RACBacktrace : NSObject
|
||||
|
||||
/// The backtrace from any previous thread.
|
||||
@property (nonatomic, strong, readonly) RACBacktrace *previousThreadBacktrace;
|
||||
|
||||
/// The call stack of this backtrace's thread.
|
||||
@property (nonatomic, copy, readonly) NSArray *callStackSymbols;
|
||||
|
||||
/// Captures the current thread's backtrace, appending it to any backtrace from
|
||||
/// a previous thread.
|
||||
+ (instancetype)backtrace;
|
||||
|
||||
/// Same as +backtrace, but omits the specified number of frames at the
|
||||
/// top of the stack (in addition to this method itself).
|
||||
+ (instancetype)backtraceIgnoringFrames:(NSUInteger)ignoreCount;
|
||||
|
||||
@end
|
||||
|
||||
#else
|
||||
|
||||
#define rac_dispatch_async dispatch_async
|
||||
#define rac_dispatch_barrier_async dispatch_barrier_async
|
||||
#define rac_dispatch_after dispatch_after
|
||||
#define rac_dispatch_async_f dispatch_async_f
|
||||
#define rac_dispatch_barrier_async_f dispatch_barrier_async_f
|
||||
#define rac_dispatch_after_f dispatch_after_f
|
||||
|
||||
#endif
|
|
@ -1,18 +0,0 @@
|
|||
//
|
||||
// RACBehaviorSubject.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 3/16/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RACSubject.h"
|
||||
|
||||
/// A behavior subject sends the last value it received when it is subscribed to.
|
||||
@interface RACBehaviorSubject : RACSubject
|
||||
|
||||
/// Creates a new behavior subject with a default value. If it hasn't received
|
||||
/// any values when it gets subscribed to, it sends the default value.
|
||||
+ (instancetype)behaviorSubjectWithDefaultValue:(id)value;
|
||||
|
||||
@end
|
|
@ -1,70 +0,0 @@
|
|||
//
|
||||
// RACChannel.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Uri Baghin on 01/01/2013.
|
||||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RACSignal.h"
|
||||
#import "RACSubscriber.h"
|
||||
|
||||
@class RACChannelTerminal;
|
||||
|
||||
/// A two-way channel.
|
||||
///
|
||||
/// Conceptually, RACChannel can be thought of as a bidirectional connection,
|
||||
/// composed of two controllable signals that work in parallel.
|
||||
///
|
||||
/// For example, when connecting between a view and a model:
|
||||
///
|
||||
/// Model View
|
||||
/// `leadingTerminal` ------> `followingTerminal`
|
||||
/// `leadingTerminal` <------ `followingTerminal`
|
||||
///
|
||||
/// The initial value of the model and all future changes to it are _sent on_ the
|
||||
/// `leadingTerminal`, and _received by_ subscribers of the `followingTerminal`.
|
||||
///
|
||||
/// Likewise, whenever the user changes the value of the view, that value is sent
|
||||
/// on the `followingTerminal`, and received in the model from the
|
||||
/// `leadingTerminal`. However, the initial value of the view is not received
|
||||
/// from the `leadingTerminal` (only future changes).
|
||||
@interface RACChannel : NSObject
|
||||
|
||||
/// The terminal which "leads" the channel, by sending its latest value
|
||||
/// immediately to new subscribers of the `followingTerminal`.
|
||||
///
|
||||
/// New subscribers to this terminal will not receive a starting value, but will
|
||||
/// receive all future values that are sent to the `followingTerminal`.
|
||||
@property (nonatomic, strong, readonly) RACChannelTerminal *leadingTerminal;
|
||||
|
||||
/// The terminal which "follows" the lead of the other terminal, only sending
|
||||
/// _future_ values to the subscribers of the `leadingTerminal`.
|
||||
///
|
||||
/// The latest value sent to the `leadingTerminal` (if any) will be sent
|
||||
/// immediately to new subscribers of this terminal, and then all future values
|
||||
/// as well.
|
||||
@property (nonatomic, strong, readonly) RACChannelTerminal *followingTerminal;
|
||||
|
||||
@end
|
||||
|
||||
/// Represents one end of a RACChannel.
|
||||
///
|
||||
/// An terminal is similar to a socket or pipe -- it represents one end of
|
||||
/// a connection (the RACChannel, in this case). Values sent to this terminal
|
||||
/// will _not_ be received by its subscribers. Instead, the values will be sent
|
||||
/// to the subscribers of the RACChannel's _other_ terminal.
|
||||
///
|
||||
/// For example, when using the `followingTerminal`, _sent_ values can only be
|
||||
/// _received_ from the `leadingTerminal`, and vice versa.
|
||||
///
|
||||
/// To make it easy to terminate a RACChannel, `error` and `completed` events
|
||||
/// sent to either terminal will be received by the subscribers of _both_
|
||||
/// terminals.
|
||||
///
|
||||
/// Do not instantiate this class directly. Create a RACChannel instead.
|
||||
@interface RACChannelTerminal : RACSignal <RACSubscriber>
|
||||
|
||||
- (id)init __attribute__((unavailable("Instantiate a RACChannel instead")));
|
||||
|
||||
@end
|
|
@ -1,123 +0,0 @@
|
|||
//
|
||||
// RACCommand.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 3/3/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RACSignal;
|
||||
|
||||
/// The domain for errors originating within `RACCommand`.
|
||||
extern NSString * const RACCommandErrorDomain;
|
||||
|
||||
/// -execute: was invoked while the command was disabled.
|
||||
extern const NSInteger RACCommandErrorNotEnabled;
|
||||
|
||||
/// A `userInfo` key for an error, associated with the `RACCommand` that the
|
||||
/// error originated from.
|
||||
///
|
||||
/// This is included only when the error code is `RACCommandErrorNotEnabled`.
|
||||
extern NSString * const RACUnderlyingCommandErrorKey;
|
||||
|
||||
/// A command is a signal triggered in response to some action, typically
|
||||
/// UI-related.
|
||||
@interface RACCommand : NSObject
|
||||
|
||||
/// A signal of the signals returned by successful invocations of -execute:
|
||||
/// (i.e., while the receiver is `enabled`).
|
||||
///
|
||||
/// Errors will be automatically caught upon the inner signals, and sent upon
|
||||
/// `errors` instead. If you _want_ to receive inner errors, use -execute: or
|
||||
/// -[RACSignal materialize].
|
||||
///
|
||||
/// Only executions that begin _after_ subscription will be sent upon this
|
||||
/// signal. All inner signals will arrive upon the main thread.
|
||||
@property (nonatomic, strong, readonly) RACSignal *executionSignals;
|
||||
|
||||
/// A signal of whether this command is currently executing.
|
||||
///
|
||||
/// This will send YES whenever -execute: is invoked and the created signal has
|
||||
/// not yet terminated. Once all executions have terminated, `executing` will
|
||||
/// send NO.
|
||||
///
|
||||
/// This signal will send its current value upon subscription, and then all
|
||||
/// future values on the main thread.
|
||||
@property (nonatomic, strong, readonly) RACSignal *executing;
|
||||
|
||||
/// A signal of whether this command is able to execute.
|
||||
///
|
||||
/// This will send NO if:
|
||||
///
|
||||
/// - The command was created with an `enabledSignal`, and NO is sent upon that
|
||||
/// signal, or
|
||||
/// - `allowsConcurrentExecution` is NO and the command has started executing.
|
||||
///
|
||||
/// Once the above conditions are no longer met, the signal will send YES.
|
||||
///
|
||||
/// This signal will send its current value upon subscription, and then all
|
||||
/// future values on the main thread.
|
||||
@property (nonatomic, strong, readonly) RACSignal *enabled;
|
||||
|
||||
/// Forwards any errors that occur within signals returned by -execute:.
|
||||
///
|
||||
/// When an error occurs on a signal returned from -execute:, this signal will
|
||||
/// send the associated NSError value as a `next` event (since an `error` event
|
||||
/// would terminate the stream).
|
||||
///
|
||||
/// After subscription, this signal will send all future errors on the main
|
||||
/// thread.
|
||||
@property (nonatomic, strong, readonly) RACSignal *errors;
|
||||
|
||||
/// Whether the command allows multiple executions to proceed concurrently.
|
||||
///
|
||||
/// The default value for this property is NO.
|
||||
@property (atomic, assign) BOOL allowsConcurrentExecution;
|
||||
|
||||
/// Invokes -initWithEnabled:signalBlock: with a nil `enabledSignal`.
|
||||
- (id)initWithSignalBlock:(RACSignal * (^)(id input))signalBlock;
|
||||
|
||||
/// Initializes a command that is conditionally enabled.
|
||||
///
|
||||
/// This is the designated initializer for this class.
|
||||
///
|
||||
/// enabledSignal - A signal of BOOLs which indicate whether the command should
|
||||
/// be enabled. `enabled` will be based on the latest value sent
|
||||
/// from this signal. Before any values are sent, `enabled` will
|
||||
/// default to YES. This argument may be nil.
|
||||
/// signalBlock - A block which will map each input value (passed to -execute:)
|
||||
/// to a signal of work. The returned signal will be multicasted
|
||||
/// to a replay subject, sent on `executionSignals`, then
|
||||
/// subscribed to synchronously. Neither the block nor the
|
||||
/// returned signal may be nil.
|
||||
- (id)initWithEnabled:(RACSignal *)enabledSignal signalBlock:(RACSignal * (^)(id input))signalBlock;
|
||||
|
||||
/// If the receiver is enabled, this method will:
|
||||
///
|
||||
/// 1. Invoke the `signalBlock` given at the time of initialization.
|
||||
/// 2. Multicast the returned signal to a RACReplaySubject.
|
||||
/// 3. Send the multicasted signal on `executionSignals`.
|
||||
/// 4. Subscribe (connect) to the original signal on the main thread.
|
||||
///
|
||||
/// input - The input value to pass to the receiver's `signalBlock`. This may be
|
||||
/// nil.
|
||||
///
|
||||
/// Returns the multicasted signal, after subscription. If the receiver is not
|
||||
/// enabled, returns a signal that will send an error with code
|
||||
/// RACCommandErrorNotEnabled.
|
||||
- (RACSignal *)execute:(id)input;
|
||||
|
||||
@end
|
||||
|
||||
@interface RACCommand (Unavailable)
|
||||
|
||||
@property (atomic, readonly) BOOL canExecute __attribute__((unavailable("Use the 'enabled' signal instead")));
|
||||
|
||||
+ (instancetype)command __attribute__((unavailable("Use -initWithSignalBlock: instead")));
|
||||
+ (instancetype)commandWithCanExecuteSignal:(RACSignal *)canExecuteSignal __attribute__((unavailable("Use -initWithEnabled:signalBlock: instead")));
|
||||
- (id)initWithCanExecuteSignal:(RACSignal *)canExecuteSignal __attribute__((unavailable("Use -initWithEnabled:signalBlock: instead")));
|
||||
- (RACSignal *)addSignalBlock:(RACSignal * (^)(id value))signalBlock __attribute__((unavailable("Pass the signalBlock to -initWithSignalBlock: instead")));
|
||||
|
||||
@end
|
|
@ -1,48 +0,0 @@
|
|||
//
|
||||
// RACCompoundDisposable.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 11/30/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RACDisposable.h"
|
||||
|
||||
/// A disposable of disposables. When it is disposed, it disposes of all its
|
||||
/// contained disposables.
|
||||
///
|
||||
/// If -addDisposable: is called after the compound disposable has been disposed
|
||||
/// of, the given disposable is immediately disposed. This allows a compound
|
||||
/// disposable to act as a stand-in for a disposable that will be delivered
|
||||
/// asynchronously.
|
||||
@interface RACCompoundDisposable : RACDisposable
|
||||
|
||||
/// Creates and returns a new compound disposable.
|
||||
+ (instancetype)compoundDisposable;
|
||||
|
||||
/// Creates and returns a new compound disposable containing the given
|
||||
/// disposables.
|
||||
+ (instancetype)compoundDisposableWithDisposables:(NSArray *)disposables;
|
||||
|
||||
/// Adds the given disposable. If the receiving disposable has already been
|
||||
/// disposed of, the given disposable is disposed immediately.
|
||||
///
|
||||
/// This method is thread-safe.
|
||||
///
|
||||
/// disposable - The disposable to add. This may be nil, in which case nothing
|
||||
/// happens.
|
||||
- (void)addDisposable:(RACDisposable *)disposable;
|
||||
|
||||
/// Removes the specified disposable from the compound disposable (regardless of
|
||||
/// its disposed status), or does nothing if it's not in the compound disposable.
|
||||
///
|
||||
/// This is mainly useful for limiting the memory usage of the compound
|
||||
/// disposable for long-running operations.
|
||||
///
|
||||
/// This method is thread-safe.
|
||||
///
|
||||
/// disposable - The disposable to remove. This argument may be nil (to make the
|
||||
/// use of weak references easier).
|
||||
- (void)removeDisposable:(RACDisposable *)disposable;
|
||||
|
||||
@end
|
|
@ -1,35 +0,0 @@
|
|||
//
|
||||
// RACDisposable.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 3/16/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RACScopedDisposable;
|
||||
|
||||
/// A disposable encapsulates the work necessary to tear down and cleanup a
|
||||
/// subscription.
|
||||
@interface RACDisposable : NSObject
|
||||
|
||||
/// Whether the receiver has been disposed.
|
||||
///
|
||||
/// Use of this property is discouraged, since it may be set to `YES`
|
||||
/// concurrently at any time.
|
||||
///
|
||||
/// This property is not KVO-compliant.
|
||||
@property (atomic, assign, getter = isDisposed, readonly) BOOL disposed;
|
||||
|
||||
+ (instancetype)disposableWithBlock:(void (^)(void))block;
|
||||
|
||||
/// Performs the disposal work. Can be called multiple times, though subsequent
|
||||
/// calls won't do anything.
|
||||
- (void)dispose;
|
||||
|
||||
/// Returns a new disposable which will dispose of this disposable when it gets
|
||||
/// dealloc'd.
|
||||
- (RACScopedDisposable *)asScopedDisposable;
|
||||
|
||||
@end
|
|
@ -1,51 +0,0 @@
|
|||
//
|
||||
// RACEvent.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2013-01-07.
|
||||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/// Describes the type of a RACEvent.
|
||||
///
|
||||
/// RACEventTypeCompleted - A `completed` event.
|
||||
/// RACEventTypeError - An `error` event.
|
||||
/// RACEventTypeNext - A `next` event.
|
||||
typedef enum : NSUInteger {
|
||||
RACEventTypeCompleted,
|
||||
RACEventTypeError,
|
||||
RACEventTypeNext
|
||||
} RACEventType;
|
||||
|
||||
/// Represents an event sent by a RACSignal.
|
||||
///
|
||||
/// This corresponds to the `Notification` class in Rx.
|
||||
@interface RACEvent : NSObject <NSCopying>
|
||||
|
||||
/// Returns a singleton RACEvent representing the `completed` event.
|
||||
+ (instancetype)completedEvent;
|
||||
|
||||
/// Returns a new event of type RACEventTypeError, containing the given error.
|
||||
+ (instancetype)eventWithError:(NSError *)error;
|
||||
|
||||
/// Returns a new event of type RACEventTypeNext, containing the given value.
|
||||
+ (instancetype)eventWithValue:(id)value;
|
||||
|
||||
/// The type of event represented by the receiver.
|
||||
@property (nonatomic, assign, readonly) RACEventType eventType;
|
||||
|
||||
/// Returns whether the receiver is of type RACEventTypeCompleted or
|
||||
/// RACEventTypeError.
|
||||
@property (nonatomic, getter = isFinished, assign, readonly) BOOL finished;
|
||||
|
||||
/// The error associated with an event of type RACEventTypeError. This will be
|
||||
/// nil for all other event types.
|
||||
@property (nonatomic, strong, readonly) NSError *error;
|
||||
|
||||
/// The value associated with an event of type RACEventTypeNext. This will be
|
||||
/// nil for all other event types.
|
||||
@property (nonatomic, strong, readonly) id value;
|
||||
|
||||
@end
|
|
@ -1,19 +0,0 @@
|
|||
//
|
||||
// RACGroupedSignal.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 5/2/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RACSubject.h"
|
||||
|
||||
/// A grouped signal is used by -[RACSignal groupBy:transform:].
|
||||
@interface RACGroupedSignal : RACSubject
|
||||
|
||||
/// The key shared by the group.
|
||||
@property (nonatomic, readonly, copy) id<NSCopying> key;
|
||||
|
||||
+ (instancetype)signalWithKey:(id<NSCopying>)key;
|
||||
|
||||
@end
|
|
@ -1,97 +0,0 @@
|
|||
//
|
||||
// RACKVOChannel.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Uri Baghin on 27/12/2012.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RACChannel.h"
|
||||
#import "EXTKeyPathCoding.h"
|
||||
#import "metamacros.h"
|
||||
|
||||
/// Creates a RACKVOChannel to the given key path. When the targeted object
|
||||
/// deallocates, the channel will complete.
|
||||
///
|
||||
/// If RACChannelTo() is used as an expression, it returns a RACChannelTerminal that
|
||||
/// can be used to watch the specified property for changes, and set new values
|
||||
/// for it. The terminal will start with the property's current value upon
|
||||
/// subscription.
|
||||
///
|
||||
/// If RACChannelTo() is used on the left-hand side of an assignment, there must a
|
||||
/// RACChannelTerminal on the right-hand side of the assignment. The two will be
|
||||
/// subscribed to one another: the property's value is immediately set to the
|
||||
/// value of the channel terminal on the right-hand side, and subsequent changes
|
||||
/// to either terminal will be reflected on the other.
|
||||
///
|
||||
/// There are two different versions of this macro:
|
||||
///
|
||||
/// - RACChannelTo(TARGET, KEYPATH, NILVALUE) will create a channel to the `KEYPATH`
|
||||
/// of `TARGET`. If the terminal is ever sent a `nil` value, the property will
|
||||
/// be set to `NILVALUE` instead. `NILVALUE` may itself be `nil` for object
|
||||
/// properties, but an NSValue should be used for primitive properties, to
|
||||
/// avoid an exception if `nil` is sent (which might occur if an intermediate
|
||||
/// object is set to `nil`).
|
||||
/// - RACChannelTo(TARGET, KEYPATH) is the same as the above, but `NILVALUE` defaults to
|
||||
/// `nil`.
|
||||
///
|
||||
/// Examples
|
||||
///
|
||||
/// RACChannelTerminal *integerChannel = RACChannelTo(self, integerProperty, @42);
|
||||
///
|
||||
/// // Sets self.integerProperty to 5.
|
||||
/// [integerChannel sendNext:@5];
|
||||
///
|
||||
/// // Logs the current value of self.integerProperty, and all future changes.
|
||||
/// [integerChannel subscribeNext:^(id value) {
|
||||
/// NSLog(@"value: %@", value);
|
||||
/// }];
|
||||
///
|
||||
/// // Binds properties to each other, taking the initial value from the right
|
||||
/// side.
|
||||
/// RACChannelTo(view, objectProperty) = RACChannelTo(model, objectProperty);
|
||||
/// RACChannelTo(view, integerProperty, @2) = RACChannelTo(model, integerProperty, @10);
|
||||
#define RACChannelTo(TARGET, ...) \
|
||||
metamacro_if_eq(1, metamacro_argcount(__VA_ARGS__)) \
|
||||
(RACChannelTo_(TARGET, __VA_ARGS__, nil)) \
|
||||
(RACChannelTo_(TARGET, __VA_ARGS__))
|
||||
|
||||
/// Do not use this directly. Use the RACChannelTo macro above.
|
||||
#define RACChannelTo_(TARGET, KEYPATH, NILVALUE) \
|
||||
[[RACKVOChannel alloc] initWithTarget:(TARGET) keyPath:@keypath(TARGET, KEYPATH) nilValue:(NILVALUE)][@keypath(RACKVOChannel.new, followingTerminal)]
|
||||
|
||||
/// A RACChannel that observes a KVO-compliant key path for changes.
|
||||
@interface RACKVOChannel : RACChannel
|
||||
|
||||
/// Initializes a channel that will observe the given object and key path.
|
||||
///
|
||||
/// The current value of the key path, and future KVO notifications for the given
|
||||
/// key path, will be sent to subscribers of the channel's `followingTerminal`.
|
||||
/// Values sent to the `followingTerminal` will be set at the given key path using
|
||||
/// key-value coding.
|
||||
///
|
||||
/// When the target object deallocates, the channel will complete. Signal errors
|
||||
/// are considered undefined behavior.
|
||||
///
|
||||
/// This is the designated initializer for this class.
|
||||
///
|
||||
/// target - The object to bind to.
|
||||
/// keyPath - The key path to observe and set the value of.
|
||||
/// nilValue - The value to set at the key path whenever a `nil` value is
|
||||
/// received. This may be nil when connecting to object properties, but
|
||||
/// an NSValue should be used for primitive properties, to avoid an
|
||||
/// exception if `nil` is received (which might occur if an intermediate
|
||||
/// object is set to `nil`).
|
||||
- (id)initWithTarget:(__weak NSObject *)target keyPath:(NSString *)keyPath nilValue:(id)nilValue;
|
||||
|
||||
- (id)init __attribute__((unavailable("Use -initWithTarget:keyPath:nilValue: instead")));
|
||||
|
||||
@end
|
||||
|
||||
/// Methods needed for the convenience macro. Do not call explicitly.
|
||||
@interface RACKVOChannel (RACChannelTo)
|
||||
|
||||
- (RACChannelTerminal *)objectForKeyedSubscript:(NSString *)key;
|
||||
- (void)setObject:(RACChannelTerminal *)otherTerminal forKeyedSubscript:(NSString *)key;
|
||||
|
||||
@end
|
|
@ -1,48 +0,0 @@
|
|||
//
|
||||
// RACMulticastConnection.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 4/11/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RACDisposable;
|
||||
@class RACSignal;
|
||||
|
||||
/// A multicast connection encapsulates the idea of sharing one subscription to a
|
||||
/// signal to many subscribers. This is most often needed if the subscription to
|
||||
/// the underlying signal involves side-effects or shouldn't be called more than
|
||||
/// once.
|
||||
///
|
||||
/// The multicasted signal is only subscribed to when
|
||||
/// -[RACMulticastConnection connect] is called. Until that happens, no values
|
||||
/// will be sent on `signal`. See -[RACMulticastConnection autoconnect] for how
|
||||
/// -[RACMulticastConnection connect] can be called automatically.
|
||||
///
|
||||
/// Note that you shouldn't create RACMulticastConnection manually. Instead use
|
||||
/// -[RACSignal publish] or -[RACSignal multicast:].
|
||||
@interface RACMulticastConnection : NSObject
|
||||
|
||||
/// The multicasted signal.
|
||||
@property (nonatomic, strong, readonly) RACSignal *signal;
|
||||
|
||||
/// Connect to the underlying signal by subscribing to it. Calling this multiple
|
||||
/// times does nothing but return the existing connection's disposable.
|
||||
///
|
||||
/// Returns the disposable for the subscription to the multicasted signal.
|
||||
- (RACDisposable *)connect;
|
||||
|
||||
/// Connects to the underlying signal when the returned signal is first
|
||||
/// subscribed to, and disposes of the subscription to the multicasted signal
|
||||
/// when the returned signal has no subscribers.
|
||||
///
|
||||
/// If new subscribers show up after being disposed, they'll subscribe and then
|
||||
/// be immediately disposed of. The returned signal will never re-connect to the
|
||||
/// multicasted signal.
|
||||
///
|
||||
/// Returns the autoconnecting signal.
|
||||
- (RACSignal *)autoconnect;
|
||||
|
||||
@end
|
|
@ -1,35 +0,0 @@
|
|||
//
|
||||
// RACQueueScheduler+Subclass.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 6/6/13.
|
||||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RACQueueScheduler.h"
|
||||
#import "RACScheduler+Subclass.h"
|
||||
|
||||
/// An interface for use by GCD queue-based subclasses.
|
||||
///
|
||||
/// See RACScheduler+Subclass.h for subclassing notes.
|
||||
@interface RACQueueScheduler ()
|
||||
|
||||
/// The queue on which blocks are enqueued.
|
||||
@property (nonatomic, strong, readonly) dispatch_queue_t queue;
|
||||
|
||||
/// Initializes the receiver with the name of the scheduler and the queue which
|
||||
/// the scheduler should use.
|
||||
///
|
||||
/// name - The name of the scheduler. If nil, a default name will be used.
|
||||
/// queue - The queue upon which the receiver should enqueue scheduled blocks.
|
||||
/// This argument must not be NULL.
|
||||
///
|
||||
/// Returns the initialized object.
|
||||
- (id)initWithName:(NSString *)name queue:(dispatch_queue_t)queue;
|
||||
|
||||
/// Converts a date into a GCD time using dispatch_walltime().
|
||||
///
|
||||
/// date - The date to convert. This must not be nil.
|
||||
+ (dispatch_time_t)wallTimeWithDate:(NSDate *)date;
|
||||
|
||||
@end
|
|
@ -1,18 +0,0 @@
|
|||
//
|
||||
// RACQueueScheduler.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 11/30/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RACScheduler.h"
|
||||
|
||||
/// An abstract scheduler which asynchronously enqueues all its work to a Grand
|
||||
/// Central Dispatch queue.
|
||||
///
|
||||
/// Because RACQueueScheduler is abstract, it should not be instantiated
|
||||
/// directly. Create a subclass using the `RACQueueScheduler+Subclass.h`
|
||||
/// interface and use that instead.
|
||||
@interface RACQueueScheduler : RACScheduler
|
||||
@end
|
|
@ -1,22 +0,0 @@
|
|||
//
|
||||
// RACReplaySubject.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 3/14/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RACSubject.h"
|
||||
|
||||
extern const NSUInteger RACReplaySubjectUnlimitedCapacity;
|
||||
|
||||
/// A replay subject saves the values it is sent (up to its defined capacity)
|
||||
/// and resends those to new subscribers. It will also replay an error or
|
||||
/// completion.
|
||||
@interface RACReplaySubject : RACSubject
|
||||
|
||||
/// Creates a new replay subject with the given capacity. A capacity of
|
||||
/// RACReplaySubjectUnlimitedCapacity means values are never trimmed.
|
||||
+ (instancetype)replaySubjectWithCapacity:(NSUInteger)capacity;
|
||||
|
||||
@end
|
|
@ -1,29 +0,0 @@
|
|||
//
|
||||
// RACScheduler.m
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Miķelis Vindavs on 5/27/14.
|
||||
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "RACScheduler.h"
|
||||
|
||||
/// An interface for use by subclasses.
|
||||
///
|
||||
/// Subclasses should use `-performAsCurrentScheduler:` to do the actual block
|
||||
/// invocation so that +[RACScheduler currentScheduler] behaves as expected.
|
||||
///
|
||||
/// **Note that RACSchedulers are expected to be serial**. Subclasses must honor
|
||||
/// that contract. See `RACTargetQueueScheduler` for a queue-based scheduler
|
||||
/// which will enforce the serialization guarantee.
|
||||
@interface RACScheduler ()
|
||||
|
||||
/// Performs the given block with the receiver as the current scheduler for
|
||||
/// its thread. This should only be called by subclasses to perform their
|
||||
/// scheduled blocks.
|
||||
///
|
||||
/// block - The block to execute. Cannot be NULL.
|
||||
- (void)performAsCurrentScheduler:(void (^)(void))block;
|
||||
|
||||
@end
|
|
@ -1,148 +0,0 @@
|
|||
//
|
||||
// RACScheduler.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 4/16/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/// The priority for the scheduler.
|
||||
///
|
||||
/// RACSchedulerPriorityHigh - High priority.
|
||||
/// RACSchedulerPriorityDefault - Default priority.
|
||||
/// RACSchedulerPriorityLow - Low priority.
|
||||
/// RACSchedulerPriorityBackground - Background priority.
|
||||
typedef enum : long {
|
||||
RACSchedulerPriorityHigh = DISPATCH_QUEUE_PRIORITY_HIGH,
|
||||
RACSchedulerPriorityDefault = DISPATCH_QUEUE_PRIORITY_DEFAULT,
|
||||
RACSchedulerPriorityLow = DISPATCH_QUEUE_PRIORITY_LOW,
|
||||
RACSchedulerPriorityBackground = DISPATCH_QUEUE_PRIORITY_BACKGROUND,
|
||||
} RACSchedulerPriority;
|
||||
|
||||
/// Scheduled with -scheduleRecursiveBlock:, this type of block is passed a block
|
||||
/// with which it can call itself recursively.
|
||||
typedef void (^RACSchedulerRecursiveBlock)(void (^reschedule)(void));
|
||||
|
||||
@class RACDisposable;
|
||||
|
||||
/// Schedulers are used to control when and where work is performed.
|
||||
@interface RACScheduler : NSObject
|
||||
|
||||
/// A singleton scheduler that immediately executes the blocks it is given.
|
||||
///
|
||||
/// **Note:** Unlike most other schedulers, this does not set the current
|
||||
/// scheduler. There may still be a valid +currentScheduler if this is used
|
||||
/// within a block scheduled on a different scheduler.
|
||||
+ (RACScheduler *)immediateScheduler;
|
||||
|
||||
/// A singleton scheduler that executes blocks in the main thread.
|
||||
+ (RACScheduler *)mainThreadScheduler;
|
||||
|
||||
/// Creates and returns a new background scheduler with the given priority and
|
||||
/// name. The name is for debug and instrumentation purposes only.
|
||||
///
|
||||
/// Scheduler creation is cheap. It's unnecessary to save the result of this
|
||||
/// method call unless you want to serialize some actions on the same background
|
||||
/// scheduler.
|
||||
+ (RACScheduler *)schedulerWithPriority:(RACSchedulerPriority)priority name:(NSString *)name;
|
||||
|
||||
/// Invokes +schedulerWithPriority:name: with a default name.
|
||||
+ (RACScheduler *)schedulerWithPriority:(RACSchedulerPriority)priority;
|
||||
|
||||
/// Invokes +schedulerWithPriority: with RACSchedulerPriorityDefault.
|
||||
+ (RACScheduler *)scheduler;
|
||||
|
||||
/// The current scheduler. This will only be valid when used from within a
|
||||
/// -[RACScheduler schedule:] block or when on the main thread.
|
||||
+ (RACScheduler *)currentScheduler;
|
||||
|
||||
/// Schedule the given block for execution on the scheduler.
|
||||
///
|
||||
/// Scheduled blocks will be executed in the order in which they were scheduled.
|
||||
///
|
||||
/// block - The block to schedule for execution. Cannot be nil.
|
||||
///
|
||||
/// Returns a disposable which can be used to cancel the scheduled block before
|
||||
/// it begins executing, or nil if cancellation is not supported.
|
||||
- (RACDisposable *)schedule:(void (^)(void))block;
|
||||
|
||||
/// Schedule the given block for execution on the scheduler at or after
|
||||
/// a specific time.
|
||||
///
|
||||
/// Note that blocks scheduled for a certain time will not preempt any other
|
||||
/// scheduled work that is executing at the time.
|
||||
///
|
||||
/// When invoked on the +immediateScheduler, the calling thread **will block**
|
||||
/// until the specified time.
|
||||
///
|
||||
/// date - The earliest time at which `block` should begin executing. The block
|
||||
/// may not execute immediately at this time, whether due to system load
|
||||
/// or another block on the scheduler currently being run. Cannot be nil.
|
||||
/// block - The block to schedule for execution. Cannot be nil.
|
||||
///
|
||||
/// Returns a disposable which can be used to cancel the scheduled block before
|
||||
/// it begins executing, or nil if cancellation is not supported.
|
||||
- (RACDisposable *)after:(NSDate *)date schedule:(void (^)(void))block;
|
||||
|
||||
/// Schedule the given block for execution on the scheduler after the delay.
|
||||
///
|
||||
/// Converts the delay into an NSDate, then invokes `-after:schedule:`.
|
||||
- (RACDisposable *)afterDelay:(NSTimeInterval)delay schedule:(void (^)(void))block;
|
||||
|
||||
/// Reschedule the given block at a particular interval, starting at a specific
|
||||
/// time, and with a given leeway for deferral.
|
||||
///
|
||||
/// Note that blocks scheduled for a certain time will not preempt any other
|
||||
/// scheduled work that is executing at the time.
|
||||
///
|
||||
/// Regardless of the value of `leeway`, the given block may not execute exactly
|
||||
/// at `when` or exactly on successive intervals, whether due to system load or
|
||||
/// because another block is currently being run on the scheduler.
|
||||
///
|
||||
/// It is considered undefined behavior to invoke this method on the
|
||||
/// +immediateScheduler.
|
||||
///
|
||||
/// date - The earliest time at which `block` should begin executing. The
|
||||
/// block may not execute immediately at this time, whether due to
|
||||
/// system load or another block on the scheduler currently being
|
||||
/// run. Cannot be nil.
|
||||
/// interval - The interval at which the block should be rescheduled, starting
|
||||
/// from `date`. This will use the system wall clock, to avoid
|
||||
/// skew when the computer goes to sleep.
|
||||
/// leeway - A hint to the system indicating the number of seconds that each
|
||||
/// scheduling can be deferred. Note that this is just a hint, and
|
||||
/// there may be some additional latency no matter what.
|
||||
/// block - The block to repeatedly schedule for execution. Cannot be nil.
|
||||
///
|
||||
/// Returns a disposable which can be used to cancel the automatic scheduling and
|
||||
/// rescheduling, or nil if cancellation is not supported.
|
||||
- (RACDisposable *)after:(NSDate *)date repeatingEvery:(NSTimeInterval)interval withLeeway:(NSTimeInterval)leeway schedule:(void (^)(void))block;
|
||||
|
||||
/// Schedule the given recursive block for execution on the scheduler. The
|
||||
/// scheduler will automatically flatten any recursive scheduling into iteration
|
||||
/// instead, so this can be used without issue for blocks that may keep invoking
|
||||
/// themselves forever.
|
||||
///
|
||||
/// Scheduled blocks will be executed in the order in which they were scheduled.
|
||||
///
|
||||
/// recursiveBlock - The block to schedule for execution. When invoked, the
|
||||
/// recursive block will be passed a `void (^)(void)` block
|
||||
/// which will reschedule the recursive block at the end of the
|
||||
/// receiver's queue. This passed-in block will automatically
|
||||
/// skip scheduling if the scheduling of the `recursiveBlock`
|
||||
/// was disposed in the meantime.
|
||||
///
|
||||
/// Returns a disposable which can be used to cancel the scheduled block before
|
||||
/// it begins executing, or to stop it from rescheduling if it's already begun
|
||||
/// execution.
|
||||
- (RACDisposable *)scheduleRecursiveBlock:(RACSchedulerRecursiveBlock)recursiveBlock;
|
||||
|
||||
@end
|
||||
|
||||
@interface RACScheduler (Deprecated)
|
||||
|
||||
+ (RACScheduler *)schedulerWithQueue:(dispatch_queue_t)queue name:(NSString *)name __attribute__((deprecated("Use -[RACTargetQueueScheduler initWithName:targetQueue:] instead.")));
|
||||
|
||||
@end
|
|
@ -1,18 +0,0 @@
|
|||
//
|
||||
// RACScopedDisposable.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 3/28/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RACDisposable.h"
|
||||
|
||||
/// A disposable that calls its own -dispose when it is dealloc'd.
|
||||
@interface RACScopedDisposable : RACDisposable
|
||||
|
||||
/// Creates a new scoped disposable that will also dispose of the given
|
||||
/// disposable when it is dealloc'd.
|
||||
+ (instancetype)scopedDisposableWithDisposable:(RACDisposable *)disposable;
|
||||
|
||||
@end
|
|
@ -1,154 +0,0 @@
|
|||
//
|
||||
// RACSequence.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2012-10-29.
|
||||
// Copyright (c) 2012 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "RACStream.h"
|
||||
|
||||
@class RACScheduler;
|
||||
@class RACSignal;
|
||||
|
||||
/// Represents an immutable sequence of values. Unless otherwise specified, the
|
||||
/// sequences' values are evaluated lazily on demand. Like Cocoa collections,
|
||||
/// sequences cannot contain nil.
|
||||
///
|
||||
/// Most inherited RACStream methods that accept a block will execute the block
|
||||
/// _at most_ once for each value that is evaluated in the returned sequence.
|
||||
/// Side effects are subject to the behavior described in
|
||||
/// +sequenceWithHeadBlock:tailBlock:.
|
||||
///
|
||||
/// Implemented as a class cluster. A minimal implementation for a subclass
|
||||
/// consists simply of -head and -tail.
|
||||
@interface RACSequence : RACStream <NSCoding, NSCopying, NSFastEnumeration>
|
||||
|
||||
/// The first object in the sequence, or nil if the sequence is empty.
|
||||
///
|
||||
/// Subclasses must provide an implementation of this method.
|
||||
@property (nonatomic, strong, readonly) id head;
|
||||
|
||||
/// All but the first object in the sequence, or nil if the sequence is empty.
|
||||
///
|
||||
/// Subclasses must provide an implementation of this method.
|
||||
@property (nonatomic, strong, readonly) RACSequence *tail;
|
||||
|
||||
/// Evaluates the full sequence to produce an equivalently-sized array.
|
||||
@property (nonatomic, copy, readonly) NSArray *array;
|
||||
|
||||
/// Returns an enumerator of all objects in the sequence.
|
||||
@property (nonatomic, copy, readonly) NSEnumerator *objectEnumerator;
|
||||
|
||||
/// Converts a sequence into an eager sequence.
|
||||
///
|
||||
/// An eager sequence fully evaluates all of its values immediately. Sequences
|
||||
/// derived from an eager sequence will also be eager.
|
||||
///
|
||||
/// Returns a new eager sequence, or the receiver if the sequence is already
|
||||
/// eager.
|
||||
@property (nonatomic, copy, readonly) RACSequence *eagerSequence;
|
||||
|
||||
/// Converts a sequence into a lazy sequence.
|
||||
///
|
||||
/// A lazy sequence evaluates its values on demand, as they are accessed.
|
||||
/// Sequences derived from a lazy sequence will also be lazy.
|
||||
///
|
||||
/// Returns a new lazy sequence, or the receiver if the sequence is already lazy.
|
||||
@property (nonatomic, copy, readonly) RACSequence *lazySequence;
|
||||
|
||||
/// Invokes -signalWithScheduler: with a new RACScheduler.
|
||||
- (RACSignal *)signal;
|
||||
|
||||
/// Evaluates the full sequence on the given scheduler.
|
||||
///
|
||||
/// Each item is evaluated in its own scheduled block, such that control of the
|
||||
/// scheduler is yielded between each value.
|
||||
///
|
||||
/// Returns a signal which sends the receiver's values on the given scheduler as
|
||||
/// they're evaluated.
|
||||
- (RACSignal *)signalWithScheduler:(RACScheduler *)scheduler;
|
||||
|
||||
/// Applies a left fold to the sequence.
|
||||
///
|
||||
/// This is the same as iterating the sequence along with a provided start value.
|
||||
/// This uses a constant amount of memory. A left fold is left-associative so in
|
||||
/// the sequence [1,2,3] the block would applied in the following order:
|
||||
/// reduce(reduce(reduce(start, 1), 2), 3)
|
||||
///
|
||||
/// start - The starting value for the fold. Used as `accumulator` for the
|
||||
/// first fold.
|
||||
/// reduce - The block used to combine the accumulated value and the next value.
|
||||
/// Cannot be nil.
|
||||
///
|
||||
/// Returns a reduced value.
|
||||
- (id)foldLeftWithStart:(id)start reduce:(id (^)(id accumulator, id value))reduce;
|
||||
|
||||
/// Applies a right fold to the sequence.
|
||||
///
|
||||
/// A right fold is equivalent to recursion on the list. The block is evaluated
|
||||
/// from the right to the left in list. It is right associative so it's applied
|
||||
/// to the rightmost elements first. For example, in the sequence [1,2,3] the
|
||||
/// block is applied in the order:
|
||||
/// reduce(1, reduce(2, reduce(3, start)))
|
||||
///
|
||||
/// start - The starting value for the fold.
|
||||
/// reduce - The block used to combine the accumulated value and the next head.
|
||||
/// The block is given the accumulated value and the value of the rest
|
||||
/// of the computation (result of the recursion). This is computed when
|
||||
/// you retrieve its value using `rest.head`. This allows you to
|
||||
/// prevent unnecessary computation by not accessing `rest.head` if you
|
||||
/// don't need to.
|
||||
///
|
||||
/// Returns a reduced value.
|
||||
- (id)foldRightWithStart:(id)start reduce:(id (^)(id first, RACSequence *rest))reduce;
|
||||
|
||||
/// Check if any value in sequence passes the block.
|
||||
///
|
||||
/// block - The block predicate used to check each item. Cannot be nil.
|
||||
///
|
||||
/// Returns a boolean indiciating if any value in the sequence passed.
|
||||
- (BOOL)any:(BOOL (^)(id value))block;
|
||||
|
||||
/// Check if all values in the sequence pass the block.
|
||||
///
|
||||
/// block - The block predicate used to check each item. Cannot be nil.
|
||||
///
|
||||
/// Returns a boolean indicating if all values in the sequence passed.
|
||||
- (BOOL)all:(BOOL (^)(id value))block;
|
||||
|
||||
/// Returns the first object that passes the block.
|
||||
///
|
||||
/// block - The block predicate used to check each item. Cannot be nil.
|
||||
///
|
||||
/// Returns an object that passes the block or nil if no objects passed.
|
||||
- (id)objectPassingTest:(BOOL (^)(id value))block;
|
||||
|
||||
/// Creates a sequence that dynamically generates its values.
|
||||
///
|
||||
/// headBlock - Invoked the first time -head is accessed.
|
||||
/// tailBlock - Invoked the first time -tail is accessed.
|
||||
///
|
||||
/// The results from each block are memoized, so each block will be invoked at
|
||||
/// most once, no matter how many times the head and tail properties of the
|
||||
/// sequence are accessed.
|
||||
///
|
||||
/// Any side effects in `headBlock` or `tailBlock` should be thread-safe, since
|
||||
/// the sequence may be evaluated at any time from any thread. Not only that, but
|
||||
/// -tail may be accessed before -head, or both may be accessed simultaneously.
|
||||
/// As noted above, side effects will only be triggered the _first_ time -head or
|
||||
/// -tail is invoked.
|
||||
///
|
||||
/// Returns a sequence that lazily invokes the given blocks to provide head and
|
||||
/// tail. `headBlock` must not be nil.
|
||||
+ (RACSequence *)sequenceWithHeadBlock:(id (^)(void))headBlock tailBlock:(RACSequence *(^)(void))tailBlock;
|
||||
|
||||
@end
|
||||
|
||||
@interface RACSequence (Deprecated)
|
||||
|
||||
- (id)foldLeftWithStart:(id)start combine:(id (^)(id accumulator, id value))combine __attribute__((deprecated("Renamed to -foldLeftWithStart:reduce:")));
|
||||
- (id)foldRightWithStart:(id)start combine:(id (^)(id first, RACSequence *rest))combine __attribute__((deprecated("Renamed to -foldRightWithStart:reduce:")));
|
||||
|
||||
@end
|
|
@ -1,43 +0,0 @@
|
|||
//
|
||||
// RACSerialDisposable.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2013-07-22.
|
||||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RACDisposable.h"
|
||||
|
||||
/// A disposable that contains exactly one other disposable and allows it to be
|
||||
/// swapped out atomically.
|
||||
@interface RACSerialDisposable : RACDisposable
|
||||
|
||||
/// The inner disposable managed by the serial disposable.
|
||||
///
|
||||
/// This property is thread-safe for reading and writing. However, if you want to
|
||||
/// read the current value _and_ write a new one atomically, use
|
||||
/// -swapInDisposable: instead.
|
||||
///
|
||||
/// Disposing of the receiver will also dispose of the current disposable set for
|
||||
/// this property, then set the property to nil. If any new disposable is set
|
||||
/// after the receiver is disposed, it will be disposed immediately and this
|
||||
/// property will remain set to nil.
|
||||
@property (atomic, strong) RACDisposable *disposable;
|
||||
|
||||
/// Creates a serial disposable which will wrap the given disposable.
|
||||
///
|
||||
/// disposable - The value to set for `disposable`. This may be nil.
|
||||
///
|
||||
/// Returns a RACSerialDisposable, or nil if an error occurs.
|
||||
+ (instancetype)serialDisposableWithDisposable:(RACDisposable *)disposable;
|
||||
|
||||
/// Atomically swaps the receiver's `disposable` for `newDisposable`.
|
||||
///
|
||||
/// newDisposable - The new value for `disposable`. If the receiver has already
|
||||
/// been disposed, this disposable will be too, and `disposable`
|
||||
/// will remain set to nil. This argument may be nil.
|
||||
///
|
||||
/// Returns the previous value for the `disposable` property.
|
||||
- (RACDisposable *)swapInDisposable:(RACDisposable *)newDisposable;
|
||||
|
||||
@end
|
|
@ -1,709 +0,0 @@
|
|||
//
|
||||
// RACSignal+Operations.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2012-09-06.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "RACSignal.h"
|
||||
|
||||
/// The domain for errors originating in RACSignal operations.
|
||||
extern NSString * const RACSignalErrorDomain;
|
||||
|
||||
/// The error code used with -timeout:.
|
||||
extern const NSInteger RACSignalErrorTimedOut;
|
||||
|
||||
/// The error code used when a value passed into +switch:cases:default: does not
|
||||
/// match any of the cases, and no default was given.
|
||||
extern const NSInteger RACSignalErrorNoMatchingCase;
|
||||
|
||||
@class RACCommand;
|
||||
@class RACDisposable;
|
||||
@class RACMulticastConnection;
|
||||
@class RACScheduler;
|
||||
@class RACSequence;
|
||||
@class RACSubject;
|
||||
@class RACTuple;
|
||||
@protocol RACSubscriber;
|
||||
|
||||
@interface RACSignal (Operations)
|
||||
|
||||
/// Do the given block on `next`. This should be used to inject side effects into
|
||||
/// the signal.
|
||||
- (RACSignal *)doNext:(void (^)(id x))block;
|
||||
|
||||
/// Do the given block on `error`. This should be used to inject side effects
|
||||
/// into the signal.
|
||||
- (RACSignal *)doError:(void (^)(NSError *error))block;
|
||||
|
||||
/// Do the given block on `completed`. This should be used to inject side effects
|
||||
/// into the signal.
|
||||
- (RACSignal *)doCompleted:(void (^)(void))block;
|
||||
|
||||
/// Sends `next`s only if we don't receive another `next` in `interval` seconds.
|
||||
///
|
||||
/// If a `next` is received, and then another `next` is received before
|
||||
/// `interval` seconds have passed, the first value is discarded.
|
||||
///
|
||||
/// After `interval` seconds have passed since the most recent `next` was sent,
|
||||
/// the most recent `next` is forwarded on the scheduler that the value was
|
||||
/// originally received on. If +[RACScheduler currentScheduler] was nil at the
|
||||
/// time, a private background scheduler is used.
|
||||
///
|
||||
/// Returns a signal which sends throttled and delayed `next` events. Completion
|
||||
/// and errors are always forwarded immediately.
|
||||
- (RACSignal *)throttle:(NSTimeInterval)interval;
|
||||
|
||||
/// Throttles `next`s for which `predicate` returns YES.
|
||||
///
|
||||
/// When `predicate` returns YES for a `next`:
|
||||
///
|
||||
/// 1. If another `next` is received before `interval` seconds have passed, the
|
||||
/// prior value is discarded. This happens regardless of whether the new
|
||||
/// value will be throttled.
|
||||
/// 2. After `interval` seconds have passed since the value was originally
|
||||
/// received, it will be forwarded on the scheduler that it was received
|
||||
/// upon. If +[RACScheduler currentScheduler] was nil at the time, a private
|
||||
/// background scheduler is used.
|
||||
///
|
||||
/// When `predicate` returns NO for a `next`, it is forwarded immediately,
|
||||
/// without any throttling.
|
||||
///
|
||||
/// interval - The number of seconds for which to buffer the latest value that
|
||||
/// passes `predicate`.
|
||||
/// predicate - Passed each `next` from the receiver, this block returns
|
||||
/// whether the given value should be throttled. This argument must
|
||||
/// not be nil.
|
||||
///
|
||||
/// Returns a signal which sends `next` events, throttled when `predicate`
|
||||
/// returns YES. Completion and errors are always forwarded immediately.
|
||||
- (RACSignal *)throttle:(NSTimeInterval)interval valuesPassingTest:(BOOL (^)(id next))predicate;
|
||||
|
||||
/// Forwards `next` and `completed` events after delaying for `interval` seconds
|
||||
/// on the current scheduler (on which the events were delivered).
|
||||
///
|
||||
/// If +[RACScheduler currentScheduler] is nil when `next` or `completed` is
|
||||
/// received, a private background scheduler is used.
|
||||
///
|
||||
/// Returns a signal which sends delayed `next` and `completed` events. Errors
|
||||
/// are always forwarded immediately.
|
||||
- (RACSignal *)delay:(NSTimeInterval)interval;
|
||||
|
||||
/// Resubscribes when the signal completes.
|
||||
- (RACSignal *)repeat;
|
||||
|
||||
/// Executes the given block each time a subscription is created.
|
||||
///
|
||||
/// block - A block which defines the subscription side effects. Cannot be `nil`.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// // Write new file, with backup.
|
||||
/// [[[[fileManager
|
||||
/// rac_createFileAtPath:path contents:data]
|
||||
/// initially:^{
|
||||
/// // 2. Second, backup current file
|
||||
/// [fileManager moveItemAtPath:path toPath:backupPath error:nil];
|
||||
/// }]
|
||||
/// initially:^{
|
||||
/// // 1. First, acquire write lock.
|
||||
/// [writeLock lock];
|
||||
/// }]
|
||||
/// finally:^{
|
||||
/// [writeLock unlock];
|
||||
/// }];
|
||||
///
|
||||
/// Returns a signal that passes through all events of the receiver, plus
|
||||
/// introduces side effects which occur prior to any subscription side effects
|
||||
/// of the receiver.
|
||||
- (RACSignal *)initially:(void (^)(void))block;
|
||||
|
||||
/// Executes the given block when the signal completes or errors.
|
||||
- (RACSignal *)finally:(void (^)(void))block;
|
||||
|
||||
/// Divides the receiver's `next`s into buffers which deliver every `interval`
|
||||
/// seconds.
|
||||
///
|
||||
/// interval - The interval in which values are grouped into one buffer.
|
||||
/// scheduler - The scheduler upon which the returned signal will deliver its
|
||||
/// values. This must not be nil or +[RACScheduler
|
||||
/// immediateScheduler].
|
||||
///
|
||||
/// Returns a signal which sends RACTuples of the buffered values at each
|
||||
/// interval on `scheduler`. When the receiver completes, any currently-buffered
|
||||
/// values will be sent immediately.
|
||||
- (RACSignal *)bufferWithTime:(NSTimeInterval)interval onScheduler:(RACScheduler *)scheduler;
|
||||
|
||||
/// Collects all receiver's `next`s into a NSArray. Nil values will be converted
|
||||
/// to NSNull.
|
||||
///
|
||||
/// This corresponds to the `ToArray` method in Rx.
|
||||
///
|
||||
/// Returns a signal which sends a single NSArray when the receiver completes
|
||||
/// successfully.
|
||||
- (RACSignal *)collect;
|
||||
|
||||
/// Takes the last `count` `next`s after the receiving signal completes.
|
||||
- (RACSignal *)takeLast:(NSUInteger)count;
|
||||
|
||||
/// Combines the latest values from the receiver and the given signal into
|
||||
/// RACTuples, once both have sent at least one `next`.
|
||||
///
|
||||
/// Any additional `next`s will result in a new RACTuple with the latest values
|
||||
/// from both signals.
|
||||
///
|
||||
/// signal - The signal to combine with. This argument must not be nil.
|
||||
///
|
||||
/// Returns a signal which sends RACTuples of the combined values, forwards any
|
||||
/// `error` events, and completes when both input signals complete.
|
||||
- (RACSignal *)combineLatestWith:(RACSignal *)signal;
|
||||
|
||||
/// Combines the latest values from the given signals into RACTuples, once all
|
||||
/// the signals have sent at least one `next`.
|
||||
///
|
||||
/// Any additional `next`s will result in a new RACTuple with the latest values
|
||||
/// from all signals.
|
||||
///
|
||||
/// signals - The signals to combine. If this collection is empty, the returned
|
||||
/// signal will immediately complete upon subscription.
|
||||
///
|
||||
/// Returns a signal which sends RACTuples of the combined values, forwards any
|
||||
/// `error` events, and completes when all input signals complete.
|
||||
+ (RACSignal *)combineLatest:(id<NSFastEnumeration>)signals;
|
||||
|
||||
/// Combines signals using +combineLatest:, then reduces the resulting tuples
|
||||
/// into a single value using -reduceEach:.
|
||||
///
|
||||
/// signals - The signals to combine. If this collection is empty, the
|
||||
/// returned signal will immediately complete upon subscription.
|
||||
/// reduceBlock - The block which reduces the latest values from all the
|
||||
/// signals into one value. It must take as many arguments as the
|
||||
/// number of signals given. Each argument will be an object
|
||||
/// argument. The return value must be an object. This argument
|
||||
/// must not be nil.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// [RACSignal combineLatest:@[ stringSignal, intSignal ] reduce:^(NSString *string, NSNumber *number) {
|
||||
/// return [NSString stringWithFormat:@"%@: %@", string, number];
|
||||
/// }];
|
||||
///
|
||||
/// Returns a signal which sends the results from each invocation of
|
||||
/// `reduceBlock`.
|
||||
+ (RACSignal *)combineLatest:(id<NSFastEnumeration>)signals reduce:(id (^)())reduceBlock;
|
||||
|
||||
/// Merges the receiver and the given signal with `+merge:` and returns the
|
||||
/// resulting signal.
|
||||
- (RACSignal *)merge:(RACSignal *)signal;
|
||||
|
||||
/// Sends the latest `next` from any of the signals.
|
||||
///
|
||||
/// Returns a signal that passes through values from each of the given signals,
|
||||
/// and sends `completed` when all of them complete. If any signal sends an error,
|
||||
/// the returned signal sends `error` immediately.
|
||||
+ (RACSignal *)merge:(id<NSFastEnumeration>)signals;
|
||||
|
||||
/// Merges the signals sent by the receiver into a flattened signal, but only
|
||||
/// subscribes to `maxConcurrent` number of signals at a time. New signals are
|
||||
/// queued and subscribed to as other signals complete.
|
||||
///
|
||||
/// If an error occurs on any of the signals, it is sent on the returned signal.
|
||||
/// It completes only after the receiver and all sent signals have completed.
|
||||
///
|
||||
/// This corresponds to `Merge<TSource>(IObservable<IObservable<TSource>>, Int32)`
|
||||
/// in Rx.
|
||||
///
|
||||
/// maxConcurrent - the maximum number of signals to subscribe to at a
|
||||
/// time. If 0, it subscribes to an unlimited number of
|
||||
/// signals.
|
||||
- (RACSignal *)flatten:(NSUInteger)maxConcurrent;
|
||||
|
||||
/// Ignores all `next`s from the receiver, waits for the receiver to complete,
|
||||
/// then subscribes to a new signal.
|
||||
///
|
||||
/// block - A block which will create or obtain a new signal to subscribe to,
|
||||
/// executed only after the receiver completes. This block must not be
|
||||
/// nil, and it must not return a nil signal.
|
||||
///
|
||||
/// Returns a signal which will pass through the events of the signal created in
|
||||
/// `block`. If the receiver errors out, the returned signal will error as well.
|
||||
- (RACSignal *)then:(RACSignal * (^)(void))block;
|
||||
|
||||
/// Concats the inner signals of a signal of signals.
|
||||
- (RACSignal *)concat;
|
||||
|
||||
/// Aggregates the `next` values of the receiver into a single combined value.
|
||||
///
|
||||
/// The algorithm proceeds as follows:
|
||||
///
|
||||
/// 1. `start` is passed into the block as the `running` value, and the first
|
||||
/// element of the receiver is passed into the block as the `next` value.
|
||||
/// 2. The result of the invocation (`running`) and the next element of the
|
||||
/// receiver (`next`) is passed into `reduceBlock`.
|
||||
/// 3. Steps 2 and 3 are repeated until all values have been processed.
|
||||
/// 4. The last result of `reduceBlock` is sent on the returned signal.
|
||||
///
|
||||
/// This method is similar to -scanWithStart:reduce:, except that only the
|
||||
/// final result is sent on the returned signal.
|
||||
///
|
||||
/// start - The value to be combined with the first element of the
|
||||
/// receiver. This value may be `nil`.
|
||||
/// reduceBlock - The block that describes how to combine values of the
|
||||
/// receiver. If the receiver is empty, this block will never be
|
||||
/// invoked. Cannot be nil.
|
||||
///
|
||||
/// Returns a signal that will send the aggregated value when the receiver
|
||||
/// completes, then itself complete. If the receiver never sends any values,
|
||||
/// `start` will be sent instead.
|
||||
- (RACSignal *)aggregateWithStart:(id)start reduce:(id (^)(id running, id next))reduceBlock;
|
||||
|
||||
/// Aggregates the `next` values of the receiver into a single combined value.
|
||||
/// This is indexed version of -aggregateWithStart:reduce:.
|
||||
///
|
||||
/// start - The value to be combined with the first element of the
|
||||
/// receiver. This value may be `nil`.
|
||||
/// reduceBlock - The block that describes how to combine values of the
|
||||
/// receiver. This block takes zero-based index value as the last
|
||||
/// parameter. If the receiver is empty, this block will never be
|
||||
/// invoked. Cannot be nil.
|
||||
///
|
||||
/// Returns a signal that will send the aggregated value when the receiver
|
||||
/// completes, then itself complete. If the receiver never sends any values,
|
||||
/// `start` will be sent instead.
|
||||
- (RACSignal *)aggregateWithStart:(id)start reduceWithIndex:(id (^)(id running, id next, NSUInteger index))reduceBlock;
|
||||
|
||||
/// Aggregates the `next` values of the receiver into a single combined value.
|
||||
///
|
||||
/// This invokes `startFactory` block on each subscription, then calls
|
||||
/// -aggregateWithStart:reduce: with the return value of the block as start value.
|
||||
///
|
||||
/// startFactory - The block that returns start value which will be combined
|
||||
/// with the first element of the receiver. Cannot be nil.
|
||||
/// reduceBlock - The block that describes how to combine values of the
|
||||
/// receiver. If the receiver is empty, this block will never be
|
||||
/// invoked. Cannot be nil.
|
||||
///
|
||||
/// Returns a signal that will send the aggregated value when the receiver
|
||||
/// completes, then itself complete. If the receiver never sends any values,
|
||||
/// the return value of `startFactory` will be sent instead.
|
||||
- (RACSignal *)aggregateWithStartFactory:(id (^)(void))startFactory reduce:(id (^)(id running, id next))reduceBlock;
|
||||
|
||||
/// Invokes -setKeyPath:onObject:nilValue: with `nil` for the nil value.
|
||||
///
|
||||
/// WARNING: Under certain conditions, this method is known to be thread-unsafe.
|
||||
/// See the description in -setKeyPath:onObject:nilValue:.
|
||||
- (RACDisposable *)setKeyPath:(NSString *)keyPath onObject:(NSObject *)object;
|
||||
|
||||
/// Binds the receiver to an object, automatically setting the given key path on
|
||||
/// every `next`. When the signal completes, the binding is automatically
|
||||
/// disposed of.
|
||||
///
|
||||
/// WARNING: Under certain conditions, this method is known to be thread-unsafe.
|
||||
/// A crash can result if `object` is deallocated concurrently on
|
||||
/// another thread within a window of time between a value being sent
|
||||
/// on this signal and immediately prior to the invocation of
|
||||
/// -setValue:forKeyPath:, which sets the property. To prevent this,
|
||||
/// ensure `object` is deallocated on the same thread the receiver
|
||||
/// sends on, or ensure that the returned disposable is disposed of
|
||||
/// before `object` deallocates.
|
||||
/// See https://github.com/ReactiveCocoa/ReactiveCocoa/pull/1184
|
||||
///
|
||||
/// Sending an error on the signal is considered undefined behavior, and will
|
||||
/// generate an assertion failure in Debug builds.
|
||||
///
|
||||
/// A given key on an object should only have one active signal bound to it at any
|
||||
/// given time. Binding more than one signal to the same property is considered
|
||||
/// undefined behavior.
|
||||
///
|
||||
/// keyPath - The key path to update with `next`s from the receiver.
|
||||
/// object - The object that `keyPath` is relative to.
|
||||
/// nilValue - The value to set at the key path whenever `nil` is sent by the
|
||||
/// receiver. This may be nil when binding to object properties, but
|
||||
/// an NSValue should be used for primitive properties, to avoid an
|
||||
/// exception if `nil` is sent (which might occur if an intermediate
|
||||
/// object is set to `nil`).
|
||||
///
|
||||
/// Returns a disposable which can be used to terminate the binding.
|
||||
- (RACDisposable *)setKeyPath:(NSString *)keyPath onObject:(NSObject *)object nilValue:(id)nilValue;
|
||||
|
||||
/// Sends NSDate.date every `interval` seconds.
|
||||
///
|
||||
/// interval - The time interval in seconds at which the current time is sent.
|
||||
/// scheduler - The scheduler upon which the current NSDate should be sent. This
|
||||
/// must not be nil or +[RACScheduler immediateScheduler].
|
||||
///
|
||||
/// Returns a signal that sends the current date/time every `interval` on
|
||||
/// `scheduler`.
|
||||
+ (RACSignal *)interval:(NSTimeInterval)interval onScheduler:(RACScheduler *)scheduler;
|
||||
|
||||
/// Sends NSDate.date at intervals of at least `interval` seconds, up to
|
||||
/// approximately `interval` + `leeway` seconds.
|
||||
///
|
||||
/// The created signal will defer sending each `next` for at least `interval`
|
||||
/// seconds, and for an additional amount of time up to `leeway` seconds in the
|
||||
/// interest of performance or power consumption. Note that some additional
|
||||
/// latency is to be expected, even when specifying a `leeway` of 0.
|
||||
///
|
||||
/// interval - The base interval between `next`s.
|
||||
/// scheduler - The scheduler upon which the current NSDate should be sent. This
|
||||
/// must not be nil or +[RACScheduler immediateScheduler].
|
||||
/// leeway - The maximum amount of additional time the `next` can be deferred.
|
||||
///
|
||||
/// Returns a signal that sends the current date/time at intervals of at least
|
||||
/// `interval seconds` up to approximately `interval` + `leeway` seconds on
|
||||
/// `scheduler`.
|
||||
+ (RACSignal *)interval:(NSTimeInterval)interval onScheduler:(RACScheduler *)scheduler withLeeway:(NSTimeInterval)leeway;
|
||||
|
||||
/// Takes `next`s until the `signalTrigger` sends `next` or `completed`.
|
||||
///
|
||||
/// Returns a signal which passes through all events from the receiver until
|
||||
/// `signalTrigger` sends `next` or `completed`, at which point the returned signal
|
||||
/// will send `completed`.
|
||||
- (RACSignal *)takeUntil:(RACSignal *)signalTrigger;
|
||||
|
||||
/// Takes `next`s until the `replacement` sends an event.
|
||||
///
|
||||
/// replacement - The signal which replaces the receiver as soon as it sends an
|
||||
/// event.
|
||||
///
|
||||
/// Returns a signal which passes through `next`s and `error` from the receiver
|
||||
/// until `replacement` sends an event, at which point the returned signal will
|
||||
/// send that event and switch to passing through events from `replacement`
|
||||
/// instead, regardless of whether the receiver has sent events already.
|
||||
- (RACSignal *)takeUntilReplacement:(RACSignal *)replacement;
|
||||
|
||||
/// Subscribes to the returned signal when an error occurs.
|
||||
- (RACSignal *)catch:(RACSignal * (^)(NSError *error))catchBlock;
|
||||
|
||||
/// Subscribes to the given signal when an error occurs.
|
||||
- (RACSignal *)catchTo:(RACSignal *)signal;
|
||||
|
||||
/// Runs `tryBlock` against each of the receiver's values, passing values
|
||||
/// until `tryBlock` returns NO, or the receiver completes.
|
||||
///
|
||||
/// tryBlock - An action to run against each of the receiver's values.
|
||||
/// The block should return YES to indicate that the action was
|
||||
/// successful. This block must not be nil.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// // The returned signal will send an error if data values cannot be
|
||||
/// // written to `someFileURL`.
|
||||
/// [signal try:^(NSData *data, NSError **errorPtr) {
|
||||
/// return [data writeToURL:someFileURL options:NSDataWritingAtomic error:errorPtr];
|
||||
/// }];
|
||||
///
|
||||
/// Returns a signal which passes through all the values of the receiver. If
|
||||
/// `tryBlock` fails for any value, the returned signal will error using the
|
||||
/// `NSError` passed out from the block.
|
||||
- (RACSignal *)try:(BOOL (^)(id value, NSError **errorPtr))tryBlock;
|
||||
|
||||
/// Runs `mapBlock` against each of the receiver's values, mapping values until
|
||||
/// `mapBlock` returns nil, or the receiver completes.
|
||||
///
|
||||
/// mapBlock - An action to map each of the receiver's values. The block should
|
||||
/// return a non-nil value to indicate that the action was successful.
|
||||
/// This block must not be nil.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// // The returned signal will send an error if data cannot be read from
|
||||
/// // `fileURL`.
|
||||
/// [signal tryMap:^(NSURL *fileURL, NSError **errorPtr) {
|
||||
/// return [NSData dataWithContentsOfURL:fileURL options:0 error:errorPtr];
|
||||
/// }];
|
||||
///
|
||||
/// Returns a signal which transforms all the values of the receiver. If
|
||||
/// `mapBlock` returns nil for any value, the returned signal will error using
|
||||
/// the `NSError` passed out from the block.
|
||||
- (RACSignal *)tryMap:(id (^)(id value, NSError **errorPtr))mapBlock;
|
||||
|
||||
/// Returns the first `next`. Note that this is a blocking call.
|
||||
- (id)first;
|
||||
|
||||
/// Returns the first `next` or `defaultValue` if the signal completes or errors
|
||||
/// without sending a `next`. Note that this is a blocking call.
|
||||
- (id)firstOrDefault:(id)defaultValue;
|
||||
|
||||
/// Returns the first `next` or `defaultValue` if the signal completes or errors
|
||||
/// without sending a `next`. If an error occurs success will be NO and error
|
||||
/// will be populated. Note that this is a blocking call.
|
||||
///
|
||||
/// Both success and error may be NULL.
|
||||
- (id)firstOrDefault:(id)defaultValue success:(BOOL *)success error:(NSError **)error;
|
||||
|
||||
/// Blocks the caller and waits for the signal to complete.
|
||||
///
|
||||
/// error - If not NULL, set to any error that occurs.
|
||||
///
|
||||
/// Returns whether the signal completed successfully. If NO, `error` will be set
|
||||
/// to the error that occurred.
|
||||
- (BOOL)waitUntilCompleted:(NSError **)error;
|
||||
|
||||
/// Defers creation of a signal until the signal's actually subscribed to.
|
||||
///
|
||||
/// This can be used to effectively turn a hot signal into a cold signal.
|
||||
+ (RACSignal *)defer:(RACSignal * (^)(void))block;
|
||||
|
||||
/// Every time the receiver sends a new RACSignal, subscribes and sends `next`s and
|
||||
/// `error`s only for that signal.
|
||||
///
|
||||
/// The receiver must be a signal of signals.
|
||||
///
|
||||
/// Returns a signal which passes through `next`s and `error`s from the latest
|
||||
/// signal sent by the receiver, and sends `completed` when both the receiver and
|
||||
/// the last sent signal complete.
|
||||
- (RACSignal *)switchToLatest;
|
||||
|
||||
/// Switches between the signals in `cases` as well as `defaultSignal` based on
|
||||
/// the latest value sent by `signal`.
|
||||
///
|
||||
/// signal - A signal of objects used as keys in the `cases` dictionary.
|
||||
/// This argument must not be nil.
|
||||
/// cases - A dictionary that has signals as values. This argument must
|
||||
/// not be nil. A RACTupleNil key in this dictionary will match
|
||||
/// nil `next` events that are received on `signal`.
|
||||
/// defaultSignal - The signal to pass through after `signal` sends a value for
|
||||
/// which `cases` does not contain a signal. If nil, any
|
||||
/// unmatched values will result in
|
||||
/// a RACSignalErrorNoMatchingCase error.
|
||||
///
|
||||
/// Returns a signal which passes through `next`s and `error`s from one of the
|
||||
/// the signals in `cases` or `defaultSignal`, and sends `completed` when both
|
||||
/// `signal` and the last used signal complete. If no `defaultSignal` is given,
|
||||
/// an unmatched `next` will result in an error on the returned signal.
|
||||
+ (RACSignal *)switch:(RACSignal *)signal cases:(NSDictionary *)cases default:(RACSignal *)defaultSignal;
|
||||
|
||||
/// Switches between `trueSignal` and `falseSignal` based on the latest value
|
||||
/// sent by `boolSignal`.
|
||||
///
|
||||
/// boolSignal - A signal of BOOLs determining whether `trueSignal` or
|
||||
/// `falseSignal` should be active. This argument must not be nil.
|
||||
/// trueSignal - The signal to pass through after `boolSignal` has sent YES.
|
||||
/// This argument must not be nil.
|
||||
/// falseSignal - The signal to pass through after `boolSignal` has sent NO. This
|
||||
/// argument must not be nil.
|
||||
///
|
||||
/// Returns a signal which passes through `next`s and `error`s from `trueSignal`
|
||||
/// and/or `falseSignal`, and sends `completed` when both `boolSignal` and the
|
||||
/// last switched signal complete.
|
||||
+ (RACSignal *)if:(RACSignal *)boolSignal then:(RACSignal *)trueSignal else:(RACSignal *)falseSignal;
|
||||
|
||||
/// Adds every `next` to an array. Nils are represented by NSNulls. Note that
|
||||
/// this is a blocking call.
|
||||
///
|
||||
/// **This is not the same as the `ToArray` method in Rx.** See -collect for
|
||||
/// that behavior instead.
|
||||
///
|
||||
/// Returns the array of `next` values, or nil if an error occurs.
|
||||
- (NSArray *)toArray;
|
||||
|
||||
/// Adds every `next` to a sequence. Nils are represented by NSNulls.
|
||||
///
|
||||
/// This corresponds to the `ToEnumerable` method in Rx.
|
||||
///
|
||||
/// Returns a sequence which provides values from the signal as they're sent.
|
||||
/// Trying to retrieve a value from the sequence which has not yet been sent will
|
||||
/// block.
|
||||
@property (nonatomic, strong, readonly) RACSequence *sequence;
|
||||
|
||||
/// Creates and returns a multicast connection. This allows you to share a single
|
||||
/// subscription to the underlying signal.
|
||||
- (RACMulticastConnection *)publish;
|
||||
|
||||
/// Creates and returns a multicast connection that pushes values into the given
|
||||
/// subject. This allows you to share a single subscription to the underlying
|
||||
/// signal.
|
||||
- (RACMulticastConnection *)multicast:(RACSubject *)subject;
|
||||
|
||||
/// Multicasts the signal to a RACReplaySubject of unlimited capacity, and
|
||||
/// immediately connects to the resulting RACMulticastConnection.
|
||||
///
|
||||
/// Returns the connected, multicasted signal.
|
||||
- (RACSignal *)replay;
|
||||
|
||||
/// Multicasts the signal to a RACReplaySubject of capacity 1, and immediately
|
||||
/// connects to the resulting RACMulticastConnection.
|
||||
///
|
||||
/// Returns the connected, multicasted signal.
|
||||
- (RACSignal *)replayLast;
|
||||
|
||||
/// Multicasts the signal to a RACReplaySubject of unlimited capacity, and
|
||||
/// lazily connects to the resulting RACMulticastConnection.
|
||||
///
|
||||
/// This means the returned signal will subscribe to the multicasted signal only
|
||||
/// when the former receives its first subscription.
|
||||
///
|
||||
/// Returns the lazily connected, multicasted signal.
|
||||
- (RACSignal *)replayLazily;
|
||||
|
||||
/// Sends an error after `interval` seconds if the source doesn't complete
|
||||
/// before then.
|
||||
///
|
||||
/// The error will be in the RACSignalErrorDomain and have a code of
|
||||
/// RACSignalErrorTimedOut.
|
||||
///
|
||||
/// interval - The number of seconds after which the signal should error out.
|
||||
/// scheduler - The scheduler upon which any timeout error should be sent. This
|
||||
/// must not be nil or +[RACScheduler immediateScheduler].
|
||||
///
|
||||
/// Returns a signal that passes through the receiver's events, until the stream
|
||||
/// finishes or times out, at which point an error will be sent on `scheduler`.
|
||||
- (RACSignal *)timeout:(NSTimeInterval)interval onScheduler:(RACScheduler *)scheduler;
|
||||
|
||||
/// Creates and returns a signal that delivers its events on the given scheduler.
|
||||
/// Any side effects of the receiver will still be performed on the original
|
||||
/// thread.
|
||||
///
|
||||
/// This is ideal when the signal already performs its work on the desired
|
||||
/// thread, but you want to handle its events elsewhere.
|
||||
///
|
||||
/// This corresponds to the `ObserveOn` method in Rx.
|
||||
- (RACSignal *)deliverOn:(RACScheduler *)scheduler;
|
||||
|
||||
/// Creates and returns a signal that executes its side effects and delivers its
|
||||
/// events on the given scheduler.
|
||||
///
|
||||
/// Use of this operator should be avoided whenever possible, because the
|
||||
/// receiver's side effects may not be safe to run on another thread. If you just
|
||||
/// want to receive the signal's events on `scheduler`, use -deliverOn: instead.
|
||||
- (RACSignal *)subscribeOn:(RACScheduler *)scheduler;
|
||||
|
||||
/// Creates and returns a signal that delivers its events on the main thread.
|
||||
/// If events are already being sent on the main thread, they may be passed on
|
||||
/// without delay. An event will instead be queued for later delivery on the main
|
||||
/// thread if sent on another thread, or if a previous event is already being
|
||||
/// processed, or has been queued.
|
||||
///
|
||||
/// Any side effects of the receiver will still be performed on the original
|
||||
/// thread.
|
||||
///
|
||||
/// This can be used when a signal will cause UI updates, to avoid potential
|
||||
/// flicker caused by delayed delivery of events, such as the first event from
|
||||
/// a RACObserve at view instantiation.
|
||||
- (RACSignal *)deliverOnMainThread;
|
||||
|
||||
/// Groups each received object into a group, as determined by calling `keyBlock`
|
||||
/// with that object. The object sent is transformed by calling `transformBlock`
|
||||
/// with the object. If `transformBlock` is nil, it sends the original object.
|
||||
///
|
||||
/// The returned signal is a signal of RACGroupedSignal.
|
||||
- (RACSignal *)groupBy:(id<NSCopying> (^)(id object))keyBlock transform:(id (^)(id object))transformBlock;
|
||||
|
||||
/// Calls -[RACSignal groupBy:keyBlock transform:nil].
|
||||
- (RACSignal *)groupBy:(id<NSCopying> (^)(id object))keyBlock;
|
||||
|
||||
/// Sends an [NSNumber numberWithBool:YES] if the receiving signal sends any
|
||||
/// objects.
|
||||
- (RACSignal *)any;
|
||||
|
||||
/// Sends an [NSNumber numberWithBool:YES] if the receiving signal sends any
|
||||
/// objects that pass `predicateBlock`.
|
||||
///
|
||||
/// predicateBlock - cannot be nil.
|
||||
- (RACSignal *)any:(BOOL (^)(id object))predicateBlock;
|
||||
|
||||
/// Sends an [NSNumber numberWithBool:YES] if all the objects the receiving
|
||||
/// signal sends pass `predicateBlock`.
|
||||
///
|
||||
/// predicateBlock - cannot be nil.
|
||||
- (RACSignal *)all:(BOOL (^)(id object))predicateBlock;
|
||||
|
||||
/// Resubscribes to the receiving signal if an error occurs, up until it has
|
||||
/// retried the given number of times.
|
||||
///
|
||||
/// retryCount - if 0, it keeps retrying until it completes.
|
||||
- (RACSignal *)retry:(NSInteger)retryCount;
|
||||
|
||||
/// Resubscribes to the receiving signal if an error occurs.
|
||||
- (RACSignal *)retry;
|
||||
|
||||
/// Sends the latest value from the receiver only when `sampler` sends a value.
|
||||
/// The returned signal could repeat values if `sampler` fires more often than
|
||||
/// the receiver. Values from `sampler` are ignored before the receiver sends
|
||||
/// its first value.
|
||||
///
|
||||
/// sampler - The signal that controls when the latest value from the receiver
|
||||
/// is sent. Cannot be nil.
|
||||
- (RACSignal *)sample:(RACSignal *)sampler;
|
||||
|
||||
/// Ignores all `next`s from the receiver.
|
||||
///
|
||||
/// Returns a signal which only passes through `error` or `completed` events from
|
||||
/// the receiver.
|
||||
- (RACSignal *)ignoreValues;
|
||||
|
||||
/// Converts each of the receiver's events into a RACEvent object.
|
||||
///
|
||||
/// Returns a signal which sends the receiver's events as RACEvents, and
|
||||
/// completes after the receiver sends `completed` or `error`.
|
||||
- (RACSignal *)materialize;
|
||||
|
||||
/// Converts each RACEvent in the receiver back into "real" RACSignal events.
|
||||
///
|
||||
/// Returns a signal which sends `next` for each value RACEvent, `error` for each
|
||||
/// error RACEvent, and `completed` for each completed RACEvent.
|
||||
- (RACSignal *)dematerialize;
|
||||
|
||||
/// Inverts each NSNumber-wrapped BOOL sent by the receiver. It will assert if
|
||||
/// the receiver sends anything other than NSNumbers.
|
||||
///
|
||||
/// Returns a signal of inverted NSNumber-wrapped BOOLs.
|
||||
- (RACSignal *)not;
|
||||
|
||||
/// Performs a boolean AND on all of the RACTuple of NSNumbers in sent by the receiver.
|
||||
///
|
||||
/// Asserts if the receiver sends anything other than a RACTuple of one or more NSNumbers.
|
||||
///
|
||||
/// Returns a signal that applies AND to each NSNumber in the tuple.
|
||||
- (RACSignal *)and;
|
||||
|
||||
/// Performs a boolean OR on all of the RACTuple of NSNumbers in sent by the receiver.
|
||||
///
|
||||
/// Asserts if the receiver sends anything other than a RACTuple of one or more NSNumbers.
|
||||
///
|
||||
/// Returns a signal that applies OR to each NSNumber in the tuple.
|
||||
- (RACSignal *)or;
|
||||
|
||||
/// Sends the result of calling the block with arguments as packed in each RACTuple
|
||||
/// sent by the receiver.
|
||||
///
|
||||
/// The receiver must send tuple values, where the first element of the tuple is
|
||||
/// a block, taking a number of parameters equal to the count of the remaining
|
||||
/// elements of the tuple, and returning an object. Each block must take at least
|
||||
/// one argument, so each tuple must contain at least 2 elements.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// RACSignal *adder = [RACSignal return:^(NSNumber *a, NSNumber *b) {
|
||||
/// return @(a.intValue + b.intValue);
|
||||
/// }];
|
||||
/// RACSignal *sums = [[RACSignal
|
||||
/// combineLatest:@[ adder, as, bs ]]
|
||||
/// reduceApply];
|
||||
///
|
||||
/// Returns a signal of the result of applying the first element of each tuple
|
||||
/// to the remaining elements.
|
||||
- (RACSignal *)reduceApply;
|
||||
|
||||
@end
|
||||
|
||||
@interface RACSignal (OperationsDeprecated)
|
||||
|
||||
- (RACSignal *)windowWithStart:(RACSignal *)openSignal close:(RACSignal * (^)(RACSignal *start))closeBlock __attribute__((deprecated("See https://github.com/ReactiveCocoa/ReactiveCocoa/issues/587")));
|
||||
- (RACSignal *)buffer:(NSUInteger)bufferCount __attribute__((deprecated("See https://github.com/ReactiveCocoa/ReactiveCocoa/issues/587")));
|
||||
- (RACSignal *)let:(RACSignal * (^)(RACSignal *sharedSignal))letBlock __attribute__((deprecated("Use -publish instead")));
|
||||
+ (RACSignal *)interval:(NSTimeInterval)interval __attribute__((deprecated("Use +interval:onScheduler: instead")));
|
||||
+ (RACSignal *)interval:(NSTimeInterval)interval withLeeway:(NSTimeInterval)leeway __attribute__((deprecated("Use +interval:onScheduler:withLeeway: instead")));
|
||||
- (RACSignal *)bufferWithTime:(NSTimeInterval)interval __attribute__((deprecated("Use -bufferWithTime:onScheduler: instead")));
|
||||
- (RACSignal *)timeout:(NSTimeInterval)interval __attribute__((deprecated("Use -timeout:onScheduler: instead")));
|
||||
- (RACDisposable *)toProperty:(NSString *)keyPath onObject:(NSObject *)object __attribute__((deprecated("Renamed to -setKeyPath:onObject:")));
|
||||
- (RACSignal *)ignoreElements __attribute__((deprecated("Renamed to -ignoreValues")));
|
||||
- (RACSignal *)sequenceNext:(RACSignal * (^)(void))block __attribute__((deprecated("Renamed to -then:")));
|
||||
- (RACSignal *)aggregateWithStart:(id)start combine:(id (^)(id running, id next))combineBlock __attribute__((deprecated("Renamed to -aggregateWithStart:reduce:")));
|
||||
- (RACSignal *)aggregateWithStartFactory:(id (^)(void))startFactory combine:(id (^)(id running, id next))combineBlock __attribute__((deprecated("Renamed to -aggregateWithStartFactory:reduce:")));
|
||||
- (RACDisposable *)executeCommand:(RACCommand *)command __attribute__((deprecated("Use -flattenMap: or -subscribeNext: instead")));
|
||||
|
||||
@end
|
|
@ -1,219 +0,0 @@
|
|||
//
|
||||
// RACSignal.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 3/1/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "RACStream.h"
|
||||
|
||||
@class RACDisposable;
|
||||
@class RACScheduler;
|
||||
@class RACSubject;
|
||||
@protocol RACSubscriber;
|
||||
|
||||
@interface RACSignal : RACStream
|
||||
|
||||
/// Creates a new signal. This is the preferred way to create a new signal
|
||||
/// operation or behavior.
|
||||
///
|
||||
/// Events can be sent to new subscribers immediately in the `didSubscribe`
|
||||
/// block, but the subscriber will not be able to dispose of the signal until
|
||||
/// a RACDisposable is returned from `didSubscribe`. In the case of infinite
|
||||
/// signals, this won't _ever_ happen if events are sent immediately.
|
||||
///
|
||||
/// To ensure that the signal is disposable, events can be scheduled on the
|
||||
/// +[RACScheduler currentScheduler] (so that they're deferred, not sent
|
||||
/// immediately), or they can be sent in the background. The RACDisposable
|
||||
/// returned by the `didSubscribe` block should cancel any such scheduling or
|
||||
/// asynchronous work.
|
||||
///
|
||||
/// didSubscribe - Called when the signal is subscribed to. The new subscriber is
|
||||
/// passed in. You can then manually control the <RACSubscriber> by
|
||||
/// sending it -sendNext:, -sendError:, and -sendCompleted,
|
||||
/// as defined by the operation you're implementing. This block
|
||||
/// should return a RACDisposable which cancels any ongoing work
|
||||
/// triggered by the subscription, and cleans up any resources or
|
||||
/// disposables created as part of it. When the disposable is
|
||||
/// disposed of, the signal must not send any more events to the
|
||||
/// `subscriber`. If no cleanup is necessary, return nil.
|
||||
///
|
||||
/// **Note:** The `didSubscribe` block is called every time a new subscriber
|
||||
/// subscribes. Any side effects within the block will thus execute once for each
|
||||
/// subscription, not necessarily on one thread, and possibly even
|
||||
/// simultaneously!
|
||||
+ (RACSignal *)createSignal:(RACDisposable * (^)(id<RACSubscriber> subscriber))didSubscribe;
|
||||
|
||||
/// Returns a signal that immediately sends the given error.
|
||||
+ (RACSignal *)error:(NSError *)error;
|
||||
|
||||
/// Returns a signal that never completes.
|
||||
+ (RACSignal *)never;
|
||||
|
||||
/// Immediately schedules the given block on the given scheduler. The block is
|
||||
/// given a subscriber to which it can send events.
|
||||
///
|
||||
/// scheduler - The scheduler on which `block` will be scheduled and results
|
||||
/// delivered. Cannot be nil.
|
||||
/// block - The block to invoke. Cannot be NULL.
|
||||
///
|
||||
/// Returns a signal which will send all events sent on the subscriber given to
|
||||
/// `block`. All events will be sent on `scheduler` and it will replay any missed
|
||||
/// events to new subscribers.
|
||||
+ (RACSignal *)startEagerlyWithScheduler:(RACScheduler *)scheduler block:(void (^)(id<RACSubscriber> subscriber))block;
|
||||
|
||||
/// Invokes the given block only on the first subscription. The block is given a
|
||||
/// subscriber to which it can send events.
|
||||
///
|
||||
/// Note that disposing of the subscription to the returned signal will *not*
|
||||
/// dispose of the underlying subscription. If you need that behavior, see
|
||||
/// -[RACMulticastConnection autoconnect]. The underlying subscription will never
|
||||
/// be disposed of. Because of this, `block` should never return an infinite
|
||||
/// signal since there would be no way of ending it.
|
||||
///
|
||||
/// scheduler - The scheduler on which the block should be scheduled. Note that
|
||||
/// if given +[RACScheduler immediateScheduler], the block will be
|
||||
/// invoked synchronously on the first subscription. Cannot be nil.
|
||||
/// block - The block to invoke on the first subscription. Cannot be NULL.
|
||||
///
|
||||
/// Returns a signal which will pass through the events sent to the subscriber
|
||||
/// given to `block` and replay any missed events to new subscribers.
|
||||
+ (RACSignal *)startLazilyWithScheduler:(RACScheduler *)scheduler block:(void (^)(id<RACSubscriber> subscriber))block;
|
||||
|
||||
@end
|
||||
|
||||
@interface RACSignal (RACStream)
|
||||
|
||||
/// Returns a signal that immediately sends the given value and then completes.
|
||||
+ (RACSignal *)return:(id)value;
|
||||
|
||||
/// Returns a signal that immediately completes.
|
||||
+ (RACSignal *)empty;
|
||||
|
||||
/// Subscribes to `signal` when the source signal completes.
|
||||
- (RACSignal *)concat:(RACSignal *)signal;
|
||||
|
||||
/// Zips the values in the receiver with those of the given signal to create
|
||||
/// RACTuples.
|
||||
///
|
||||
/// The first `next` of each stream will be combined, then the second `next`, and
|
||||
/// so forth, until either signal completes or errors.
|
||||
///
|
||||
/// signal - The signal to zip with. This must not be `nil`.
|
||||
///
|
||||
/// Returns a new signal of RACTuples, representing the combined values of the
|
||||
/// two signals. Any error from one of the original signals will be forwarded on
|
||||
/// the returned signal.
|
||||
- (RACSignal *)zipWith:(RACSignal *)signal;
|
||||
|
||||
@end
|
||||
|
||||
@interface RACSignal (Subscription)
|
||||
|
||||
/// Subscribes `subscriber` to changes on the receiver. The receiver defines which
|
||||
/// events it actually sends and in what situations the events are sent.
|
||||
///
|
||||
/// Subscription will always happen on a valid RACScheduler. If the
|
||||
/// +[RACScheduler currentScheduler] cannot be determined at the time of
|
||||
/// subscription (e.g., because the calling code is running on a GCD queue or
|
||||
/// NSOperationQueue), subscription will occur on a private background scheduler.
|
||||
/// On the main thread, subscriptions will always occur immediately, with a
|
||||
/// +[RACScheduler currentScheduler] of +[RACScheduler mainThreadScheduler].
|
||||
///
|
||||
/// This method must be overridden by any subclasses.
|
||||
///
|
||||
/// Returns nil or a disposable. You can call -[RACDisposable dispose] if you
|
||||
/// need to end your subscription before it would "naturally" end, either by
|
||||
/// completing or erroring. Once the disposable has been disposed, the subscriber
|
||||
/// won't receive any more events from the subscription.
|
||||
- (RACDisposable *)subscribe:(id<RACSubscriber>)subscriber;
|
||||
|
||||
/// Convenience method to subscribe to the `next` event.
|
||||
///
|
||||
/// This corresponds to `IObserver<T>.OnNext` in Rx.
|
||||
- (RACDisposable *)subscribeNext:(void (^)(id x))nextBlock;
|
||||
|
||||
/// Convenience method to subscribe to the `next` and `completed` events.
|
||||
- (RACDisposable *)subscribeNext:(void (^)(id x))nextBlock completed:(void (^)(void))completedBlock;
|
||||
|
||||
/// Convenience method to subscribe to the `next`, `completed`, and `error` events.
|
||||
- (RACDisposable *)subscribeNext:(void (^)(id x))nextBlock error:(void (^)(NSError *error))errorBlock completed:(void (^)(void))completedBlock;
|
||||
|
||||
/// Convenience method to subscribe to `error` events.
|
||||
///
|
||||
/// This corresponds to the `IObserver<T>.OnError` in Rx.
|
||||
- (RACDisposable *)subscribeError:(void (^)(NSError *error))errorBlock;
|
||||
|
||||
/// Convenience method to subscribe to `completed` events.
|
||||
///
|
||||
/// This corresponds to the `IObserver<T>.OnCompleted` in Rx.
|
||||
- (RACDisposable *)subscribeCompleted:(void (^)(void))completedBlock;
|
||||
|
||||
/// Convenience method to subscribe to `next` and `error` events.
|
||||
- (RACDisposable *)subscribeNext:(void (^)(id x))nextBlock error:(void (^)(NSError *error))errorBlock;
|
||||
|
||||
/// Convenience method to subscribe to `error` and `completed` events.
|
||||
- (RACDisposable *)subscribeError:(void (^)(NSError *error))errorBlock completed:(void (^)(void))completedBlock;
|
||||
|
||||
@end
|
||||
|
||||
/// Additional methods to assist with debugging.
|
||||
@interface RACSignal (Debugging)
|
||||
|
||||
/// Logs all events that the receiver sends.
|
||||
- (RACSignal *)logAll;
|
||||
|
||||
/// Logs each `next` that the receiver sends.
|
||||
- (RACSignal *)logNext;
|
||||
|
||||
/// Logs any error that the receiver sends.
|
||||
- (RACSignal *)logError;
|
||||
|
||||
/// Logs any `completed` event that the receiver sends.
|
||||
- (RACSignal *)logCompleted;
|
||||
|
||||
@end
|
||||
|
||||
/// Additional methods to assist with unit testing.
|
||||
///
|
||||
/// **These methods should never ship in production code.**
|
||||
@interface RACSignal (Testing)
|
||||
|
||||
/// Spins the main run loop for a short while, waiting for the receiver to send a `next`.
|
||||
///
|
||||
/// **Because this method executes the run loop recursively, it should only be used
|
||||
/// on the main thread, and only from a unit test.**
|
||||
///
|
||||
/// defaultValue - Returned if the receiver completes or errors before sending
|
||||
/// a `next`, or if the method times out. This argument may be
|
||||
/// nil.
|
||||
/// success - If not NULL, set to whether the receiver completed
|
||||
/// successfully.
|
||||
/// error - If not NULL, set to any error that occurred.
|
||||
///
|
||||
/// Returns the first value received, or `defaultValue` if no value is received
|
||||
/// before the signal finishes or the method times out.
|
||||
- (id)asynchronousFirstOrDefault:(id)defaultValue success:(BOOL *)success error:(NSError **)error;
|
||||
|
||||
/// Spins the main run loop for a short while, waiting for the receiver to complete.
|
||||
///
|
||||
/// **Because this method executes the run loop recursively, it should only be used
|
||||
/// on the main thread, and only from a unit test.**
|
||||
///
|
||||
/// error - If not NULL, set to any error that occurs.
|
||||
///
|
||||
/// Returns whether the signal completed successfully before timing out. If NO,
|
||||
/// `error` will be set to any error that occurred.
|
||||
- (BOOL)asynchronouslyWaitUntilCompleted:(NSError **)error;
|
||||
|
||||
@end
|
||||
|
||||
@interface RACSignal (Deprecated)
|
||||
|
||||
+ (RACSignal *)start:(id (^)(BOOL *success, NSError **error))block __attribute__((deprecated("Use +startEagerlyWithScheduler:block: instead")));
|
||||
+ (RACSignal *)startWithScheduler:(RACScheduler *)scheduler subjectBlock:(void (^)(RACSubject *subject))block __attribute__((deprecated("Use +startEagerlyWithScheduler:block: instead")));
|
||||
+ (RACSignal *)startWithScheduler:(RACScheduler *)scheduler block:(id (^)(BOOL *success, NSError **error))block __attribute__((deprecated("Use +startEagerlyWithScheduler:block: instead")));
|
||||
|
||||
@end
|
|
@ -1,335 +0,0 @@
|
|||
//
|
||||
// RACStream.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2012-10-31.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RACStream;
|
||||
|
||||
/// A block which accepts a value from a RACStream and returns a new instance
|
||||
/// of the same stream class.
|
||||
///
|
||||
/// Setting `stop` to `YES` will cause the bind to terminate after the returned
|
||||
/// value. Returning `nil` will result in immediate termination.
|
||||
typedef RACStream * (^RACStreamBindBlock)(id value, BOOL *stop);
|
||||
|
||||
/// An abstract class representing any stream of values.
|
||||
///
|
||||
/// This class represents a monad, upon which many stream-based operations can
|
||||
/// be built.
|
||||
///
|
||||
/// When subclassing RACStream, only the methods in the main @interface body need
|
||||
/// to be overridden.
|
||||
@interface RACStream : NSObject
|
||||
|
||||
/// Returns an empty stream.
|
||||
+ (instancetype)empty;
|
||||
|
||||
/// Lifts `value` into the stream monad.
|
||||
///
|
||||
/// Returns a stream containing only the given value.
|
||||
+ (instancetype)return:(id)value;
|
||||
|
||||
/// Lazily binds a block to the values in the receiver.
|
||||
///
|
||||
/// This should only be used if you need to terminate the bind early, or close
|
||||
/// over some state. -flattenMap: is more appropriate for all other cases.
|
||||
///
|
||||
/// block - A block returning a RACStreamBindBlock. This block will be invoked
|
||||
/// each time the bound stream is re-evaluated. This block must not be
|
||||
/// nil or return nil.
|
||||
///
|
||||
/// Returns a new stream which represents the combined result of all lazy
|
||||
/// applications of `block`.
|
||||
- (instancetype)bind:(RACStreamBindBlock (^)(void))block;
|
||||
|
||||
/// Appends the values of `stream` to the values in the receiver.
|
||||
///
|
||||
/// stream - A stream to concatenate. This must be an instance of the same
|
||||
/// concrete class as the receiver, and should not be `nil`.
|
||||
///
|
||||
/// Returns a new stream representing the receiver followed by `stream`.
|
||||
- (instancetype)concat:(RACStream *)stream;
|
||||
|
||||
/// Zips the values in the receiver with those of the given stream to create
|
||||
/// RACTuples.
|
||||
///
|
||||
/// The first value of each stream will be combined, then the second value, and
|
||||
/// so forth, until at least one of the streams is exhausted.
|
||||
///
|
||||
/// stream - The stream to zip with. This must be an instance of the same
|
||||
/// concrete class as the receiver, and should not be `nil`.
|
||||
///
|
||||
/// Returns a new stream of RACTuples, representing the zipped values of the
|
||||
/// two streams.
|
||||
- (instancetype)zipWith:(RACStream *)stream;
|
||||
|
||||
@end
|
||||
|
||||
/// This extension contains functionality to support naming streams for
|
||||
/// debugging.
|
||||
///
|
||||
/// Subclasses do not need to override the methods here.
|
||||
@interface RACStream ()
|
||||
|
||||
/// The name of the stream. This is for debugging/human purposes only.
|
||||
@property (copy) NSString *name;
|
||||
|
||||
/// Sets the name of the receiver to the given format string.
|
||||
///
|
||||
/// This is for debugging purposes only, and won't do anything unless the
|
||||
/// RAC_DEBUG_SIGNAL_NAMES environment variable is set.
|
||||
///
|
||||
/// Returns the receiver, for easy method chaining.
|
||||
- (instancetype)setNameWithFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1, 2);
|
||||
|
||||
@end
|
||||
|
||||
/// Operations built on the RACStream primitives.
|
||||
///
|
||||
/// These methods do not need to be overridden, although subclasses may
|
||||
/// occasionally gain better performance from doing so.
|
||||
@interface RACStream (Operations)
|
||||
|
||||
/// Maps `block` across the values in the receiver and flattens the result.
|
||||
///
|
||||
/// Note that operators applied _after_ -flattenMap: behave differently from
|
||||
/// operators _within_ -flattenMap:. See the Examples section below.
|
||||
///
|
||||
/// This corresponds to the `SelectMany` method in Rx.
|
||||
///
|
||||
/// block - A block which accepts the values in the receiver and returns a new
|
||||
/// instance of the receiver's class. Returning `nil` from this block is
|
||||
/// equivalent to returning an empty signal.
|
||||
///
|
||||
/// Examples
|
||||
///
|
||||
/// [signal flattenMap:^(id x) {
|
||||
/// // Logs each time a returned signal completes.
|
||||
/// return [[RACSignal return:x] logCompleted];
|
||||
/// }];
|
||||
///
|
||||
/// [[signal
|
||||
/// flattenMap:^(id x) {
|
||||
/// return [RACSignal return:x];
|
||||
/// }]
|
||||
/// // Logs only once, when all of the signals complete.
|
||||
/// logCompleted];
|
||||
///
|
||||
/// Returns a new stream which represents the combined streams resulting from
|
||||
/// mapping `block`.
|
||||
- (instancetype)flattenMap:(RACStream * (^)(id value))block;
|
||||
|
||||
/// Flattens a stream of streams.
|
||||
///
|
||||
/// This corresponds to the `Merge` method in Rx.
|
||||
///
|
||||
/// Returns a stream consisting of the combined streams obtained from the
|
||||
/// receiver.
|
||||
- (instancetype)flatten;
|
||||
|
||||
/// Maps `block` across the values in the receiver.
|
||||
///
|
||||
/// This corresponds to the `Select` method in Rx.
|
||||
///
|
||||
/// Returns a new stream with the mapped values.
|
||||
- (instancetype)map:(id (^)(id value))block;
|
||||
|
||||
/// Replaces each value in the receiver with the given object.
|
||||
///
|
||||
/// Returns a new stream which includes the given object once for each value in
|
||||
/// the receiver.
|
||||
- (instancetype)mapReplace:(id)object;
|
||||
|
||||
/// Filters out values in the receiver that don't pass the given test.
|
||||
///
|
||||
/// This corresponds to the `Where` method in Rx.
|
||||
///
|
||||
/// Returns a new stream with only those values that passed.
|
||||
- (instancetype)filter:(BOOL (^)(id value))block;
|
||||
|
||||
/// Filters out values in the receiver that equal (via -isEqual:) the provided value.
|
||||
///
|
||||
/// value - The value can be `nil`, in which case it ignores `nil` values.
|
||||
///
|
||||
/// Returns a new stream containing only the values which did not compare equal
|
||||
/// to `value`.
|
||||
- (instancetype)ignore:(id)value;
|
||||
|
||||
/// Unpacks each RACTuple in the receiver and maps the values to a new value.
|
||||
///
|
||||
/// reduceBlock - The block which reduces each RACTuple's values into one value.
|
||||
/// It must take as many arguments as the number of tuple elements
|
||||
/// to process. Each argument will be an object argument. The
|
||||
/// return value must be an object. This argument cannot be nil.
|
||||
///
|
||||
/// Returns a new stream of reduced tuple values.
|
||||
- (instancetype)reduceEach:(id (^)())reduceBlock;
|
||||
|
||||
/// Returns a stream consisting of `value`, followed by the values in the
|
||||
/// receiver.
|
||||
- (instancetype)startWith:(id)value;
|
||||
|
||||
/// Skips the first `skipCount` values in the receiver.
|
||||
///
|
||||
/// Returns the receiver after skipping the first `skipCount` values. If
|
||||
/// `skipCount` is greater than the number of values in the stream, an empty
|
||||
/// stream is returned.
|
||||
- (instancetype)skip:(NSUInteger)skipCount;
|
||||
|
||||
/// Returns a stream of the first `count` values in the receiver. If `count` is
|
||||
/// greater than or equal to the number of values in the stream, a stream
|
||||
/// equivalent to the receiver is returned.
|
||||
- (instancetype)take:(NSUInteger)count;
|
||||
|
||||
/// Zips the values in the given streams to create RACTuples.
|
||||
///
|
||||
/// The first value of each stream will be combined, then the second value, and
|
||||
/// so forth, until at least one of the streams is exhausted.
|
||||
///
|
||||
/// streams - The streams to combine. These must all be instances of the same
|
||||
/// concrete class implementing the protocol. If this collection is
|
||||
/// empty, the returned stream will be empty.
|
||||
///
|
||||
/// Returns a new stream containing RACTuples of the zipped values from the
|
||||
/// streams.
|
||||
+ (instancetype)zip:(id<NSFastEnumeration>)streams;
|
||||
|
||||
/// Zips streams using +zip:, then reduces the resulting tuples into a single
|
||||
/// value using -reduceEach:
|
||||
///
|
||||
/// streams - The streams to combine. These must all be instances of the
|
||||
/// same concrete class implementing the protocol. If this
|
||||
/// collection is empty, the returned stream will be empty.
|
||||
/// reduceBlock - The block which reduces the values from all the streams
|
||||
/// into one value. It must take as many arguments as the
|
||||
/// number of streams given. Each argument will be an object
|
||||
/// argument. The return value must be an object. This argument
|
||||
/// must not be nil.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// [RACStream zip:@[ stringSignal, intSignal ] reduce:^(NSString *string, NSNumber *number) {
|
||||
/// return [NSString stringWithFormat:@"%@: %@", string, number];
|
||||
/// }];
|
||||
///
|
||||
/// Returns a new stream containing the results from each invocation of
|
||||
/// `reduceBlock`.
|
||||
+ (instancetype)zip:(id<NSFastEnumeration>)streams reduce:(id (^)())reduceBlock;
|
||||
|
||||
/// Returns a stream obtained by concatenating `streams` in order.
|
||||
+ (instancetype)concat:(id<NSFastEnumeration>)streams;
|
||||
|
||||
/// Combines values in the receiver from left to right using the given block.
|
||||
///
|
||||
/// The algorithm proceeds as follows:
|
||||
///
|
||||
/// 1. `startingValue` is passed into the block as the `running` value, and the
|
||||
/// first element of the receiver is passed into the block as the `next` value.
|
||||
/// 2. The result of the invocation is added to the returned stream.
|
||||
/// 3. The result of the invocation (`running`) and the next element of the
|
||||
/// receiver (`next`) is passed into `block`.
|
||||
/// 4. Steps 2 and 3 are repeated until all values have been processed.
|
||||
///
|
||||
/// startingValue - The value to be combined with the first element of the
|
||||
/// receiver. This value may be `nil`.
|
||||
/// reduceBlock - The block that describes how to combine values of the
|
||||
/// receiver. If the receiver is empty, this block will never be
|
||||
/// invoked. Cannot be nil.
|
||||
///
|
||||
/// Examples
|
||||
///
|
||||
/// RACSequence *numbers = @[ @1, @2, @3, @4 ].rac_sequence;
|
||||
///
|
||||
/// // Contains 1, 3, 6, 10
|
||||
/// RACSequence *sums = [numbers scanWithStart:@0 reduce:^(NSNumber *sum, NSNumber *next) {
|
||||
/// return @(sum.integerValue + next.integerValue);
|
||||
/// }];
|
||||
///
|
||||
/// Returns a new stream that consists of each application of `reduceBlock`. If the
|
||||
/// receiver is empty, an empty stream is returned.
|
||||
- (instancetype)scanWithStart:(id)startingValue reduce:(id (^)(id running, id next))reduceBlock;
|
||||
|
||||
/// Combines values in the receiver from left to right using the given block
|
||||
/// which also takes zero-based index of the values.
|
||||
///
|
||||
/// startingValue - The value to be combined with the first element of the
|
||||
/// receiver. This value may be `nil`.
|
||||
/// reduceBlock - The block that describes how to combine values of the
|
||||
/// receiver. This block takes zero-based index value as the last
|
||||
/// parameter. If the receiver is empty, this block will never
|
||||
/// be invoked. Cannot be nil.
|
||||
///
|
||||
/// Returns a new stream that consists of each application of `reduceBlock`. If the
|
||||
/// receiver is empty, an empty stream is returned.
|
||||
- (instancetype)scanWithStart:(id)startingValue reduceWithIndex:(id (^)(id running, id next, NSUInteger index))reduceBlock;
|
||||
|
||||
/// Combines each previous and current value into one object.
|
||||
///
|
||||
/// This method is similar to -scanWithStart:reduce:, but only ever operates on
|
||||
/// the previous and current values (instead of the whole stream), and does not
|
||||
/// pass the return value of `reduceBlock` into the next invocation of it.
|
||||
///
|
||||
/// start - The value passed into `reduceBlock` as `previous` for the
|
||||
/// first value.
|
||||
/// reduceBlock - The block that combines the previous value and the current
|
||||
/// value to create the reduced value. Cannot be nil.
|
||||
///
|
||||
/// Examples
|
||||
///
|
||||
/// RACSequence *numbers = @[ @1, @2, @3, @4 ].rac_sequence;
|
||||
///
|
||||
/// // Contains 1, 3, 5, 7
|
||||
/// RACSequence *sums = [numbers combinePreviousWithStart:@0 reduce:^(NSNumber *previous, NSNumber *next) {
|
||||
/// return @(previous.integerValue + next.integerValue);
|
||||
/// }];
|
||||
///
|
||||
/// Returns a new stream consisting of the return values from each application of
|
||||
/// `reduceBlock`.
|
||||
- (instancetype)combinePreviousWithStart:(id)start reduce:(id (^)(id previous, id current))reduceBlock;
|
||||
|
||||
/// Takes values until the given block returns `YES`.
|
||||
///
|
||||
/// Returns a stream of the initial values in the receiver that fail `predicate`.
|
||||
/// If `predicate` never returns `YES`, a stream equivalent to the receiver is
|
||||
/// returned.
|
||||
- (instancetype)takeUntilBlock:(BOOL (^)(id x))predicate;
|
||||
|
||||
/// Takes values until the given block returns `NO`.
|
||||
///
|
||||
/// Returns a stream of the initial values in the receiver that pass `predicate`.
|
||||
/// If `predicate` never returns `NO`, a stream equivalent to the receiver is
|
||||
/// returned.
|
||||
- (instancetype)takeWhileBlock:(BOOL (^)(id x))predicate;
|
||||
|
||||
/// Skips values until the given block returns `YES`.
|
||||
///
|
||||
/// Returns a stream containing the values of the receiver that follow any
|
||||
/// initial values failing `predicate`. If `predicate` never returns `YES`,
|
||||
/// an empty stream is returned.
|
||||
- (instancetype)skipUntilBlock:(BOOL (^)(id x))predicate;
|
||||
|
||||
/// Skips values until the given block returns `NO`.
|
||||
///
|
||||
/// Returns a stream containing the values of the receiver that follow any
|
||||
/// initial values passing `predicate`. If `predicate` never returns `NO`, an
|
||||
/// empty stream is returned.
|
||||
- (instancetype)skipWhileBlock:(BOOL (^)(id x))predicate;
|
||||
|
||||
/// Returns a stream of values for which -isEqual: returns NO when compared to the
|
||||
/// previous value.
|
||||
- (instancetype)distinctUntilChanged;
|
||||
|
||||
@end
|
||||
|
||||
@interface RACStream (Deprecated)
|
||||
|
||||
- (instancetype)sequenceMany:(RACStream * (^)(void))block __attribute__((deprecated("Use -flattenMap: instead")));
|
||||
- (instancetype)scanWithStart:(id)startingValue combine:(id (^)(id running, id next))block __attribute__((deprecated("Renamed to -scanWithStart:reduce:")));
|
||||
- (instancetype)mapPreviousWithStart:(id)start reduce:(id (^)(id previous, id current))combineBlock __attribute__((deprecated("Renamed to -combinePreviousWithStart:reduce:")));
|
||||
|
||||
@end
|
|
@ -1,22 +0,0 @@
|
|||
//
|
||||
// RACSubject.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 3/9/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RACSignal.h"
|
||||
#import "RACSubscriber.h"
|
||||
|
||||
/// A subject can be thought of as a signal that you can manually control by
|
||||
/// sending next, completed, and error.
|
||||
///
|
||||
/// They're most helpful in bridging the non-RAC world to RAC, since they let you
|
||||
/// manually control the sending of events.
|
||||
@interface RACSubject : RACSignal <RACSubscriber>
|
||||
|
||||
/// Returns a new subject.
|
||||
+ (instancetype)subject;
|
||||
|
||||
@end
|
|
@ -1,51 +0,0 @@
|
|||
//
|
||||
// RACSubscriber.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 3/1/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RACCompoundDisposable;
|
||||
|
||||
/// Represents any object which can directly receive values from a RACSignal.
|
||||
///
|
||||
/// You generally shouldn't need to implement this protocol. +[RACSignal
|
||||
/// createSignal:], RACSignal's subscription methods, or RACSubject should work
|
||||
/// for most uses.
|
||||
///
|
||||
/// Implementors of this protocol may receive messages and values from multiple
|
||||
/// threads simultaneously, and so should be thread-safe. Subscribers will also
|
||||
/// be weakly referenced so implementations must allow that.
|
||||
@protocol RACSubscriber <NSObject>
|
||||
@required
|
||||
|
||||
/// Sends the next value to subscribers.
|
||||
///
|
||||
/// value - The value to send. This can be `nil`.
|
||||
- (void)sendNext:(id)value;
|
||||
|
||||
/// Sends the error to subscribers.
|
||||
///
|
||||
/// error - The error to send. This can be `nil`.
|
||||
///
|
||||
/// This terminates the subscription, and invalidates the subscriber (such that
|
||||
/// it cannot subscribe to anything else in the future).
|
||||
- (void)sendError:(NSError *)error;
|
||||
|
||||
/// Sends completed to subscribers.
|
||||
///
|
||||
/// This terminates the subscription, and invalidates the subscriber (such that
|
||||
/// it cannot subscribe to anything else in the future).
|
||||
- (void)sendCompleted;
|
||||
|
||||
/// Sends the subscriber a disposable that represents one of its subscriptions.
|
||||
///
|
||||
/// A subscriber may receive multiple disposables if it gets subscribed to
|
||||
/// multiple signals; however, any error or completed events must terminate _all_
|
||||
/// subscriptions.
|
||||
- (void)didSubscribeWithDisposable:(RACCompoundDisposable *)disposable;
|
||||
|
||||
@end
|
|
@ -1,54 +0,0 @@
|
|||
//
|
||||
// RACSubscriptingAssignmentTrampoline.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 9/24/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "EXTKeyPathCoding.h"
|
||||
|
||||
@class RACSignal;
|
||||
|
||||
/// Assigns a signal to an object property, automatically setting the given key
|
||||
/// path on every `next`. When the signal completes, the binding is automatically
|
||||
/// disposed of.
|
||||
///
|
||||
/// There are two different versions of this macro:
|
||||
///
|
||||
/// - RAC(TARGET, KEYPATH, NILVALUE) will bind the `KEYPATH` of `TARGET` to the
|
||||
/// given signal. If the signal ever sends a `nil` value, the property will be
|
||||
/// set to `NILVALUE` instead. `NILVALUE` may itself be `nil` for object
|
||||
/// properties, but an NSValue should be used for primitive properties, to
|
||||
/// avoid an exception if `nil` is sent (which might occur if an intermediate
|
||||
/// object is set to `nil`).
|
||||
/// - RAC(TARGET, KEYPATH) is the same as the above, but `NILVALUE` defaults to
|
||||
/// `nil`.
|
||||
///
|
||||
/// See -[RACSignal setKeyPath:onObject:nilValue:] for more information about the
|
||||
/// binding's semantics.
|
||||
///
|
||||
/// Examples
|
||||
///
|
||||
/// RAC(self, objectProperty) = objectSignal;
|
||||
/// RAC(self, stringProperty, @"foobar") = stringSignal;
|
||||
/// RAC(self, integerProperty, @42) = integerSignal;
|
||||
///
|
||||
/// WARNING: Under certain conditions, use of this macro can be thread-unsafe.
|
||||
/// See the documentation of -setKeyPath:onObject:nilValue:.
|
||||
#define RAC(TARGET, ...) \
|
||||
metamacro_if_eq(1, metamacro_argcount(__VA_ARGS__)) \
|
||||
(RAC_(TARGET, __VA_ARGS__, nil)) \
|
||||
(RAC_(TARGET, __VA_ARGS__))
|
||||
|
||||
/// Do not use this directly. Use the RAC macro above.
|
||||
#define RAC_(TARGET, KEYPATH, NILVALUE) \
|
||||
[[RACSubscriptingAssignmentTrampoline alloc] initWithTarget:(TARGET) nilValue:(NILVALUE)][@keypath(TARGET, KEYPATH)]
|
||||
|
||||
@interface RACSubscriptingAssignmentTrampoline : NSObject
|
||||
|
||||
- (id)initWithTarget:(id)target nilValue:(id)nilValue;
|
||||
- (void)setObject:(RACSignal *)signal forKeyedSubscript:(NSString *)keyPath;
|
||||
|
||||
@end
|
|
@ -1,24 +0,0 @@
|
|||
//
|
||||
// RACTargetQueueScheduler.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 6/6/13.
|
||||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RACQueueScheduler.h"
|
||||
|
||||
/// A scheduler that enqueues blocks on a private serial queue, targeting an
|
||||
/// arbitrary GCD queue.
|
||||
@interface RACTargetQueueScheduler : RACQueueScheduler
|
||||
|
||||
/// Initializes the receiver with a serial queue that will target the given
|
||||
/// `targetQueue`.
|
||||
///
|
||||
/// name - The name of the scheduler. If nil, a default name will be used.
|
||||
/// targetQueue - The queue to target. Cannot be NULL.
|
||||
///
|
||||
/// Returns the initialized object.
|
||||
- (id)initWithName:(NSString *)name targetQueue:(dispatch_queue_t)targetQueue;
|
||||
|
||||
@end
|
|
@ -1,42 +0,0 @@
|
|||
//
|
||||
// RACTestScheduler.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2013-07-06.
|
||||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RACScheduler.h"
|
||||
|
||||
/// A special kind of scheduler that steps through virtualized time.
|
||||
///
|
||||
/// This scheduler class can be used in unit tests to verify asynchronous
|
||||
/// behaviors without spending significant time waiting.
|
||||
///
|
||||
/// This class can be used from multiple threads, but only one thread can `step`
|
||||
/// through the enqueued actions at a time. Other threads will wait while the
|
||||
/// scheduled blocks are being executed.
|
||||
@interface RACTestScheduler : RACScheduler
|
||||
|
||||
/// Initializes a new test scheduler.
|
||||
- (instancetype)init;
|
||||
|
||||
/// Executes the next scheduled block, if any.
|
||||
///
|
||||
/// This method will block until the scheduled action has completed.
|
||||
- (void)step;
|
||||
|
||||
/// Executes up to the next `ticks` scheduled blocks.
|
||||
///
|
||||
/// This method will block until the scheduled actions have completed.
|
||||
///
|
||||
/// ticks - The number of scheduled blocks to execute. If there aren't this many
|
||||
/// blocks enqueued, all scheduled blocks are executed.
|
||||
- (void)step:(NSUInteger)ticks;
|
||||
|
||||
/// Executes all of the scheduled blocks on the receiver.
|
||||
///
|
||||
/// This method will block until the scheduled actions have completed.
|
||||
- (void)stepAll;
|
||||
|
||||
@end
|
|
@ -1,159 +0,0 @@
|
|||
//
|
||||
// RACTuple.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 4/12/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "metamacros.h"
|
||||
|
||||
@class RACSequence;
|
||||
|
||||
/// Creates a new tuple with the given values. At least one value must be given.
|
||||
/// Values can be nil.
|
||||
#define RACTuplePack(...) \
|
||||
RACTuplePack_(__VA_ARGS__)
|
||||
|
||||
/// Declares new object variables and unpacks a RACTuple into them.
|
||||
///
|
||||
/// This macro should be used on the left side of an assignment, with the
|
||||
/// tuple on the right side. Nothing else should appear on the same line, and the
|
||||
/// macro should not be the only statement in a conditional or loop body.
|
||||
///
|
||||
/// If the tuple has more values than there are variables listed, the excess
|
||||
/// values are ignored.
|
||||
///
|
||||
/// If the tuple has fewer values than there are variables listed, the excess
|
||||
/// variables are initialized to nil.
|
||||
///
|
||||
/// Examples
|
||||
///
|
||||
/// RACTupleUnpack(NSString *string, NSNumber *num) = [RACTuple tupleWithObjects:@"foo", @5, nil];
|
||||
/// NSLog(@"string: %@", string);
|
||||
/// NSLog(@"num: %@", num);
|
||||
///
|
||||
/// /* The above is equivalent to: */
|
||||
/// RACTuple *t = [RACTuple tupleWithObjects:@"foo", @5, nil];
|
||||
/// NSString *string = t[0];
|
||||
/// NSNumber *num = t[1];
|
||||
/// NSLog(@"string: %@", string);
|
||||
/// NSLog(@"num: %@", num);
|
||||
#define RACTupleUnpack(...) \
|
||||
RACTupleUnpack_(__VA_ARGS__)
|
||||
|
||||
/// A sentinel object that represents nils in the tuple.
|
||||
///
|
||||
/// It should never be necessary to create a tuple nil yourself. Just use
|
||||
/// +tupleNil.
|
||||
@interface RACTupleNil : NSObject <NSCopying, NSCoding>
|
||||
/// A singleton instance.
|
||||
+ (RACTupleNil *)tupleNil;
|
||||
@end
|
||||
|
||||
|
||||
/// A tuple is an ordered collection of objects. It may contain nils, represented
|
||||
/// by RACTupleNil.
|
||||
@interface RACTuple : NSObject <NSCoding, NSCopying, NSFastEnumeration>
|
||||
|
||||
@property (nonatomic, readonly) NSUInteger count;
|
||||
|
||||
/// These properties all return the object at that index or nil if the number of
|
||||
/// objects is less than the index.
|
||||
@property (nonatomic, readonly) id first;
|
||||
@property (nonatomic, readonly) id second;
|
||||
@property (nonatomic, readonly) id third;
|
||||
@property (nonatomic, readonly) id fourth;
|
||||
@property (nonatomic, readonly) id fifth;
|
||||
@property (nonatomic, readonly) id last;
|
||||
|
||||
/// Creates a new tuple out of the array. Does not convert nulls to nils.
|
||||
+ (instancetype)tupleWithObjectsFromArray:(NSArray *)array;
|
||||
|
||||
/// Creates a new tuple out of the array. If `convert` is YES, it also converts
|
||||
/// every NSNull to RACTupleNil.
|
||||
+ (instancetype)tupleWithObjectsFromArray:(NSArray *)array convertNullsToNils:(BOOL)convert;
|
||||
|
||||
/// Creates a new tuple with the given objects. Use RACTupleNil to represent
|
||||
/// nils.
|
||||
+ (instancetype)tupleWithObjects:(id)object, ... NS_REQUIRES_NIL_TERMINATION;
|
||||
|
||||
/// Returns the object at `index` or nil if the object is a RACTupleNil. Unlike
|
||||
/// NSArray and friends, it's perfectly fine to ask for the object at an index
|
||||
/// past the tuple's count - 1. It will simply return nil.
|
||||
- (id)objectAtIndex:(NSUInteger)index;
|
||||
|
||||
/// Returns an array of all the objects. RACTupleNils are converted to NSNulls.
|
||||
- (NSArray *)allObjects;
|
||||
|
||||
/// Appends `obj` to the receiver.
|
||||
///
|
||||
/// obj - The object to add to the tuple. This argument may be nil.
|
||||
///
|
||||
/// Returns a new tuple.
|
||||
- (instancetype)tupleByAddingObject:(id)obj;
|
||||
|
||||
@end
|
||||
|
||||
@interface RACTuple (RACSequenceAdditions)
|
||||
|
||||
/// Returns a sequence of all the objects. RACTupleNils are converted to NSNulls.
|
||||
@property (nonatomic, copy, readonly) RACSequence *rac_sequence;
|
||||
|
||||
@end
|
||||
|
||||
@interface RACTuple (ObjectSubscripting)
|
||||
/// Returns the object at that index or nil if the number of objects is less
|
||||
/// than the index.
|
||||
- (id)objectAtIndexedSubscript:(NSUInteger)idx;
|
||||
@end
|
||||
|
||||
/// This and everything below is for internal use only.
|
||||
///
|
||||
/// See RACTuplePack() and RACTupleUnpack() instead.
|
||||
#define RACTuplePack_(...) \
|
||||
([RACTuple tupleWithObjectsFromArray:@[ metamacro_foreach(RACTuplePack_object_or_ractuplenil,, __VA_ARGS__) ]])
|
||||
|
||||
#define RACTuplePack_object_or_ractuplenil(INDEX, ARG) \
|
||||
(ARG) ?: RACTupleNil.tupleNil,
|
||||
|
||||
#define RACTupleUnpack_(...) \
|
||||
metamacro_foreach(RACTupleUnpack_decl,, __VA_ARGS__) \
|
||||
\
|
||||
int RACTupleUnpack_state = 0; \
|
||||
\
|
||||
RACTupleUnpack_after: \
|
||||
; \
|
||||
metamacro_foreach(RACTupleUnpack_assign,, __VA_ARGS__) \
|
||||
if (RACTupleUnpack_state != 0) RACTupleUnpack_state = 2; \
|
||||
\
|
||||
while (RACTupleUnpack_state != 2) \
|
||||
if (RACTupleUnpack_state == 1) { \
|
||||
goto RACTupleUnpack_after; \
|
||||
} else \
|
||||
for (; RACTupleUnpack_state != 1; RACTupleUnpack_state = 1) \
|
||||
[RACTupleUnpackingTrampoline trampoline][ @[ metamacro_foreach(RACTupleUnpack_value,, __VA_ARGS__) ] ]
|
||||
|
||||
#define RACTupleUnpack_state metamacro_concat(RACTupleUnpack_state, __LINE__)
|
||||
#define RACTupleUnpack_after metamacro_concat(RACTupleUnpack_after, __LINE__)
|
||||
#define RACTupleUnpack_loop metamacro_concat(RACTupleUnpack_loop, __LINE__)
|
||||
|
||||
#define RACTupleUnpack_decl_name(INDEX) \
|
||||
metamacro_concat(metamacro_concat(RACTupleUnpack, __LINE__), metamacro_concat(_var, INDEX))
|
||||
|
||||
#define RACTupleUnpack_decl(INDEX, ARG) \
|
||||
__strong id RACTupleUnpack_decl_name(INDEX);
|
||||
|
||||
#define RACTupleUnpack_assign(INDEX, ARG) \
|
||||
__strong ARG = RACTupleUnpack_decl_name(INDEX);
|
||||
|
||||
#define RACTupleUnpack_value(INDEX, ARG) \
|
||||
[NSValue valueWithPointer:&RACTupleUnpack_decl_name(INDEX)],
|
||||
|
||||
@interface RACTupleUnpackingTrampoline : NSObject
|
||||
|
||||
+ (instancetype)trampoline;
|
||||
- (void)setObject:(RACTuple *)tuple forKeyedSubscript:(NSArray *)variables;
|
||||
|
||||
@end
|
|
@ -1,19 +0,0 @@
|
|||
//
|
||||
// RACUnit.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 3/27/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/// A unit represents an empty value.
|
||||
///
|
||||
/// It should never be necessary to create a unit yourself. Just use +defaultUnit.
|
||||
@interface RACUnit : NSObject
|
||||
|
||||
/// A singleton instance.
|
||||
+ (RACUnit *)defaultUnit;
|
||||
|
||||
@end
|
|
@ -1,89 +0,0 @@
|
|||
//
|
||||
// ReactiveCocoa.h
|
||||
// ReactiveCocoa
|
||||
//
|
||||
// Created by Josh Abernathy on 3/5/12.
|
||||
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
//! Project version number for ReactiveCocoa.
|
||||
FOUNDATION_EXPORT double ReactiveCocoaVersionNumber;
|
||||
|
||||
//! Project version string for ReactiveCocoa.
|
||||
FOUNDATION_EXPORT const unsigned char ReactiveCocoaVersionString[];
|
||||
|
||||
#import <ReactiveCocoa/EXTKeyPathCoding.h>
|
||||
#import <ReactiveCocoa/EXTScope.h>
|
||||
#import <ReactiveCocoa/NSArray+RACSequenceAdditions.h>
|
||||
#import <ReactiveCocoa/NSData+RACSupport.h>
|
||||
#import <ReactiveCocoa/NSDictionary+RACSequenceAdditions.h>
|
||||
#import <ReactiveCocoa/NSEnumerator+RACSequenceAdditions.h>
|
||||
#import <ReactiveCocoa/NSFileHandle+RACSupport.h>
|
||||
#import <ReactiveCocoa/NSNotificationCenter+RACSupport.h>
|
||||
#import <ReactiveCocoa/NSObject+RACDeallocating.h>
|
||||
#import <ReactiveCocoa/NSObject+RACLifting.h>
|
||||
#import <ReactiveCocoa/NSObject+RACPropertySubscribing.h>
|
||||
#import <ReactiveCocoa/NSObject+RACSelectorSignal.h>
|
||||
#import <ReactiveCocoa/NSOrderedSet+RACSequenceAdditions.h>
|
||||
#import <ReactiveCocoa/NSSet+RACSequenceAdditions.h>
|
||||
#import <ReactiveCocoa/NSString+RACSequenceAdditions.h>
|
||||
#import <ReactiveCocoa/NSString+RACSupport.h>
|
||||
#import <ReactiveCocoa/NSIndexSet+RACSequenceAdditions.h>
|
||||
#import <ReactiveCocoa/NSURLConnection+RACSupport.h>
|
||||
#import <ReactiveCocoa/NSUserDefaults+RACSupport.h>
|
||||
#import <ReactiveCocoa/RACBacktrace.h>
|
||||
#import <ReactiveCocoa/RACBehaviorSubject.h>
|
||||
#import <ReactiveCocoa/RACChannel.h>
|
||||
#import <ReactiveCocoa/RACCommand.h>
|
||||
#import <ReactiveCocoa/RACCompoundDisposable.h>
|
||||
#import <ReactiveCocoa/RACDisposable.h>
|
||||
#import <ReactiveCocoa/RACEvent.h>
|
||||
#import <ReactiveCocoa/RACGroupedSignal.h>
|
||||
#import <ReactiveCocoa/RACKVOChannel.h>
|
||||
#import <ReactiveCocoa/RACMulticastConnection.h>
|
||||
#import <ReactiveCocoa/RACQueueScheduler.h>
|
||||
#import <ReactiveCocoa/RACQueueScheduler+Subclass.h>
|
||||
#import <ReactiveCocoa/RACReplaySubject.h>
|
||||
#import <ReactiveCocoa/RACScheduler.h>
|
||||
#import <ReactiveCocoa/RACScheduler+Subclass.h>
|
||||
#import <ReactiveCocoa/RACScopedDisposable.h>
|
||||
#import <ReactiveCocoa/RACSequence.h>
|
||||
#import <ReactiveCocoa/RACSerialDisposable.h>
|
||||
#import <ReactiveCocoa/RACSignal+Operations.h>
|
||||
#import <ReactiveCocoa/RACSignal.h>
|
||||
#import <ReactiveCocoa/RACStream.h>
|
||||
#import <ReactiveCocoa/RACSubject.h>
|
||||
#import <ReactiveCocoa/RACSubscriber.h>
|
||||
#import <ReactiveCocoa/RACSubscriptingAssignmentTrampoline.h>
|
||||
#import <ReactiveCocoa/RACTargetQueueScheduler.h>
|
||||
#import <ReactiveCocoa/RACTestScheduler.h>
|
||||
#import <ReactiveCocoa/RACTuple.h>
|
||||
#import <ReactiveCocoa/RACUnit.h>
|
||||
|
||||
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
|
||||
#import <ReactiveCocoa/UIActionSheet+RACSignalSupport.h>
|
||||
#import <ReactiveCocoa/UIAlertView+RACSignalSupport.h>
|
||||
#import <ReactiveCocoa/UIBarButtonItem+RACCommandSupport.h>
|
||||
#import <ReactiveCocoa/UIButton+RACCommandSupport.h>
|
||||
#import <ReactiveCocoa/UICollectionReusableView+RACSignalSupport.h>
|
||||
#import <ReactiveCocoa/UIControl+RACSignalSupport.h>
|
||||
#import <ReactiveCocoa/UIDatePicker+RACSignalSupport.h>
|
||||
#import <ReactiveCocoa/UIGestureRecognizer+RACSignalSupport.h>
|
||||
#import <ReactiveCocoa/UIImagePickerController+RACSignalSupport.h>
|
||||
#import <ReactiveCocoa/UIRefreshControl+RACCommandSupport.h>
|
||||
#import <ReactiveCocoa/UISegmentedControl+RACSignalSupport.h>
|
||||
#import <ReactiveCocoa/UISlider+RACSignalSupport.h>
|
||||
#import <ReactiveCocoa/UIStepper+RACSignalSupport.h>
|
||||
#import <ReactiveCocoa/UISwitch+RACSignalSupport.h>
|
||||
#import <ReactiveCocoa/UITableViewCell+RACSignalSupport.h>
|
||||
#import <ReactiveCocoa/UITableViewHeaderFooterView+RACSignalSupport.h>
|
||||
#import <ReactiveCocoa/UITextField+RACSignalSupport.h>
|
||||
#import <ReactiveCocoa/UITextView+RACSignalSupport.h>
|
||||
#elif TARGET_OS_MAC
|
||||
#import <ReactiveCocoa/NSControl+RACCommandSupport.h>
|
||||
#import <ReactiveCocoa/NSControl+RACTextSignalSupport.h>
|
||||
#import <ReactiveCocoa/NSObject+RACAppKitBindings.h>
|
||||
#import <ReactiveCocoa/NSText+RACSignalSupport.h>
|
||||
#endif
|
|
@ -1,666 +0,0 @@
|
|||
/**
|
||||
* Macros for metaprogramming
|
||||
* ExtendedC
|
||||
*
|
||||
* Copyright (C) 2012 Justin Spahr-Summers
|
||||
* Released under the MIT license
|
||||
*/
|
||||
|
||||
#ifndef EXTC_METAMACROS_H
|
||||
#define EXTC_METAMACROS_H
|
||||
|
||||
/**
|
||||
* Executes one or more expressions (which may have a void type, such as a call
|
||||
* to a function that returns no value) and always returns true.
|
||||
*/
|
||||
#define metamacro_exprify(...) \
|
||||
((__VA_ARGS__), true)
|
||||
|
||||
/**
|
||||
* Returns a string representation of VALUE after full macro expansion.
|
||||
*/
|
||||
#define metamacro_stringify(VALUE) \
|
||||
metamacro_stringify_(VALUE)
|
||||
|
||||
/**
|
||||
* Returns A and B concatenated after full macro expansion.
|
||||
*/
|
||||
#define metamacro_concat(A, B) \
|
||||
metamacro_concat_(A, B)
|
||||
|
||||
/**
|
||||
* Returns the Nth variadic argument (starting from zero). At least
|
||||
* N + 1 variadic arguments must be given. N must be between zero and twenty,
|
||||
* inclusive.
|
||||
*/
|
||||
#define metamacro_at(N, ...) \
|
||||
metamacro_concat(metamacro_at, N)(__VA_ARGS__)
|
||||
|
||||
/**
|
||||
* Returns the number of arguments (up to twenty) provided to the macro. At
|
||||
* least one argument must be provided.
|
||||
*
|
||||
* Inspired by P99: http://p99.gforge.inria.fr
|
||||
*/
|
||||
#define metamacro_argcount(...) \
|
||||
metamacro_at(20, __VA_ARGS__, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
|
||||
|
||||
/**
|
||||
* Identical to #metamacro_foreach_cxt, except that no CONTEXT argument is
|
||||
* given. Only the index and current argument will thus be passed to MACRO.
|
||||
*/
|
||||
#define metamacro_foreach(MACRO, SEP, ...) \
|
||||
metamacro_foreach_cxt(metamacro_foreach_iter, SEP, MACRO, __VA_ARGS__)
|
||||
|
||||
/**
|
||||
* For each consecutive variadic argument (up to twenty), MACRO is passed the
|
||||
* zero-based index of the current argument, CONTEXT, and then the argument
|
||||
* itself. The results of adjoining invocations of MACRO are then separated by
|
||||
* SEP.
|
||||
*
|
||||
* Inspired by P99: http://p99.gforge.inria.fr
|
||||
*/
|
||||
#define metamacro_foreach_cxt(MACRO, SEP, CONTEXT, ...) \
|
||||
metamacro_concat(metamacro_foreach_cxt, metamacro_argcount(__VA_ARGS__))(MACRO, SEP, CONTEXT, __VA_ARGS__)
|
||||
|
||||
/**
|
||||
* Identical to #metamacro_foreach_cxt. This can be used when the former would
|
||||
* fail due to recursive macro expansion.
|
||||
*/
|
||||
#define metamacro_foreach_cxt_recursive(MACRO, SEP, CONTEXT, ...) \
|
||||
metamacro_concat(metamacro_foreach_cxt_recursive, metamacro_argcount(__VA_ARGS__))(MACRO, SEP, CONTEXT, __VA_ARGS__)
|
||||
|
||||
/**
|
||||
* In consecutive order, appends each variadic argument (up to twenty) onto
|
||||
* BASE. The resulting concatenations are then separated by SEP.
|
||||
*
|
||||
* This is primarily useful to manipulate a list of macro invocations into instead
|
||||
* invoking a different, possibly related macro.
|
||||
*/
|
||||
#define metamacro_foreach_concat(BASE, SEP, ...) \
|
||||
metamacro_foreach_cxt(metamacro_foreach_concat_iter, SEP, BASE, __VA_ARGS__)
|
||||
|
||||
/**
|
||||
* Iterates COUNT times, each time invoking MACRO with the current index
|
||||
* (starting at zero) and CONTEXT. The results of adjoining invocations of MACRO
|
||||
* are then separated by SEP.
|
||||
*
|
||||
* COUNT must be an integer between zero and twenty, inclusive.
|
||||
*/
|
||||
#define metamacro_for_cxt(COUNT, MACRO, SEP, CONTEXT) \
|
||||
metamacro_concat(metamacro_for_cxt, COUNT)(MACRO, SEP, CONTEXT)
|
||||
|
||||
/**
|
||||
* Returns the first argument given. At least one argument must be provided.
|
||||
*
|
||||
* This is useful when implementing a variadic macro, where you may have only
|
||||
* one variadic argument, but no way to retrieve it (for example, because \c ...
|
||||
* always needs to match at least one argument).
|
||||
*
|
||||
* @code
|
||||
|
||||
#define varmacro(...) \
|
||||
metamacro_head(__VA_ARGS__)
|
||||
|
||||
* @endcode
|
||||
*/
|
||||
#define metamacro_head(...) \
|
||||
metamacro_head_(__VA_ARGS__, 0)
|
||||
|
||||
/**
|
||||
* Returns every argument except the first. At least two arguments must be
|
||||
* provided.
|
||||
*/
|
||||
#define metamacro_tail(...) \
|
||||
metamacro_tail_(__VA_ARGS__)
|
||||
|
||||
/**
|
||||
* Returns the first N (up to twenty) variadic arguments as a new argument list.
|
||||
* At least N variadic arguments must be provided.
|
||||
*/
|
||||
#define metamacro_take(N, ...) \
|
||||
metamacro_concat(metamacro_take, N)(__VA_ARGS__)
|
||||
|
||||
/**
|
||||
* Removes the first N (up to twenty) variadic arguments from the given argument
|
||||
* list. At least N variadic arguments must be provided.
|
||||
*/
|
||||
#define metamacro_drop(N, ...) \
|
||||
metamacro_concat(metamacro_drop, N)(__VA_ARGS__)
|
||||
|
||||
/**
|
||||
* Decrements VAL, which must be a number between zero and twenty, inclusive.
|
||||
*
|
||||
* This is primarily useful when dealing with indexes and counts in
|
||||
* metaprogramming.
|
||||
*/
|
||||
#define metamacro_dec(VAL) \
|
||||
metamacro_at(VAL, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)
|
||||
|
||||
/**
|
||||
* Increments VAL, which must be a number between zero and twenty, inclusive.
|
||||
*
|
||||
* This is primarily useful when dealing with indexes and counts in
|
||||
* metaprogramming.
|
||||
*/
|
||||
#define metamacro_inc(VAL) \
|
||||
metamacro_at(VAL, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)
|
||||
|
||||
/**
|
||||
* If A is equal to B, the next argument list is expanded; otherwise, the
|
||||
* argument list after that is expanded. A and B must be numbers between zero
|
||||
* and twenty, inclusive. Additionally, B must be greater than or equal to A.
|
||||
*
|
||||
* @code
|
||||
|
||||
// expands to true
|
||||
metamacro_if_eq(0, 0)(true)(false)
|
||||
|
||||
// expands to false
|
||||
metamacro_if_eq(0, 1)(true)(false)
|
||||
|
||||
* @endcode
|
||||
*
|
||||
* This is primarily useful when dealing with indexes and counts in
|
||||
* metaprogramming.
|
||||
*/
|
||||
#define metamacro_if_eq(A, B) \
|
||||
metamacro_concat(metamacro_if_eq, A)(B)
|
||||
|
||||
/**
|
||||
* Identical to #metamacro_if_eq. This can be used when the former would fail
|
||||
* due to recursive macro expansion.
|
||||
*/
|
||||
#define metamacro_if_eq_recursive(A, B) \
|
||||
metamacro_concat(metamacro_if_eq_recursive, A)(B)
|
||||
|
||||
/**
|
||||
* Returns 1 if N is an even number, or 0 otherwise. N must be between zero and
|
||||
* twenty, inclusive.
|
||||
*
|
||||
* For the purposes of this test, zero is considered even.
|
||||
*/
|
||||
#define metamacro_is_even(N) \
|
||||
metamacro_at(N, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1)
|
||||
|
||||
/**
|
||||
* Returns the logical NOT of B, which must be the number zero or one.
|
||||
*/
|
||||
#define metamacro_not(B) \
|
||||
metamacro_at(B, 1, 0)
|
||||
|
||||
// IMPLEMENTATION DETAILS FOLLOW!
|
||||
// Do not write code that depends on anything below this line.
|
||||
#define metamacro_stringify_(VALUE) # VALUE
|
||||
#define metamacro_concat_(A, B) A ## B
|
||||
#define metamacro_foreach_iter(INDEX, MACRO, ARG) MACRO(INDEX, ARG)
|
||||
#define metamacro_head_(FIRST, ...) FIRST
|
||||
#define metamacro_tail_(FIRST, ...) __VA_ARGS__
|
||||
#define metamacro_consume_(...)
|
||||
#define metamacro_expand_(...) __VA_ARGS__
|
||||
|
||||
// implemented from scratch so that metamacro_concat() doesn't end up nesting
|
||||
#define metamacro_foreach_concat_iter(INDEX, BASE, ARG) metamacro_foreach_concat_iter_(BASE, ARG)
|
||||
#define metamacro_foreach_concat_iter_(BASE, ARG) BASE ## ARG
|
||||
|
||||
// metamacro_at expansions
|
||||
#define metamacro_at0(...) metamacro_head(__VA_ARGS__)
|
||||
#define metamacro_at1(_0, ...) metamacro_head(__VA_ARGS__)
|
||||
#define metamacro_at2(_0, _1, ...) metamacro_head(__VA_ARGS__)
|
||||
#define metamacro_at3(_0, _1, _2, ...) metamacro_head(__VA_ARGS__)
|
||||
#define metamacro_at4(_0, _1, _2, _3, ...) metamacro_head(__VA_ARGS__)
|
||||
#define metamacro_at5(_0, _1, _2, _3, _4, ...) metamacro_head(__VA_ARGS__)
|
||||
#define metamacro_at6(_0, _1, _2, _3, _4, _5, ...) metamacro_head(__VA_ARGS__)
|
||||
#define metamacro_at7(_0, _1, _2, _3, _4, _5, _6, ...) metamacro_head(__VA_ARGS__)
|
||||
#define metamacro_at8(_0, _1, _2, _3, _4, _5, _6, _7, ...) metamacro_head(__VA_ARGS__)
|
||||
#define metamacro_at9(_0, _1, _2, _3, _4, _5, _6, _7, _8, ...) metamacro_head(__VA_ARGS__)
|
||||
#define metamacro_at10(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, ...) metamacro_head(__VA_ARGS__)
|
||||
#define metamacro_at11(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, ...) metamacro_head(__VA_ARGS__)
|
||||
#define metamacro_at12(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, ...) metamacro_head(__VA_ARGS__)
|
||||
#define metamacro_at13(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, ...) metamacro_head(__VA_ARGS__)
|
||||
#define metamacro_at14(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, ...) metamacro_head(__VA_ARGS__)
|
||||
#define metamacro_at15(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, ...) metamacro_head(__VA_ARGS__)
|
||||
#define metamacro_at16(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, ...) metamacro_head(__VA_ARGS__)
|
||||
#define metamacro_at17(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, ...) metamacro_head(__VA_ARGS__)
|
||||
#define metamacro_at18(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, ...) metamacro_head(__VA_ARGS__)
|
||||
#define metamacro_at19(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, ...) metamacro_head(__VA_ARGS__)
|
||||
#define metamacro_at20(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, ...) metamacro_head(__VA_ARGS__)
|
||||
|
||||
// metamacro_foreach_cxt expansions
|
||||
#define metamacro_foreach_cxt0(MACRO, SEP, CONTEXT)
|
||||
#define metamacro_foreach_cxt1(MACRO, SEP, CONTEXT, _0) MACRO(0, CONTEXT, _0)
|
||||
|
||||
#define metamacro_foreach_cxt2(MACRO, SEP, CONTEXT, _0, _1) \
|
||||
metamacro_foreach_cxt1(MACRO, SEP, CONTEXT, _0) \
|
||||
SEP \
|
||||
MACRO(1, CONTEXT, _1)
|
||||
|
||||
#define metamacro_foreach_cxt3(MACRO, SEP, CONTEXT, _0, _1, _2) \
|
||||
metamacro_foreach_cxt2(MACRO, SEP, CONTEXT, _0, _1) \
|
||||
SEP \
|
||||
MACRO(2, CONTEXT, _2)
|
||||
|
||||
#define metamacro_foreach_cxt4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \
|
||||
metamacro_foreach_cxt3(MACRO, SEP, CONTEXT, _0, _1, _2) \
|
||||
SEP \
|
||||
MACRO(3, CONTEXT, _3)
|
||||
|
||||
#define metamacro_foreach_cxt5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \
|
||||
metamacro_foreach_cxt4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \
|
||||
SEP \
|
||||
MACRO(4, CONTEXT, _4)
|
||||
|
||||
#define metamacro_foreach_cxt6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \
|
||||
metamacro_foreach_cxt5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \
|
||||
SEP \
|
||||
MACRO(5, CONTEXT, _5)
|
||||
|
||||
#define metamacro_foreach_cxt7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \
|
||||
metamacro_foreach_cxt6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \
|
||||
SEP \
|
||||
MACRO(6, CONTEXT, _6)
|
||||
|
||||
#define metamacro_foreach_cxt8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \
|
||||
metamacro_foreach_cxt7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \
|
||||
SEP \
|
||||
MACRO(7, CONTEXT, _7)
|
||||
|
||||
#define metamacro_foreach_cxt9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \
|
||||
metamacro_foreach_cxt8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \
|
||||
SEP \
|
||||
MACRO(8, CONTEXT, _8)
|
||||
|
||||
#define metamacro_foreach_cxt10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \
|
||||
metamacro_foreach_cxt9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \
|
||||
SEP \
|
||||
MACRO(9, CONTEXT, _9)
|
||||
|
||||
#define metamacro_foreach_cxt11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \
|
||||
metamacro_foreach_cxt10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \
|
||||
SEP \
|
||||
MACRO(10, CONTEXT, _10)
|
||||
|
||||
#define metamacro_foreach_cxt12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \
|
||||
metamacro_foreach_cxt11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \
|
||||
SEP \
|
||||
MACRO(11, CONTEXT, _11)
|
||||
|
||||
#define metamacro_foreach_cxt13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \
|
||||
metamacro_foreach_cxt12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \
|
||||
SEP \
|
||||
MACRO(12, CONTEXT, _12)
|
||||
|
||||
#define metamacro_foreach_cxt14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \
|
||||
metamacro_foreach_cxt13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \
|
||||
SEP \
|
||||
MACRO(13, CONTEXT, _13)
|
||||
|
||||
#define metamacro_foreach_cxt15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \
|
||||
metamacro_foreach_cxt14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \
|
||||
SEP \
|
||||
MACRO(14, CONTEXT, _14)
|
||||
|
||||
#define metamacro_foreach_cxt16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \
|
||||
metamacro_foreach_cxt15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \
|
||||
SEP \
|
||||
MACRO(15, CONTEXT, _15)
|
||||
|
||||
#define metamacro_foreach_cxt17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \
|
||||
metamacro_foreach_cxt16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \
|
||||
SEP \
|
||||
MACRO(16, CONTEXT, _16)
|
||||
|
||||
#define metamacro_foreach_cxt18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \
|
||||
metamacro_foreach_cxt17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \
|
||||
SEP \
|
||||
MACRO(17, CONTEXT, _17)
|
||||
|
||||
#define metamacro_foreach_cxt19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \
|
||||
metamacro_foreach_cxt18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \
|
||||
SEP \
|
||||
MACRO(18, CONTEXT, _18)
|
||||
|
||||
#define metamacro_foreach_cxt20(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19) \
|
||||
metamacro_foreach_cxt19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \
|
||||
SEP \
|
||||
MACRO(19, CONTEXT, _19)
|
||||
|
||||
// metamacro_foreach_cxt_recursive expansions
|
||||
#define metamacro_foreach_cxt_recursive0(MACRO, SEP, CONTEXT)
|
||||
#define metamacro_foreach_cxt_recursive1(MACRO, SEP, CONTEXT, _0) MACRO(0, CONTEXT, _0)
|
||||
|
||||
#define metamacro_foreach_cxt_recursive2(MACRO, SEP, CONTEXT, _0, _1) \
|
||||
metamacro_foreach_cxt_recursive1(MACRO, SEP, CONTEXT, _0) \
|
||||
SEP \
|
||||
MACRO(1, CONTEXT, _1)
|
||||
|
||||
#define metamacro_foreach_cxt_recursive3(MACRO, SEP, CONTEXT, _0, _1, _2) \
|
||||
metamacro_foreach_cxt_recursive2(MACRO, SEP, CONTEXT, _0, _1) \
|
||||
SEP \
|
||||
MACRO(2, CONTEXT, _2)
|
||||
|
||||
#define metamacro_foreach_cxt_recursive4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \
|
||||
metamacro_foreach_cxt_recursive3(MACRO, SEP, CONTEXT, _0, _1, _2) \
|
||||
SEP \
|
||||
MACRO(3, CONTEXT, _3)
|
||||
|
||||
#define metamacro_foreach_cxt_recursive5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \
|
||||
metamacro_foreach_cxt_recursive4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \
|
||||
SEP \
|
||||
MACRO(4, CONTEXT, _4)
|
||||
|
||||
#define metamacro_foreach_cxt_recursive6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \
|
||||
metamacro_foreach_cxt_recursive5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \
|
||||
SEP \
|
||||
MACRO(5, CONTEXT, _5)
|
||||
|
||||
#define metamacro_foreach_cxt_recursive7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \
|
||||
metamacro_foreach_cxt_recursive6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \
|
||||
SEP \
|
||||
MACRO(6, CONTEXT, _6)
|
||||
|
||||
#define metamacro_foreach_cxt_recursive8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \
|
||||
metamacro_foreach_cxt_recursive7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \
|
||||
SEP \
|
||||
MACRO(7, CONTEXT, _7)
|
||||
|
||||
#define metamacro_foreach_cxt_recursive9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \
|
||||
metamacro_foreach_cxt_recursive8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \
|
||||
SEP \
|
||||
MACRO(8, CONTEXT, _8)
|
||||
|
||||
#define metamacro_foreach_cxt_recursive10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \
|
||||
metamacro_foreach_cxt_recursive9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \
|
||||
SEP \
|
||||
MACRO(9, CONTEXT, _9)
|
||||
|
||||
#define metamacro_foreach_cxt_recursive11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \
|
||||
metamacro_foreach_cxt_recursive10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \
|
||||
SEP \
|
||||
MACRO(10, CONTEXT, _10)
|
||||
|
||||
#define metamacro_foreach_cxt_recursive12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \
|
||||
metamacro_foreach_cxt_recursive11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \
|
||||
SEP \
|
||||
MACRO(11, CONTEXT, _11)
|
||||
|
||||
#define metamacro_foreach_cxt_recursive13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \
|
||||
metamacro_foreach_cxt_recursive12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \
|
||||
SEP \
|
||||
MACRO(12, CONTEXT, _12)
|
||||
|
||||
#define metamacro_foreach_cxt_recursive14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \
|
||||
metamacro_foreach_cxt_recursive13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \
|
||||
SEP \
|
||||
MACRO(13, CONTEXT, _13)
|
||||
|
||||
#define metamacro_foreach_cxt_recursive15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \
|
||||
metamacro_foreach_cxt_recursive14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \
|
||||
SEP \
|
||||
MACRO(14, CONTEXT, _14)
|
||||
|
||||
#define metamacro_foreach_cxt_recursive16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \
|
||||
metamacro_foreach_cxt_recursive15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \
|
||||
SEP \
|
||||
MACRO(15, CONTEXT, _15)
|
||||
|
||||
#define metamacro_foreach_cxt_recursive17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \
|
||||
metamacro_foreach_cxt_recursive16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \
|
||||
SEP \
|
||||
MACRO(16, CONTEXT, _16)
|
||||
|
||||
#define metamacro_foreach_cxt_recursive18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \
|
||||
metamacro_foreach_cxt_recursive17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \
|
||||
SEP \
|
||||
MACRO(17, CONTEXT, _17)
|
||||
|
||||
#define metamacro_foreach_cxt_recursive19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \
|
||||
metamacro_foreach_cxt_recursive18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \
|
||||
SEP \
|
||||
MACRO(18, CONTEXT, _18)
|
||||
|
||||
#define metamacro_foreach_cxt_recursive20(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19) \
|
||||
metamacro_foreach_cxt_recursive19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \
|
||||
SEP \
|
||||
MACRO(19, CONTEXT, _19)
|
||||
|
||||
// metamacro_for_cxt expansions
|
||||
#define metamacro_for_cxt0(MACRO, SEP, CONTEXT)
|
||||
#define metamacro_for_cxt1(MACRO, SEP, CONTEXT) MACRO(0, CONTEXT)
|
||||
|
||||
#define metamacro_for_cxt2(MACRO, SEP, CONTEXT) \
|
||||
metamacro_for_cxt1(MACRO, SEP, CONTEXT) \
|
||||
SEP \
|
||||
MACRO(1, CONTEXT)
|
||||
|
||||
#define metamacro_for_cxt3(MACRO, SEP, CONTEXT) \
|
||||
metamacro_for_cxt2(MACRO, SEP, CONTEXT) \
|
||||
SEP \
|
||||
MACRO(2, CONTEXT)
|
||||
|
||||
#define metamacro_for_cxt4(MACRO, SEP, CONTEXT) \
|
||||
metamacro_for_cxt3(MACRO, SEP, CONTEXT) \
|
||||
SEP \
|
||||
MACRO(3, CONTEXT)
|
||||
|
||||
#define metamacro_for_cxt5(MACRO, SEP, CONTEXT) \
|
||||
metamacro_for_cxt4(MACRO, SEP, CONTEXT) \
|
||||
SEP \
|
||||
MACRO(4, CONTEXT)
|
||||
|
||||
#define metamacro_for_cxt6(MACRO, SEP, CONTEXT) \
|
||||
metamacro_for_cxt5(MACRO, SEP, CONTEXT) \
|
||||
SEP \
|
||||
MACRO(5, CONTEXT)
|
||||
|
||||
#define metamacro_for_cxt7(MACRO, SEP, CONTEXT) \
|
||||
metamacro_for_cxt6(MACRO, SEP, CONTEXT) \
|
||||
SEP \
|
||||
MACRO(6, CONTEXT)
|
||||
|
||||
#define metamacro_for_cxt8(MACRO, SEP, CONTEXT) \
|
||||
metamacro_for_cxt7(MACRO, SEP, CONTEXT) \
|
||||
SEP \
|
||||
MACRO(7, CONTEXT)
|
||||
|
||||
#define metamacro_for_cxt9(MACRO, SEP, CONTEXT) \
|
||||
metamacro_for_cxt8(MACRO, SEP, CONTEXT) \
|
||||
SEP \
|
||||
MACRO(8, CONTEXT)
|
||||
|
||||
#define metamacro_for_cxt10(MACRO, SEP, CONTEXT) \
|
||||
metamacro_for_cxt9(MACRO, SEP, CONTEXT) \
|
||||
SEP \
|
||||
MACRO(9, CONTEXT)
|
||||
|
||||
#define metamacro_for_cxt11(MACRO, SEP, CONTEXT) \
|
||||
metamacro_for_cxt10(MACRO, SEP, CONTEXT) \
|
||||
SEP \
|
||||
MACRO(10, CONTEXT)
|
||||
|
||||
#define metamacro_for_cxt12(MACRO, SEP, CONTEXT) \
|
||||
metamacro_for_cxt11(MACRO, SEP, CONTEXT) \
|
||||
SEP \
|
||||
MACRO(11, CONTEXT)
|
||||
|
||||
#define metamacro_for_cxt13(MACRO, SEP, CONTEXT) \
|
||||
metamacro_for_cxt12(MACRO, SEP, CONTEXT) \
|
||||
SEP \
|
||||
MACRO(12, CONTEXT)
|
||||
|
||||
#define metamacro_for_cxt14(MACRO, SEP, CONTEXT) \
|
||||
metamacro_for_cxt13(MACRO, SEP, CONTEXT) \
|
||||
SEP \
|
||||
MACRO(13, CONTEXT)
|
||||
|
||||
#define metamacro_for_cxt15(MACRO, SEP, CONTEXT) \
|
||||
metamacro_for_cxt14(MACRO, SEP, CONTEXT) \
|
||||
SEP \
|
||||
MACRO(14, CONTEXT)
|
||||
|
||||
#define metamacro_for_cxt16(MACRO, SEP, CONTEXT) \
|
||||
metamacro_for_cxt15(MACRO, SEP, CONTEXT) \
|
||||
SEP \
|
||||
MACRO(15, CONTEXT)
|
||||
|
||||
#define metamacro_for_cxt17(MACRO, SEP, CONTEXT) \
|
||||
metamacro_for_cxt16(MACRO, SEP, CONTEXT) \
|
||||
SEP \
|
||||
MACRO(16, CONTEXT)
|
||||
|
||||
#define metamacro_for_cxt18(MACRO, SEP, CONTEXT) \
|
||||
metamacro_for_cxt17(MACRO, SEP, CONTEXT) \
|
||||
SEP \
|
||||
MACRO(17, CONTEXT)
|
||||
|
||||
#define metamacro_for_cxt19(MACRO, SEP, CONTEXT) \
|
||||
metamacro_for_cxt18(MACRO, SEP, CONTEXT) \
|
||||
SEP \
|
||||
MACRO(18, CONTEXT)
|
||||
|
||||
#define metamacro_for_cxt20(MACRO, SEP, CONTEXT) \
|
||||
metamacro_for_cxt19(MACRO, SEP, CONTEXT) \
|
||||
SEP \
|
||||
MACRO(19, CONTEXT)
|
||||
|
||||
// metamacro_if_eq expansions
|
||||
#define metamacro_if_eq0(VALUE) \
|
||||
metamacro_concat(metamacro_if_eq0_, VALUE)
|
||||
|
||||
#define metamacro_if_eq0_0(...) __VA_ARGS__ metamacro_consume_
|
||||
#define metamacro_if_eq0_1(...) metamacro_expand_
|
||||
#define metamacro_if_eq0_2(...) metamacro_expand_
|
||||
#define metamacro_if_eq0_3(...) metamacro_expand_
|
||||
#define metamacro_if_eq0_4(...) metamacro_expand_
|
||||
#define metamacro_if_eq0_5(...) metamacro_expand_
|
||||
#define metamacro_if_eq0_6(...) metamacro_expand_
|
||||
#define metamacro_if_eq0_7(...) metamacro_expand_
|
||||
#define metamacro_if_eq0_8(...) metamacro_expand_
|
||||
#define metamacro_if_eq0_9(...) metamacro_expand_
|
||||
#define metamacro_if_eq0_10(...) metamacro_expand_
|
||||
#define metamacro_if_eq0_11(...) metamacro_expand_
|
||||
#define metamacro_if_eq0_12(...) metamacro_expand_
|
||||
#define metamacro_if_eq0_13(...) metamacro_expand_
|
||||
#define metamacro_if_eq0_14(...) metamacro_expand_
|
||||
#define metamacro_if_eq0_15(...) metamacro_expand_
|
||||
#define metamacro_if_eq0_16(...) metamacro_expand_
|
||||
#define metamacro_if_eq0_17(...) metamacro_expand_
|
||||
#define metamacro_if_eq0_18(...) metamacro_expand_
|
||||
#define metamacro_if_eq0_19(...) metamacro_expand_
|
||||
#define metamacro_if_eq0_20(...) metamacro_expand_
|
||||
|
||||
#define metamacro_if_eq1(VALUE) metamacro_if_eq0(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq2(VALUE) metamacro_if_eq1(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq3(VALUE) metamacro_if_eq2(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq4(VALUE) metamacro_if_eq3(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq5(VALUE) metamacro_if_eq4(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq6(VALUE) metamacro_if_eq5(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq7(VALUE) metamacro_if_eq6(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq8(VALUE) metamacro_if_eq7(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq9(VALUE) metamacro_if_eq8(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq10(VALUE) metamacro_if_eq9(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq11(VALUE) metamacro_if_eq10(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq12(VALUE) metamacro_if_eq11(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq13(VALUE) metamacro_if_eq12(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq14(VALUE) metamacro_if_eq13(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq15(VALUE) metamacro_if_eq14(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq16(VALUE) metamacro_if_eq15(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq17(VALUE) metamacro_if_eq16(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq18(VALUE) metamacro_if_eq17(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq19(VALUE) metamacro_if_eq18(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq20(VALUE) metamacro_if_eq19(metamacro_dec(VALUE))
|
||||
|
||||
// metamacro_if_eq_recursive expansions
|
||||
#define metamacro_if_eq_recursive0(VALUE) \
|
||||
metamacro_concat(metamacro_if_eq_recursive0_, VALUE)
|
||||
|
||||
#define metamacro_if_eq_recursive0_0(...) __VA_ARGS__ metamacro_consume_
|
||||
#define metamacro_if_eq_recursive0_1(...) metamacro_expand_
|
||||
#define metamacro_if_eq_recursive0_2(...) metamacro_expand_
|
||||
#define metamacro_if_eq_recursive0_3(...) metamacro_expand_
|
||||
#define metamacro_if_eq_recursive0_4(...) metamacro_expand_
|
||||
#define metamacro_if_eq_recursive0_5(...) metamacro_expand_
|
||||
#define metamacro_if_eq_recursive0_6(...) metamacro_expand_
|
||||
#define metamacro_if_eq_recursive0_7(...) metamacro_expand_
|
||||
#define metamacro_if_eq_recursive0_8(...) metamacro_expand_
|
||||
#define metamacro_if_eq_recursive0_9(...) metamacro_expand_
|
||||
#define metamacro_if_eq_recursive0_10(...) metamacro_expand_
|
||||
#define metamacro_if_eq_recursive0_11(...) metamacro_expand_
|
||||
#define metamacro_if_eq_recursive0_12(...) metamacro_expand_
|
||||
#define metamacro_if_eq_recursive0_13(...) metamacro_expand_
|
||||
#define metamacro_if_eq_recursive0_14(...) metamacro_expand_
|
||||
#define metamacro_if_eq_recursive0_15(...) metamacro_expand_
|
||||
#define metamacro_if_eq_recursive0_16(...) metamacro_expand_
|
||||
#define metamacro_if_eq_recursive0_17(...) metamacro_expand_
|
||||
#define metamacro_if_eq_recursive0_18(...) metamacro_expand_
|
||||
#define metamacro_if_eq_recursive0_19(...) metamacro_expand_
|
||||
#define metamacro_if_eq_recursive0_20(...) metamacro_expand_
|
||||
|
||||
#define metamacro_if_eq_recursive1(VALUE) metamacro_if_eq_recursive0(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq_recursive2(VALUE) metamacro_if_eq_recursive1(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq_recursive3(VALUE) metamacro_if_eq_recursive2(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq_recursive4(VALUE) metamacro_if_eq_recursive3(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq_recursive5(VALUE) metamacro_if_eq_recursive4(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq_recursive6(VALUE) metamacro_if_eq_recursive5(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq_recursive7(VALUE) metamacro_if_eq_recursive6(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq_recursive8(VALUE) metamacro_if_eq_recursive7(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq_recursive9(VALUE) metamacro_if_eq_recursive8(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq_recursive10(VALUE) metamacro_if_eq_recursive9(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq_recursive11(VALUE) metamacro_if_eq_recursive10(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq_recursive12(VALUE) metamacro_if_eq_recursive11(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq_recursive13(VALUE) metamacro_if_eq_recursive12(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq_recursive14(VALUE) metamacro_if_eq_recursive13(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq_recursive15(VALUE) metamacro_if_eq_recursive14(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq_recursive16(VALUE) metamacro_if_eq_recursive15(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq_recursive17(VALUE) metamacro_if_eq_recursive16(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq_recursive18(VALUE) metamacro_if_eq_recursive17(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq_recursive19(VALUE) metamacro_if_eq_recursive18(metamacro_dec(VALUE))
|
||||
#define metamacro_if_eq_recursive20(VALUE) metamacro_if_eq_recursive19(metamacro_dec(VALUE))
|
||||
|
||||
// metamacro_take expansions
|
||||
#define metamacro_take0(...)
|
||||
#define metamacro_take1(...) metamacro_head(__VA_ARGS__)
|
||||
#define metamacro_take2(...) metamacro_head(__VA_ARGS__), metamacro_take1(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_take3(...) metamacro_head(__VA_ARGS__), metamacro_take2(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_take4(...) metamacro_head(__VA_ARGS__), metamacro_take3(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_take5(...) metamacro_head(__VA_ARGS__), metamacro_take4(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_take6(...) metamacro_head(__VA_ARGS__), metamacro_take5(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_take7(...) metamacro_head(__VA_ARGS__), metamacro_take6(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_take8(...) metamacro_head(__VA_ARGS__), metamacro_take7(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_take9(...) metamacro_head(__VA_ARGS__), metamacro_take8(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_take10(...) metamacro_head(__VA_ARGS__), metamacro_take9(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_take11(...) metamacro_head(__VA_ARGS__), metamacro_take10(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_take12(...) metamacro_head(__VA_ARGS__), metamacro_take11(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_take13(...) metamacro_head(__VA_ARGS__), metamacro_take12(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_take14(...) metamacro_head(__VA_ARGS__), metamacro_take13(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_take15(...) metamacro_head(__VA_ARGS__), metamacro_take14(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_take16(...) metamacro_head(__VA_ARGS__), metamacro_take15(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_take17(...) metamacro_head(__VA_ARGS__), metamacro_take16(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_take18(...) metamacro_head(__VA_ARGS__), metamacro_take17(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_take19(...) metamacro_head(__VA_ARGS__), metamacro_take18(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_take20(...) metamacro_head(__VA_ARGS__), metamacro_take19(metamacro_tail(__VA_ARGS__))
|
||||
|
||||
// metamacro_drop expansions
|
||||
#define metamacro_drop0(...) __VA_ARGS__
|
||||
#define metamacro_drop1(...) metamacro_tail(__VA_ARGS__)
|
||||
#define metamacro_drop2(...) metamacro_drop1(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_drop3(...) metamacro_drop2(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_drop4(...) metamacro_drop3(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_drop5(...) metamacro_drop4(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_drop6(...) metamacro_drop5(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_drop7(...) metamacro_drop6(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_drop8(...) metamacro_drop7(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_drop9(...) metamacro_drop8(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_drop10(...) metamacro_drop9(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_drop11(...) metamacro_drop10(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_drop12(...) metamacro_drop11(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_drop13(...) metamacro_drop12(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_drop14(...) metamacro_drop13(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_drop15(...) metamacro_drop14(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_drop16(...) metamacro_drop15(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_drop17(...) metamacro_drop16(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_drop18(...) metamacro_drop17(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_drop19(...) metamacro_drop18(metamacro_tail(__VA_ARGS__))
|
||||
#define metamacro_drop20(...) metamacro_drop19(metamacro_tail(__VA_ARGS__))
|
||||
|
||||
#endif
|
|
@ -1,6 +0,0 @@
|
|||
framework module ReactiveCocoa {
|
||||
umbrella header "ReactiveCocoa.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
Binary file not shown.
|
@ -1,47 +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>BuildMachineOSBuild</key>
|
||||
<string>14C1514</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>ReactiveCocoa</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.reactivecocoa.ReactiveCocoa</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>ReactiveCocoa</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>6C131e</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>14A383</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.10</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0620</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>6C131e</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2014 GitHub. All rights reserved.</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1 +0,0 @@
|
|||
A
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/Headers
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/Modules
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/Resources
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/Squirrel
|
|
@ -1,20 +0,0 @@
|
|||
//
|
||||
// NSBundle+SQRLVersionExtensions.h
|
||||
// Squirrel
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2013-09-25.
|
||||
// Copyright (c) 2013 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSBundle (SQRLVersionExtensions)
|
||||
|
||||
// The value associated with the `CFBundleVersion` key in the receiver's
|
||||
// Info.plist, or nil if the key is not present.
|
||||
@property (nonatomic, copy, readonly) NSString *sqrl_bundleVersion;
|
||||
|
||||
/// The value of the `kCFBundleExecutableKey` key.
|
||||
@property (nonatomic, copy, readonly) NSString *sqrl_executableName;
|
||||
|
||||
@end
|
|
@ -1,16 +0,0 @@
|
|||
//
|
||||
// NSProcessInfo+SQRLVersionExtensions.h
|
||||
// Squirrel
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2013-09-16.
|
||||
// Copyright (c) 2013 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSProcessInfo (SQRLVersionExtensions)
|
||||
|
||||
// The short version string (e.g. `10.8.5`) for the running version of OS X.
|
||||
@property (nonatomic, copy, readonly) NSString *sqrl_operatingSystemShortVersionString;
|
||||
|
||||
@end
|
|
@ -1,31 +0,0 @@
|
|||
//
|
||||
// SQRLDownloadedUpdate.h
|
||||
// Squirrel
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2013-09-25.
|
||||
// Copyright (c) 2013 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Mantle/Mantle.h>
|
||||
|
||||
@class SQRLUpdate;
|
||||
|
||||
// A SQRLUpdate that has been successfully downloaded to disk.
|
||||
@interface SQRLDownloadedUpdate : MTLModel
|
||||
|
||||
// The application bundle representing the downloaded and unarchived update.
|
||||
@property (nonatomic, strong, readonly) NSBundle *bundle;
|
||||
|
||||
// The update information sent by the server.
|
||||
//
|
||||
// This may be a `SQRLUpdate` subclass if `SQRLUpdater.updateClass` was changed.
|
||||
@property (nonatomic, copy, readonly) SQRLUpdate *update;
|
||||
|
||||
// Initializes the receiver with update metadata and the downloaded and
|
||||
// unarchived bundle.
|
||||
//
|
||||
// update - The update information sent by the server. This must not be nil.
|
||||
// bundle - The application bundle representing the update. This must not be nil.
|
||||
- (id)initWithUpdate:(SQRLUpdate *)update bundle:(NSBundle *)bundle;
|
||||
|
||||
@end
|
|
@ -1,31 +0,0 @@
|
|||
//
|
||||
// SQRLUpdate.h
|
||||
// Squirrel
|
||||
//
|
||||
// Created by Keith Duncan on 18/09/2013.
|
||||
// Copyright (c) 2013 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <Mantle/Mantle.h>
|
||||
|
||||
// An update parsed from a response to the `SQRLUpdater.updateRequest`.
|
||||
//
|
||||
// This can be subclassed, and `SQRLUpdater.updateClass` set, to preserve
|
||||
// additional JSON data. Any subclasses must be immutable, and should inherit
|
||||
// their superclass' property key and transformer behaviors.
|
||||
@interface SQRLUpdate : MTLModel <MTLJSONSerializing>
|
||||
|
||||
// The release notes for the update.
|
||||
@property (readonly, copy, nonatomic) NSString *releaseNotes;
|
||||
|
||||
// The release name for the update.
|
||||
@property (readonly, copy, nonatomic) NSString *releaseName;
|
||||
|
||||
// The release date for the update.
|
||||
@property (readonly, copy, nonatomic) NSDate *releaseDate;
|
||||
|
||||
// The URL to the update package that should be downloaded for installation.
|
||||
@property (readonly, copy, nonatomic) NSURL *updateURL;
|
||||
|
||||
@end
|
|
@ -1,205 +0,0 @@
|
|||
//
|
||||
// SQRLUpdater.h
|
||||
// Squirrel
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2013-07-21.
|
||||
// Copyright (c) 2013 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <ReactiveCocoa/ReactiveCocoa.h>
|
||||
|
||||
// Represents the current state of the updater.
|
||||
//
|
||||
// SQRLUpdaterStateIdle - Doing absolutely diddly squat.
|
||||
// SQRLUpdaterStateCheckingForUpdate - Checking for any updates from the server.
|
||||
// SQRLUpdaterStateDownloadingUpdate - Update found, downloading the archive.
|
||||
// SQRLUpdaterStateAwaitingRelaunch - Awaiting a relaunch to install
|
||||
// the update.
|
||||
typedef enum : NSUInteger {
|
||||
SQRLUpdaterStateIdle,
|
||||
SQRLUpdaterStateCheckingForUpdate,
|
||||
SQRLUpdaterStateDownloadingUpdate,
|
||||
SQRLUpdaterStateAwaitingRelaunch,
|
||||
} SQRLUpdaterState;
|
||||
|
||||
// Block for providing download requests given a download url
|
||||
typedef NSURLRequest * (^SQRLRequestForDownload)(NSURL *);
|
||||
|
||||
// The domain for errors originating within SQRLUpdater.
|
||||
extern NSString * const SQRLUpdaterErrorDomain;
|
||||
|
||||
// The downloaded update does not contain an app bundle, or it was deleted on
|
||||
// disk before we could get to it.
|
||||
extern const NSInteger SQRLUpdaterErrorMissingUpdateBundle;
|
||||
|
||||
// An error occurred in the out-of-process updater while it was setting up.
|
||||
extern const NSInteger SQRLUpdaterErrorPreparingUpdateJob;
|
||||
|
||||
// The code signing requirement for the running application could not be
|
||||
// retrieved.
|
||||
extern const NSInteger SQRLUpdaterErrorRetrievingCodeSigningRequirement;
|
||||
|
||||
// The server sent a response that we didn't understand.
|
||||
//
|
||||
// Includes `SQRLUpdaterServerDataErrorKey` in the error's `userInfo`.
|
||||
extern const NSInteger SQRLUpdaterErrorInvalidServerResponse;
|
||||
|
||||
// The server sent a response body that we didn't understand.
|
||||
//
|
||||
// Includes `SQRLUpdaterServerDataErrorKey` in the error's `userInfo`.
|
||||
extern const NSInteger SQRLUpdaterErrorInvalidServerBody;
|
||||
|
||||
// The server sent update JSON that we didn't understand.
|
||||
//
|
||||
// Includes `SQRLUpdaterJSONObjectErrorKey` in the error's `userInfo`.
|
||||
extern const NSInteger SQRLUpdaterErrorInvalidJSON;
|
||||
|
||||
// Associated with the `NSData` received from the server when an error with code
|
||||
// `SQRLUpdaterErrorInvalidServerResponse` is generated.
|
||||
extern NSString * const SQRLUpdaterServerDataErrorKey;
|
||||
|
||||
// Associated with the JSON object that was received from the server when an
|
||||
// error with code `SQRLUpdaterErrorInvalidJSON` is generated.
|
||||
extern NSString * const SQRLUpdaterJSONObjectErrorKey;
|
||||
|
||||
@class RACCommand;
|
||||
@class RACDisposable;
|
||||
@class RACSignal;
|
||||
|
||||
/// Type of mode used to download the release
|
||||
typedef enum {
|
||||
JSONFILE=1,
|
||||
RELEASESERVER
|
||||
} SQRLUpdaterMode;
|
||||
|
||||
// Checks for, downloads, and installs updates.
|
||||
@interface SQRLUpdater : NSObject
|
||||
|
||||
// Kicks off a check for updates.
|
||||
//
|
||||
// If an update is available, it will be sent on `updates` once downloaded.
|
||||
@property (nonatomic, strong, readonly) RACCommand *checkForUpdatesCommand;
|
||||
|
||||
// The current state of the manager.
|
||||
//
|
||||
// This property is KVO-compliant.
|
||||
@property (atomic, readonly) SQRLUpdaterState state;
|
||||
|
||||
// Sends an `SQRLDownloadedUpdate` object on the main thread whenever a new
|
||||
// update is available.
|
||||
//
|
||||
// This signal is actually just `checkForUpdatesCommand.executionSignals`,
|
||||
// flattened for convenience.
|
||||
@property (nonatomic, strong, readonly) RACSignal *updates;
|
||||
|
||||
// The request that will be sent to check for updates.
|
||||
//
|
||||
// The default value is the argument that was originally passed to
|
||||
// -initWithUpdateRequest:.
|
||||
//
|
||||
// This property must never be set to nil.
|
||||
@property (atomic, copy) NSURLRequest *updateRequest;
|
||||
|
||||
// The block used for fetching a given download request
|
||||
//
|
||||
// The default value is the argument that was originally passed to
|
||||
// -initWithUpdateRequest:requestForDownload:.
|
||||
//
|
||||
// If initialized with -initWithUpdateRequest: this block will
|
||||
// return a generic NSURLRequest with the provided url.
|
||||
@property (nonatomic, copy) SQRLRequestForDownload requestForDownload;
|
||||
|
||||
// The `SQRLUpdate` subclass to instantiate with the server's response.
|
||||
//
|
||||
// By default, this is `SQRLUpdate` itself, but it can be set to a custom
|
||||
// subclass in order to preserve additional JSON data. See the `SQRLUpdate`
|
||||
// documentation for more information.
|
||||
@property (atomic, strong) Class updateClass;
|
||||
|
||||
// Initializes an updater that will send the given request to check for updates.
|
||||
//
|
||||
// This is the designated initializer for this class.
|
||||
//
|
||||
// updateRequest - A request to send to check for updates. This request can be
|
||||
// customized as desired, like by including an `Authorization`
|
||||
// header to authenticate with a private update server, or
|
||||
// pointing to a local URL for testing. This must not be nil.
|
||||
//
|
||||
// Returns the initialized `SQRLUpdater`.
|
||||
- (id)initWithUpdateRequest:(NSURLRequest *)updateRequest;
|
||||
|
||||
// Initializes an updater that will send the given request to check for updates
|
||||
// on a CDN reading a release file in json format.
|
||||
//
|
||||
// updateRequest - A request to send to check for updates. This request can be
|
||||
// customized as desired, like by including an `Authorization`
|
||||
// header to authenticate with a private update server, or
|
||||
// pointing to a local URL for testing. This must not be nil.
|
||||
// forVersion - the currently installed version
|
||||
//
|
||||
// Returns the initialized `SQRLUpdater`.
|
||||
- (id)initWithUpdateRequest:(NSURLRequest *)updateRequest
|
||||
forVersion:(NSString*)version;
|
||||
|
||||
// Initializes an updater that will send the given request to check for updates
|
||||
// and passes a block to provide requests for the update downloads.
|
||||
//
|
||||
// updateRequest - Same as with initWithUpdateRequest
|
||||
// requestForDownload - Once the update url is found for the update download, allow
|
||||
// providing custom requests that can be costomized as desired.
|
||||
// Useful for including `Authorization` headers just like the
|
||||
// updateRequest param.
|
||||
//
|
||||
// Returns the initialized `SQRLUpdater`.
|
||||
- (id)initWithUpdateRequest:(NSURLRequest *)updateRequest requestForDownload:(SQRLRequestForDownload)requestForDownload;
|
||||
|
||||
// Initializes an updater that will send the given request to check for updates
|
||||
// and passes a block to provide requests for the update downloads.
|
||||
//
|
||||
// updateRequest - Same as with initWithUpdateRequest
|
||||
// requestForDownload - Once the update url is found for the update download, allow
|
||||
// providing custom requests that can be costomized as desired.
|
||||
// Useful for including `Authorization` headers just like the
|
||||
// updateRequest param.
|
||||
// forVersion - currently running version
|
||||
// useMode - either RELEASESERVER or JSONFILE
|
||||
//
|
||||
// Returns the initialized `SQRLUpdater`.
|
||||
- (id)initWithUpdateRequest:(NSURLRequest *)updateRequest requestForDownload:(SQRLRequestForDownload)requestForDownload forVersion:(NSString*) version useMode:(SQRLUpdaterMode) mode;
|
||||
|
||||
// Executes `checkForUpdatesCommand` (if enabled) every `interval` seconds.
|
||||
//
|
||||
// The first check will not occur until `interval` seconds have passed.
|
||||
//
|
||||
// interval - The interval, in seconds, between each check.
|
||||
//
|
||||
// Returns a disposable which can be used to cancel the automatic update
|
||||
// checking.
|
||||
- (RACDisposable *)startAutomaticChecksWithInterval:(NSTimeInterval)interval;
|
||||
|
||||
// Terminates the running application to install any available update, then
|
||||
// automatically relaunches the app after updating.
|
||||
//
|
||||
// This method is only useful if you want the application to automatically
|
||||
// relaunch. Otherwise, you can simply use `-[NSApplication terminate:]` or any
|
||||
// other exit mechanism.
|
||||
//
|
||||
// After invoking this method, the receiver is responsible for terminating the
|
||||
// application upon success. The app must not be terminated in any other way
|
||||
// unless an error occurs.
|
||||
//
|
||||
// Returns a signal that will error on the main scheduler if anything goes
|
||||
// wrong before termination. The signal will never complete.
|
||||
- (RACSignal *)relaunchToInstallUpdate;
|
||||
|
||||
- (BOOL)isRunningOnReadOnlyVolume;
|
||||
- (RACSignal *)updateFromJSONData:(NSData *)data;
|
||||
|
||||
@end
|
||||
|
||||
@interface SQRLUpdater (Unavailable)
|
||||
|
||||
- (id)init __attribute__((unavailable("Use -initWithUpdateRequest: instead")));
|
||||
|
||||
@end
|
|
@ -1,21 +0,0 @@
|
|||
//
|
||||
// Squirrel.h
|
||||
// Squirrel
|
||||
//
|
||||
// Created by Justin Spahr-Summers on 2013-07-21.
|
||||
// Copyright (c) 2013 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
//! Project version number for Squirrel.
|
||||
FOUNDATION_EXPORT double SquirrelVersionNumber;
|
||||
|
||||
//! Project version string for Squirrel.
|
||||
FOUNDATION_EXPORT const unsigned char SquirrelVersionString[];
|
||||
|
||||
#import <Squirrel/NSBundle+SQRLVersionExtensions.h>
|
||||
#import <Squirrel/NSProcessInfo+SQRLVersionExtensions.h>
|
||||
#import <Squirrel/SQRLDownloadedUpdate.h>
|
||||
#import <Squirrel/SQRLUpdater.h>
|
||||
#import <Squirrel/SQRLUpdate.h>
|
|
@ -1,6 +0,0 @@
|
|||
framework module Squirrel {
|
||||
umbrella header "Squirrel.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
|
@ -1,46 +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>BuildMachineOSBuild</key>
|
||||
<string>17D47</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Squirrel</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.github.Squirrel</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Squirrel</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>MacOSX</string>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>8C38</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>16C58</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.12</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0820</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>8C38</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2013 GitHub. All rights reserved.</string>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
Binary file not shown.
|
@ -1 +0,0 @@
|
|||
A
|
|
@ -1,32 +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>BuildMachineOSBuild</key>
|
||||
<string>17D102</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.electron.hifi-screenshare.helper</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>hifi-screenshare Helper (Plugin)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>10.13</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.13</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0941</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>9F2000</string>
|
||||
<key>LSUIElement</key>
|
||||
<true/>
|
||||
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||
<true/>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>hifi-screenshare Helper (Plugin)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>hifi-screenshare Helper (Plugin)</string>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
|
@ -1 +0,0 @@
|
|||
APPL????
|
|
@ -1,32 +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>BuildMachineOSBuild</key>
|
||||
<string>17D102</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.electron.hifi-screenshare.helper</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>hifi-screenshare Helper (Renderer)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>10.13</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.13</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0941</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>9F2000</string>
|
||||
<key>LSUIElement</key>
|
||||
<true/>
|
||||
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||
<true/>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>hifi-screenshare Helper (Renderer)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>hifi-screenshare Helper (Renderer)</string>
|
||||
</dict>
|
||||
</plist>
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue