1.1.2 • Published 7 years ago
@johndhammcodes/react-native-swift-library-template v1.1.2
react-native-swift-library-template
Getting started
$ npm install react-native-swift-library-template --save
Mostly automatic installation
$ react-native link react-native-swift-library-template
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜react-native-swift-library-templateand addRNSwiftLibraryTemplate.xcodeproj - In XCode, in the project navigator, select your project. Add
libRNSwiftLibraryTemplate.ato your project'sBuild Phases➜Link Binary With Libraries - Run your project (
Cmd+R)<
Android
- Open up
android/app/src/main/java/[...]/MainApplication.java
- Add
import com.reactlibrary.RNSwiftLibraryTemplatePackage;to the imports at the top of the file - Add
new RNSwiftLibraryTemplatePackage()to the list returned by thegetPackages()method
- Append the following lines to
android/settings.gradle:include ':react-native-swift-library-template' project(':react-native-swift-library-template').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-swift-library-template/android') - Insert the following lines inside the dependencies block in
android/app/build.gradle:compile project(':react-native-swift-library-template')
Windows
- In Visual Studio add the
RNSwiftLibraryTemplate.slninnode_modules/react-native-swift-library-template/windows/RNSwiftLibraryTemplate.slnfolder to their solution, reference from their app. - Open up your
MainPage.csapp
- Add
using Swift.Library.Template.RNSwiftLibraryTemplate;to the usings at the top of the file - Add
new RNSwiftLibraryTemplatePackage()to theList<IReactPackage>returned by thePackagesmethod
Usage
import RNSwiftLibraryTemplate from 'react-native-swift-library-template';
// TODO: What to do with the module?
RNSwiftLibraryTemplate;