├── .gitignore ├── DMRemoteRequest ├── DMRemoteRequestPrivate.h ├── Host App │ ├── DMRemoteRequestProtocol.h │ ├── DMRemoteRequestRouter.h │ └── DMRemoteRequestRouter.m └── Watch Extension │ ├── DMRemoteRequestObserver.h │ └── DMRemoteRequestObserver.m ├── Example ├── DMRemoteRequest WatchKit App │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── LaunchImage.launchimage │ │ │ └── Contents.json │ ├── Info.plist │ └── Interface.storyboard ├── DMRemoteRequest WatchKit Extension │ ├── Images.xcassets │ │ └── MyImage.imageset │ │ │ └── Contents.json │ ├── Info.plist │ ├── InterfaceController.h │ ├── InterfaceController.m │ ├── NotificationController.h │ ├── NotificationController.m │ └── PushNotificationPayload.apns ├── DMRemoteRequest.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── DMRemoteRequest │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── SomeOperation.h │ ├── SomeOperation.m │ ├── ViewController.h │ ├── ViewController.m │ └── main.m └── DMRemoteRequestTests │ ├── DMRemoteRequestTests.m │ ├── Info.plist │ ├── TestOperation.h │ └── TestOperation.m ├── LICENSE ├── README.md └── circle.yml /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | # Pods/ 27 | -------------------------------------------------------------------------------- /DMRemoteRequest/DMRemoteRequestPrivate.h: -------------------------------------------------------------------------------- 1 | // 2 | // DMRemoteRequestPrivate.h 3 | // 4 | // Created by David Muzi on 2014-12-13. 5 | // Copyright (c) 2014 David Muzi. All rights reserved. 6 | // 7 | 8 | #ifndef Tempo_DMRemoteRequestPrivate_h 9 | #define Tempo_DMRemoteRequestPrivate_h 10 | 11 | /** 12 | * Look away, look away 13 | */ 14 | static NSString * const DMPrivateNotificationKey = @"DMPrivateNotificationKey"; 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /DMRemoteRequest/Host App/DMRemoteRequestProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // DMRemoteRequestProtocol.h 3 | // 4 | // Created by David Muzi on 2014-12-11. 5 | // Copyright (c) 2014 David Muzi. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @protocol DMRemoteRequestProtocol 11 | 12 | /** 13 | * An operation to handle the command 14 | * 15 | * @param userInfo command parameters 16 | * @param handler callback handler 17 | * 18 | * @return an NSOperation instance 19 | */ 20 | + (NSOperation *)operationWithUserInfo:(NSDictionary *)userInfo completionHandler:(void (^)(NSDictionary *results))handler; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /DMRemoteRequest/Host App/DMRemoteRequestRouter.h: -------------------------------------------------------------------------------- 1 | // 2 | // DMRemoteRequestRouter.h 3 | // 4 | // Created by David Muzi on 2014-12-11. 5 | // Copyright (c) 2014 David Muzi. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "DMRemoteRequestProtocol.h" 10 | 11 | /** 12 | * Request bloack handler 13 | * 14 | * @param userInfo input dictionary 15 | * @param ^callback callback block to be called on completion 16 | */ 17 | typedef void (^DMRemoteRequestBlock)(NSDictionary *userInfo, void(^callback)(NSDictionary *results)); 18 | 19 | @interface DMRemoteRequestRouter : NSObject 20 | 21 | /** 22 | * Singleton reference 23 | * 24 | * @return sharedRouter 25 | */ 26 | + (instancetype)sharedRouter; 27 | 28 | /** 29 | * Registers a class to handle a command originating from the watch 30 | * 31 | * @param protocolClass a class that will handle the command 32 | * @param method method name 33 | */ 34 | - (void)registerClass:(Class )protocolClass forMethod:(NSString *)method; 35 | 36 | /** 37 | * Registers a block which can perform an asyncronous task before calling its completion handler 38 | * 39 | * @param method the method to be handled 40 | * @param block handler 41 | */ 42 | - (void)registerBlock:(DMRemoteRequestBlock)block forMethod:(NSString *)method; 43 | 44 | /** 45 | * Convenience method to set handler 46 | * 47 | * @param obj protocol class or request block 48 | * @param key method name 49 | */ 50 | - (void)setObject:(id)obj forKeyedSubscript:(id )key; 51 | 52 | /** 53 | * Convenience method to get a registered handler 54 | * 55 | * @param key method name 56 | * 57 | * @return a protocol class or registered block 58 | */ 59 | - (id)objectForKeyedSubscript:(id )key; 60 | 61 | /** 62 | * This should be called from application:handleWatchKitExtensionRequest:reply: 63 | * 64 | * @param request the command parameters 65 | * @param reply the callback block 66 | * 67 | * @return YES if the command was successfully handled 68 | */ 69 | - (BOOL)handleRequest:(NSDictionary *)request reply:(void (^)(NSDictionary *))reply; 70 | 71 | /** 72 | * Sends a notifcation to the watch signifying an event has occurred on the host app 73 | */ 74 | - (void)notifyWatch; 75 | 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /DMRemoteRequest/Host App/DMRemoteRequestRouter.m: -------------------------------------------------------------------------------- 1 | // 2 | // DMRemoteRequestCoordinator.m 3 | // 4 | // Created by David Muzi on 2014-12-11. 5 | // Copyright (c) 2014 David Muzi. All rights reserved. 6 | // 7 | 8 | #import "DMRemoteRequestRouter.h" 9 | #import "DMRemoteRequestPrivate.h" 10 | #import 11 | 12 | static NSString * const DMMethodNameKey = @"method"; 13 | 14 | @interface DMRemoteRequestRouter () 15 | @property (nonatomic, strong) NSMutableDictionary *classes; 16 | @property (nonatomic, strong) NSMutableDictionary *blocks; 17 | 18 | @property (nonatomic, strong) NSOperationQueue *opQueue; 19 | @end 20 | 21 | @implementation DMRemoteRequestRouter 22 | 23 | + (instancetype)sharedRouter { 24 | 25 | static dispatch_once_t once; 26 | static DMRemoteRequestRouter *instance; 27 | 28 | dispatch_once(&once, ^{ 29 | 30 | instance = [self new]; 31 | instance.classes = [NSMutableDictionary new]; 32 | instance.blocks = [NSMutableDictionary new]; 33 | 34 | instance.opQueue = [[NSOperationQueue alloc] init]; 35 | instance.opQueue.maxConcurrentOperationCount = 1; 36 | instance.opQueue.name = @"com.muzi.remoteCommand"; 37 | }); 38 | 39 | return instance; 40 | } 41 | 42 | #pragma mark - Registering 43 | 44 | - (void)registerClass:(Class )protocolClass forMethod:(NSString *)method { 45 | 46 | [self.classes setObject:protocolClass forKey:method]; 47 | [self.blocks removeObjectForKey:method]; 48 | } 49 | 50 | - (void)registerBlock:(DMRemoteRequestBlock)block forMethod:(NSString *)method { 51 | 52 | [self.blocks setObject:block forKey:method]; 53 | [self.classes removeObjectForKey:method]; 54 | } 55 | 56 | - (id)objectForKeyedSubscript:(id )key { 57 | 58 | NSString *methodName = (NSString *)key; 59 | id object = nil; 60 | 61 | if ([self.classes.allKeys containsObject:methodName]) { 62 | 63 | id theClass = [self.classes objectForKey:methodName]; 64 | object = theClass; 65 | } 66 | else if ([self.blocks.allKeys containsObject:methodName]) { 67 | 68 | NSDictionary* (^block)(NSDictionary*) = [self.blocks objectForKey:methodName]; 69 | object = block; 70 | } 71 | 72 | return object; 73 | } 74 | 75 | - (void)setObject:(id)obj forKeyedSubscript:(id )key { 76 | 77 | NSString *method = (NSString *)key; 78 | 79 | if ([obj isKindOfClass:NSClassFromString(@"NSBlock")]) { 80 | [self registerBlock:obj forMethod:method]; 81 | } 82 | else if (class_isMetaClass(object_getClass(obj))) { 83 | [self registerClass:obj forMethod:method]; 84 | } 85 | } 86 | 87 | #pragma mark - Route handling 88 | 89 | - (BOOL)handleRequest:(NSDictionary *)request reply:(void (^)(NSDictionary *))reply { 90 | 91 | BOOL handled = NO; 92 | 93 | NSString *methodName = request[DMMethodNameKey]; 94 | 95 | if ([self.classes.allKeys containsObject:methodName]) { 96 | 97 | id theClass = self.classes[methodName]; 98 | 99 | NSOperation *op = [theClass operationWithUserInfo:request completionHandler:reply]; 100 | [self.opQueue addOperation:op]; 101 | 102 | handled = YES; 103 | } 104 | else if ([self.blocks.allKeys containsObject:methodName]) { 105 | 106 | DMRemoteRequestBlock block = self.blocks[methodName]; 107 | block(request, reply); 108 | 109 | handled = YES; 110 | } 111 | 112 | return handled; 113 | } 114 | 115 | 116 | - (void)notifyWatch { 117 | 118 | CFNotificationCenterRef const center = CFNotificationCenterGetDarwinNotifyCenter(); 119 | CFNotificationCenterPostNotification(center, (__bridge CFStringRef)DMPrivateNotificationKey, NULL, NULL, YES); 120 | } 121 | 122 | @end 123 | -------------------------------------------------------------------------------- /DMRemoteRequest/Watch Extension/DMRemoteRequestObserver.h: -------------------------------------------------------------------------------- 1 | // 2 | // DMRemoteCommandObserver.h 3 | // 4 | // Created by David Muzi on 2014-12-12. 5 | // Copyright (c) 2014 David Muzi. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | /** 11 | * The notification name originating from the host app 12 | */ 13 | static NSString * const DMRemoteCommandNotificationName; 14 | 15 | /** 16 | * Calls to application:handleWatchKitExtensionRequest:reply: should contain this key with the method name for the object 17 | */ 18 | static NSString * const DMMethodNameKey = @"method"; 19 | 20 | 21 | -------------------------------------------------------------------------------- /DMRemoteRequest/Watch Extension/DMRemoteRequestObserver.m: -------------------------------------------------------------------------------- 1 | // 2 | // DMRemoteRequestObserver.m 3 | // 4 | // Created by David Muzi on 2014-12-12. 5 | // Copyright (c) 2014 David Muzi. All rights reserved. 6 | // 7 | 8 | #import "DMRemoteRequestObserver.h" 9 | #import "DMRemoteRequestPrivate.h" 10 | 11 | static NSString * const DMRemoteCommandNotificationName = @"DMRemoteCommandNotificationName"; 12 | 13 | @interface DMRemoteRequestObserver : NSObject 14 | @end 15 | 16 | @implementation DMRemoteRequestObserver 17 | 18 | + (void)load { 19 | DMRemoteRequestObserver *commander = [self sharedInstance]; 20 | [commander registerForDarwinNotifications]; 21 | } 22 | 23 | + (instancetype)sharedInstance { 24 | 25 | static dispatch_once_t once; 26 | static DMRemoteRequestObserver *instance; 27 | 28 | dispatch_once(&once, ^{ 29 | 30 | instance = [self new]; 31 | }); 32 | 33 | return instance; 34 | } 35 | 36 | - (void)dealloc { 37 | [self unregisterForDarwinNotifications]; 38 | } 39 | 40 | #pragma mark - Watch 41 | 42 | - (void)registerForDarwinNotifications { 43 | 44 | CFNotificationCenterRef const center = CFNotificationCenterGetDarwinNotifyCenter(); 45 | CFStringRef str = (__bridge CFStringRef)DMPrivateNotificationKey; 46 | CFNotificationCenterAddObserver(center, 47 | (__bridge const void *)(self), 48 | notificationCallback, 49 | str, 50 | NULL, 51 | CFNotificationSuspensionBehaviorDeliverImmediately); 52 | } 53 | 54 | - (void)unregisterForDarwinNotifications { 55 | 56 | CFNotificationCenterRef const center = CFNotificationCenterGetDarwinNotifyCenter(); 57 | CFStringRef str = (__bridge CFStringRef)DMPrivateNotificationKey; 58 | CFNotificationCenterRemoveObserver(center, 59 | (__bridge const void *)(self), 60 | str, 61 | NULL); 62 | } 63 | 64 | void notificationCallback(CFNotificationCenterRef center, 65 | void * observer, 66 | CFStringRef name, 67 | void const * object, 68 | CFDictionaryRef userInfo) { 69 | 70 | [[NSNotificationCenter defaultCenter] postNotificationName:DMRemoteCommandNotificationName 71 | object:nil 72 | userInfo:nil]; 73 | } 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /Example/DMRemoteRequest WatchKit App/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "22x22", 5 | "idiom" : "watch", 6 | "scale" : "2x", 7 | "role" : "notificationCenter", 8 | "subtype" : "38mm" 9 | }, 10 | { 11 | "size" : "27.5x27.5", 12 | "idiom" : "watch", 13 | "scale" : "2x", 14 | "role" : "notificationCenter", 15 | "subtype" : "42mm" 16 | }, 17 | { 18 | "size" : "29x29", 19 | "idiom" : "watch", 20 | "role" : "companionSettings", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "size" : "29.3x29.3", 25 | "idiom" : "watch", 26 | "role" : "companionSettings", 27 | "scale" : "3x" 28 | }, 29 | { 30 | "size" : "40x40", 31 | "idiom" : "watch", 32 | "scale" : "2x", 33 | "role" : "appLauncher", 34 | "subtype" : "38mm" 35 | }, 36 | { 37 | "size" : "44x44", 38 | "idiom" : "watch", 39 | "scale" : "2x", 40 | "role" : "appLauncher", 41 | "subtype" : "42mm" 42 | }, 43 | { 44 | "size" : "86x86", 45 | "idiom" : "watch", 46 | "scale" : "2x", 47 | "role" : "quickLook", 48 | "subtype" : "38mm" 49 | }, 50 | { 51 | "size" : "98x98", 52 | "idiom" : "watch", 53 | "scale" : "2x", 54 | "role" : "quickLook", 55 | "subtype" : "42mm" 56 | }, 57 | { 58 | "scale" : "2x", 59 | "idiom" : "watch", 60 | "unassigned" : true, 61 | "role" : "notificationCenter", 62 | "subtype" : "38mm" 63 | }, 64 | { 65 | "scale" : "2x", 66 | "idiom" : "watch", 67 | "unassigned" : true, 68 | "role" : "notificationCenter", 69 | "subtype" : "42mm" 70 | } 71 | ], 72 | "info" : { 73 | "version" : 1, 74 | "author" : "xcode" 75 | } 76 | } -------------------------------------------------------------------------------- /Example/DMRemoteRequest WatchKit App/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "watch", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "8.0", 8 | "subtype" : "38mm", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "orientation" : "portrait", 13 | "idiom" : "watch", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "8.0", 16 | "subtype" : "42mm", 17 | "scale" : "2x" 18 | } 19 | ], 20 | "info" : { 21 | "version" : 1, 22 | "author" : "xcode" 23 | } 24 | } -------------------------------------------------------------------------------- /Example/DMRemoteRequest WatchKit App/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | DMRemoteRequest 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | com.muzi.DMRemoteRequest.watchkitapp 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | UISupportedInterfaceOrientations 26 | 27 | UIInterfaceOrientationPortrait 28 | UIInterfaceOrientationPortraitUpsideDown 29 | 30 | WKCompanionAppBundleIdentifier 31 | com.muzi.DMRemoteRequest 32 | WKWatchKitApp 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Example/DMRemoteRequest WatchKit App/Interface.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /Example/DMRemoteRequest WatchKit Extension/Images.xcassets/MyImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "scale" : "3x" 14 | } 15 | ], 16 | "info" : { 17 | "version" : 1, 18 | "author" : "xcode" 19 | } 20 | } -------------------------------------------------------------------------------- /Example/DMRemoteRequest WatchKit Extension/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | DMRemoteRequest WatchKit Extension 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | com.muzi.DMRemoteRequest.watchkitextension 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | XPC! 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | NSExtension 26 | 27 | NSExtensionAttributes 28 | 29 | WKAppBundleIdentifier 30 | com.muzi.DMRemoteRequest.watchkitapp 31 | 32 | NSExtensionPointIdentifier 33 | com.apple.watchkit 34 | 35 | RemoteInterfacePrincipalClass 36 | InterfaceController 37 | 38 | 39 | -------------------------------------------------------------------------------- /Example/DMRemoteRequest WatchKit Extension/InterfaceController.h: -------------------------------------------------------------------------------- 1 | // 2 | // InterfaceController.h 3 | // DMRemoteRequest WatchKit Extension 4 | // 5 | // Created by David Muzi on 2014-12-13. 6 | // Copyright (c) 2014 David Muzi. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface InterfaceController : WKInterfaceController 13 | 14 | @property (weak, nonatomic) IBOutlet WKInterfaceLabel *nameLabel; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Example/DMRemoteRequest WatchKit Extension/InterfaceController.m: -------------------------------------------------------------------------------- 1 | // 2 | // InterfaceController.m 3 | // DMRemoteRequest WatchKit Extension 4 | // 5 | // Created by David Muzi on 2014-12-13. 6 | // Copyright (c) 2014 David Muzi. All rights reserved. 7 | // 8 | 9 | #import "InterfaceController.h" 10 | #import "DMRemoteRequestObserver.h" 11 | 12 | @interface InterfaceController() 13 | 14 | @end 15 | 16 | 17 | @implementation InterfaceController 18 | 19 | - (void)awakeWithContext:(id)context { 20 | [super awakeWithContext:context]; 21 | 22 | // Configure interface objects here. 23 | NSLog(@"%@ awakeWithContext", self); 24 | 25 | [self updateLabel]; 26 | 27 | [WKInterfaceController openParentApplication:@{DMMethodNameKey: @"getDate"} reply:^(NSDictionary *replyInfo, NSError *error) { 28 | NSLog(@"date: %@", replyInfo[@"date"]); 29 | }]; 30 | } 31 | 32 | - (void)willActivate { 33 | // This method is called when watch view controller is about to be visible to user 34 | NSLog(@"%@ will activate", self); 35 | 36 | // observe update notifications originating from the host app 37 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateLabel) name:DMRemoteCommandNotificationName object:nil]; 38 | } 39 | 40 | - (IBAction)switchTapped:(BOOL)value { 41 | 42 | [WKInterfaceController openParentApplication:@{DMMethodNameKey: @"setSpin", @"state": @(value)} reply:^(NSDictionary *replyInfo, NSError *error) { 43 | 44 | }]; 45 | } 46 | 47 | - (void)didDeactivate { 48 | // This method is called when watch view controller is no longer visible 49 | NSLog(@"%@ did deactivate", self); 50 | 51 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 52 | } 53 | 54 | - (void)updateLabel { 55 | // Request information from the host app 56 | [WKInterfaceController openParentApplication:@{DMMethodNameKey: @"getState"} reply:^(NSDictionary *replyInfo, NSError *error) { 57 | 58 | [self.nameLabel setText:replyInfo[@"name"]]; 59 | 60 | }]; 61 | } 62 | 63 | @end 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /Example/DMRemoteRequest WatchKit Extension/NotificationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NotificationController.h 3 | // DMRemoteRequest WatchKit Extension 4 | // 5 | // Created by David Muzi on 2014-12-13. 6 | // Copyright (c) 2014 David Muzi. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface NotificationController : WKUserNotificationInterfaceController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Example/DMRemoteRequest WatchKit Extension/NotificationController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NotificationController.m 3 | // DMRemoteRequest WatchKit Extension 4 | // 5 | // Created by David Muzi on 2014-12-13. 6 | // Copyright (c) 2014 David Muzi. All rights reserved. 7 | // 8 | 9 | #import "NotificationController.h" 10 | 11 | 12 | @interface NotificationController() 13 | 14 | @end 15 | 16 | 17 | @implementation NotificationController 18 | 19 | - (void)awakeWithContext:(id)context { 20 | [super awakeWithContext:context]; 21 | 22 | // Configure interface objects here. 23 | NSLog(@"%@ awakeWithContext", self); 24 | } 25 | 26 | - (void)willActivate { 27 | // This method is called when watch view controller is about to be visible to user 28 | NSLog(@"%@ will activate", self); 29 | } 30 | 31 | - (void)didDeactivate { 32 | // This method is called when watch view controller is no longer visible 33 | NSLog(@"%@ did deactivate", self); 34 | } 35 | 36 | /* 37 | - (void)didReceiveLocalNotification:(UILocalNotification *)localNotification withCompletion:(void (^)(WKUserNotificationInterfaceType))completionHandler { 38 | // This method is called when a local notification needs to be presented. 39 | // Implement it if you use a dynamic notification interface. 40 | // Populate your dynamic notification inteface as quickly as possible. 41 | // 42 | // After populating your dynamic notification interface call the completion block. 43 | completionHandler(WKUserNotificationInterfaceTypeCustom); 44 | } 45 | */ 46 | 47 | /* 48 | - (void)didReceiveRemoteNotification:(NSDictionary *)remoteNotification withCompletion:(void (^)(WKUserNotificationInterfaceType))completionHandler { 49 | // This method is called when a remote notification needs to be presented. 50 | // Implement it if you use a dynamic notification interface. 51 | // Populate your dynamic notification inteface as quickly as possible. 52 | // 53 | // After populating your dynamic notification interface call the completion block. 54 | completionHandler(WKUserNotificationInterfaceTypeCustom); 55 | } 56 | */ 57 | 58 | @end 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /Example/DMRemoteRequest WatchKit Extension/PushNotificationPayload.apns: -------------------------------------------------------------------------------- 1 | { 2 | "aps": { 3 | "alert": "Test message", 4 | "title": "Optional title", 5 | "category": "myCategory" 6 | }, 7 | 8 | "WatchKit Simulator Actions": [ 9 | { 10 | "title": "First Button", 11 | "identifier": "firstButtonAction" 12 | } 13 | ], 14 | 15 | "customKey": "Use this file to define a testing payload for your notifications. The aps dictionary specifies the category, alert text and title. The WatchKit Simulator Actions array can provide info for one or more action buttons in addition to the standard Dismiss button. Any other top level keys are custom payload. If you have multiple such JSON files in your project, you'll be able to select them when choosing to debug the notification interface of your Watch App." 16 | } 17 | -------------------------------------------------------------------------------- /Example/DMRemoteRequest.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | BE445CE81A7206A700BA1B5C /* TestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = BE445CE71A7206A700BA1B5C /* TestOperation.m */; }; 11 | BEAEB4911A3C96D2003D26F6 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BEAEB4901A3C96D2003D26F6 /* main.m */; }; 12 | BEAEB4941A3C96D2003D26F6 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = BEAEB4931A3C96D2003D26F6 /* AppDelegate.m */; }; 13 | BEAEB4971A3C96D2003D26F6 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BEAEB4961A3C96D2003D26F6 /* ViewController.m */; }; 14 | BEAEB49A1A3C96D2003D26F6 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BEAEB4981A3C96D2003D26F6 /* Main.storyboard */; }; 15 | BEAEB49C1A3C96D2003D26F6 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BEAEB49B1A3C96D2003D26F6 /* Images.xcassets */; }; 16 | BEAEB49F1A3C96D2003D26F6 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = BEAEB49D1A3C96D2003D26F6 /* LaunchScreen.xib */; }; 17 | BEAEB4AB1A3C96D2003D26F6 /* DMRemoteRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = BEAEB4AA1A3C96D2003D26F6 /* DMRemoteRequestTests.m */; }; 18 | BEAEB4C01A3C98D6003D26F6 /* DMRemoteRequestRouter.m in Sources */ = {isa = PBXBuildFile; fileRef = BEAEB4BE1A3C98D6003D26F6 /* DMRemoteRequestRouter.m */; }; 19 | BEAEB4CD1A3C992B003D26F6 /* InterfaceController.m in Sources */ = {isa = PBXBuildFile; fileRef = BEAEB4CC1A3C992B003D26F6 /* InterfaceController.m */; }; 20 | BEAEB4D01A3C992B003D26F6 /* NotificationController.m in Sources */ = {isa = PBXBuildFile; fileRef = BEAEB4CF1A3C992B003D26F6 /* NotificationController.m */; }; 21 | BEAEB4D21A3C992B003D26F6 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BEAEB4D11A3C992B003D26F6 /* Images.xcassets */; }; 22 | BEAEB4D61A3C992B003D26F6 /* DMRemoteRequest WatchKit App.app in Resources */ = {isa = PBXBuildFile; fileRef = BEAEB4D51A3C992B003D26F6 /* DMRemoteRequest WatchKit App.app */; }; 23 | BEAEB4DD1A3C992B003D26F6 /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BEAEB4DC1A3C992B003D26F6 /* Interface.storyboard */; }; 24 | BEAEB4DF1A3C992B003D26F6 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BEAEB4DE1A3C992B003D26F6 /* Images.xcassets */; }; 25 | BEAEB4E21A3C992B003D26F6 /* DMRemoteRequest WatchKit Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = BEAEB4C61A3C992A003D26F6 /* DMRemoteRequest WatchKit Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 26 | BEAEB4ED1A3C9949003D26F6 /* DMRemoteRequestObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = BEAEB4EC1A3C9949003D26F6 /* DMRemoteRequestObserver.m */; }; 27 | BEAEB4F01A3CA1ED003D26F6 /* SomeOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = BEAEB4EF1A3CA1ED003D26F6 /* SomeOperation.m */; }; 28 | /* End PBXBuildFile section */ 29 | 30 | /* Begin PBXContainerItemProxy section */ 31 | BEAEB4A51A3C96D2003D26F6 /* PBXContainerItemProxy */ = { 32 | isa = PBXContainerItemProxy; 33 | containerPortal = BEAEB4831A3C96D2003D26F6 /* Project object */; 34 | proxyType = 1; 35 | remoteGlobalIDString = BEAEB48A1A3C96D2003D26F6; 36 | remoteInfo = DMRemoteRequest; 37 | }; 38 | BEAEB4D71A3C992B003D26F6 /* PBXContainerItemProxy */ = { 39 | isa = PBXContainerItemProxy; 40 | containerPortal = BEAEB4831A3C96D2003D26F6 /* Project object */; 41 | proxyType = 1; 42 | remoteGlobalIDString = BEAEB4D41A3C992B003D26F6; 43 | remoteInfo = "DMRemoteRequest WatchKit App"; 44 | }; 45 | BEAEB4E01A3C992B003D26F6 /* PBXContainerItemProxy */ = { 46 | isa = PBXContainerItemProxy; 47 | containerPortal = BEAEB4831A3C96D2003D26F6 /* Project object */; 48 | proxyType = 1; 49 | remoteGlobalIDString = BEAEB4C51A3C992A003D26F6; 50 | remoteInfo = "DMRemoteRequest WatchKit Extension"; 51 | }; 52 | /* End PBXContainerItemProxy section */ 53 | 54 | /* Begin PBXCopyFilesBuildPhase section */ 55 | BEAEB4E91A3C992B003D26F6 /* Embed App Extensions */ = { 56 | isa = PBXCopyFilesBuildPhase; 57 | buildActionMask = 2147483647; 58 | dstPath = ""; 59 | dstSubfolderSpec = 13; 60 | files = ( 61 | BEAEB4E21A3C992B003D26F6 /* DMRemoteRequest WatchKit Extension.appex in Embed App Extensions */, 62 | ); 63 | name = "Embed App Extensions"; 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | /* End PBXCopyFilesBuildPhase section */ 67 | 68 | /* Begin PBXFileReference section */ 69 | BE445CE61A7206A700BA1B5C /* TestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestOperation.h; sourceTree = ""; }; 70 | BE445CE71A7206A700BA1B5C /* TestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestOperation.m; sourceTree = ""; }; 71 | BEAEB48B1A3C96D2003D26F6 /* DMRemoteRequest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DMRemoteRequest.app; sourceTree = BUILT_PRODUCTS_DIR; }; 72 | BEAEB48F1A3C96D2003D26F6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 73 | BEAEB4901A3C96D2003D26F6 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 74 | BEAEB4921A3C96D2003D26F6 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 75 | BEAEB4931A3C96D2003D26F6 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 76 | BEAEB4951A3C96D2003D26F6 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 77 | BEAEB4961A3C96D2003D26F6 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 78 | BEAEB4991A3C96D2003D26F6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 79 | BEAEB49B1A3C96D2003D26F6 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 80 | BEAEB49E1A3C96D2003D26F6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 81 | BEAEB4A41A3C96D2003D26F6 /* DMRemoteRequestTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DMRemoteRequestTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 82 | BEAEB4A91A3C96D2003D26F6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 83 | BEAEB4AA1A3C96D2003D26F6 /* DMRemoteRequestTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DMRemoteRequestTests.m; sourceTree = ""; }; 84 | BEAEB4BD1A3C98D6003D26F6 /* DMRemoteRequestRouter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DMRemoteRequestRouter.h; path = "../../DMRemoteRequest/Host App/DMRemoteRequestRouter.h"; sourceTree = ""; }; 85 | BEAEB4BE1A3C98D6003D26F6 /* DMRemoteRequestRouter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DMRemoteRequestRouter.m; path = "../../DMRemoteRequest/Host App/DMRemoteRequestRouter.m"; sourceTree = ""; }; 86 | BEAEB4BF1A3C98D6003D26F6 /* DMRemoteRequestProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DMRemoteRequestProtocol.h; path = "../../DMRemoteRequest/Host App/DMRemoteRequestProtocol.h"; sourceTree = ""; }; 87 | BEAEB4C11A3C98E6003D26F6 /* DMRemoteRequestPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = DMRemoteRequestPrivate.h; path = ../../DMRemoteRequest/DMRemoteRequestPrivate.h; sourceTree = ""; }; 88 | BEAEB4C61A3C992A003D26F6 /* DMRemoteRequest WatchKit Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "DMRemoteRequest WatchKit Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; 89 | BEAEB4C91A3C992A003D26F6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 90 | BEAEB4CA1A3C992A003D26F6 /* PushNotificationPayload.apns */ = {isa = PBXFileReference; lastKnownFileType = text; path = PushNotificationPayload.apns; sourceTree = ""; }; 91 | BEAEB4CB1A3C992B003D26F6 /* InterfaceController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InterfaceController.h; sourceTree = ""; }; 92 | BEAEB4CC1A3C992B003D26F6 /* InterfaceController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InterfaceController.m; sourceTree = ""; }; 93 | BEAEB4CE1A3C992B003D26F6 /* NotificationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NotificationController.h; sourceTree = ""; }; 94 | BEAEB4CF1A3C992B003D26F6 /* NotificationController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NotificationController.m; sourceTree = ""; }; 95 | BEAEB4D11A3C992B003D26F6 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 96 | BEAEB4D51A3C992B003D26F6 /* DMRemoteRequest WatchKit App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DMRemoteRequest WatchKit App.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 97 | BEAEB4DB1A3C992B003D26F6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 98 | BEAEB4DC1A3C992B003D26F6 /* Interface.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Interface.storyboard; sourceTree = ""; }; 99 | BEAEB4DE1A3C992B003D26F6 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 100 | BEAEB4EB1A3C9949003D26F6 /* DMRemoteRequestObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DMRemoteRequestObserver.h; path = "../../DMRemoteRequest/Watch Extension/DMRemoteRequestObserver.h"; sourceTree = ""; }; 101 | BEAEB4EC1A3C9949003D26F6 /* DMRemoteRequestObserver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DMRemoteRequestObserver.m; path = "../../DMRemoteRequest/Watch Extension/DMRemoteRequestObserver.m"; sourceTree = ""; }; 102 | BEAEB4EE1A3CA1ED003D26F6 /* SomeOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SomeOperation.h; sourceTree = ""; }; 103 | BEAEB4EF1A3CA1ED003D26F6 /* SomeOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SomeOperation.m; sourceTree = ""; }; 104 | /* End PBXFileReference section */ 105 | 106 | /* Begin PBXFrameworksBuildPhase section */ 107 | BEAEB4881A3C96D2003D26F6 /* Frameworks */ = { 108 | isa = PBXFrameworksBuildPhase; 109 | buildActionMask = 2147483647; 110 | files = ( 111 | ); 112 | runOnlyForDeploymentPostprocessing = 0; 113 | }; 114 | BEAEB4A11A3C96D2003D26F6 /* Frameworks */ = { 115 | isa = PBXFrameworksBuildPhase; 116 | buildActionMask = 2147483647; 117 | files = ( 118 | ); 119 | runOnlyForDeploymentPostprocessing = 0; 120 | }; 121 | BEAEB4C31A3C992A003D26F6 /* Frameworks */ = { 122 | isa = PBXFrameworksBuildPhase; 123 | buildActionMask = 2147483647; 124 | files = ( 125 | ); 126 | runOnlyForDeploymentPostprocessing = 0; 127 | }; 128 | /* End PBXFrameworksBuildPhase section */ 129 | 130 | /* Begin PBXGroup section */ 131 | BEAEB4821A3C96D2003D26F6 = { 132 | isa = PBXGroup; 133 | children = ( 134 | BEAEB48D1A3C96D2003D26F6 /* DMRemoteRequestExample */, 135 | BEAEB4A71A3C96D2003D26F6 /* DMRemoteRequestTests */, 136 | BEAEB4C71A3C992A003D26F6 /* DMRemoteRequest WatchKit Extension */, 137 | BEAEB4D91A3C992B003D26F6 /* DMRemoteRequest WatchKit App */, 138 | BEAEB48C1A3C96D2003D26F6 /* Products */, 139 | ); 140 | sourceTree = ""; 141 | }; 142 | BEAEB48C1A3C96D2003D26F6 /* Products */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | BEAEB48B1A3C96D2003D26F6 /* DMRemoteRequest.app */, 146 | BEAEB4A41A3C96D2003D26F6 /* DMRemoteRequestTests.xctest */, 147 | BEAEB4C61A3C992A003D26F6 /* DMRemoteRequest WatchKit Extension.appex */, 148 | BEAEB4D51A3C992B003D26F6 /* DMRemoteRequest WatchKit App.app */, 149 | ); 150 | name = Products; 151 | sourceTree = ""; 152 | }; 153 | BEAEB48D1A3C96D2003D26F6 /* DMRemoteRequestExample */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | BEAEB4B41A3C96F0003D26F6 /* DMRemoteRequest */, 157 | BEAEB4921A3C96D2003D26F6 /* AppDelegate.h */, 158 | BEAEB4931A3C96D2003D26F6 /* AppDelegate.m */, 159 | BEAEB4951A3C96D2003D26F6 /* ViewController.h */, 160 | BEAEB4961A3C96D2003D26F6 /* ViewController.m */, 161 | BEAEB4EE1A3CA1ED003D26F6 /* SomeOperation.h */, 162 | BEAEB4EF1A3CA1ED003D26F6 /* SomeOperation.m */, 163 | BEAEB4981A3C96D2003D26F6 /* Main.storyboard */, 164 | BEAEB49B1A3C96D2003D26F6 /* Images.xcassets */, 165 | BEAEB49D1A3C96D2003D26F6 /* LaunchScreen.xib */, 166 | BEAEB48E1A3C96D2003D26F6 /* Supporting Files */, 167 | ); 168 | name = DMRemoteRequestExample; 169 | path = DMRemoteRequest; 170 | sourceTree = ""; 171 | }; 172 | BEAEB48E1A3C96D2003D26F6 /* Supporting Files */ = { 173 | isa = PBXGroup; 174 | children = ( 175 | BEAEB48F1A3C96D2003D26F6 /* Info.plist */, 176 | BEAEB4901A3C96D2003D26F6 /* main.m */, 177 | ); 178 | name = "Supporting Files"; 179 | sourceTree = ""; 180 | }; 181 | BEAEB4A71A3C96D2003D26F6 /* DMRemoteRequestTests */ = { 182 | isa = PBXGroup; 183 | children = ( 184 | BEAEB4AA1A3C96D2003D26F6 /* DMRemoteRequestTests.m */, 185 | BE445CE61A7206A700BA1B5C /* TestOperation.h */, 186 | BE445CE71A7206A700BA1B5C /* TestOperation.m */, 187 | BEAEB4A81A3C96D2003D26F6 /* Supporting Files */, 188 | ); 189 | path = DMRemoteRequestTests; 190 | sourceTree = ""; 191 | }; 192 | BEAEB4A81A3C96D2003D26F6 /* Supporting Files */ = { 193 | isa = PBXGroup; 194 | children = ( 195 | BEAEB4A91A3C96D2003D26F6 /* Info.plist */, 196 | ); 197 | name = "Supporting Files"; 198 | sourceTree = ""; 199 | }; 200 | BEAEB4B41A3C96F0003D26F6 /* DMRemoteRequest */ = { 201 | isa = PBXGroup; 202 | children = ( 203 | BEAEB4C11A3C98E6003D26F6 /* DMRemoteRequestPrivate.h */, 204 | BEAEB4BD1A3C98D6003D26F6 /* DMRemoteRequestRouter.h */, 205 | BEAEB4BE1A3C98D6003D26F6 /* DMRemoteRequestRouter.m */, 206 | BEAEB4BF1A3C98D6003D26F6 /* DMRemoteRequestProtocol.h */, 207 | ); 208 | name = DMRemoteRequest; 209 | sourceTree = ""; 210 | }; 211 | BEAEB4C71A3C992A003D26F6 /* DMRemoteRequest WatchKit Extension */ = { 212 | isa = PBXGroup; 213 | children = ( 214 | BEAEB4EA1A3C9939003D26F6 /* DMRemoteRequest */, 215 | BEAEB4CB1A3C992B003D26F6 /* InterfaceController.h */, 216 | BEAEB4CC1A3C992B003D26F6 /* InterfaceController.m */, 217 | BEAEB4CE1A3C992B003D26F6 /* NotificationController.h */, 218 | BEAEB4CF1A3C992B003D26F6 /* NotificationController.m */, 219 | BEAEB4D11A3C992B003D26F6 /* Images.xcassets */, 220 | BEAEB4C81A3C992A003D26F6 /* Supporting Files */, 221 | ); 222 | path = "DMRemoteRequest WatchKit Extension"; 223 | sourceTree = ""; 224 | }; 225 | BEAEB4C81A3C992A003D26F6 /* Supporting Files */ = { 226 | isa = PBXGroup; 227 | children = ( 228 | BEAEB4C91A3C992A003D26F6 /* Info.plist */, 229 | BEAEB4CA1A3C992A003D26F6 /* PushNotificationPayload.apns */, 230 | ); 231 | name = "Supporting Files"; 232 | sourceTree = ""; 233 | }; 234 | BEAEB4D91A3C992B003D26F6 /* DMRemoteRequest WatchKit App */ = { 235 | isa = PBXGroup; 236 | children = ( 237 | BEAEB4DC1A3C992B003D26F6 /* Interface.storyboard */, 238 | BEAEB4DE1A3C992B003D26F6 /* Images.xcassets */, 239 | BEAEB4DA1A3C992B003D26F6 /* Supporting Files */, 240 | ); 241 | path = "DMRemoteRequest WatchKit App"; 242 | sourceTree = ""; 243 | }; 244 | BEAEB4DA1A3C992B003D26F6 /* Supporting Files */ = { 245 | isa = PBXGroup; 246 | children = ( 247 | BEAEB4DB1A3C992B003D26F6 /* Info.plist */, 248 | ); 249 | name = "Supporting Files"; 250 | sourceTree = ""; 251 | }; 252 | BEAEB4EA1A3C9939003D26F6 /* DMRemoteRequest */ = { 253 | isa = PBXGroup; 254 | children = ( 255 | BEAEB4EB1A3C9949003D26F6 /* DMRemoteRequestObserver.h */, 256 | BEAEB4EC1A3C9949003D26F6 /* DMRemoteRequestObserver.m */, 257 | ); 258 | name = DMRemoteRequest; 259 | sourceTree = ""; 260 | }; 261 | /* End PBXGroup section */ 262 | 263 | /* Begin PBXNativeTarget section */ 264 | BEAEB48A1A3C96D2003D26F6 /* DMRemoteRequest */ = { 265 | isa = PBXNativeTarget; 266 | buildConfigurationList = BEAEB4AE1A3C96D2003D26F6 /* Build configuration list for PBXNativeTarget "DMRemoteRequest" */; 267 | buildPhases = ( 268 | BEAEB4871A3C96D2003D26F6 /* Sources */, 269 | BEAEB4881A3C96D2003D26F6 /* Frameworks */, 270 | BEAEB4891A3C96D2003D26F6 /* Resources */, 271 | BEAEB4E91A3C992B003D26F6 /* Embed App Extensions */, 272 | ); 273 | buildRules = ( 274 | ); 275 | dependencies = ( 276 | BEAEB4E11A3C992B003D26F6 /* PBXTargetDependency */, 277 | ); 278 | name = DMRemoteRequest; 279 | productName = DMRemoteRequest; 280 | productReference = BEAEB48B1A3C96D2003D26F6 /* DMRemoteRequest.app */; 281 | productType = "com.apple.product-type.application"; 282 | }; 283 | BEAEB4A31A3C96D2003D26F6 /* DMRemoteRequestTests */ = { 284 | isa = PBXNativeTarget; 285 | buildConfigurationList = BEAEB4B11A3C96D2003D26F6 /* Build configuration list for PBXNativeTarget "DMRemoteRequestTests" */; 286 | buildPhases = ( 287 | BEAEB4A01A3C96D2003D26F6 /* Sources */, 288 | BEAEB4A11A3C96D2003D26F6 /* Frameworks */, 289 | BEAEB4A21A3C96D2003D26F6 /* Resources */, 290 | ); 291 | buildRules = ( 292 | ); 293 | dependencies = ( 294 | BEAEB4A61A3C96D2003D26F6 /* PBXTargetDependency */, 295 | ); 296 | name = DMRemoteRequestTests; 297 | productName = DMRemoteRequestTests; 298 | productReference = BEAEB4A41A3C96D2003D26F6 /* DMRemoteRequestTests.xctest */; 299 | productType = "com.apple.product-type.bundle.unit-test"; 300 | }; 301 | BEAEB4C51A3C992A003D26F6 /* DMRemoteRequest WatchKit Extension */ = { 302 | isa = PBXNativeTarget; 303 | buildConfigurationList = BEAEB4E61A3C992B003D26F6 /* Build configuration list for PBXNativeTarget "DMRemoteRequest WatchKit Extension" */; 304 | buildPhases = ( 305 | BEAEB4C21A3C992A003D26F6 /* Sources */, 306 | BEAEB4C31A3C992A003D26F6 /* Frameworks */, 307 | BEAEB4C41A3C992A003D26F6 /* Resources */, 308 | ); 309 | buildRules = ( 310 | ); 311 | dependencies = ( 312 | BEAEB4D81A3C992B003D26F6 /* PBXTargetDependency */, 313 | ); 314 | name = "DMRemoteRequest WatchKit Extension"; 315 | productName = "DMRemoteRequest WatchKit Extension"; 316 | productReference = BEAEB4C61A3C992A003D26F6 /* DMRemoteRequest WatchKit Extension.appex */; 317 | productType = "com.apple.product-type.watchkit-extension"; 318 | }; 319 | BEAEB4D41A3C992B003D26F6 /* DMRemoteRequest WatchKit App */ = { 320 | isa = PBXNativeTarget; 321 | buildConfigurationList = BEAEB4E31A3C992B003D26F6 /* Build configuration list for PBXNativeTarget "DMRemoteRequest WatchKit App" */; 322 | buildPhases = ( 323 | BEAEB4D31A3C992B003D26F6 /* Resources */, 324 | ); 325 | buildRules = ( 326 | ); 327 | dependencies = ( 328 | ); 329 | name = "DMRemoteRequest WatchKit App"; 330 | productName = "DMRemoteRequest WatchKit App"; 331 | productReference = BEAEB4D51A3C992B003D26F6 /* DMRemoteRequest WatchKit App.app */; 332 | productType = "com.apple.product-type.application.watchapp"; 333 | }; 334 | /* End PBXNativeTarget section */ 335 | 336 | /* Begin PBXProject section */ 337 | BEAEB4831A3C96D2003D26F6 /* Project object */ = { 338 | isa = PBXProject; 339 | attributes = { 340 | LastUpgradeCheck = 0620; 341 | ORGANIZATIONNAME = "David Muzi"; 342 | TargetAttributes = { 343 | BEAEB48A1A3C96D2003D26F6 = { 344 | CreatedOnToolsVersion = 6.2; 345 | }; 346 | BEAEB4A31A3C96D2003D26F6 = { 347 | CreatedOnToolsVersion = 6.2; 348 | TestTargetID = BEAEB48A1A3C96D2003D26F6; 349 | }; 350 | BEAEB4C51A3C992A003D26F6 = { 351 | CreatedOnToolsVersion = 6.2; 352 | }; 353 | BEAEB4D41A3C992B003D26F6 = { 354 | CreatedOnToolsVersion = 6.2; 355 | }; 356 | }; 357 | }; 358 | buildConfigurationList = BEAEB4861A3C96D2003D26F6 /* Build configuration list for PBXProject "DMRemoteRequest" */; 359 | compatibilityVersion = "Xcode 3.2"; 360 | developmentRegion = English; 361 | hasScannedForEncodings = 0; 362 | knownRegions = ( 363 | en, 364 | Base, 365 | ); 366 | mainGroup = BEAEB4821A3C96D2003D26F6; 367 | productRefGroup = BEAEB48C1A3C96D2003D26F6 /* Products */; 368 | projectDirPath = ""; 369 | projectRoot = ""; 370 | targets = ( 371 | BEAEB48A1A3C96D2003D26F6 /* DMRemoteRequest */, 372 | BEAEB4A31A3C96D2003D26F6 /* DMRemoteRequestTests */, 373 | BEAEB4C51A3C992A003D26F6 /* DMRemoteRequest WatchKit Extension */, 374 | BEAEB4D41A3C992B003D26F6 /* DMRemoteRequest WatchKit App */, 375 | ); 376 | }; 377 | /* End PBXProject section */ 378 | 379 | /* Begin PBXResourcesBuildPhase section */ 380 | BEAEB4891A3C96D2003D26F6 /* Resources */ = { 381 | isa = PBXResourcesBuildPhase; 382 | buildActionMask = 2147483647; 383 | files = ( 384 | BEAEB49A1A3C96D2003D26F6 /* Main.storyboard in Resources */, 385 | BEAEB49F1A3C96D2003D26F6 /* LaunchScreen.xib in Resources */, 386 | BEAEB49C1A3C96D2003D26F6 /* Images.xcassets in Resources */, 387 | ); 388 | runOnlyForDeploymentPostprocessing = 0; 389 | }; 390 | BEAEB4A21A3C96D2003D26F6 /* Resources */ = { 391 | isa = PBXResourcesBuildPhase; 392 | buildActionMask = 2147483647; 393 | files = ( 394 | ); 395 | runOnlyForDeploymentPostprocessing = 0; 396 | }; 397 | BEAEB4C41A3C992A003D26F6 /* Resources */ = { 398 | isa = PBXResourcesBuildPhase; 399 | buildActionMask = 2147483647; 400 | files = ( 401 | BEAEB4D61A3C992B003D26F6 /* DMRemoteRequest WatchKit App.app in Resources */, 402 | BEAEB4D21A3C992B003D26F6 /* Images.xcassets in Resources */, 403 | ); 404 | runOnlyForDeploymentPostprocessing = 0; 405 | }; 406 | BEAEB4D31A3C992B003D26F6 /* Resources */ = { 407 | isa = PBXResourcesBuildPhase; 408 | buildActionMask = 2147483647; 409 | files = ( 410 | BEAEB4DD1A3C992B003D26F6 /* Interface.storyboard in Resources */, 411 | BEAEB4DF1A3C992B003D26F6 /* Images.xcassets in Resources */, 412 | ); 413 | runOnlyForDeploymentPostprocessing = 0; 414 | }; 415 | /* End PBXResourcesBuildPhase section */ 416 | 417 | /* Begin PBXSourcesBuildPhase section */ 418 | BEAEB4871A3C96D2003D26F6 /* Sources */ = { 419 | isa = PBXSourcesBuildPhase; 420 | buildActionMask = 2147483647; 421 | files = ( 422 | BEAEB4971A3C96D2003D26F6 /* ViewController.m in Sources */, 423 | BEAEB4C01A3C98D6003D26F6 /* DMRemoteRequestRouter.m in Sources */, 424 | BEAEB4F01A3CA1ED003D26F6 /* SomeOperation.m in Sources */, 425 | BEAEB4941A3C96D2003D26F6 /* AppDelegate.m in Sources */, 426 | BEAEB4911A3C96D2003D26F6 /* main.m in Sources */, 427 | ); 428 | runOnlyForDeploymentPostprocessing = 0; 429 | }; 430 | BEAEB4A01A3C96D2003D26F6 /* Sources */ = { 431 | isa = PBXSourcesBuildPhase; 432 | buildActionMask = 2147483647; 433 | files = ( 434 | BEAEB4AB1A3C96D2003D26F6 /* DMRemoteRequestTests.m in Sources */, 435 | BE445CE81A7206A700BA1B5C /* TestOperation.m in Sources */, 436 | ); 437 | runOnlyForDeploymentPostprocessing = 0; 438 | }; 439 | BEAEB4C21A3C992A003D26F6 /* Sources */ = { 440 | isa = PBXSourcesBuildPhase; 441 | buildActionMask = 2147483647; 442 | files = ( 443 | BEAEB4D01A3C992B003D26F6 /* NotificationController.m in Sources */, 444 | BEAEB4ED1A3C9949003D26F6 /* DMRemoteRequestObserver.m in Sources */, 445 | BEAEB4CD1A3C992B003D26F6 /* InterfaceController.m in Sources */, 446 | ); 447 | runOnlyForDeploymentPostprocessing = 0; 448 | }; 449 | /* End PBXSourcesBuildPhase section */ 450 | 451 | /* Begin PBXTargetDependency section */ 452 | BEAEB4A61A3C96D2003D26F6 /* PBXTargetDependency */ = { 453 | isa = PBXTargetDependency; 454 | target = BEAEB48A1A3C96D2003D26F6 /* DMRemoteRequest */; 455 | targetProxy = BEAEB4A51A3C96D2003D26F6 /* PBXContainerItemProxy */; 456 | }; 457 | BEAEB4D81A3C992B003D26F6 /* PBXTargetDependency */ = { 458 | isa = PBXTargetDependency; 459 | target = BEAEB4D41A3C992B003D26F6 /* DMRemoteRequest WatchKit App */; 460 | targetProxy = BEAEB4D71A3C992B003D26F6 /* PBXContainerItemProxy */; 461 | }; 462 | BEAEB4E11A3C992B003D26F6 /* PBXTargetDependency */ = { 463 | isa = PBXTargetDependency; 464 | target = BEAEB4C51A3C992A003D26F6 /* DMRemoteRequest WatchKit Extension */; 465 | targetProxy = BEAEB4E01A3C992B003D26F6 /* PBXContainerItemProxy */; 466 | }; 467 | /* End PBXTargetDependency section */ 468 | 469 | /* Begin PBXVariantGroup section */ 470 | BEAEB4981A3C96D2003D26F6 /* Main.storyboard */ = { 471 | isa = PBXVariantGroup; 472 | children = ( 473 | BEAEB4991A3C96D2003D26F6 /* Base */, 474 | ); 475 | name = Main.storyboard; 476 | sourceTree = ""; 477 | }; 478 | BEAEB49D1A3C96D2003D26F6 /* LaunchScreen.xib */ = { 479 | isa = PBXVariantGroup; 480 | children = ( 481 | BEAEB49E1A3C96D2003D26F6 /* Base */, 482 | ); 483 | name = LaunchScreen.xib; 484 | sourceTree = ""; 485 | }; 486 | /* End PBXVariantGroup section */ 487 | 488 | /* Begin XCBuildConfiguration section */ 489 | BEAEB4AC1A3C96D2003D26F6 /* Debug */ = { 490 | isa = XCBuildConfiguration; 491 | buildSettings = { 492 | ALWAYS_SEARCH_USER_PATHS = NO; 493 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 494 | CLANG_CXX_LIBRARY = "libc++"; 495 | CLANG_ENABLE_MODULES = YES; 496 | CLANG_ENABLE_OBJC_ARC = YES; 497 | CLANG_WARN_BOOL_CONVERSION = YES; 498 | CLANG_WARN_CONSTANT_CONVERSION = YES; 499 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 500 | CLANG_WARN_EMPTY_BODY = YES; 501 | CLANG_WARN_ENUM_CONVERSION = YES; 502 | CLANG_WARN_INT_CONVERSION = YES; 503 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 504 | CLANG_WARN_UNREACHABLE_CODE = YES; 505 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 506 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 507 | COPY_PHASE_STRIP = NO; 508 | ENABLE_STRICT_OBJC_MSGSEND = YES; 509 | GCC_C_LANGUAGE_STANDARD = gnu99; 510 | GCC_DYNAMIC_NO_PIC = NO; 511 | GCC_OPTIMIZATION_LEVEL = 0; 512 | GCC_PREPROCESSOR_DEFINITIONS = ( 513 | "DEBUG=1", 514 | "$(inherited)", 515 | ); 516 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 517 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 518 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 519 | GCC_WARN_UNDECLARED_SELECTOR = YES; 520 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 521 | GCC_WARN_UNUSED_FUNCTION = YES; 522 | GCC_WARN_UNUSED_VARIABLE = YES; 523 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 524 | MTL_ENABLE_DEBUG_INFO = YES; 525 | ONLY_ACTIVE_ARCH = YES; 526 | SDKROOT = iphoneos; 527 | }; 528 | name = Debug; 529 | }; 530 | BEAEB4AD1A3C96D2003D26F6 /* Release */ = { 531 | isa = XCBuildConfiguration; 532 | buildSettings = { 533 | ALWAYS_SEARCH_USER_PATHS = NO; 534 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 535 | CLANG_CXX_LIBRARY = "libc++"; 536 | CLANG_ENABLE_MODULES = YES; 537 | CLANG_ENABLE_OBJC_ARC = YES; 538 | CLANG_WARN_BOOL_CONVERSION = YES; 539 | CLANG_WARN_CONSTANT_CONVERSION = YES; 540 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 541 | CLANG_WARN_EMPTY_BODY = YES; 542 | CLANG_WARN_ENUM_CONVERSION = YES; 543 | CLANG_WARN_INT_CONVERSION = YES; 544 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 545 | CLANG_WARN_UNREACHABLE_CODE = YES; 546 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 547 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 548 | COPY_PHASE_STRIP = YES; 549 | ENABLE_NS_ASSERTIONS = NO; 550 | ENABLE_STRICT_OBJC_MSGSEND = YES; 551 | GCC_C_LANGUAGE_STANDARD = gnu99; 552 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 553 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 554 | GCC_WARN_UNDECLARED_SELECTOR = YES; 555 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 556 | GCC_WARN_UNUSED_FUNCTION = YES; 557 | GCC_WARN_UNUSED_VARIABLE = YES; 558 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 559 | MTL_ENABLE_DEBUG_INFO = NO; 560 | SDKROOT = iphoneos; 561 | VALIDATE_PRODUCT = YES; 562 | }; 563 | name = Release; 564 | }; 565 | BEAEB4AF1A3C96D2003D26F6 /* Debug */ = { 566 | isa = XCBuildConfiguration; 567 | buildSettings = { 568 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 569 | INFOPLIST_FILE = DMRemoteRequest/Info.plist; 570 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 571 | PRODUCT_NAME = "$(TARGET_NAME)"; 572 | }; 573 | name = Debug; 574 | }; 575 | BEAEB4B01A3C96D2003D26F6 /* Release */ = { 576 | isa = XCBuildConfiguration; 577 | buildSettings = { 578 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 579 | INFOPLIST_FILE = DMRemoteRequest/Info.plist; 580 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 581 | PRODUCT_NAME = "$(TARGET_NAME)"; 582 | }; 583 | name = Release; 584 | }; 585 | BEAEB4B21A3C96D2003D26F6 /* Debug */ = { 586 | isa = XCBuildConfiguration; 587 | buildSettings = { 588 | BUNDLE_LOADER = "$(TEST_HOST)"; 589 | FRAMEWORK_SEARCH_PATHS = ( 590 | "$(SDKROOT)/Developer/Library/Frameworks", 591 | "$(inherited)", 592 | ); 593 | GCC_PREPROCESSOR_DEFINITIONS = ( 594 | "DEBUG=1", 595 | "$(inherited)", 596 | ); 597 | INFOPLIST_FILE = DMRemoteRequestTests/Info.plist; 598 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 599 | PRODUCT_NAME = "$(TARGET_NAME)"; 600 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DMRemoteRequest.app/DMRemoteRequest"; 601 | }; 602 | name = Debug; 603 | }; 604 | BEAEB4B31A3C96D2003D26F6 /* Release */ = { 605 | isa = XCBuildConfiguration; 606 | buildSettings = { 607 | BUNDLE_LOADER = "$(TEST_HOST)"; 608 | FRAMEWORK_SEARCH_PATHS = ( 609 | "$(SDKROOT)/Developer/Library/Frameworks", 610 | "$(inherited)", 611 | ); 612 | INFOPLIST_FILE = DMRemoteRequestTests/Info.plist; 613 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 614 | PRODUCT_NAME = "$(TARGET_NAME)"; 615 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DMRemoteRequest.app/DMRemoteRequest"; 616 | }; 617 | name = Release; 618 | }; 619 | BEAEB4E41A3C992B003D26F6 /* Debug */ = { 620 | isa = XCBuildConfiguration; 621 | buildSettings = { 622 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 623 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 624 | GCC_PREPROCESSOR_DEFINITIONS = ( 625 | "DEBUG=1", 626 | "$(inherited)", 627 | ); 628 | IBSC_MODULE = DMRemoteRequest_WatchKit_Extension; 629 | INFOPLIST_FILE = "DMRemoteRequest WatchKit App/Info.plist"; 630 | PRODUCT_NAME = "$(TARGET_NAME)"; 631 | SKIP_INSTALL = YES; 632 | TARGETED_DEVICE_FAMILY = 4; 633 | "TARGETED_DEVICE_FAMILY[sdk=iphonesimulator*]" = "1,4"; 634 | }; 635 | name = Debug; 636 | }; 637 | BEAEB4E51A3C992B003D26F6 /* Release */ = { 638 | isa = XCBuildConfiguration; 639 | buildSettings = { 640 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 641 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 642 | IBSC_MODULE = DMRemoteRequest_WatchKit_Extension; 643 | INFOPLIST_FILE = "DMRemoteRequest WatchKit App/Info.plist"; 644 | PRODUCT_NAME = "$(TARGET_NAME)"; 645 | SKIP_INSTALL = YES; 646 | TARGETED_DEVICE_FAMILY = 4; 647 | "TARGETED_DEVICE_FAMILY[sdk=iphonesimulator*]" = "1,4"; 648 | }; 649 | name = Release; 650 | }; 651 | BEAEB4E71A3C992B003D26F6 /* Debug */ = { 652 | isa = XCBuildConfiguration; 653 | buildSettings = { 654 | GCC_PREPROCESSOR_DEFINITIONS = ( 655 | "DEBUG=1", 656 | "$(inherited)", 657 | ); 658 | INFOPLIST_FILE = "DMRemoteRequest WatchKit Extension/Info.plist"; 659 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; 660 | PRODUCT_NAME = "${TARGET_NAME}"; 661 | SKIP_INSTALL = YES; 662 | }; 663 | name = Debug; 664 | }; 665 | BEAEB4E81A3C992B003D26F6 /* Release */ = { 666 | isa = XCBuildConfiguration; 667 | buildSettings = { 668 | INFOPLIST_FILE = "DMRemoteRequest WatchKit Extension/Info.plist"; 669 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; 670 | PRODUCT_NAME = "${TARGET_NAME}"; 671 | SKIP_INSTALL = YES; 672 | }; 673 | name = Release; 674 | }; 675 | /* End XCBuildConfiguration section */ 676 | 677 | /* Begin XCConfigurationList section */ 678 | BEAEB4861A3C96D2003D26F6 /* Build configuration list for PBXProject "DMRemoteRequest" */ = { 679 | isa = XCConfigurationList; 680 | buildConfigurations = ( 681 | BEAEB4AC1A3C96D2003D26F6 /* Debug */, 682 | BEAEB4AD1A3C96D2003D26F6 /* Release */, 683 | ); 684 | defaultConfigurationIsVisible = 0; 685 | defaultConfigurationName = Release; 686 | }; 687 | BEAEB4AE1A3C96D2003D26F6 /* Build configuration list for PBXNativeTarget "DMRemoteRequest" */ = { 688 | isa = XCConfigurationList; 689 | buildConfigurations = ( 690 | BEAEB4AF1A3C96D2003D26F6 /* Debug */, 691 | BEAEB4B01A3C96D2003D26F6 /* Release */, 692 | ); 693 | defaultConfigurationIsVisible = 0; 694 | defaultConfigurationName = Release; 695 | }; 696 | BEAEB4B11A3C96D2003D26F6 /* Build configuration list for PBXNativeTarget "DMRemoteRequestTests" */ = { 697 | isa = XCConfigurationList; 698 | buildConfigurations = ( 699 | BEAEB4B21A3C96D2003D26F6 /* Debug */, 700 | BEAEB4B31A3C96D2003D26F6 /* Release */, 701 | ); 702 | defaultConfigurationIsVisible = 0; 703 | defaultConfigurationName = Release; 704 | }; 705 | BEAEB4E31A3C992B003D26F6 /* Build configuration list for PBXNativeTarget "DMRemoteRequest WatchKit App" */ = { 706 | isa = XCConfigurationList; 707 | buildConfigurations = ( 708 | BEAEB4E41A3C992B003D26F6 /* Debug */, 709 | BEAEB4E51A3C992B003D26F6 /* Release */, 710 | ); 711 | defaultConfigurationIsVisible = 0; 712 | defaultConfigurationName = Release; 713 | }; 714 | BEAEB4E61A3C992B003D26F6 /* Build configuration list for PBXNativeTarget "DMRemoteRequest WatchKit Extension" */ = { 715 | isa = XCConfigurationList; 716 | buildConfigurations = ( 717 | BEAEB4E71A3C992B003D26F6 /* Debug */, 718 | BEAEB4E81A3C992B003D26F6 /* Release */, 719 | ); 720 | defaultConfigurationIsVisible = 0; 721 | defaultConfigurationName = Release; 722 | }; 723 | /* End XCConfigurationList section */ 724 | }; 725 | rootObject = BEAEB4831A3C96D2003D26F6 /* Project object */; 726 | } 727 | -------------------------------------------------------------------------------- /Example/DMRemoteRequest.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/DMRemoteRequest/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // DMRemoteRequest 4 | // 5 | // Created by David Muzi on 2014-12-13. 6 | // Copyright (c) 2014 David Muzi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Example/DMRemoteRequest/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // DMRemoteRequest 4 | // 5 | // Created by David Muzi on 2014-12-13. 6 | // Copyright (c) 2014 David Muzi. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "DMRemoteRequestRouter.h" 11 | 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | // Override point for customization after application launch. 21 | return YES; 22 | } 23 | 24 | - (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void (^)(NSDictionary *))reply { 25 | 26 | [[DMRemoteRequestRouter sharedRouter] handleRequest:userInfo reply:reply]; 27 | } 28 | 29 | - (void)applicationWillResignActive:(UIApplication *)application { 30 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 31 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 32 | } 33 | 34 | - (void)applicationDidEnterBackground:(UIApplication *)application { 35 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 36 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 37 | } 38 | 39 | - (void)applicationWillEnterForeground:(UIApplication *)application { 40 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 41 | } 42 | 43 | - (void)applicationDidBecomeActive:(UIApplication *)application { 44 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 45 | } 46 | 47 | - (void)applicationWillTerminate:(UIApplication *)application { 48 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Example/DMRemoteRequest/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Example/DMRemoteRequest/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Example/DMRemoteRequest/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Example/DMRemoteRequest/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.muzi.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Example/DMRemoteRequest/SomeOperation.h: -------------------------------------------------------------------------------- 1 | // 2 | // SomeOperation.h 3 | // DMRemoteRequest 4 | // 5 | // Created by David Muzi on 2014-12-13. 6 | // Copyright (c) 2014 David Muzi. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DMRemoteRequestRouter.h" 11 | 12 | @interface SomeOperation : NSObject 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Example/DMRemoteRequest/SomeOperation.m: -------------------------------------------------------------------------------- 1 | // 2 | // SomeOperation.m 3 | // DMRemoteRequest 4 | // 5 | // Created by David Muzi on 2014-12-13. 6 | // Copyright (c) 2014 David Muzi. All rights reserved. 7 | // 8 | 9 | #import "SomeOperation.h" 10 | 11 | @implementation SomeOperation 12 | 13 | + (void)load { 14 | [[DMRemoteRequestRouter sharedRouter] registerClass:self forMethod:@"getDate"]; 15 | } 16 | 17 | + (NSOperation *)operationWithUserInfo:(NSDictionary *)userInfo completionHandler:(void (^)(NSDictionary *results))handler { 18 | 19 | return [NSBlockOperation blockOperationWithBlock:^{ 20 | 21 | handler(@{@"date": @"NSDate.date"}); 22 | 23 | }]; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Example/DMRemoteRequest/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // DMRemoteRequest 4 | // 5 | // Created by David Muzi on 2014-12-13. 6 | // Copyright (c) 2014 David Muzi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @property (strong, nonatomic) IBOutlet UISegmentedControl *segmentControl; 14 | @property (weak, nonatomic) IBOutlet UIActivityIndicatorView *spinner; 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Example/DMRemoteRequest/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // DMRemoteRequest 4 | // 5 | // Created by David Muzi on 2014-12-13. 6 | // Copyright (c) 2014 David Muzi. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "DMRemoteRequestRouter.h" 11 | 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view, typically from a nib. 21 | 22 | [[DMRemoteRequestRouter sharedRouter] registerBlock:^(NSDictionary *userInfo, void (^callback)(NSDictionary *)) { 23 | callback(@{@"name": [_segmentControl titleForSegmentAtIndex:_segmentControl.selectedSegmentIndex]}); 24 | } forMethod:@"getState"]; 25 | 26 | [DMRemoteRequestRouter sharedRouter][@"setSpin"] = ^NSDictionary *(NSDictionary *userInfo) { 27 | 28 | if ([userInfo[@"state"] boolValue]) { 29 | [_spinner startAnimating]; 30 | } 31 | else { 32 | [_spinner stopAnimating]; 33 | } 34 | 35 | return nil; 36 | }; 37 | } 38 | 39 | - (IBAction)didTap:(id)sender { 40 | 41 | // notify the watch that something has updated on the host app 42 | [[DMRemoteRequestRouter sharedRouter] notifyWatch]; 43 | 44 | } 45 | 46 | - (void)didReceiveMemoryWarning { 47 | [super didReceiveMemoryWarning]; 48 | // Dispose of any resources that can be recreated. 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Example/DMRemoteRequest/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // DMRemoteRequest 4 | // 5 | // Created by David Muzi on 2014-12-13. 6 | // Copyright (c) 2014 David Muzi. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Example/DMRemoteRequestTests/DMRemoteRequestTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // DMRemoteRequestTests.m 3 | // DMRemoteRequestTests 4 | // 5 | // Created by David Muzi on 2014-12-13. 6 | // Copyright (c) 2014 David Muzi. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "DMRemoteRequestRouter.h" 12 | #import "DMRemoteRequestObserver.h" 13 | #import "TestOperation.h" 14 | 15 | @interface DMRemoteRequestTests : XCTestCase 16 | @property (nonatomic, strong) DMRemoteRequestRouter *router; 17 | @end 18 | 19 | @implementation DMRemoteRequestTests 20 | 21 | - (void)setUp { 22 | [super setUp]; 23 | // Put setup code here. This method is called before the invocation of each test method in the class.s 24 | 25 | self.router = [DMRemoteRequestRouter sharedRouter]; 26 | } 27 | 28 | - (void)tearDown { 29 | // Put teardown code here. This method is called after the invocation of each test method in the class. 30 | [super tearDown]; 31 | } 32 | 33 | - (void)testRegisterBlockWithSubscript { 34 | 35 | self.router[@"hello"] = ^(NSDictionary *userInfo, void (^callback)(NSDictionary *)) { 36 | callback(@{@"response": @"world"}); 37 | }; 38 | 39 | id block = self.router[@"hello"]; 40 | 41 | XCTAssertNotNil(block, @"block not returned"); 42 | } 43 | 44 | - (void)testRegisterBlockWithMethod { 45 | 46 | [self.router registerBlock:^(NSDictionary *userInfo, void (^callback)(NSDictionary *)) { 47 | callback(@{@"response": @"world"}); 48 | } forMethod:@"hello"]; 49 | 50 | id block = self.router[@"hello"]; 51 | 52 | XCTAssertNotNil(block, @"block not returned"); 53 | } 54 | 55 | - (void)testRegisterClass { 56 | 57 | [self.router registerClass:TestOperation.class forMethod:@"date"]; 58 | 59 | id classs = self.router[@"date"]; 60 | XCTAssertNotNil(classs, @"block not returned"); 61 | } 62 | 63 | - (void)testRegisterClassWithSubscript { 64 | 65 | self.router[@"date"] = TestOperation.class; 66 | 67 | id classs = self.router[@"date"]; 68 | XCTAssertNotNil(classs, @"block not returned"); 69 | } 70 | 71 | - (void)testPerformClass { 72 | 73 | XCTestExpectation *expectation = 74 | [self expectationWithDescription:@"class test"]; 75 | 76 | self.router[@"date"] = TestOperation.class; 77 | 78 | [self.router handleRequest:@{DMMethodNameKey: @"date"} reply:^(NSDictionary *reply) { 79 | 80 | XCTAssertTrue([reply[@"response"] isKindOfClass:NSDate.class], @"Expecting date"); 81 | [expectation fulfill]; 82 | }]; 83 | 84 | [self waitForExpectationsWithTimeout:1.0 handler:^(NSError *error) { 85 | if (error) NSLog(@"error: %@", error.localizedDescription); 86 | }]; 87 | } 88 | 89 | - (void)testPerformBlock { 90 | 91 | XCTestExpectation *expectation = 92 | [self expectationWithDescription:@"block test"]; 93 | 94 | [self.router registerBlock:^(NSDictionary *userInfo, void (^callback)(NSDictionary *)) { 95 | callback(@{@"response": @"world"}); 96 | } forMethod:@"hello"]; 97 | 98 | [self.router handleRequest:@{DMMethodNameKey: @"hello"} reply:^(NSDictionary *reply) { 99 | XCTAssertEqual(reply[@"response"], @"world", @"response not equal"); 100 | 101 | [expectation fulfill]; 102 | }]; 103 | 104 | [self waitForExpectationsWithTimeout:1.0 handler:^(NSError *error) { 105 | if (error) NSLog(@"error: %@", error.localizedDescription); 106 | }]; 107 | } 108 | 109 | @end 110 | -------------------------------------------------------------------------------- /Example/DMRemoteRequestTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.muzi.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/DMRemoteRequestTests/TestOperation.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestOperation.h 3 | // DMRemoteRequest 4 | // 5 | // Created by David Muzi on 2015-01-22. 6 | // Copyright (c) 2015 David Muzi. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DMRemoteRequestRouter.h" 11 | 12 | @interface TestOperation : NSOperation 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Example/DMRemoteRequestTests/TestOperation.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestOperation.m 3 | // DMRemoteRequest 4 | // 5 | // Created by David Muzi on 2015-01-22. 6 | // Copyright (c) 2015 David Muzi. All rights reserved. 7 | // 8 | 9 | #import "TestOperation.h" 10 | 11 | @implementation TestOperation 12 | 13 | + (NSOperation *)operationWithUserInfo:(NSDictionary *)userInfo completionHandler:(void (^)(NSDictionary *))handler { 14 | 15 | return [NSBlockOperation blockOperationWithBlock:^{ 16 | 17 | handler(@{@"response": NSDate.date}); 18 | 19 | }]; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 David Muzi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | DMRemoteRequest 2 | =============== 3 | 4 | iOS library which structures the handling and routing of requests originating from an Watch 5 | 6 | 7 | ## Purpose 8 | 9 | To easily facilitate communication to and from a watch application and its host app, and to keep your App Delegate clean 10 | 11 | 12 | ## Installation 13 | 14 | To the host app add: 15 | - DMRemoteRequestPrivate.h 16 | - DMRemoteRequestRouter.h 17 | - DMRemoteRequestRouter.m 18 | - DMRemoteRequestProtocol.h 19 | 20 | To the watch extension add: 21 | - DMRemoteRequestPrivate.h 22 | - DMRemoteRequestObserver.h 23 | - DMRemoteRequestObserver.m 24 | 25 | ## Usage 26 | 27 | ### In Host App 28 | 29 | In your AppDelegate pass the openApplication call to `DMRemoteRequest` 30 | 31 | ```obj-c 32 | - (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void (^)(NSDictionary *))reply { 33 | 34 | [[]DMRemoteRequestRouter sharedRouter] handleCommand:userInfo reply:reply]; 35 | } 36 | ``` 37 | 38 | To handle a request from the watch, register a block or a class to handle it 39 | 40 | ```obj-c 41 | [self.router registerBlock:^(NSDictionary *userInfo, void (^callback)(NSDictionary *)) { 42 | callback(@{@"state": @"All systems go!"}); 43 | } forMethod:@"state"]; 44 | ``` 45 | 46 | With a class: 47 | 48 | ```obj-c 49 | [self.router registerClass:TestOperation.class forMethod:@"date"]; 50 | ``` 51 | 52 | Or, using a subscript: 53 | 54 | ```obj-c 55 | self.router[@"date"] = TestOperation.class; 56 | ``` 57 | 58 | To send a notification to the watch, 59 | 60 | ```obj-c 61 | [self.router notifyWatch]; 62 | ``` 63 | 64 | ### In Watch Extension 65 | 66 | To request data from the host application, in your watch extension use the `application:handleWatchKitExtensionRequest:reply:` method on WKInterfaceController, and include the key `DMMethodNameKey` with the method name for the object. 67 | 68 | ```obj-c 69 | [WKInterfaceController openParentApplication:@{DMMethodNameKey: @"getState"} reply:^(NSDictionary *replyInfo, NSError *error) { 70 | NSLog(@"state: %@", replyInfo[@"state"]); 71 | }]; 72 | ``` 73 | 74 | To receive notifications from the host app, register an observer for the notification `DMRemoteCommandNotificationName`. If you want to send data bi-directionally, [MMWormHole](https://github.com/mutualmobile/MMWormhole) can also be used in companion with DMRemoteRequest. 75 | 76 | ## Contributions 77 | 78 | Are welcome, please submit issues and PRs! 79 | 80 | -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | general: 2 | build_dir: Example 3 | 4 | test: 5 | override: 6 | - xctool -reporter pretty -reporter junit:$CIRCLE_TEST_REPORTS/xcode/results.xml -scheme "DMRemoteRequest" -project DMRemoteRequest.xcodeproj -sdk iphonesimulator clean test 7 | 8 | --------------------------------------------------------------------------------