-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSweeprReactViewController.swift
More file actions
49 lines (36 loc) · 1.21 KB
/
Copy pathSweeprReactViewController.swift
File metadata and controls
49 lines (36 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// SweeprReactViewController.swift
// ReactTest
//
// Created by Eoin Norris on 18/06/2019.
// Copyright © 2019 Eoin Norris. All rights reserved.
//
import UIKit
import React
import Sweepr
// needs to be global or it will reload on every segue.
var embededRootView:RCTRootView?
class SweeprReactViewController: UIViewController {
var sweeprCloud:SweeprCloud?
override func viewDidLoad() {
super.viewDidLoad()
self.tabBarController?.tabBar.isHidden = true
let jsCodeLocation = RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index.ios", fallbackResource: nil)
// you can set this to false if you want to use the menu
let embedData = ["isEmbedded": true]
if (embededRootView == nil) {
if let rootView = RCTRootView(
bundleURL: jsCodeLocation,
moduleName: "App",
initialProperties: embedData as [NSObject : Any],
launchOptions: nil
) {
embededRootView = rootView
}
}
self.view = embededRootView
}
override func viewDidDisappear(_ animated: Bool) {
self.view = nil;
}
}