Initial commit 🎉
fbshipit-source-id: b6fc29740c6875d2e78953b8a7123890a67930f2 Co-authored-by: Sebastian McKenzie <sebmck@fb.com> Co-authored-by: John Knox <jknox@fb.com> Co-authored-by: Emil Sjölander <emilsj@fb.com> Co-authored-by: Pritesh Nandgaonkar <prit91@fb.com>
This commit is contained in:
53
iOS/Sample/AppDelegate.mm
Normal file
53
iOS/Sample/AppDelegate.mm
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
#import "AppDelegate.h"
|
||||
|
||||
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
|
||||
#import <SonarKit/SonarClient.h>
|
||||
#import <SonarKitLayoutComponentKitSupport/SonarKitLayoutComponentKitSupport.h>
|
||||
#import <SonarKitLayoutPlugin/SonarKitLayoutPlugin.h>
|
||||
#import <SonarKitNetworkPlugin/SonarKitNetworkPlugin.h>
|
||||
|
||||
#import "MainViewController.h"
|
||||
#import "RootViewController.h"
|
||||
|
||||
#if !FB_SONARKIT_ENABLED
|
||||
#error "Sample need to be run with SonarKit enabled in order to properly interact with Sonar. SonarKit is enabled by default if its a debug build."
|
||||
#endif
|
||||
|
||||
@implementation AppDelegate {
|
||||
UIWindow *_window;
|
||||
}
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
_window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||||
|
||||
SonarClient *client = [SonarClient sharedClient];
|
||||
|
||||
SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
|
||||
[SonarKitLayoutComponentKitSupport setUpWithDescriptorMapper: layoutDescriptorMapper];
|
||||
[client addPlugin: [[SonarKitLayoutPlugin alloc] initWithRootNode: application
|
||||
withDescriptorMapper: layoutDescriptorMapper]];
|
||||
|
||||
[[SonarClient sharedClient] addPlugin: [[SonarKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
|
||||
[[SonarClient sharedClient] start];
|
||||
|
||||
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryBoard" bundle:nil];
|
||||
MainViewController *mainViewController = [storyboard instantiateViewControllerWithIdentifier:@"MainViewController"];
|
||||
|
||||
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController: mainViewController];
|
||||
navigationController.navigationBar.topItem.title = @"Sample";
|
||||
navigationController.navigationBar.translucent = NO;
|
||||
|
||||
[_window setRootViewController: [[UINavigationController alloc] initWithRootViewController: mainViewController]];
|
||||
[_window makeKeyAndVisible];
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user