ios-jsc icon indicating copy to clipboard operation
ios-jsc copied to clipboard

Research consuming {N} as a library

Open atanasovg opened this issue 9 years ago • 17 comments

More and more people are asking for a way to test {N} within an existing native application. Such an integration will allow for better adoption since starting an entire application from scratch is less appealing than just integrating a library and testing how a single screen works.

Generally there are two steps needed to accomplish this:

  • [x] Verify the iOS Runtime can be consumed as a library
  • [ ] Verify the modules can work as a library rather than a framework

I can help with the second part of the research but will need some help with the first part.

atanasovg avatar Jan 04 '16 09:01 atanasovg

On the first count, check out https://github.com/NativeScript/sample-ios-embedded.

fealebenpae avatar Jan 04 '16 14:01 fealebenpae

Great, 10x @fealebenpae!

atanasovg avatar Jan 04 '16 16:01 atanasovg

This is excellent @fealebenpae. This could allow mixing and matching or native and Nativescript. Make transitioning from native to nativescript or vice versa.

stephenfeather avatar Jan 07 '16 03:01 stephenfeather

Any progress on this. I have an existing native code base and trying to integrate with a nativescript codebase.

getmetorajesh avatar Jun 03 '16 02:06 getmetorajesh

The fact that ReactNative supports this weighs heavily in their favor when deciding on a JS platform for native app development. For most use cases, i.e. writing something from scratch, going full monty isn't really a problem. But in most enterprise cases, where you have a transition period for a number of very feature intense apps, the ability to gradually transition is actually a deal breaker.

This discussion is also greater than iOS-runtime / Android-Runtime. It needs to be supported for at least both these platforms before NativeScript is a viable option for anything other than a startup or standalone deal.

I feel that, with this in place, I would feel comfortable recommending my team of 40 app developers to move in this direction. Until then, i'm leaning towards ReactNative.

weslien avatar Sep 26 '16 08:09 weslien

@weslien The iOS runtime can be embedded in a native iOS application. Does this example work for you? Keep in mind that currently the example is working with iOS runtime older then v2.1 but we are planning to update it.

ivanbuhov avatar Sep 27 '16 08:09 ivanbuhov

Hi @ivanbuhov ,

I have been trying to accomplish an UIView from a NativeScript to the existing app native. I trying with this example. It is working fine, but this would allow a NativeScript frame to be embedded into an existing view.

I'm new in this NativeScript.

Thanks!

antonyraphel avatar Mar 22 '17 11:03 antonyraphel

The iOS embedded example is broken now with the Xcode 9 release. It looks like embedding into an existing app is not a supported use case.

https://github.com/NativeScript/sample-ios-embedded/issues/3 https://github.com/NativeScript/ios-runtime/issues/798

bootstraponline avatar Sep 27 '17 02:09 bootstraponline

Came here to show support that my company would love to extend our existing Swift 3 iOS app with NativeScript!

sivabudh avatar Oct 28 '17 07:10 sivabudh

It looks like embedding into an existing app is not a supported use case.

It sure seems so since this issue has been open for more than two years now.

jzilske avatar Feb 21 '18 08:02 jzilske

Is anyone from developers is going to fix it? Two years later there is still no way to embed the NativeScript Runtime safely in an existing app... Since NativeScript/ios-metadata-generator-nclang.git seems to be private there is even no way to check why ios-metadata-generator fails and somehow to fix it.

Gamadril avatar Feb 22 '18 13:02 Gamadril

If you are trying this feature out, please use the instructions found here: https://docs.nativescript.org/integration-with-existing-ios-and-android-apps/extend-existing-ios-app

If you are using that exact process and are having issues, please specify the exact issue you are having. We are keeping an eye on this and looking for more data points and use cases.

sipacate avatar Mar 02 '18 17:03 sipacate

If you are trying this feature out, please use the instructions found here: https://docs.nativescript.org/integration-with-existing-ios-and-android-apps/extend-existing-ios-app

If you are using that exact process and are having issues, please specify the exact issue you are having.

I did; the issues I ran into seem to be the same as reported here and here, i.e. metadata generation fails. What can I do to get around this?

jzilske avatar Mar 05 '18 07:03 jzilske

hi guys,

I followed the how-to from NativeScript/sample-ios-embedded using ns4.1 And I get the issue JS ERROR Error: A Frame must be used to navigate to a Page. at the line [runtime executeModule: @"./"];. Any idea how can I fix that ? Is there a way to tell which view ns should load in ?

jolafrite avatar Jun 05 '18 07:06 jolafrite

(y).

If NativeScrip were easy to embeb I will use it without hesitation.

The ideal is that is just a .a library (or a few ones) and options to point to the js sources and similar.

What is blocking this?

mamcx avatar Jun 10 '18 02:06 mamcx

Hi. I want to integrate my Nativescript+Angular app to exist IOS and Android apps, call some methods from Angular part in IOS and Android and so on. I tried https://github.com/NativeScript/sample-ios-embedded but I use new versions of Xcode and Nativescript and I can't import TNSRuntime from <NativeScript/NativeScript.h>. For Android https://github.com/NativeScript/sample-extend-android-app I see last update also was 4 years ago.

Can you update instruction for IOS and Android with Nativescript v8 or help me with advice?)

Ilirus avatar Feb 01 '23 11:02 Ilirus

We have a blog post draft we are planning to publish this month which will detail the updated and improved steps @Ilirus

NathanWalker avatar Feb 02 '23 14:02 NathanWalker