TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Apr 2015 |
Maintained by Dmitriy Kuragin.
...
#import <ApiAIWatchKit/AIWatchKitHandler.h>
...
- (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void(^)(NSDictionary *replyInfo))reply
{
if (![AIWatchKitHandler handleWatchKitRequest:userInfo andReply:reply]) {
// you code for handle messages from watch
}
}
...
...
# Pod for Apple Watch Extension target
pod 'ApiAIWatchKit/WatchKitForWatch'
...
# Pod for Phone application
pod 'ApiAIWatchKit/WatchKitForPhone'
...
...
NSArray *suggestions = @[
...
// you suggestions for text input
...
];
[self presentTextInputControllerWithSuggestions:suggestions
allowedInputMode:WKTextInputModePlain
completion:^(NSArray *results) {
if (results.count) {
AIWatchKitTextRequest *textRequest = [[AIWatchKitTextRequest alloc] init];
textRequest.query = @[results.firstObject];
[textRequest runWithCompletionWithSuccesfull:^(id response) {
NSString *text = response[@"result"][@"speech"];
// you handle response code
} andFailure:^(NSError *error) {
// you handle error code
}];
}
}];
...