$ npm install react-native-react-arkit --save
$ react-native link react-native-react-arkit
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-react-arkit
and addRNReactArkit.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNReactArkit.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
ie. How to deal with Xcode stuff...
For our app to be able to launch the AR Scene, we need to ask the user for the permission to the phone camera. Before starting the following steps, launch your project on Xcode.
You can do this by, doing the following within the root of your project directory
open ios/<ProjectName>.xcodeproj/
Once the project is open on Xcode, find the Info.plist
file:
Click on one of the +
signs that appear when you hover over a row. Add Privacy - Camera Usage Description
as the key, and This application will use the camera for Augmented Reality.
as the value.
You should be good to go!
Since React-Native apps are by default Obj-c apps, we need to tell Xcode what Swift compiler to use for our Swift files. The easiest way to do this is to simply add a blank .swift
file into the project.
File > New > File... >
This prompt should show up:
Make sure Swift File is selected. Press Next. Give the file an arbitrary name, or keep the default File.swift
. In the next prompt you can choose not to create the Bridging Header file.
That's it!