Clojurians
#cljsrn
<
2015-12-10
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

dvcrn10:12:22

@mfikes I thought these were indices to the components inside the registry, starting with 1

dvcrn10:12:26

Actually not even sure either

johannjohann18:12:09

does anyone know how to get source maps to work in the chrome debugger?

anisoptera22:12:34

X post: Does anyone have a link to some good examples of how to do interop between native iOS objects/functions and Om/React/ClJs?

artemyarulin22:12:54

can you elaborate a bit more? What are you trying to achieve?

anisoptera22:12:33

So I have an existing app with a core data model and a bunch of business logic relating to those objects

anisoptera22:12:53

And I have a uikit UI right now, but it's mostly just a placeholder. I want to try React out instead but I'm stuck on actually marshaling the objects into ClJs and getting events back out

artemyarulin22:12:09

Oh nice, I’m not the only one who is migrating the existing app to CLJS :simple_smile: Most of the people here creating apps from the scratch

anisoptera22:12:31

Like I want something akin to the Shrimp example attached to Goby, but using Om instead

anisoptera22:12:50

Yeah it seems like everyone is just going pure cljs and I kind of like swift too

anisoptera22:12:20

It seems like a good fit to have the UI layer in react and the rest of the app native

artemyarulin22:12:32

So, just to clarify - you would like to use React Native wrapped in Om-Next for UI and the *logic in native swift?

anisoptera22:12:38

I kind of understand JSExport and such but React seems to resist this kind of thing to begin with

anisoptera22:12:59

Yeah basically. I want my model objects in swift and the UI logic in Om

artemyarulin22:12:32

hm, let me think. I have the exact opposite currently - logic in CLJS and native UI

anisoptera22:12:49

I looked at that but it was 4am so maybe I didn't quite understand what I was reading

artemyarulin22:12:30

re read what you wrote - your problem is to pass custom Swift class to JS world or what?

anisoptera22:12:20

Yes, I want to be able to marshal my existing model objects (core data) into JS. I know to do that is JSExport but I don't know how that fits in with Om

artemyarulin22:12:12

Ah, got it - you want to go hardcore style :simple_smile:

anisoptera22:12:43

The fact that you use that word to describe this is mildly unsettling, but sure :)

artemyarulin22:12:25

Well it is possible for sure

anisoptera22:12:22

Modules look like they're probably what I'm looking for. I'd just make a module encapsulating my data model... I see what you mean about hardcore though :p

artemyarulin22:12:46

well you can always pass data though RN *bridge, it support some basic types serialization by default + maps + arrays, but you would loose a context of core data

anisoptera22:12:28

Hmm, that's awkward

johanatan22:12:33

I wouldn't exactly call that hardcore-- in any app, you're going to inevitably encounter the need for native modules. And they're actually quite easy to get rolling with

johanatan22:12:56

I wrote and used one on my first day of working with CLJSRN

anisoptera22:12:57

It makes sense, I suppose I'd just have to also pass an object id and retrieve it when I save or whatever

artemyarulin22:12:02

another way could be - find a reference to JSContext which is used inside by ReactNative and using JSValue just inject your model inside of JS context

anisoptera22:12:19

Oh that sounds interesting

artemyarulin22:12:27

modules wouldn’t solve this problem actually - under the hood all the communication between JS and native world are still happening using bridge and some kind of serialization. I mean even though it’s a native module - you cannot transfer anything there. With JSValue you can

artemyarulin22:12:09

oh no, I guess I’m wrong, RN using JSContext and JSValues under the hood

anisoptera22:12:33

Ahh okay. I have some new names to look up now :) thanks!

artemyarulin22:12:12

well yeah, you welcome. I’m not sure that RN exposes kind of stuff but maybe

anisoptera22:12:38

I mean at worst I think I can just export some hooks from cljs and call into them using the context like you said

anisoptera22:12:02

It's still very experimental right now so I'm happy to have at least a starting point

artemyarulin22:12:52

just checked - in RN it’s called executors and it looks like it’s private https://github.com/facebook/react-native/blob/master/React/Base/RCTBatchedBridge.m#L330

artemyarulin22:12:40

I had a bit different case at the beginning - I had to make a call from native to CLJS without any RN RootView and so on. So I’ve created react-native-eval https://github.com/artemyarulin/react-native-eval Which allows calling js eval from the native side

artemyarulin22:12:36

Maybe it would help if you going to build some kind of custom bridge between your native and cljs world

anisoptera22:12:53

Yeah that looks helpful :)