{"id":13759456,"url":"https://github.com/phronmophobic/mobiletest","last_synced_at":"2025-03-16T04:30:50.918Z","repository":{"id":47612852,"uuid":"375462166","full_name":"phronmophobic/mobiletest","owner":"phronmophobic","description":"A proof of concept for building iOS applications in clojure via graalvm's native-image","archived":false,"fork":false,"pushed_at":"2022-05-27T18:18:07.000Z","size":37903,"stargazers_count":92,"open_issues_count":0,"forks_count":4,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-02-27T05:02:46.036Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phronmophobic.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-09T19:02:52.000Z","updated_at":"2024-10-09T06:37:55.000Z","dependencies_parsed_at":"2022-07-21T16:34:37.218Z","dependency_job_id":null,"html_url":"https://github.com/phronmophobic/mobiletest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phronmophobic%2Fmobiletest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phronmophobic%2Fmobiletest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phronmophobic%2Fmobiletest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phronmophobic%2Fmobiletest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phronmophobic","download_url":"https://codeload.github.com/phronmophobic/mobiletest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243802943,"owners_count":20350316,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T13:00:53.425Z","updated_at":"2025-03-16T04:30:45.906Z","avatar_url":"https://github.com/phronmophobic.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# This Project has moved to https://github.com/phronmophobic/grease\n\nThis project has been renamed to grease and moved to https://github.com/phronmophobic/grease.\n\n# mobiletest\n\nAn example of building a clojure library for iOS with graalvm native-image.\n\n\n## Game of Life Example\n\nSee `examples/gol`\n\n![game-of-life](/game-of-life.gif?raw=true)\n\n## Public Beta\n\nTry the public beta iOS app through test flight https://testflight.apple.com/join/GLOKMgFX\n\n## Prerequisites\n\n1. Download java's arm64 static libraries built for ios. They can be downloaded using `download-deps`\n\n```sh\n\n$ scripts/download-deps\n```\n\n2. Setup graalvm and make sure your clojure project is graalvm compatible. https://github.com/BrunoBonacci/graalvm-clojure\n\nMake sure `GRAALVM_HOME` is set and is on your path before starting.\n\n```\nexport GRAALVM_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java11-VERSION/Contents/Home\nexport PATH=$GRAALVM_HOME/bin:$PATH\n```\n\n3. Install [Graalvm LLVM Backend](https://www.graalvm.org/reference-manual/native-image/LLVMBackend/)\n\n```sh\n$ gu install llvm-toolchain\n```\n\n## Usage\n\n1. Compile your clojure project\n\n```sh\n\n$ ./scripts/compile-shared\n\n```\nThis can take a while. \n\n2. Open the xcode project in xcode/MobileTest/MobileTest.xcodeproj  \n3. Select \"Any iOS Device(arm64)\" or your connected device as the build target. (iOS Simulator not supported yet)\n4. Build and run\n\n\n\n## Membrane Example\n\nAn example project that uses [membrane](https://github.com/phronmophobic/membrane) for UI can be found under xcode/TestSkia/TestSkia.xcodeproj. It also starts a sci repl that can be used for interactive development. Simply connect to the repl and start hacking! To update the UI, just `reset!` the main view atom. Example scripts below.\n\n### Usage\n\n1. Compile `./scripts/compile-membrane`\n2. Open xcode/TestSkia/TestSkia.xcodeproj\n3. Build and run\n4. The console will print the IP addresses available. Connect to repl on your device using the IP address and port 23456.\n5. Hack away!\n\n### Example scripts\n\nHello World!\n\n```clojure\n(require '[membrane.ui :as ui])\n(require '[com.phronemophobic.mobiletest.membrane :refer\n           [main-view]])\n\n(def red [1 0 0])\n\n(reset! main-view\n        (ui/translate 50 100\n                      (ui/with-color red\n                        (ui/label \"Hello World!\"\n                                  (ui/font nil 42)))))\n```\n\nSimple Counter\n\n```clojure\n(require '[membrane.ui :as ui])\n(require '[com.phronemophobic.mobiletest.membrane :refer\n           [main-view]])\n\n\n(def my-count (atom 0))\n\n(defn counter-view []\n  (ui/translate 50 100\n                (ui/on\n                 :mouse-down\n                 (fn [pos]\n                   (swap! my-count inc)\n                   nil)\n                 (ui/label (str \"the count \"\n                                @my-count)\n                           (ui/font nil 42)))))\n\n\n(add-watch my-count ::update-view (fn [k ref old updated]\n                                    (reset! main-view (counter-view))))\n\n(reset! my-count 0)\n```\n\nBasic Drawing\n\n```clojure\n\n(require '[membrane.ui :as ui])\n(require '[com.phronemophobic.mobiletest.membrane :refer\n           [main-view]])\n\n\n(def pixels (atom []))\n\n(defn view []\n  (ui/on\n   :mouse-down\n   (fn [pos]\n     (swap! pixels conj pos))\n   [(ui/rectangle 600 800)\n    (into []\n          (map (fn [[x y]]\n                 (ui/translate x y\n                               (ui/with-color [0 0 1 1]\n                                 (ui/rectangle 10 10)))))\n          @pixels\n     )])\n  )\n\n(add-watch pixels ::update-view (fn [k ref old updated]\n                                  (reset! main-view (view))))\n\n(reset! pixels [])\n```\n\n### Example projects\n\nFound in `examples/` directory.\n\n[examples/ants](examples/ants) - Classic ant sim  \n[examples/gol](examples/gol) - Game of Life  \n[examples/objc](examples/objc) - Objective-c interop  \n[t3tr0s-bare](https://github.com/phronmophobic/t3tr0s-bare) - Tetris  \n[snake](https://github.com/phronmophobic/programming-clojure) - Snake  \n\n## Slack\n\nQuestions? Comments? Connect with us on clojurians slack in [#graalvm-mobile](https://clojurians.slack.com/archives/C0260KHN0Q0) (join [here](http://clojurians.net/)).\n\n\n## License\n\nCopyright © 2021 Adrian\n\nDistributed under the GPLv2 License. See LICENSE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphronmophobic%2Fmobiletest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphronmophobic%2Fmobiletest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphronmophobic%2Fmobiletest/lists"}