Skip to content

Commit 49bb34e

Browse files
committed
Moved to cocoapods, with setup instructions (due to Firebase library dependency)
1 parent 22bf35b commit 49bb34e

File tree

7 files changed

+38
-77
lines changed

7 files changed

+38
-77
lines changed

Firestack.podspec

Lines changed: 25 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ version = package["version"]
44
repo = package['repository']
55
author = package['author']
66

7-
default_header_search_paths = ["$(inherited)", "${SRCROOT}/../../React/**", "${SRCROOT}/../node_modules/react-native/**"]
8-
97
Pod::Spec.new do |s|
108

119
s.name = "Firestack"
@@ -27,53 +25,42 @@ Pod::Spec.new do |s|
2725
# s.tvos.deployment_target = "9.0"
2826

2927
s.source = { :git => repo['url'], :tag => "v#{version}" }
30-
s.public_header_files = "ios/Firestack/*.h", "Pods/**/*.h"
28+
s.public_header_files = "ios/Firestack/*.h"
3129

3230
s.source_files = 'ios/Firestack/*.{h,m}'
3331
s.preserve_paths = 'README.md', 'package.json', '*.js'
3432

3533
s.default_subspec = 'Core'
36-
3734
s.subspec 'Core' do |ss|
38-
[
39-
'Firebase/Core',
40-
'Firebase/Auth',
41-
'Firebase/Storage',
42-
'Firebase/Database',
43-
'Firebase/RemoteConfig'
44-
].each do |lib|
45-
ss.dependency lib
46-
end
47-
48-
49-
ss.xcconfig = {
50-
'HEADER_SEARCH_PATHS' => default_header_search_paths.join(' ')
51-
}
5235

53-
ss.user_target_xcconfig = {
54-
'HEADER_SEARCH_PATHS' => default_header_search_paths.join(' '),
55-
'FRAMEWORK_SEARCH_PATHS' => default_header_search_paths.join(' ')
56-
}
36+
ss.dependency 'Firebase/Core'
37+
ss.dependency 'Firebase/Auth'
38+
ss.dependency 'Firebase/Storage'
39+
ss.dependency 'Firebase/Database'
40+
ss.dependency 'Firebase/RemoteConfig'
41+
42+
s.ios.frameworks = [
43+
'CFNetwork', 'Security',
44+
'SystemConfiguration'
45+
]
46+
s.ios.libraries = ['icucore', 'c++']
5747
end
5848

59-
s.subspec 'Test' do |ss|
60-
ss.dependency 'Firestack/Core'
61-
# ss.dependency 'React'
62-
63-
ss.xcconfig = {
64-
'HEADER_SEARCH_PATHS' => [
65-
default_header_search_paths,
66-
"$(SRCROOT)/../../react-native/React/**",
67-
].flatten.join(' ')
68-
}
49+
# Dev is used only to stub for lib linting and development
50+
s.subspec 'Dev' do |ss|
51+
ss.dependency "React"
6952
end
7053

71-
# s.vendored_frameworks = ['Firebase']
72-
73-
# s.ios.framework = [
74-
# 'SystemConfiguration', 'CFNetwork', 'Security', 'UIKit',
75-
# 'CoreFoundation', 'StoreKit', 'MobileCoreServices',
76-
# ]
54+
s.xcconfig = {
55+
'HEADER_SEARCH_PATHS' => [
56+
"$(inherited)", "${SRCROOT}/../../React/**", "${SRCROOT}/../../node_modules/react-native/**"
57+
].join(' '),
58+
'FRAMEWORK_SEARCH_PATHS' => [
59+
"$(inherited)",
60+
"${PODS_ROOT}/Firebase/**",
61+
].join(' '),
62+
'OTHER_LDFLAGS' => '$(inherited) -ObjC'
63+
}
7764

7865
s.requires_arc = true
7966
end

README.md

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,40 +24,21 @@ To use Firestack, we'll need to have a development environment that includes the
2424

2525
We need to link the package with our development packaging. We have two options to handle linking:
2626

27-
#### Through CocoaPods
27+
#### Through CocoaPods (iOS only)
2828

2929
Unfortunately, until we can link cocoapods in a library dynamically, we must use CocoaPods to use Firestack. Although it's not terribly difficult to do, we're stuck with this requirement for the time being.
3030

31-
#### Automatically with [rnpm](https://github.com/rnpm/rnpm)
31+
In order to use cocoapods, we'll first need to install it. The [getting started](https://guides.cocoapods.org/using/getting-started.html) guide through CocoaPods offers a nice introduction on installing and using [Cocoapods](https://cocoapods.org/).
3232

33-
[rnpm](https://github.com/rnpm/rnpm) is a React Native package manager which can help to automate the process of linking package environments.
33+
Cocoapods is delivered as a ruby gem, so we'll need to make sure we have ruby installed. (We recommend using [rvm](https://rvm.io/)) to manage environments.
3434

35-
```bash
36-
rnpm link
35+
```shell
36+
gem install cocoapods
3737
```
3838

39-
#### Manually
40-
41-
If you prefer not to use `rnpm`, we can manually link the package together with the following steps, after `npm install`:
42-
43-
1. In XCode, right click on `Libraries` and find the `Add Files to [project name]`.
44-
45-
![Add library to project](http://d.pr/i/2gEH.png)
46-
47-
2. Add the `node_modules/react-native-firestack/ios/Firestack.xcodeproj`
48-
49-
![Firebase.xcodeproj in Libraries listing](http://d.pr/i/19ktP.png)
50-
51-
3. In the project's "Build Settings" tab in your app's target, add `libFirestack.a` to the list of `Link Binary with Libraries`
52-
53-
![Linking binaries](http://d.pr/i/1cHgs.png)
54-
55-
4. Ensure that the `Build Settings` of the `Firestack.xcodeproj` project is ticked to _All_ and it's `Header Search Paths` include both of the following paths _and_ are set to _recursive_:
56-
57-
1. `$(SRCROOT)/../../react-native/React`
58-
2. `$(SRCROOT)/../node_modules/react-native/React`
39+
> If you run into issues installing cocoapods, please see their [getting started guide](https://guides.cocoapods.org/using/getting-started.html) for help.
5940
60-
![Recursive paths](http://d.pr/i/1hAr1.png)
41+
With cocoapods installed, we'll need to
6142

6243
### Android
6344

@@ -469,4 +450,5 @@ The following is left to be done:
469450

470451
- [ ] Add Android support
471452
- [ ] Add Cloud Messaging
453+
- [ ] Move to use swift (cleaner syntax)
472454
- [ ] TODO: Finish Facebook integration

ios/Firestack.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@
301301
"-undefined",
302302
dynamic_lookup,
303303
"-lc++",
304+
"-ObjC",
304305
);
305306
PRODUCT_NAME = Firestack;
306307
SKIP_INSTALL = YES;
@@ -333,6 +334,7 @@
333334
"-undefined",
334335
dynamic_lookup,
335336
"-lc++",
337+
"-ObjC",
336338
);
337339
PRODUCT_NAME = Firestack;
338340
SKIP_INSTALL = YES;

ios/Firestack.xcworkspace/contents.xcworkspacedata

Lines changed: 0 additions & 10 deletions
This file was deleted.

ios/Firestack/Firestack.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
//
66

77
// #import <UIKit/UIKit.h>
8-
#import <Firebase.h>
9-
#import <RCTBridgeModule.h>
10-
#import <RCTEventDispatcher.h>
8+
#import "Firebase.h"
9+
#import "RCTBridgeModule.h"
10+
#import "RCTEventDispatcher.h"
1111

1212
@interface Firestack : NSObject <RCTBridgeModule> {
1313
FIRAuthStateDidChangeListenerHandle authListenerHandle;

0 commit comments

Comments
 (0)