Fork me on GitHub
#cljsrn
<
2021-08-09
>
kennytilton16:08:05

Just a heads up for CLJS+RN fans: over the weekend I got Matrix driving RN thanks to #helix, as far as a proof of concept and maybe half the slick macro-fication it needs for easy coding. I hope to put up a WIP repo next weekend. This package would then be CLJS+RN+transparent dataflow, without Reagent.

alexdavis16:08:25

what’s Matrix? not an easy thing to google 🙂

☝️ 2
kennytilton19:08:20

This the best of many Matrix write-ups, code pens, fiddles... : https://github.com/kennytilton/mxtodomvc/blob/master/README.md

alexdavis20:08:10

Interesting, I’ve been looking for new state management solutions since deciding that I really don’t like reframe/reagent much anymore, I mean they are great and do the job mostly, but there are issues.. I’ve been playing with Helix + https://github.com/orestis/reseda for smaller projects and was thinking of using something like https://homebase.io for big projects, but haven’t really put much time into any real research. I am a bit turned off by heavy macro usage though, its not a deal breaker but it makes things harder to learn and debug

kennytilton00:08:22

re-frame rocks if one likes setting up state/event domino chains manually, perhaps for a greater sense of control over what is happening. Libraries like MobX and Matrix go the transparent route, which can indeed be disconcerting; at first it feels like giving up control. A good analogy might be manual vs automatic memory management. The latter took a long time to gain acceptance outside of Lisp, not because folks doubted the automatic GC, but because it just gave them the willies. Creatures of habit we are. Reagent feels more like Cells to me, but it suffers from glitches. They do not break things very often, but why go there when glitch-free solutions are available? And even if the glitches were fixed (it is non-trivial), with Reagent we are still manually arranging the state/event dominos. Libraries such as MobX and Matrix discern the signal graph automatically by tracking dynamic state access. As for not liking macros, you can certainly code Matrix without them. I myself am not comfortable with "magic" until I understand what is going on, and macros do hide the mechanics. I think after about a day of coding you will be writing your own macros, but that is not a bad sequence.

sova-soars-the-sora23:08:00

Hi, I am interested in turning my mostly web-based (cljs/html) application into an iOS application... Is there some sort of guide I ought to be aware of?

kennytilton00:08:00

Are you Ok with Cordova? That will take an HTML-oriented app to mobile. If not, you just have to port from HTML to RN JSX and styling and use https://github.com/PEZ/rn-rf-shadow or sth

sova-soars-the-sora14:08:56

Cordova... I will have to check it out. Thanks for the link 🙂

kennytilton21:08:33

We develop/test in our local browser, ship to ChromeBook or iOS, @U3ES97LAC. Mind you, it is PITA deploying to iOS, but that is a given.

raspasov10:08:16

Except for putting it inside an iOS WebView, “turning” or “converting” a web-based HTML app into an iOS application that was not designed with iOS in mind is very much an impossibility without a significant re-write. Of course you might be able to extract the state logic written in CLJS, if it is well separated, but assume you’ll be re-writing 95%+ of all view/CSS code.

raspasov10:08:53

I don’t personally think Cordova, etc are good approaches, but if you’re OK with all the trade-offs, perhaps take a look at https://capacitorjs.com Apparently it’s derived from Cordova and modernized. I haven’t used either of them, so I can’t say much more.

kennytilton14:08:35

The goal was "turning my mostly web-based (cljs/html) application into an iOS application", so guessing the OP understands significant work lies ahead, but they are hoping for not as significant as a port to Swift. Mind you, I should have asked their current framework: lots of CLJS + RN examples out there for Reagent and re-frame, and soon Matrix. 🙂

👍 4
kennytilton14:08:51

@U3ES97LAC, what FE framework are you using now?

kennytilton14:08:09

This guy will have you up on RN in three minutes. 🙂 https://github.com/PEZ/rn-rf-shadow#using-clojurescript-repl Hello world, anyway, but we all know what a bear that is.

sova-soars-the-sora16:08:03

@U0PUGPSFR Thank you for confirming my suspicions on the pita part. Yeah, I think I need to get a running copy of Xcode first, and I was thinking there was a way to REPL onto an iPhone/iPad, kinda like shadowcljs or figwheel, but I don't necessarily need all that... If I can just package what I have relatively pain-free as an "app" even though it's just a website, maybe it would be plenty good. Needing constant internet connection is probably a non-starter though. So, thinking about it out loud like this, maybe I will work on making all the app data available in one SPA and then port that SPA to iOS.

alexdavis23:08:45

There is no html in rn so that might be more like rewriting your application than simply moving it across.. if it's a complex app and you don't need specific native components you can make a simple wrapper app using a webview. its definitely the quickest way and has the advantage of staying in sync with the web version, though you have to include some basic native functionality like push notifications so that apple will approve it. We did it for a big web app and just added a native sign in screen which fetched and stored the session token from the server, everything else used the web app in a webview component

alexdavis23:08:20

If you go down that path I would recommend just using swift though

alexdavis23:08:11

Otherwise you will have to extract out the common code that can be shared between rn and the web, and then rewrite your views (and anything that users browser only apis like local storage)