React Native newbie. Using XCode for the native iOS part in /iOS. What do I use for javascript in root folder? What's a best-practice workflow? - ios

Confused as any newbie would be!
I am a React Native newbie. Following a tutorial I created a project. I can use XCode to open the native iOS project in /iOS. What do I use for the javascript files in the root folder? Should I use a second editor for js - i.e. one of the standard js editors (Atom, vi etc). What is the best-practice workflow? Or can I accomplish everything with one editor. Advice, recommendations would be most appreciated.
CLARIFICATIOINS:
To clarify my question, take the following sample project:
I want to write a react native app which opens to a table view i.e. list screen with multiple items in a list screen. When you pick one item in the list the app navigates to a details screen. Suppose the list screen is React Native and the details screen is Native iOS. I can code up the list screen using VSCode in React Native js. And then I can code the native details screen in XCode. So for the native part I can open XCode and create a fresh project. What kind of project should this be? Should it be an IOS App or am IOS framework/library? Perhaps a main app as the AppDelegate and a test harness, and a framework/library for the one View Controller screen I will need to import into my React Native project? And then how do I run this to test and debug it out end to end in the simulator? I can possibly correct and live reload the React native portion, but suppose I want to update the iOS portion, what step do I need to go back to? etc.

It's not very common to do your coding work directly inside XCode. XCode is more of a place to organize your project/environment/builds/signing etc...
Instead you should be writing all of your code inside the editor of your choice. The standard workflow would be:
Create project on command line
Use your editor of choice for coding. I use VSCode.
in your editor, open your project folder that you just created
use XCode for running the ios emulator and super specific iOS tasks
All Android specific work can easily be done in VSCode (you don't ever actually need to use Android Studio)

Related

Hyperlinks with ios recipe on kivy-ios

I'm trying to make a hyperlink that launches safari when clicked. I gather that this involves using iOS's native API, however I noticed in the kivy-ios package, there's a recipe called "ios" that seems to have this function built in.
I've not been able to google this successfully, maybe because searches for "kivy ios package" bring up the kivy-ios package which isn't what I'm looking for.
How can I use this and is there any documentation?
The source of the ios module is in the recipes/ios/src folder. It doesn't contain much so you can probably get what you need by just reading it.
You probably want the open_url function, which I think you can import as from ios.ios import open_url.

Creating an iOS library or framework using libgdx (roboVM)

Is it possible to create an iOS library or framework using libgdx (RoboVM) that can be imported into Xcode?
Background:
One of my colleagues has created a 3D visualisation app as a libgdx project for android and windows desktop. It can be compiled to run on iOS using RoboVM. However, I would like to wrap extra native user interface elements around it using Xcode. I know its possible to build the user interface programmatically via RoboVM but I would be keen to investigate if its possible to bring the existing work into Xcode. I don't need to edit the 3D visualisation component but add extra GUI elements around the 3D Vis window. I thought compiling the libgdx (RoboVM) code to a framework or library might be a solution that could be imported?!
Yes you can do it.
All you need to create a method, say initRoboVM(), This will be called by your code when you want to initialize libgdx. You'll need to pass the app path in, which you can hardcode when you're testing.
initRoboVM() will need some modifications, namely it should not call your Java app's main method, well, at least, that's what well behaving libraries should not do IMO. It should also not call rvmShutdown.
You can get further information from here
Thanks :)
I asked the RoboVM team directly. Their answer: It's not a native function, but it certainly can be done.
The complete message...
Hi,
Sorry for the late reply. This use case is not something we're going
to do now. It is possible though if you're prepared to do some
patching of RoboVM. Search the RoboVM Google Group and you should find
others who have managed to get this working.
We get this request every know and then so we will add support for
this eventually.
Regards, Niklas

Custom Cordova IOS keyboard

I am working on a Cordova app for which the client insists we have a custom keyboard for numeric input that looks native; the goal is similar to a keyboard that comes up with PayPal.
Here is the problem: we need to do this without touching the way things work for Android in our app. This probably means we need to create a cordova plugin, but I have read that creating custom keyboard is looked down on by the folks over at Apple (see this old post about it).
I've had a very difficult time finding any documentation on how to do this with Cordova on IOS, which makes me lean towards rolling a solution inside of Cordova using a jquery library. My question has two parts:
1: If possible, how does one create a custom keyboard for html5 inputs in Cordova as an IOS plugin?
2: If this is a lost cause, what existing jquery plugins would you recommend instead?

iOS native functionality inside a Titanium application

I have a Titanium application and I want to put few UI screens which have been developed using iPhone SDK (native) inside it.
Titanium app starts and at some point it calls the native UI classes and the the native classes cotinue the navigation.
I need to switch back and forth accordingly as well.
Obviously I need to pass patameters between them.
Can these requirements be developed using iOS Module Development which can be found at iOS Module Development- Titanium
Or is there a better way?
Creating a custom module is the only way to do this besides re-writing your Obj-C code in Titanium.
Modules are really not that difficult! The link you provided is a great starting point, also I would check the moddevguide example module which is chock full of examples of passing data back and forth. Also, the paint module is a great example of subclassing UIView to roll your own titanium component.

Integrating phoneGap with native iOS app

i'm trying to create an app which uses the combination of native functionality and the phoneGap framework. The native app has a button, upon the click of which the phoneGap ui has to be added to the view. Is there any way to achieve this? Are there any tutorials for the same?
Yes, this is possible. Although you might be getting yourself into some headaches. My app kind of goes the other way around, it's mostly phonegap, but occasionally i'll pop open a view that is native. Here is the link to code that shows an excellent example of how to switch between the iOS and phonegap worlds.
new updated recommended article (see update below)
These files represent a standard plugin used in phonegap. In this particular plugin, a native view is opened on top of a phonegap view. Notice you have a custom xib and everything. This plugin can be modified to display any xib with any functionality you could think of.
If you implement this plugin you will easily see how to jump back and forth. I've successfully heavily modified these classes to add LOTS of native capabilities to my phonegap project. Also you should probably check out the official phonegap guide to phonegap plugins. Here
Important Edit
Was informed original linkwas broken (not terribly surprised as this answer is very old and i've long since moved away from Phonegap) so I replaced the original link with an article that shows how to do these plugins well. In the article it explains the link is broken and gives several links where these older files are maintained, but in fact those are broken as well. Here is a branch of one of them I found that still hosts the original files on an "archive" branch. But I haven't investigated whether these files are wildly different from my original work. Good luck!
That's not how Phonegap is meant to be used.
To achieve what you are asking for you just need to create a Phonegap app and add the extra native functionality by writing a Phonegap plugin in Objective-C. You may add as much native code as you want.
I'm actually wanting to do the same thing as the original poster. Theoretically it would be comparatively easy, but non-trival to do. I'd love it if there was a PhoneGapView that one could integrate into an existing project. Bonus points if said PhoneGapView could be integrated in Interface Builder as a re-sizeable and re-positional object, basically think of it as an Object that extends UIWebView.
This is wishful thinking on my part seeing as this is how the higher-ups want my project.

Resources