How can I restrict the use of OpenFrameworks to a single view controller in a native iOS app? - ios

I have an existing iOS (Swift- and storyboard-based) app and I'd like to use cross-platform OpenFrameworks code in just one UIViewController. However, I notice that the demo OF projects take over the iOS application lifecycle up to the application delegate class and even contain a customised main.mm file. Has anyone managed to create a storyboards-based iOS project where use of OF is restricted to a single view controller?

Related

How to control embedded Unity app from native iOS app

I want to create an iOS app that contains Unity3D elements. I also want to control these elements, to change colors and set specific properties on them.
I want to do this controlling from UIKit elements, so that I can create my interface easily (using native elements such as UINavigationController).
Is there a way to integrate a Unity3D view as a subview in a native (or Xamarin) app?
I have found a way to take the exported build code from Unity and put it inside another project so that I can instantiate that UIWindow and display it when I need it, but I have not found a way to interact with it or use it as a subview in my view hierarchy.
Does anyone have some experience with this? Or a way to do this?
Edit: I have a structure in my mind: create a unity app, take the main window (or even the view that is contained inside it, if that does not mess with the contents), and then use the view in the view hierarchy as I like. I think I might be able to use the Native Plugin Interface to talk to my Unity view then.
Edit2: I found a video explaining the entire process I had in mind: https://vimeo.com/145572230
This interaction will require iOS plugin to be written for Unity. A bit tough job but definitely possible.
Have a look here should answer your questions.
https://docs.unity3d.com/Manual/PluginsForIOS.html
Define your extern method in the C# file as follows:
[DllImport ("__Internal")]
private static extern float FooPluginFunction();
Set the editor to the iOS build target
Add your native code source files to the generated Xcode project’s “Classes” folder (this folder is not overwritten when the project is updated, but don’t forget to backup your native code).
If you are using C++ (.cpp) or Objective-C++ (.mm) to implement the plugin you must ensure the functions are declared with C linkage to avoid name mangling issues.
extern "C" {
float FooPluginFunction();
}
to call Unity from native code
UnitySendMessage("GameObjectName1", "MethodName1", "Message to send");
Hope that helps

iOS Build app extension base on existing app. How to avoid code duplication?

I have an iOS app that add Sound FX to videos. Now I want to build app extension target to support stocked Photo App. However, I have to duplicate almost every codes from the iOS app. And my solution that I have so far is to put common functions in a shared files and use it for both targets, because some codes in the app linked to AppDelegate and I can't use it in App Extension. Is there any better way to avoid code duplication in this case?
One more question: most extensions that I saw on AppStore only have 1 screen, is there any rules for this?
In my app, I have to let users to choose sounds from folder & library, and it requires navigation controller. But Navigation Controller is not usable in App Extension, should I build my own Navigaion Controller or is there a better way?
As long as you don't need to target iOS 7 or earlier, you can put the common classes into a shared framework and load that framework from both targets. This avoids having two instances of the code on disk.
As an added bonus, because of the way the OS handles shared library loading, all of the actual code pages get shared between the app and the extension, so you aren't wasting RAM, either.

Swift framework how to run and test

I want to build a swift framework which can be added to hosting applications and run some logic
It basically show a new screen with web view which does some things (among other JS bridging)
After creating the logic as a regular app (with invocation button) i am now trying to convert it to a framework which can be added easily to existing projects
Is this the right way to do it? my code contain a ViewController which should be segue to
How do i start converting it to a framework? can a framework contain ViewControllers? how to test it? I see for example that a regular UIView dont exist is not available in the view adder

Using native ios views in React Native

Is there a way to use native ui components except delivered by react native (ListView, Text, etc) in js file?
For example, I have application created by react native and I want to use MWPhotoBrowser in it.
Yes. If you take a look at this section of the docs, under the title "Extensibility", then there's a bit that says "Custom iOS views can be exposed by subclassing RCTViewManager". This should get you started and then you can look at the React Native source code for examples of view classes that subclass RCTViewManager.

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.

Resources