OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/showcase/suggestions/sc_suggestions_coordinator.h" | 5 #import "ios/showcase/suggestions/sc_suggestions_coordinator.h" |
6 | 6 |
7 #import "ios/chrome/browser/ui/suggestions/suggestions_commands.h" | 7 #import "ios/chrome/browser/ui/suggestions/suggestions_commands.h" |
8 #import "ios/chrome/browser/ui/suggestions/suggestions_view_controller.h" | 8 #import "ios/chrome/browser/ui/suggestions/suggestions_view_controller.h" |
9 | 9 |
10 #if !defined(__has_feature) || !__has_feature(objc_arc) | 10 #if !defined(__has_feature) || !__has_feature(objc_arc) |
11 #error "This file requires ARC support." | 11 #error "This file requires ARC support." |
12 #endif | 12 #endif |
13 | 13 |
14 @interface SCSuggestionsCoordinator ()<SuggestionsCommands> | 14 @interface SCSuggestionsCoordinator ()<SuggestionsCommands> |
15 | 15 |
| 16 @property(nonatomic, strong) |
| 17 SuggestionsViewController* suggestionViewController; |
| 18 |
16 @end | 19 @end |
17 | 20 |
18 @implementation SCSuggestionsCoordinator | 21 @implementation SCSuggestionsCoordinator |
19 | 22 |
20 @synthesize baseViewController; | 23 @synthesize baseViewController; |
| 24 @synthesize suggestionViewController = _suggestionViewController; |
21 | 25 |
22 #pragma mark - Coordinator | 26 #pragma mark - Coordinator |
23 | 27 |
24 - (void)start { | 28 - (void)start { |
25 SuggestionsViewController* suggestion = [[SuggestionsViewController alloc] | 29 _suggestionViewController = [[SuggestionsViewController alloc] |
26 initWithStyle:CollectionViewControllerStyleDefault]; | 30 initWithStyle:CollectionViewControllerStyleDefault]; |
27 | 31 |
28 suggestion.suggestionCommandHandler = self; | 32 _suggestionViewController.suggestionCommandHandler = self; |
29 | 33 |
30 [self.baseViewController pushViewController:suggestion animated:YES]; | 34 [self.baseViewController pushViewController:_suggestionViewController |
| 35 animated:YES]; |
31 } | 36 } |
32 | 37 |
33 #pragma mark - SuggestionsCommands | 38 #pragma mark - SuggestionsCommands |
34 | 39 |
35 - (void)addEmptyItem { | 40 - (void)addEmptyItem { |
| 41 [self.suggestionViewController addTextItem:@"Button clicked" |
| 42 subtitle:@"Item Added!" |
| 43 toSection:5]; |
36 } | 44 } |
37 | 45 |
38 @end | 46 @end |
OLD | NEW |