native-navigation icon indicating copy to clipboard operation
native-navigation copied to clipboard

Provide an installation option without CocoaPods

Open Kureev opened this issue 7 years ago • 9 comments

Dear authors,

Currently, there is only one way how you can add this project to iOS app (using CocoaPods). As a JavaScript / React Native developer, I'd like to be able to install this awesome library using react-native install or link it by using react-native link. Although it's not hard to do, the code won't work with a standard react-native init app due to the current way it imports React (using import React in Swift files).

I managed to make it work without these imports (by adding native-navigation library directly to the project), but I consider this way pretty hackish as I have to remove these imports by hand. I'd like to find a way how we can distribute a Cocoa pod using CocoaPods and npm module using the same codebase. The best thing I can think of is a pre-publish hook that cuts off imports before publishing (tmp dir -> s/import React//g -> publish files from tmp dir -> rm tmp dir).

What do you think?

Kureev avatar Mar 20 '17 00:03 Kureev

Hey, thanks for filing an issue. I'd like us to make Native Navigation work without CocoaPods.

The problem is not cocoapods but rather the fact that the swift library (native navigation) has a transitive dependency on React, which we also want to include in the app as a statically linked binary, which for the most part is incompatible with swift.

I don't think removing the imports and then treating the library as application code is the right approach though. I will try and rope in some other people that understand this better and see if they can help and what they think we should do.

lelandrichardson avatar Mar 20 '17 20:03 lelandrichardson

Thanks for your feedback!

Yeah, I completely understand your concerns. This is just one of the approaches we can take there, so I'm completely fine with any proposed alternative if result will be the same.

In the meantime, I'll fill the gap by forking your library and implementing proposed solution. Once it'll be solved in the master, I'll delete my fork.

Please, let me know if I can help solving this.

Kureev avatar Mar 20 '17 20:03 Kureev

What about Carthage support? I only use Carthage in my development

nihgwu avatar Mar 21 '17 02:03 nihgwu

@nihgwu can we have a separate thread for Carthage support? I'd like to keep this thread as focused as possible (otherwise initial subject will be lost).

Kureev avatar Mar 21 '17 10:03 Kureev

@Kureev - could you write out how you got the install working, specifically? Would be helpful to me, I don't use CocoaPods.

braco avatar Apr 05 '17 23:04 braco

@braco sure. I wrote a short blogpost about it, but not sure if I should publish it. Here you can see the draft: https://medium.com/@kureevalexey/how-to-use-airbnbs-native-navigation-without-cocoapods-aa958554beff

Kureev avatar Apr 06 '17 12:04 Kureev

@Kureev: thank you! I say publish it, a hacky solution beats no solution.

braco avatar Apr 06 '17 18:04 braco

With upcoming support for Swift static libraries in Xcode 9, it seems like it should be possible to get something working with react-native link.

mgriepentrog avatar Sep 10 '17 18:09 mgriepentrog

Is there anyone that managed to do this with react-native link?

MarkMolina avatar Feb 13 '18 14:02 MarkMolina