DemoData.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Copyright 2016 Google LLC. All rights reserved.
  3. *
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
  6. * file except in compliance with the License. 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 distributed under
  11. * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  12. * ANY KIND, either express or implied. See the License for the specific language governing
  13. * permissions and limitations under the License.
  14. */
  15. #import <UIKit/UIKit.h>
  16. #import <GooglePlaces/GooglePlaces.h>
  17. /*
  18. * This file contains a set of data objects which represent the list of demos which are provided by
  19. * this sample app.
  20. */
  21. /**
  22. * Represents a specific demo sample, stores the title and the name of the view controller which
  23. * contains the demo code.
  24. */
  25. @interface Demo : NSObject
  26. /**
  27. * The title of the demo. This is displayed in the list of demos.
  28. */
  29. @property(nonatomic, readonly) NSString *title;
  30. /**
  31. * Construct a |Demo| object with the specified view controller which contains the demo code.
  32. *
  33. * @param viewControllerClass The class of the view controller to display when the demo is selected
  34. * from the list.
  35. */
  36. - (instancetype)initWithViewControllerClass:(Class)viewControllerClass;
  37. /**
  38. * Construct and return a new UIViewController instance which contains the view to present when the
  39. * demo is selected from the list.
  40. *
  41. * @param autocompleteFilter The |GMSAutocompleteFilter| that filters on types and countries.
  42. * @param placeField The |GMSPlaceField| to request individual fields for the |GMSPlace| result.
  43. */
  44. - (UIViewController *)createViewControllerWithAutocompleteFilter:
  45. (GMSAutocompleteFilter *)autocompleteFilter
  46. placeFields:(GMSPlaceField)placeField;
  47. @end
  48. /**
  49. * A group of demos which comprise a section in the list of demos.
  50. */
  51. @interface DemoSection : NSObject
  52. /**
  53. * The title of the section.
  54. */
  55. @property(nonatomic, readonly) NSString *title;
  56. /**
  57. * The list of demos which are contained in the section.
  58. */
  59. @property(nonatomic, readonly) NSArray<Demo *> *demos;
  60. /**
  61. * Initialise a |DemoSection| with the specified title and list of demos.
  62. *
  63. * @param title The title of the section.
  64. * @param demos The demos contained in the section.
  65. */
  66. - (instancetype)initWithTitle:(NSString *)title demos:(NSArray<Demo *> *)demos;
  67. @end
  68. /**
  69. * A class which encapsulates the data required to create and display demos.
  70. */
  71. @interface DemoData : NSObject
  72. /**
  73. * A list of sections to display.
  74. */
  75. @property(nonatomic, readonly) NSArray<DemoSection *> *sections;
  76. /**
  77. * The first demo to display when launched in side-by-side mode.
  78. */
  79. @property(nonatomic, readonly) Demo *firstDemo;
  80. @end