Docs with an updated install instruction (#343)

Summary:
This PR updates the installation instruction. It missed few crucial information and thus the projects installing flipper as a dependency were facing issues. It addresses the issue #341. It also brings the sample application at par with the documentation.
Pull Request resolved: https://github.com/facebook/flipper/pull/343

Reviewed By: danielbuechele

Differential Revision: D13507298

Pulled By: priteshrnandgaonkar

fbshipit-source-id: 5a4b23d79930cb7eeb491e359b616d3558e260fb
This commit is contained in:
Pritesh Nandgaonkar
2018-12-21 07:38:35 -08:00
committed by Facebook Github Bot
parent 470c770e97
commit da37ab78bd
6 changed files with 232 additions and 53 deletions

59
iOS/Sample/AppDelegate.m Normal file
View File

@@ -0,0 +1,59 @@
/*
* 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 <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitLayoutComponentKitSupport/FlipperKitLayoutComponentKitSupport.h>
#import <FlipperKitExamplePlugin/FlipperKitExamplePlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.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]];
FlipperClient *client = [FlipperClient sharedClient];
SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
[FlipperKitLayoutComponentKitSupport setUpWithDescriptorMapper: layoutDescriptorMapper];
[client addPlugin: [[FlipperKitLayoutPlugin alloc] initWithRootNode: application
withDescriptorMapper: layoutDescriptorMapper]];
[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
[[FlipperClient sharedClient] addPlugin: [[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
[client addPlugin:[FlipperKitExamplePlugin sharedInstance]];
[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