DemoData.h 2.82 KB
Newer Older
Julio Hermosa committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
/*
 * Copyright 2016 Google Inc. All rights reserved.
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
 * file except in compliance with the License. You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
 * ANY KIND, either express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */

#import <UIKit/UIKit.h>

#import <GooglePlaces/GooglePlaces.h>

/*
 * This file contains a set of data objects which represent the list of demos which are provided by
 * this sample app.
 */

/**
 * Represents a specific demo sample, stores the title and the name of the view controller which
 * contains the demo code.
 */
@interface Demo : NSObject

/**
 * The title of the demo. This is displayed in the list of demos.
 */
@property(nonatomic, readonly) NSString *title;

/**
 * Construct a |Demo| object with the specified view controller which contains the demo code.
 *
 * @param viewControllerClass The class of the view controller to display when the demo is selected
 * from the list.
 */
- (instancetype)initWithViewControllerClass:(Class)viewControllerClass;

/**
 * Construct and return a new UIViewController instance which contains the view to present when the
 * demo is selected from the list.
 *
 * @param autocompleteFilter The |GMSAutocompleteFilter| that filters on types and countries.
 * @param placeField The |GMSPlaceField| to request individual fields for the |GMSPlace| result.
 */
- (UIViewController *)createViewControllerWithAutocompleteFilter:
                          (GMSAutocompleteFilter *)autocompleteFilter
                                                     placeFields:(GMSPlaceField)placeField;

@end

/**
 * A group of demos which comprise a section in the list of demos.
 */
@interface DemoSection : NSObject

/**
 * The title of the section.
 */
@property(nonatomic, readonly) NSString *title;

/**
 * The list of demos which are contained in the section.
 */
@property(nonatomic, readonly) NSArray<Demo *> *demos;

/**
 * Initialise a |DemoSection| with the specified title and list of demos.
 *
 * @param title The title of the section.
 * @param demos The demos contained in the section.
 */
- (instancetype)initWithTitle:(NSString *)title demos:(NSArray<Demo *> *)demos;

@end

/**
 * A class which encapsulates the data required to create and display demos.
 */
@interface DemoData : NSObject

/**
 * A list of sections to display.
 */
@property(nonatomic, readonly) NSArray<DemoSection *> *sections;

/**
 * The first demo to display when launched in side-by-side mode.
 */
@property(nonatomic, readonly) Demo *firstDemo;

@end