{"id":15873798,"url":"https://github.com/phronmophobic/objcjure","last_synced_at":"2025-03-16T04:30:44.709Z","repository":{"id":248938747,"uuid":"830177794","full_name":"phronmophobic/objcjure","owner":"phronmophobic","description":"A clojure DSL for calling objective c code","archived":false,"fork":false,"pushed_at":"2024-11-08T23:02:53.000Z","size":42,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-27T05:02:52.748Z","etag":null,"topics":["clojure","ffi","objective-c"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phronmophobic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-17T18:47:06.000Z","updated_at":"2024-11-13T02:33:13.000Z","dependencies_parsed_at":"2024-11-08T20:36:10.912Z","dependency_job_id":null,"html_url":"https://github.com/phronmophobic/objcjure","commit_stats":{"total_commits":28,"total_committers":1,"mean_commits":28.0,"dds":0.0,"last_synced_commit":"d3a79e64539c4312ec0ea79a35465dabf934420f"},"previous_names":["phronmophobic/objcjure"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phronmophobic%2Fobjcjure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phronmophobic%2Fobjcjure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phronmophobic%2Fobjcjure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phronmophobic%2Fobjcjure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phronmophobic","download_url":"https://codeload.github.com/phronmophobic/objcjure/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":["clojure","ffi","objective-c"],"created_at":"2024-10-06T01:06:49.104Z","updated_at":"2025-03-16T04:30:44.703Z","avatar_url":"https://github.com/phronmophobic.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# objcjure\n\nA clojure DSL for calling objective c code. This turns out to be mostly useless since most interesting app permissions aren't enabled for the default \"JVM app\". \n\n## Usage\n\n### Dep\n\n```clojure\ncom.phronemophobic/objcjure {:mvn/version \"1.0\"}\n```\n\n### Require\n\n```clojure\n(require '[com.phronemophobic.objcjure :refer [objc]\n           :as objc])\n```\n\n## Syntax\n\n### Literals\n\n| Clojure Type | Objective-C Type |\n|--------------|-------------------|\n| `nil`        | NULL (null pointer) |\n| `boolean`    | BOOL                |\n| `byte`       | int8                |\n| `short`      | int16               |\n| `int`        | int32               |\n| `long`       | int64               |\n| `float`      | float32             |\n| `double`     | float64             |\n\nExamples:\n\n| Clojure       | Objective-C |\n|---------------|-------------|\n| `nil`         | `NULL`        |\n| `true`        | `YES`         |\n| `false`       | `NO`          |\n| `(byte 1)`    | `1`           |\n| `(short 1)`   | `1`           |\n| `(int 1)`     | `1`           |\n| `1`           | `1`           |\n| `(float 1.0)` | `1.0`         |\n| `1.0`         | `1.0`         |\n\n#### Coercions\n\nCoercions for common objective-c types are also provided via `@`.\n\n| Clojure       | Objective-C |\n|---------------|-------------|\n| `@\"mystring\"` | `@\"mystring\"` |\n| `@true`       | `@YES`      |\n| `@false`      | `@NO`       |\n| `@1`          | `@1`        |\n| `@1.0`        | `@1.0`      |\n| `@{@\"key\" @\"value\"}` | `@{@\"key\" @\"value\"}` |\n| `@[@1, @2]` | `@[@1 @2 ]` |\n| `@#{@1, @2}` | `[NSSet setWithArray: @[@1 @2 ]]` |\n\n### Symbols\n\nIf a symbol can be resolved in the current context, it will use the value of the binding. Otherwise, it is assumed to be the name of a class which will be looked up at runtime.\n\n\n### Function Calls\n\nFunction calls are represented by vectors (similar to how they appear in objective-c).\n\nSome examples:\n\n| clojure | objective-c |\n|--------------|-------------------|\n| `[NSArray :array]` | `[NSArray array]` |\n| `[nsdict :setValue:forKey info @\"nowPlayingInfo\"]` | `[nsdict setValue:info forKey:@\"nowPlayingInfo\"]` |\n\nNote the differences:\n- the method selector is a keyword\n- the method selector is the full selector (splitting up the selector into its parts to more closely match objective c may be supported in the future).\n- No trailing `:` in method name!\n\nThe return type is assumed to be a pointer, but can be coerced via type hint.\n```clojure\n\n;; Return a long.\n(objc ^long [[NSArray :array] :count])\n;; Return void\n(objc ^void [my-player :play])\n\n;; Return a type by hinting the dtype next struct name\n(objc ^cm_time [~(:player @pod-state) :currentTime])\n```\n\nThe following type hints are supported:\n- `byte`\n- `short`\n- `int`\n- `long`\n- `float`\n- `double`\n- `pointer`\n- `pointer?`\n- `void`\n- The name (as a symbol) of a dtype next struct.\n\n\n### Blocks\n\nAnonymous functions are automatically coerced to blocks. The return value and args are assumed to be of type pointer, but can be specified via type hint.\n\n```\n(objc ^void\n      [[AVAudioSession :sharedInstance]\n       :activateWithOptions:completionHandler\n       0\n       (fn ^void [^byte activated error]\n         (println \"activated\" activated error))])\n```\n\n### Unescape\n\nArbitrary clojure can be inserted anywhere using `~`.\n\n`(objc [NSNumber :numberWithLong ~(+ 1 2 3 4)])`\n\n## License\n\nCopyright © 2024 Adrian\n\nDistributed under the under Apache License v2.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphronmophobic%2Fobjcjure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphronmophobic%2Fobjcjure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphronmophobic%2Fobjcjure/lists"}