|
| 1 | +/* |
| 2 | + Copyright 2016-present Google Inc. All Rights Reserved. |
| 3 | +
|
| 4 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + you may not use this file except in compliance with the License. |
| 6 | + You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | + Unless required by applicable law or agreed to in writing, software |
| 11 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + See the License for the specific language governing permissions and |
| 14 | + limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +#import <UIKit/UIKit.h> |
| 18 | + |
| 19 | +@class CBCNode; |
| 20 | + |
| 21 | +/** |
| 22 | + An instance of CBCNodeListViewController is able to represent a non-example CBCNode instance as a |
| 23 | + UITableView. |
| 24 | + */ |
| 25 | +@interface CBCNodeListViewController : UITableViewController |
| 26 | + |
| 27 | +/** Initializes a CBCNodeViewController instance with a non-example node. */ |
| 28 | +- (nonnull instancetype)initWithNode:(nonnull CBCNode *)node; |
| 29 | + |
| 30 | +/** The node that this view controller must represent. */ |
| 31 | +@property(nonatomic, strong, nonnull, readonly) CBCNode *node; |
| 32 | + |
| 33 | +@end |
| 34 | + |
| 35 | +/** |
| 36 | + Returns the root of a CBCNode tree representing the complete catalog navigation hierarchy. |
| 37 | +
|
| 38 | + Only classes that implement +catalogBreadcrumbs and return at least one breadcrumb will be part of |
| 39 | + the tree. |
| 40 | + */ |
| 41 | +FOUNDATION_EXTERN CBCNode *__nonnull CBCCreateNavigationTree(void); |
| 42 | + |
| 43 | +/** |
| 44 | + A node describes a single navigable page in the Catalog by Convention. |
| 45 | +
|
| 46 | + A node either has children or it is an example. |
| 47 | +
|
| 48 | + - If a node has children, then the node should be represented by a list of some sort. |
| 49 | + - If a node is an example, then the example controller can be instantiated with |
| 50 | + createExampleViewController. |
| 51 | + */ |
| 52 | +@interface CBCNode : NSObject |
| 53 | + |
| 54 | +/** Nodes cannot be created by clients. */ |
| 55 | +- (nullable instancetype)init NS_UNAVAILABLE; |
| 56 | + |
| 57 | +/** The title for this node. */ |
| 58 | +@property(nonatomic, copy, nonnull, readonly) NSString *title; |
| 59 | + |
| 60 | +/** The children of this node. */ |
| 61 | +@property(nonatomic, strong, nonnull, readonly) NSArray<CBCNode *> *children; |
| 62 | + |
| 63 | +/** Returns YES if this is an example node. */ |
| 64 | +- (BOOL)isExample; |
| 65 | + |
| 66 | +/** Returns an instance of a UIViewController for presentation purposes. */ |
| 67 | +- (nonnull UIViewController *)createExampleViewController; |
| 68 | + |
| 69 | +@end |
0 commit comments