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/core/app_delegate.h" |
| 6 |
| 7 #import "ios/showcase/core/showcase_model.h" |
| 8 #import "ios/showcase/core/showcase_view_controller.h" |
| 9 |
| 10 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 11 #error "This file requires ARC support." |
| 12 #endif |
| 13 |
| 14 @implementation AppDelegate |
| 15 @synthesize window = _window; |
| 16 |
| 17 - (BOOL)application:(UIApplication*)application |
| 18 didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { |
| 19 // Override point for customization after application launch. |
| 20 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; |
| 21 ShowcaseViewController* viewController = |
| 22 [[ShowcaseViewController alloc] initWithRows:[self rowsToDisplay]]; |
| 23 UINavigationController* navigationController = [[UINavigationController alloc] |
| 24 initWithRootViewController:viewController]; |
| 25 self.window.rootViewController = navigationController; |
| 26 [self.window makeKeyAndVisible]; |
| 27 return YES; |
| 28 } |
| 29 |
| 30 #pragma mark - Private |
| 31 |
| 32 // Creates model data to display in the view controller. |
| 33 - (NSArray<showcase::ModelRow*>*)rowsToDisplay { |
| 34 NSArray<showcase::ModelRow*>* rows = [ShowcaseModel model]; |
| 35 NSSortDescriptor* sortDescriptor = |
| 36 [NSSortDescriptor sortDescriptorWithKey:showcase::kClassForDisplayKey |
| 37 ascending:YES]; |
| 38 return [rows sortedArrayUsingDescriptors:@[ sortDescriptor ]]; |
| 39 } |
| 40 |
| 41 @end |
OLD | NEW |