Fork me on GitHub
#graalvm-mobile
<
2021-07-11
>
phronmophobic19:07:47

Just added an example that let's you script UIs using a sci repl, https://github.com/phronmophobic/mobiletest#membrane-example. Feedback welcome! Here's an example of a simple counter:

(require '[membrane.ui :as ui])
(require '[com.phronemophobic.mobiletest.membrane :refer
           [main-view]])


(def my-count (atom 0))

(defn counter-view []
  (ui/translate 50 100
                (ui/on
                 :mouse-down
                 (fn [pos]
                   (swap! my-count inc)
                   nil)
                 (ui/label (str "the count "
                                @my-count)
                           (ui/font nil 42)))))


(add-watch my-count ::update-view (fn [k ref old updated]
                                    (reset! main-view (counter-view))))

(reset! my-count 0)

👍 2
borkdude19:07:12

wwwwaaat, wow

😄 2
phronmophobic19:07:29

I've done a little bit more research into what objc interop would look like, but it's still a work in progress.

phronmophobic19:07:39

I wish the Apple ecosystem wasn't so closed down. Not sure what the best way to make it easy for other people to try things out.

borkdude19:07:39

Perhaps publish a thing that people can try via this thing, what was it, TestFlight?

phronmophobic20:07:09

yea, I can look into that if people are interested

borkdude20:07:55

I would be interested in that.

borkdude20:07:13

Are you also able to change the UI via the SCI REPL in the published app?

phronmophobic20:07:51

yea, there's a main-view atom. just reset its value and it will get redrawn

borkdude20:07:58

that's wicked

phronmophobic20:07:04

in addition to test-flight, I guess there's probably some CI system that could build everything for you if given the right provisioning profile

borkdude20:07:38

Maybe try to get something in the app store? ;)

phronmophobic20:07:54

I know Apple has frowned upon apps with scripting capabilities before, but maybe it's less restrictive now?

borkdude20:07:09

Maybe don't tell em? ;)

borkdude20:07:23

it's just "a config file to set the UI layout"

borkdude20:07:21

I think you could let users point to their gist to import a certain UI configuration (using scripting). Don't know what the app itself would do, perhaps a 4clojure app (now that the site is closing down) or a SCI REPL?

borkdude20:07:25

(typing code on a phone is a bit awkward though)

borkdude20:07:45

perhaps "docstring of the day", an app which shows you info about a particular clojure function

phronmophobic20:07:20

yea, it's more fun if you can script against the Apple platform apis

phronmophobic20:07:32

otherwise, you might as well make a web app

borkdude20:07:06

yes, agreed

borkdude21:07:18

@smith.adriane I wonder, have you ever had the stalling problem again since we made the initialize-at-build-time fix? > If it gets stuck directly after setup and doesn't reach the clinit phase within 3-4 minutes, try stopping the script and restarting ./scripts/compile-shared.

phronmophobic21:07:20

good find! maybe it's time to remove the warning from the docs

borkdude21:07:25

Perhaps it's possible to record your screen on the phone as post this as an animated gif in the repo

phronmophobic21:07:21

yea, shouldn't be too hard

borkdude21:07:29

also perhaps make a link or mention of this channel to get more interested people in here

2
👍 2