We have a project based on the swift based ARKit example Capturing Body Motion in 3D from the WWDC 2019. And we have a React Native app using native swift components, following the great instructions from Swift in React Native - The Ultimate Guide. Now we want to implement the view from the ARKit example as a react-native component, but I just don't find out how to do this.
The ARKit example uses a UIViewController with ARSessionDelegate, which means we have to wrap more than a simple view in the component.
I found some answers on how to present a native UIViewController in React Native, but could not translate this solution into swift code and could not get it to work with the ARKit example. Does anybody of you have an idea how to wire this up?
Ok, I understand it by now ;-)
In the example Capturing Body Motion in 3D all functionality is implemented in the UIViewController. We do not have separate UIViewController for each component in react native, we have RCTViewManager instead.
We can create our own View class, based on ARView and move the ARSessionDelegate from the UIViewController directly to this new view, including the session method and all corresponding parts.
An instance of this new View van be returned from the RCTViewManager and voila, it works!
Related
I am currently looking for some way to display either a window with a Unity game or a fullscreen Unity game with swift UI elements added on top of it. Has anyone done this before or know if this is possible?
I haven't yet tried anything, currently just trying to pick out my tech stack for this project and see if its possible in any stack.
Yes, Unity has ViewController for rendering game scene.
You can get UnityAppController how call unityFramework.appController().
UnityAppController can used as such as other ViewControllers.
It also work by using UIViewControllerRepresentable in SwiftUI case.
This technique called Unity as a Library.
I am trying to integrate any gaming kit (like scenekit or sprite kit) inside my utility based single view application , so is it possible to integrate any game kit with single view application what is the approach to start integrating game using objective c/swift. i can develop simple games using UIKit framework, but i want to try more interesting things in my apps. so what is the best option to integrate gaming in single view applications.
Thanks for your advice
To answer this, Yes you can. All it takes is adding a view to your view controller, giving it the custom SKView class, then inside of your view controller code, use the view that is attached with the SKView class to present the scene that you want to be working with.
Coming from a native iOS background, I have recently started working with react native. A while ago, I have implemented a view transition like that with Swift :
Following this tutorial :
How To Make A View Controller Transition Animation Like in the Ping App
I'm wondering if creating something similar with react native would be possible. If yes, how should I approach it? I just need a hint and some intuition on how to proceed with this idea.
Thanks!
I want to create a small animation in Unity and integrate this animation with Native iOS Application.
Looked into many possible solutions, but they were not useful. I don't want the animation in a video format.
Just for the sake of more info that may help, here is some of my research that I have tried out. I created the animation using After Effects, exported it as a Unity animation, and then reimported it into Unity; but when I exported it as an iOS application, it was not able to separate out
this animation sequence for my native application. There was a way in After Effects where I could export the animation as video file but that's not what I want.
You can create bindings in either direction, such as Objective-C bindings for Unity, or vice versa. You can also use plug-ins, but they're a premium feature, more details here: http://docs.unity3d.com/Manual/Plugins.html
If you can convert your animation objects to obj files, you can import them that way also. If that doesn't work, you can use Blender3D to create models, and import them obj files.
Is it possible to develop an app mixing UIViewController and iOS specific API elements with Cocos2D views?
A Cocos2D app runs on a UIView and hence I guess it is possible to switch between one view (Cocos2D) and another (iOS), is this correct? Are there any good examples of apps doing this?
The core idea is to develop some graphical animations using Cocos2D and others using UIKit.
Actually you can add any UIView as a subview to CCDirector.sharedDirector().view anytime in a Cocos2D running app.
I bet the only reason you really should mix Cocos2D and UIKit is for creating menus and other UI in UIKit and run game scene using Cocos2D. To do that you can simply find a place where Cocos2D is initialized and replace it with your own UIKit things and then anywhere you want you can run a Cocos2D scene using the code you had replaced. If you want to do that the method you are looking for is
- (void) setupCocos2dWithOptions:(NSDictionary*)config
Maybe consider using SpriteKit since it won't increase the footprint of your app and is already in a very usable state. It uses the same concepts as cocos2d which makes it very easy for you if you know cocos2d already. Also it fits better in the UIKit environment.