Files
flipper/iOS/Sample/AppDelegate.mm
Pritesh Nandgaonkar 10dc4d0ca9 Change the mention of Sonar in iOS sample app
Summary: Update the iOS sample app with flipper

Reviewed By: passy

Differential Revision: D9056882

fbshipit-source-id: f5b49fc60905c6d5ebca3da977cf966e76feffb8
2018-07-31 14:02:58 -07:00

56 lines
2.2 KiB
Plaintext

/*
* 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 <SonarKit/SonarClient.h>
#import <SonarKitLayoutPlugin/SonarKitLayoutPlugin.h>
#import <SonarKitNetworkPlugin/SonarKitNetworkPlugin.h>
#import <SonarKitLayoutComponentKitSupport/SonarKitLayoutComponentKitSupport.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.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]]];
[client 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];
NSLog(@"Hello from Flipper in an Objc app!");
return YES;
}
@end