Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: ios/showcase/suggestions/sc_suggestions_coordinator.mm

Issue 2619963004: Suggestions UI - Add Data Source and Item (Closed)
Patch Set: Cleanup Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_data_source.h"
8 #import "ios/chrome/browser/ui/suggestions/suggestions_view_controller.h" 9 #import "ios/chrome/browser/ui/suggestions/suggestions_view_controller.h"
9 10
10 #if !defined(__has_feature) || !__has_feature(objc_arc) 11 #if !defined(__has_feature) || !__has_feature(objc_arc)
11 #error "This file requires ARC support." 12 #error "This file requires ARC support."
12 #endif 13 #endif
13 14
14 @interface SCSuggestionsCoordinator ()<SuggestionsCommands> 15 @interface SCSuggestionsCoordinator ()<SuggestionsCommands> {
16 SuggestionsDataSource* _dataSource;
17 }
15 18
16 @end 19 @end
17 20
18 @implementation SCSuggestionsCoordinator 21 @implementation SCSuggestionsCoordinator
19
20 @synthesize baseViewController; 22 @synthesize baseViewController;
21 23
22 #pragma mark - Coordinator 24 #pragma mark - Coordinator
23 25
24 - (void)start { 26 - (void)start {
25 SuggestionsViewController* suggestion = [[SuggestionsViewController alloc] 27 SuggestionsViewController* suggestion = [[SuggestionsViewController alloc]
26 initWithStyle:CollectionViewControllerStyleDefault]; 28 initWithStyle:CollectionViewControllerStyleDefault];
27 29
30 _dataSource = [[SuggestionsDataSource alloc] init];
31 _dataSource.collectionViewController = suggestion;
lpromero 2017/01/11 09:47:05 Since you set the collectionviewcontroller here, w
gambard 2017/01/11 15:10:38 Done.
32
28 suggestion.suggestionCommandHandler = self; 33 suggestion.suggestionCommandHandler = self;
29 34
30 [self.baseViewController pushViewController:suggestion animated:YES]; 35 [self.baseViewController pushViewController:suggestion animated:YES];
31 } 36 }
32 37
33 #pragma mark - SuggestionsCommands 38 #pragma mark - SuggestionsCommands
34 39
35 - (void)addEmptyItem { 40 - (void)addEmptyItem {
41 [_dataSource addTextItem:@"Button clicked"
42 subtitle:@"Item Added!"
43 toSection:0];
36 } 44 }
37 45
38 @end 46 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698