OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/showcase/suggestions/suggestions_coordinator.h" |
| 6 |
| 7 #import "ios/chrome/browser/ui/suggestions/suggestions_data_source.h" |
| 8 #import "ios/third_party/material_components_ios/src/components/Collections/src/
MaterialCollections.h" |
| 9 |
| 10 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 11 #error "This file requires ARC support." |
| 12 #endif |
| 13 |
| 14 @implementation SuggestionsCoordinator { |
| 15 SuggestionsDataSource* _dataSource; |
| 16 } |
| 17 |
| 18 @synthesize baseViewController; |
| 19 |
| 20 #pragma mark - Coordinator |
| 21 |
| 22 - (void)start { |
| 23 SuggestionsViewController* suggestion = [[SuggestionsViewController alloc] |
| 24 initWithStyle:CollectionViewControllerStyleDefault]; |
| 25 |
| 26 _dataSource = [[SuggestionsDataSource alloc] init]; |
| 27 _dataSource.collectionViewController = suggestion; |
| 28 |
| 29 suggestion.dataSourceDelegate = _dataSource; |
| 30 suggestion.actionsDelegate = self; |
| 31 |
| 32 [self.baseViewController pushViewController:suggestion animated:YES]; |
| 33 } |
| 34 |
| 35 #pragma mark - SuggestionsActions |
| 36 |
| 37 - (void)addItem { |
| 38 [_dataSource addTextItem:@"Button clicked" |
| 39 subtitle:@"Item Added!" |
| 40 toSection:0]; |
| 41 } |
| 42 |
| 43 @end |
OLD | NEW |