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

Unified Diff: ios/showcase/core/app_delegate.mm

Issue 2592593003: Upstream ios/showcase source code. (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/showcase/core/app_delegate.h ('k') | ios/showcase/core/main.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/showcase/core/app_delegate.mm
diff --git a/ios/showcase/core/app_delegate.mm b/ios/showcase/core/app_delegate.mm
new file mode 100644
index 0000000000000000000000000000000000000000..788d4a773a083501095d7eb237f081da7aada7e1
--- /dev/null
+++ b/ios/showcase/core/app_delegate.mm
@@ -0,0 +1,41 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/showcase/core/app_delegate.h"
+
+#import "ios/showcase/core/showcase_model.h"
+#import "ios/showcase/core/showcase_view_controller.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+@implementation AppDelegate
+@synthesize window = _window;
+
+- (BOOL)application:(UIApplication*)application
+ didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
+ // Override point for customization after application launch.
+ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ ShowcaseViewController* viewController =
+ [[ShowcaseViewController alloc] initWithRows:[self rowsToDisplay]];
+ UINavigationController* navigationController = [[UINavigationController alloc]
+ initWithRootViewController:viewController];
+ self.window.rootViewController = navigationController;
+ [self.window makeKeyAndVisible];
+ return YES;
+}
+
+#pragma mark - Private
+
+// Creates model data to display in the view controller.
+- (NSArray<showcase::ModelRow*>*)rowsToDisplay {
+ NSArray<showcase::ModelRow*>* rows = [ShowcaseModel model];
+ NSSortDescriptor* sortDescriptor =
+ [NSSortDescriptor sortDescriptorWithKey:showcase::kClassForDisplayKey
+ ascending:YES];
+ return [rows sortedArrayUsingDescriptors:@[ sortDescriptor ]];
+}
+
+@end
« no previous file with comments | « ios/showcase/core/app_delegate.h ('k') | ios/showcase/core/main.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698