Skip to content

Commit 1c75ef6

Browse files
Fall back to Bridging Header
1 parent 5e1075b commit 1c75ef6

File tree

12 files changed

+262
-452
lines changed

12 files changed

+262
-452
lines changed

docs/SWIFT.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
## Swift
22

3-
React Native Brownfield provides first-class support for Swift. You just need to add `use_frameworks!` on top of your `Podfile`, however if you'd like to use Objective-C API via bridging header, you can omit that step.
3+
React Native Brownfield provides first-class support for Swift.
4+
5+
### `use_frameworks!` support
6+
7+
It is possible to build `react-native-brownfield` with `use_frameworks!` directive in CocoaPods as long as `React` can be built this way.
8+
9+
| React Native version | `use_frameworks!` compatibility |
10+
| -------------------------- | ------------------------------- |
11+
| <= 0.59.X | Compatible |
12+
| 0.60.X | Not compatible |
13+
| 0.61.0-rc.0 | Not compatible |
14+
15+
Please reffer to [this issue](https://github.com/facebook/react-native/issues/25349) to learn more about `use_frameworks!` state in React Native.
16+
17+
Until this behavior is fixed, you can access `react-native-brownfield` API in Swift via [Bridging Header](../example/swift/BridgingHeader.h).
418

519
### Linking
620

example/objc/Podfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ target 'NativeExample' do
55
pod 'React', :path => '../../node_modules/react-native/'
66
pod 'React-Core', :path => '../../node_modules/react-native/React'
77
pod 'React-DevSupport', :path => '../../node_modules/react-native/React'
8-
pod 'React-fishhook', :path => '../../node_modules/react-native/Libraries/fishhook'
98
pod 'React-RCTActionSheet', :path => '../../node_modules/react-native/Libraries/ActionSheetIOS'
109
pod 'React-RCTAnimation', :path => '../../node_modules/react-native/Libraries/NativeAnimation'
1110
pod 'React-RCTBlob', :path => '../../node_modules/react-native/Libraries/Blob'

example/swift/AppDelegate.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//
88

99
import UIKit
10-
import ReactNativeBrownfield
1110

1211
@UIApplicationMain
1312
class AppDelegate: UIResponder, UIApplicationDelegate {

example/swift/Base.lproj/Main.storyboard

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
</navigationController>
7272
<placeholder placeholderIdentifier="IBFirstResponder" id="ArW-KT-f49" userLabel="First Responder" sceneMemberID="firstResponder"/>
7373
</objects>
74-
<point key="canvasLocation" x="119" y="104"/>
74+
<point key="canvasLocation" x="123" y="92"/>
7575
</scene>
7676
</scenes>
7777
</document>

example/swift/BridgingHeader.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//
2+
// BridgingHeader.h
3+
// SwiftExample
4+
//
5+
// Created by Michal Chudziak on 27/08/2019.
6+
// Copyright © 2019 Callstack. All rights reserved.
7+
//
8+
9+
#import <ReactNativeBrownfield/ReactNativeBrownfield.h>
10+
#import <ReactNativeBrownfield/ReactNativeViewController.h>

example/swift/Podfile

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
platform :ios, '9.0'
2-
use_frameworks!
32
require_relative '../../node_modules/@react-native-community/cli-platform-ios/native_modules'
43

5-
64
target 'SwiftExample' do
7-
pod 'FBLazyVector', :path => "../../node_modules/react-native/Libraries/FBLazyVector"
8-
pod 'FBReactNativeSpec', :path => "../../node_modules/react-native/Libraries/FBReactNativeSpec"
9-
pod 'RCTRequired', :path => "../../node_modules/react-native/Libraries/RCTRequired"
10-
pod 'RCTTypeSafety', :path => "../../node_modules/react-native/Libraries/TypeSafety"
115
pod 'React', :path => '../../node_modules/react-native/'
12-
pod 'React-Core', :path => '../../node_modules/react-native/'
13-
pod 'React-CoreModules', :path => '../../node_modules/react-native/React/CoreModules'
14-
pod 'React-Core/DevSupport', :path => '../../node_modules/react-native/'
6+
pod 'React-Core', :path => '../../node_modules/react-native/React'
7+
pod 'React-DevSupport', :path => '../../node_modules/react-native/React'
158
pod 'React-RCTActionSheet', :path => '../../node_modules/react-native/Libraries/ActionSheetIOS'
169
pod 'React-RCTAnimation', :path => '../../node_modules/react-native/Libraries/NativeAnimation'
1710
pod 'React-RCTBlob', :path => '../../node_modules/react-native/Libraries/Blob'
@@ -21,20 +14,18 @@ target 'SwiftExample' do
2114
pod 'React-RCTSettings', :path => '../../node_modules/react-native/Libraries/Settings'
2215
pod 'React-RCTText', :path => '../../node_modules/react-native/Libraries/Text'
2316
pod 'React-RCTVibration', :path => '../../node_modules/react-native/Libraries/Vibration'
24-
pod 'React-Core/RCTWebSocket', :path => '../../node_modules/react-native/'
17+
pod 'React-RCTWebSocket', :path => '../../node_modules/react-native/Libraries/WebSocket'
18+
19+
pod 'DoubleConversion', :podspec => '../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
20+
pod 'glog', :podspec => '../../node_modules/react-native/third-party-podspecs/glog.podspec'
21+
pod 'Folly', :podspec => '../../node_modules/react-native/third-party-podspecs/Folly.podspec'
2522

2623
pod 'React-cxxreact', :path => '../../node_modules/react-native/ReactCommon/cxxreact'
2724
pod 'React-jsi', :path => '../../node_modules/react-native/ReactCommon/jsi'
2825
pod 'React-jsiexecutor', :path => '../../node_modules/react-native/ReactCommon/jsiexecutor'
2926
pod 'React-jsinspector', :path => '../../node_modules/react-native/ReactCommon/jsinspector'
30-
pod 'ReactCommon/jscallinvoker', :path => "../../node_modules/react-native/ReactCommon"
31-
pod 'ReactCommon/turbomodule/core', :path => "../../node_modules/react-native/ReactCommon"
3227
pod 'yoga', :path => '../../node_modules/react-native/ReactCommon/yoga'
3328

34-
pod 'DoubleConversion', :podspec => '../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
35-
pod 'glog', :podspec => '../../node_modules/react-native/third-party-podspecs/glog.podspec'
36-
pod 'Folly', :podspec => '../../node_modules/react-native/third-party-podspecs/Folly.podspec'
37-
3829
use_native_modules!('../..')
3930

4031
end

0 commit comments

Comments
 (0)