ListFeatures demo
diff --git a/objective-c/route_guide/ViewControllers.m b/objective-c/route_guide/ViewControllers.m
index 797ef0a..6a1e8b9 100644
--- a/objective-c/route_guide/ViewControllers.m
+++ b/objective-c/route_guide/ViewControllers.m
@@ -73,6 +73,9 @@
#pragma mark List Features
+// Run the listFeatures demo. Calls listFeatures with a rectangle containing all of the features in
+// the pre-generated database. Prints each response as it comes in.
+
@interface ListFeaturesViewController : UIViewController
@end
@@ -80,7 +83,23 @@
- (void)viewDidLoad {
[super viewDidLoad];
- // Do any additional setup after loading the view, typically from a nib.
+
+ RTGRouteGuide *client = [[RTGRouteGuide alloc] initWithHost:kHostAddress];
+
+ RTGRectangle *rectangle = [RTGRectangle message];
+ rectangle.lo.latitude = 40E7;
+ rectangle.lo.longitude = -75E7;
+ rectangle.hi.latitude = 42E7;
+ rectangle.hi.longitude = -73E7;
+
+ NSLog(@"Looking for features between 40, -75 and 42, -73");
+ [client listFeaturesWithRequest:rectangle handler:^(BOOL done, RTGFeature *response, NSError *error) {
+ if (response) {
+ NSLog(@"Found feature called %@ at %@.", response.name, response.location);
+ } else if (error) {
+ NSLog(@"RPC error: %@", error);
+ }
+ }];
}
@end