├── .github └── workflows │ ├── archive-platform │ └── action.yml │ ├── bundle-xcframeworks │ └── action.yml │ ├── ci.yml │ ├── codeql-analysis.yml │ ├── release.yml │ └── setup │ └── action.yml ├── .gitignore ├── Makefile ├── README.md ├── example ├── .gitignore ├── Makefile ├── Podfile ├── Podfile.lock ├── README.md ├── Targets │ ├── ReactNativeBinaryExample │ │ ├── Resources │ │ │ └── LaunchScreen.storyboard │ │ ├── Sources │ │ │ └── AppDelegate.swift │ │ └── Tests │ │ │ └── AppTests.swift │ ├── ReactNativeBinaryExampleKit │ │ ├── Sources │ │ │ └── ReactNativeBinaryExampleKit.swift │ │ └── Tests │ │ │ └── ReactNativeBinaryExampleKitTests.swift │ └── ReactNativeBinaryExampleUI │ │ ├── Sources │ │ ├── MainViewController.swift │ │ ├── ReactNativeBinaryExampleUI.swift │ │ └── generated │ │ │ └── .keep │ │ └── Tests │ │ └── ReactNativeBinaryExampleUITests.swift ├── project.yml └── scripts │ ├── metro.config.js │ ├── package-lock.json │ ├── package.json │ ├── src │ ├── Hello.tsx │ └── index.js │ └── tsconfig.json ├── frontend └── .gitignore ├── ios ├── .gitignore ├── .xcode.env ├── Brewfile ├── DummyApp │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── DummyApp.entitlements │ ├── Info.plist │ ├── PrivacyInfo.xcprivacy │ └── main.m ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── Makefile ├── Podfile ├── Podfile.lock ├── PrivacyInfo.xcprivacy ├── ReactNative-Binary.podspec ├── project.yml ├── scripts │ ├── build_single_platform.sh │ ├── build_xcframework.sh │ ├── release.sh │ ├── release_commit_podspec.sh │ ├── set_up_xcode_env.sh │ ├── shared │ │ └── get_release_branch_version.sh │ └── validate_archive_size.sh └── xcconfig │ ├── DummyApp.debug.xcconfig │ ├── DummyApp.release.xcconfig │ └── DummyApp.xcconfig ├── package-lock.json └── package.json /.github/workflows/archive-platform/action.yml: -------------------------------------------------------------------------------- 1 | name: "Archive Platform" 2 | description: "Xcode Archive single platform" 3 | inputs: 4 | platform: 5 | description: "Apple platform, either iphonesimulator, iphoneos, or maccatalyst" 6 | required: true 7 | runs: 8 | using: "composite" 9 | steps: 10 | - uses: ./.github/workflows/setup 11 | name: Setup 12 | 13 | - name: Archive 14 | shell: bash 15 | run: | 16 | cd ios 17 | echo "before compile:" 18 | ccache --show-stats -v 19 | make CONFIGURATION="Debug" PLATFORM="${{ inputs.platform }}" archive-platform 20 | make CONFIGURATION="Release" PLATFORM="${{ inputs.platform }}" archive-platform 21 | echo "ccache stats:" 22 | ccache --show-stats -v 23 | 24 | - name: Upload to artifacts 25 | uses: actions/upload-artifact@v2 26 | with: 27 | name: "${{ inputs.platform }}-binary-Debug" 28 | path: "ios/${{ inputs.platform }}-binary-Debug.tar.gz" 29 | 30 | - name: Upload to artifacts 31 | uses: actions/upload-artifact@v2 32 | with: 33 | name: "${{ inputs.platform }}-binary-Release" 34 | path: "ios/${{ inputs.platform }}-binary-Release.tar.gz" 35 | -------------------------------------------------------------------------------- /.github/workflows/bundle-xcframeworks/action.yml: -------------------------------------------------------------------------------- 1 | name: "Archive" 2 | description: "Generate xcframeworks" 3 | runs: 4 | using: "composite" 5 | steps: 6 | - uses: ./.github/workflows/setup 7 | name: Set up 8 | - uses: actions/download-artifact@v3 9 | name: "Download Debug (iphoneos)" 10 | with: 11 | name: "iphoneos-binary-Debug" 12 | path: ./ios/iphoneos-binary-Debug 13 | - uses: actions/download-artifact@v3 14 | name: "Download Release (iphoneos)" 15 | with: 16 | name: "iphoneos-binary-Release" 17 | path: ./ios/iphoneos-binary-Release 18 | - uses: actions/download-artifact@v3 19 | name: "Download Debug (maccatalyst)" 20 | with: 21 | name: "maccatalyst-binary-Debug" 22 | path: ./ios/maccatalyst-binary-Debug 23 | - uses: actions/download-artifact@v3 24 | name: "Download Release (maccatalyst)" 25 | with: 26 | name: "maccatalyst-binary-Release" 27 | path: ./ios/maccatalyst-binary-Release 28 | - uses: actions/download-artifact@v3 29 | name: "Download Debug (iphonesimulator)" 30 | with: 31 | name: "iphonesimulator-binary-Debug" 32 | path: ./ios/iphonesimulator-binary-Debug 33 | - uses: actions/download-artifact@v3 34 | name: "Download Release (iphonesimulator)" 35 | with: 36 | name: "iphonesimulator-binary-Release" 37 | path: ./ios/iphonesimulator-binary-Release 38 | - name: "Move archives" 39 | shell: bash 40 | run: | 41 | cd ios 42 | mv ./iphoneos-binary-Debug/iphoneos-binary-Debug.tar.gz . 43 | mv ./iphoneos-binary-Release/iphoneos-binary-Release.tar.gz . 44 | mv ./maccatalyst-binary-Debug/maccatalyst-binary-Debug.tar.gz . 45 | mv ./maccatalyst-binary-Release/maccatalyst-binary-Release.tar.gz . 46 | mv ./iphonesimulator-binary-Debug/iphonesimulator-binary-Debug.tar.gz . 47 | mv ./iphonesimulator-binary-Release/iphonesimulator-binary-Release.tar.gz . 48 | - name: "Merge archives into xcframeworks" 49 | shell: bash 50 | run: | 51 | cd ios 52 | CONFIGURATION=Debug make build-xcframework 53 | CONFIGURATION=Release make build-xcframework 54 | 55 | - name: "Validate file size" 56 | shell: bash 57 | run: | 58 | cd ios 59 | make FILE_PATH=./ReactNative-binary-Debug.tar.gz validate-archive 60 | make FILE_PATH=./ReactNative-binary-Release.tar.gz validate-archive 61 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | branches: ["main"] 6 | pull_request: 7 | branches: ["main"] 8 | 9 | jobs: 10 | build-matrix: 11 | runs-on: macos-14 12 | env: 13 | CCACHE_DIR: ~/.ccache 14 | strategy: 15 | matrix: 16 | platform: 17 | - iphonesimulator 18 | - iphoneos 19 | - maccatalyst 20 | steps: 21 | - name: Checkout 22 | uses: actions/checkout@v3 23 | - uses: ./.github/workflows/archive-platform 24 | name: Set up and Archive 25 | with: 26 | platform: ${{ matrix.platform }} 27 | 28 | create-xcframework-archives: 29 | name: "Create xcframeworks" 30 | runs-on: macos-14 31 | env: 32 | CCACHE_DIR: ~/.ccache 33 | needs: 34 | - build-matrix 35 | steps: 36 | - name: Checkout 37 | uses: actions/checkout@v3 38 | 39 | - uses: ./.github/workflows/bundle-xcframeworks 40 | name: Set up and Build xcframework Archive 41 | 42 | build-example-project: 43 | name: "Build the example project" 44 | runs-on: macos-14 45 | env: 46 | CCACHE_DIR: ~/.ccache 47 | steps: 48 | - name: Checkout 49 | uses: actions/checkout@v3 50 | 51 | - name: Brew install xcodegen 52 | run: brew install xcodegen 53 | shell: bash 54 | 55 | - name: Build the example project 56 | run: | 57 | cd example 58 | make install 59 | make bundle 60 | make gen 61 | make build 62 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ "main" ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ "main" ] 20 | schedule: 21 | - cron: '25 19 * * 5' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [ 'javascript', 'ruby' ] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] 37 | # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support 38 | 39 | steps: 40 | - name: Checkout repository 41 | uses: actions/checkout@v3 42 | 43 | # Initializes the CodeQL tools for scanning. 44 | - name: Initialize CodeQL 45 | uses: github/codeql-action/init@v2 46 | with: 47 | languages: ${{ matrix.language }} 48 | # If you wish to specify custom queries, you can do so here or in a config file. 49 | # By default, queries listed here will override any specified in a config file. 50 | # Prefix the list here with "+" to use these queries and those in the config file. 51 | 52 | # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs 53 | # queries: security-extended,security-and-quality 54 | 55 | 56 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 57 | # If this step fails, then you should remove it and run the build manually (see below) 58 | - name: Autobuild 59 | uses: github/codeql-action/autobuild@v2 60 | 61 | # ℹ️ Command-line programs to run using the OS shell. 62 | # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun 63 | 64 | # If the Autobuild fails above, remove it and uncomment the following three lines. 65 | # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. 66 | 67 | # - run: | 68 | # echo "Run, Build Application using script" 69 | # ./location_of_script_within_repo/buildscript.sh 70 | 71 | - name: Perform CodeQL Analysis 72 | uses: github/codeql-action/analyze@v2 73 | with: 74 | category: "/language:${{matrix.language}}" 75 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | branches: 6 | - "releases/**" 7 | jobs: 8 | build-matrix: 9 | runs-on: macos-14 10 | env: 11 | CCACHE_DIR: ~/.ccache 12 | strategy: 13 | matrix: 14 | platform: 15 | - iphonesimulator 16 | - iphoneos 17 | - maccatalyst 18 | steps: 19 | - name: Checkout 20 | uses: actions/checkout@v3 21 | - uses: ./.github/workflows/archive-platform 22 | name: Set up and Archive 23 | with: 24 | platform: ${{ matrix.platform }} 25 | 26 | publish-cocoapods: 27 | name: "Create Xcframeworks and Publish to CocoaPods" 28 | runs-on: macos-14 29 | needs: 30 | - build-matrix 31 | if: "!contains(github.event.commits[0].message, '[skip ci]')" 32 | # TODO: Investigate whether we can remove this if condition because of: 33 | # 34 | steps: 35 | - name: Checkout 36 | uses: actions/checkout@v3 37 | with: 38 | token: ${{ secrets.PAT }} 39 | - uses: ./.github/workflows/bundle-xcframeworks 40 | name: Set up and Build xcframeworks 41 | - name: "Run release script" 42 | shell: bash 43 | env: 44 | GH_TOKEN: ${{secrets.GITHUB_TOKEN}} 45 | BRANCH_NAME: ${{ github.head_ref || github.ref_name }} 46 | run: | 47 | cd ios 48 | make release 49 | - name: "Publish to CocoaPods" 50 | shell: bash 51 | env: 52 | COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} 53 | run: | 54 | cd ios 55 | make publish 56 | -------------------------------------------------------------------------------- /.github/workflows/setup/action.yml: -------------------------------------------------------------------------------- 1 | name: "Project Setup" 2 | description: "Install dependencies" 3 | inputs: 4 | platform: 5 | description: "Apple platform, either iphonesimulator, iphoneos, or maccatalyst" 6 | required: true 7 | runs: 8 | using: "composite" 9 | steps: 10 | # - name: Set Xcode version 11 | # shell: bash 12 | # run: | 13 | # sudo xcode-select -s "/Applications/Xcode_14.3.1.app" 14 | - name: Show CI arch 15 | run: arch 16 | shell: bash 17 | 18 | - name: Brew install 19 | run: make brew-install 20 | shell: bash 21 | 22 | - uses: actions/cache@v3 23 | with: 24 | path: ~/.ccache 25 | key: ${{ runner.os }}-${{inputs.platform}}-ccache-${{ hashFiles('package-lock.json') }} 26 | restore-keys: | 27 | ${{ runner.os }}-${{inputs.platform}}-ccache-dir 28 | 29 | - uses: maxim-lobanov/setup-xcode@v1 30 | with: 31 | xcode-version: latest-stable 32 | 33 | - name: Prepare 34 | shell: bash 35 | run: | 36 | cd ios 37 | make prepare 38 | - name: "Generate Xcode project" 39 | shell: bash 40 | run: | 41 | pushd ios 42 | make gen 43 | popd 44 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### Generated by gibo (https://github.com/simonwhitaker/gibo) 2 | ### https://raw.github.com/github/gitignore/4488915eec0b3a45b5c63ead28f286819c0917de/Node.gitignore 3 | 4 | # Logs 5 | logs 6 | *.log 7 | npm-debug.log* 8 | yarn-debug.log* 9 | yarn-error.log* 10 | lerna-debug.log* 11 | .pnpm-debug.log* 12 | 13 | # Diagnostic reports (https://nodejs.org/api/report.html) 14 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 15 | 16 | # Runtime data 17 | pids 18 | *.pid 19 | *.seed 20 | *.pid.lock 21 | 22 | # Directory for instrumented libs generated by jscoverage/JSCover 23 | lib-cov 24 | 25 | # Coverage directory used by tools like istanbul 26 | coverage 27 | *.lcov 28 | 29 | # nyc test coverage 30 | .nyc_output 31 | 32 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 33 | .grunt 34 | 35 | # Bower dependency directory (https://bower.io/) 36 | bower_components 37 | 38 | # node-waf configuration 39 | .lock-wscript 40 | 41 | # Compiled binary addons (https://nodejs.org/api/addons.html) 42 | build/Release 43 | 44 | # Dependency directories 45 | node_modules/ 46 | jspm_packages/ 47 | 48 | # Snowpack dependency directory (https://snowpack.dev/) 49 | web_modules/ 50 | 51 | # TypeScript cache 52 | *.tsbuildinfo 53 | 54 | # Optional npm cache directory 55 | .npm 56 | 57 | # Optional eslint cache 58 | .eslintcache 59 | 60 | # Optional stylelint cache 61 | .stylelintcache 62 | 63 | # Microbundle cache 64 | .rpt2_cache/ 65 | .rts2_cache_cjs/ 66 | .rts2_cache_es/ 67 | .rts2_cache_umd/ 68 | 69 | # Optional REPL history 70 | .node_repl_history 71 | 72 | # Output of 'npm pack' 73 | *.tgz 74 | 75 | # Yarn Integrity file 76 | .yarn-integrity 77 | 78 | # dotenv environment variable files 79 | .env 80 | .env.development.local 81 | .env.test.local 82 | .env.production.local 83 | .env.local 84 | 85 | # parcel-bundler cache (https://parceljs.org/) 86 | .cache 87 | .parcel-cache 88 | 89 | # Next.js build output 90 | .next 91 | out 92 | 93 | # Nuxt.js build / generate output 94 | .nuxt 95 | dist 96 | 97 | # Gatsby files 98 | .cache/ 99 | # Comment in the public line in if your project uses Gatsby and not Next.js 100 | # https://nextjs.org/blog/next-9-1#public-directory-support 101 | # public 102 | 103 | # vuepress build output 104 | .vuepress/dist 105 | 106 | # vuepress v2.x temp and cache directory 107 | .temp 108 | .cache 109 | 110 | # Docusaurus cache and generated files 111 | .docusaurus 112 | 113 | # Serverless directories 114 | .serverless/ 115 | 116 | # FuseBox cache 117 | .fusebox/ 118 | 119 | # DynamoDB Local files 120 | .dynamodb/ 121 | 122 | # TernJS port file 123 | .tern-port 124 | 125 | # Stores VSCode versions used for testing VSCode extensions 126 | .vscode-test 127 | 128 | # yarn v2 129 | .yarn/cache 130 | .yarn/unplugged 131 | .yarn/build-state.yml 132 | .yarn/install-state.gz 133 | .pnp.* 134 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | brew-install: 2 | brew bundle install --no-lock --file ios/Brewfile -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ReactNative-Binary 2 | 3 | Pre-built React Native xcframeworks to save the time of humans. 4 | 5 | Features: 6 | 7 | - iOS and Mac Catalyst are both supported with xcframeworks. 8 | - About 1 minute (on M1) is saved for clean build (each CPU/platform target). 9 | - Easy integration without messy Podfile. 10 | 11 | Inspired by . 12 | 13 | ## Project State 14 | 15 | Thanks for your interesting of opening this web page. 16 | I'll be resuming the development of this project soon, probably in a couple of hours. 17 | 18 | ## Get Started 19 | 20 | ### Installation 21 | 22 | #### CocoaPods 23 | 24 | ```rb 25 | pod 'ReactNative-Binary', configuration: 'Release' 26 | pod 'ReactNative-Binary-Debug', configuration: 'Debug' # loading debug support 27 | ``` 28 | 29 | #### Swift Package 30 | 31 | (working in progress) 32 | 33 | ### Code Snippet 34 | 35 | Full example can be found at the [example](https://github.com/imWildCat/ReactNative-Binary/tree/main/example) folder. 36 | 37 | ```swift 38 | import React 39 | import UIKit 40 | 41 | public class ReactNativeBaseVC: UIViewController { 42 | private enum Constants { 43 | static let moduleName = "[ModuleName]" 44 | } 45 | 46 | private lazy var rootView: UIView = RCTAppSetupDefaultRootView(self.bridge, Constants.moduleName, [:]) 47 | private lazy var bridge = RCTBridge(delegate: self, launchOptions: [:]) 48 | 49 | public init() { 50 | super.init(nibName: nil, bundle: nil) 51 | } 52 | 53 | override public func viewDidLoad() { 54 | super.viewDidLoad() 55 | 56 | rootView.translatesAutoresizingMaskIntoConstraints = false 57 | view.addSubview(rootView) 58 | 59 | NSLayoutConstraint.activate([ 60 | rootView.topAnchor.constraint(equalTo: view.topAnchor), 61 | rootView.bottomAnchor.constraint(equalTo: view.bottomAnchor), 62 | rootView.leftAnchor.constraint(equalTo: view.leftAnchor), 63 | rootView.rightAnchor.constraint(equalTo: view.rightAnchor), 64 | ]) 65 | } 66 | } 67 | 68 | extension ReactNativeBaseVC: RCTBridgeDelegate { 69 | public func sourceURL(for _: RCTBridge!) -> URL! { 70 | URL(string: "http://localhost:8081/index.bundle?platform=ios")! // or your local JavaScript bundle file 71 | } 72 | 73 | public func extraModules(for _: RCTBridge!) -> [RCTBridgeModule]! { 74 | [ 75 | RCTDevSettings(), 76 | RCTAsyncLocalStorage(), 77 | RCTRedBox(), 78 | ] 79 | } 80 | } 81 | 82 | 83 | ``` 84 | ([example/Targets/ReactNativeBinaryExampleUI/Sources/MainViewController.swift](example/Targets/ReactNativeBinaryExampleUI/Sources/MainViewController.swift)) 85 | 86 | ## Development 87 | 88 | ## Release Plan 89 | 90 | We're using release branches `releases/[react_native_version]` to track the official release of React Native. 91 | 92 | (working in progress) 93 | 94 | 95 | ## License 96 | 97 | MIT -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | ### macOS ### 2 | # General 3 | .DS_Store 4 | .AppleDouble 5 | .LSOverride 6 | 7 | # Icon must end with two 8 | Icon 9 | 10 | # Thumbnails 11 | ._* 12 | 13 | # Files that might appear in the root of a volume 14 | .DocumentRevisions-V100 15 | .fseventsd 16 | .Spotlight-V100 17 | .TemporaryItems 18 | .Trashes 19 | .VolumeIcon.icns 20 | .com.apple.timemachine.donotpresent 21 | 22 | # Directories potentially created on remote AFP share 23 | .AppleDB 24 | .AppleDesktop 25 | Network Trash Folder 26 | Temporary Items 27 | .apdisk 28 | 29 | ### Xcode ### 30 | # Xcode 31 | # 32 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 33 | 34 | ## User settings 35 | xcuserdata/ 36 | 37 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 38 | *.xcscmblueprint 39 | *.xccheckout 40 | 41 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 42 | build/ 43 | DerivedData/ 44 | *.moved-aside 45 | *.pbxuser 46 | !default.pbxuser 47 | *.mode1v3 48 | !default.mode1v3 49 | *.mode2v3 50 | !default.mode2v3 51 | *.perspectivev3 52 | !default.perspectivev3 53 | 54 | ### Xcode Patch ### 55 | *.xcodeproj/* 56 | !*.xcodeproj/project.pbxproj 57 | !*.xcodeproj/xcshareddata/ 58 | !*.xcworkspace/contents.xcworkspacedata 59 | /*.gcno 60 | 61 | ### Projects ### 62 | *.xcodeproj 63 | *.xcworkspace 64 | 65 | ### Tuist derived files ### 66 | graph.dot 67 | Derived/ 68 | 69 | ### Tuist managed dependencies ### 70 | Tuist/Dependencies 71 | 72 | .build/ 73 | 74 | Targets/ReactNativeBinaryExampleUI/Sources/generated/index.jsbundle 75 | .swiftpm/ 76 | 77 | 78 | Pods 79 | DerivedData 80 | -------------------------------------------------------------------------------- /example/Makefile: -------------------------------------------------------------------------------- 1 | gen: 2 | xcodegen 3 | RCT_NEW_ARCH_ENABLED=0 USE_FRAMEWORKS=dynamic pod install 4 | 5 | bundle: 6 | cd scripts && npm run bundle-ios 7 | 8 | install: 9 | cd scripts && npm install 10 | 11 | open: 12 | xed ReactNativeBinaryExample.xcworkspace 13 | 14 | build: 15 | xcodebuild -workspace ReactNativeBinaryExample.xcworkspace \ 16 | -scheme ReactNativeBinaryExample \ 17 | -destination 'platform=iOS Simulator,name=iPhone 14' \ 18 | CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO \ 19 | | xcbeautify 20 | -------------------------------------------------------------------------------- /example/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | def react_native_binary! 5 | pod 'ReactNative-Binary', configuration: 'Release' 6 | pod 'ReactNative-Binary-Debug', configuration: 'Debug' 7 | end 8 | 9 | target 'ReactNativeBinaryExample' do 10 | # Comment the next line if you don't want to use dynamic frameworks 11 | use_frameworks! 12 | 13 | # Pods for ReactNativeBinaryExample 14 | react_native_binary! 15 | 16 | target 'ReactNativeBinaryExampleKitTests' do 17 | inherit! :search_paths 18 | # Pods for testing 19 | end 20 | 21 | target 'ReactNativeBinaryExampleTests' do 22 | inherit! :search_paths 23 | # Pods for testing 24 | end 25 | 26 | target 'ReactNativeBinaryExampleUITests' do 27 | inherit! :search_paths 28 | # Pods for testing 29 | end 30 | end 31 | 32 | target 'ReactNativeBinaryExampleUI' do 33 | use_frameworks! 34 | 35 | react_native_binary! 36 | end 37 | -------------------------------------------------------------------------------- /example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - ReactNative-Binary (0.70.4): 3 | - ReactNative-Binary/main (= 0.70.4) 4 | - ReactNative-Binary-Debug (0.70.4): 5 | - ReactNative-Binary-Debug/main (= 0.70.4) 6 | - ReactNative-Binary-Debug/main (0.70.4) 7 | - ReactNative-Binary/main (0.70.4) 8 | 9 | DEPENDENCIES: 10 | - ReactNative-Binary 11 | - ReactNative-Binary-Debug 12 | 13 | SPEC REPOS: 14 | trunk: 15 | - ReactNative-Binary 16 | - ReactNative-Binary-Debug 17 | 18 | SPEC CHECKSUMS: 19 | ReactNative-Binary: 758bef6f070a6cf88c1bfd24219d2517f9444ee3 20 | ReactNative-Binary-Debug: 9cac1161c0ae7bb71f05892e27288ad9c7df6886 21 | 22 | PODFILE CHECKSUM: 579562a8fbe29557b89eca7b1527fadb5bd4987a 23 | 24 | COCOAPODS: 1.15.2 25 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # Example App of React Native Binary 2 | 3 | ## Quick Start 4 | 5 | ```shell 6 | # Install Xcode project generator 7 | make tuist-install # Or grab `tuistenv` at: 8 | 9 | # Install node dependencies 10 | make npm install 11 | 12 | # Build JavaScript bundle for React Native 13 | make bundle 14 | 15 | # Generate Xcode project 16 | make gen 17 | 18 | # Open Xcode project 19 | make open 20 | 21 | # (Optional) Build the project using command line 22 | make build 23 | ``` -------------------------------------------------------------------------------- /example/Targets/ReactNativeBinaryExample/Resources/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /example/Targets/ReactNativeBinaryExample/Sources/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import ReactNativeBinaryExampleKit 3 | import ReactNativeBinaryExampleUI 4 | 5 | @main 6 | class AppDelegate: UIResponder, UIApplicationDelegate { 7 | 8 | var window: UIWindow? 9 | 10 | func application( 11 | _ application: UIApplication, 12 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil 13 | ) -> Bool { 14 | window = UIWindow(frame: UIScreen.main.bounds) 15 | let mainVC = MainViewController() 16 | mainVC.view.backgroundColor = .white 17 | window?.rootViewController = mainVC 18 | window?.makeKeyAndVisible() 19 | ReactNativeBinaryExampleKit.hello() 20 | ReactNativeBinaryExampleUI.hello() 21 | 22 | return true 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /example/Targets/ReactNativeBinaryExample/Tests/AppTests.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import XCTest 3 | 4 | final class ReactNativeBinaryExampleTests: XCTestCase { 5 | func test_twoPlusTwo_isFour() { 6 | XCTAssertEqual(2+2, 4) 7 | } 8 | } -------------------------------------------------------------------------------- /example/Targets/ReactNativeBinaryExampleKit/Sources/ReactNativeBinaryExampleKit.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public final class ReactNativeBinaryExampleKit { 4 | public static func hello() { 5 | print("Hello, from your Kit framework") 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /example/Targets/ReactNativeBinaryExampleKit/Tests/ReactNativeBinaryExampleKitTests.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import XCTest 3 | 4 | final class ReactNativeBinaryExampleKitTests: XCTestCase { 5 | func test_example() { 6 | XCTAssertEqual("ReactNativeBinaryExampleKit", "ReactNativeBinaryExampleKit") 7 | } 8 | } -------------------------------------------------------------------------------- /example/Targets/ReactNativeBinaryExampleUI/Sources/MainViewController.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2022 WildCat.io. All rights reserved. 2 | 3 | import React 4 | import UIKit 5 | 6 | public class MainViewController: UIViewController { 7 | private enum Constants { 8 | static let moduleName = "ExampleApp" 9 | } 10 | 11 | private lazy var rootView: UIView = RCTAppSetupDefaultRootView( 12 | self.bridge, Constants.moduleName, 13 | [ 14 | "name": "initial props from native", 15 | ] 16 | ) 17 | private lazy var bridge = RCTBridge(delegate: self, launchOptions: [:]) 18 | 19 | public init() { 20 | super.init(nibName: nil, bundle: nil) 21 | } 22 | 23 | @available(*, unavailable) 24 | required init?(coder _: NSCoder) { 25 | fatalError("init(coder:) has not been implemented") 26 | } 27 | 28 | override public func viewDidLoad() { 29 | super.viewDidLoad() 30 | 31 | rootView.translatesAutoresizingMaskIntoConstraints = false 32 | view.addSubview(rootView) 33 | 34 | NSLayoutConstraint.activate([ 35 | rootView.topAnchor.constraint(equalTo: view.topAnchor), 36 | rootView.bottomAnchor.constraint(equalTo: view.bottomAnchor), 37 | rootView.leftAnchor.constraint(equalTo: view.leftAnchor), 38 | rootView.rightAnchor.constraint(equalTo: view.rightAnchor), 39 | ]) 40 | } 41 | } 42 | 43 | extension MainViewController: RCTBridgeDelegate { 44 | public func sourceURL(for _: RCTBridge!) -> URL! { 45 | let u = Bundle(for: Self.self).url(forResource: "index", withExtension: "jsbundle") 46 | return u! 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /example/Targets/ReactNativeBinaryExampleUI/Sources/ReactNativeBinaryExampleUI.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public final class ReactNativeBinaryExampleUI { 4 | public static func hello() { 5 | print("Hello, from your UI framework") 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /example/Targets/ReactNativeBinaryExampleUI/Sources/generated/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imWildCat/ReactNative-Binary/33eef9b1334e765b180be41e2f9ba1c3873f0ea7/example/Targets/ReactNativeBinaryExampleUI/Sources/generated/.keep -------------------------------------------------------------------------------- /example/Targets/ReactNativeBinaryExampleUI/Tests/ReactNativeBinaryExampleUITests.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import XCTest 3 | 4 | final class ReactNativeBinaryExampleUITests: XCTestCase { 5 | func test_example() { 6 | XCTAssertEqual("ReactNativeBinaryExampleUI", "ReactNativeBinaryExampleUI") 7 | } 8 | } -------------------------------------------------------------------------------- /example/project.yml: -------------------------------------------------------------------------------- 1 | name: ReactNativeBinaryExample 2 | options: 3 | bundleIdPrefix: io.wildcat 4 | deploymentTarget: 5 | iOS: 15.0 6 | configs: 7 | Debug: debug 8 | Release: release 9 | settings: 10 | BASE_SDK: iphoneos 11 | targets: 12 | ReactNativeBinaryExample: 13 | type: application 14 | platform: iOS 15 | sources: 16 | - path: Targets/ReactNativeBinaryExample/Sources 17 | resources: 18 | - path: Targets/ReactNativeBinaryExample/Resources 19 | dependencies: 20 | - target: ReactNativeBinaryExampleKit 21 | - target: ReactNativeBinaryExampleUI 22 | settings: 23 | PRODUCT_BUNDLE_IDENTIFIER: io.wildcat.ReactNativeBinaryExample 24 | IPHONEOS_DEPLOYMENT_TARGET: 15.0 25 | GENERATE_INFOPLIST_FILE: YES 26 | ReactNativeBinaryExampleTests: 27 | type: bundle.unit-test 28 | platform: iOS 29 | sources: 30 | - path: Targets/ReactNativeBinaryExample/Tests 31 | dependencies: 32 | - target: ReactNativeBinaryExample 33 | settings: 34 | INFO_PLIST_FILE: Targets/ReactNativeBinaryExampleTests/Info.plist 35 | PRODUCT_BUNDLE_IDENTIFIER: io.wildcat.ReactNativeBinaryExampleTests 36 | ReactNativeBinaryExampleKit: 37 | type: framework 38 | platform: iOS 39 | sources: 40 | - path: Targets/ReactNativeBinaryExampleKit/Sources 41 | settings: 42 | PRODUCT_BUNDLE_IDENTIFIER: io.wildcat.ReactNativeBinaryExampleKit 43 | ReactNativeBinaryExampleKitTests: 44 | type: bundle.unit-test 45 | platform: iOS 46 | sources: 47 | - path: Targets/ReactNativeBinaryExampleKit/Tests 48 | dependencies: 49 | - target: ReactNativeBinaryExampleKit 50 | settings: 51 | PRODUCT_BUNDLE_IDENTIFIER: io.wildcat.ReactNativeBinaryExampleKitTests 52 | ReactNativeBinaryExampleUI: 53 | type: framework 54 | platform: iOS 55 | sources: 56 | - path: Targets/ReactNativeBinaryExampleUI/Sources 57 | resources: 58 | - path: Targets/ReactNativeBinaryExampleUI/Sources/generated/index.jsbundle 59 | settings: 60 | PRODUCT_BUNDLE_IDENTIFIER: io.wildcat.ReactNativeBinaryExampleUI 61 | ReactNativeBinaryExampleUITests: 62 | type: bundle.unit-test 63 | platform: iOS 64 | sources: 65 | - path: Targets/ReactNativeBinaryExampleUI/Tests 66 | dependencies: 67 | - target: ReactNativeBinaryExampleUI 68 | settings: 69 | PRODUCT_BUNDLE_IDENTIFIER: io.wildcat.ReactNativeBinaryExampleUITests 70 | -------------------------------------------------------------------------------- /example/scripts/metro.config.js: -------------------------------------------------------------------------------- 1 | const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config'); 2 | 3 | /** 4 | * Metro configuration 5 | * https://reactnative.dev/docs/metro 6 | * 7 | * @type {import('metro-config').MetroConfig} 8 | */ 9 | const config = {}; 10 | 11 | module.exports = mergeConfig(getDefaultConfig(__dirname), config); 12 | -------------------------------------------------------------------------------- /example/scripts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example-scripts", 3 | "version": "1.0.0", 4 | "main": "index.tsx", 5 | "license": "MIT", 6 | "scripts": { 7 | "android": "react-native run-android", 8 | "ios": "react-native run-ios", 9 | "bundle-ios": "react-native bundle --platform ios --dev false --entry-file src/index.js --bundle-output ../Targets/ReactNativeBinaryExampleUI/Sources/generated/index.jsbundle", 10 | "start": "react-native start", 11 | "test": "jest", 12 | "lint": "eslint ." 13 | }, 14 | "dependencies": { 15 | "react": "^18", 16 | "react-native": "0.74.0" 17 | }, 18 | "devDependencies": { 19 | "@babel/core": "^7.20.0", 20 | "@babel/preset-env": "^7.20.0", 21 | "@babel/runtime": "^7.20.0", 22 | "@react-native/babel-preset": "0.74.81", 23 | "@react-native/eslint-config": "0.74.81", 24 | "@react-native/metro-config": "0.74.81", 25 | "@react-native/typescript-config": "0.74.81", 26 | "@types/react": "^18.2.6", 27 | "@types/react-test-renderer": "^18.0.0", 28 | "babel-jest": "^29.6.3", 29 | "eslint": "^8.19.0", 30 | "jest": "^29.6.3", 31 | "prettier": "2.8.8", 32 | "react-test-renderer": "18.2.0", 33 | "typescript": "5.0.4" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /example/scripts/src/Hello.tsx: -------------------------------------------------------------------------------- 1 | // From: 2 | 3 | import React from 'react'; 4 | import { Button, StyleSheet, Text, View } from 'react-native'; 5 | 6 | export type Props = { 7 | name: string; 8 | baseEnthusiasmLevel?: number; 9 | }; 10 | 11 | const Hello: React.FC = ({ 12 | name, 13 | baseEnthusiasmLevel = 0 14 | }) => { 15 | const [enthusiasmLevel, setEnthusiasmLevel] = React.useState( 16 | baseEnthusiasmLevel 17 | ); 18 | 19 | const onIncrement = () => 20 | setEnthusiasmLevel(enthusiasmLevel + 1); 21 | const onDecrement = () => 22 | setEnthusiasmLevel( 23 | enthusiasmLevel > 0 ? enthusiasmLevel - 1 : 0 24 | ); 25 | 26 | const getExclamationMarks = (numChars: number) => 27 | numChars > 0 ? Array(numChars + 1).join('!') : ''; 28 | 29 | return ( 30 | 31 | 32 | Hello {name} 33 | {getExclamationMarks(enthusiasmLevel)} 34 | 35 | 36 |