{"id":15663934,"url":"https://github.com/djdeveloperr/deno_objc","last_synced_at":"2025-05-06T18:48:44.917Z","repository":{"id":43041596,"uuid":"453351867","full_name":"DjDeveloperr/deno_objc","owner":"DjDeveloperr","description":"Objective-C runtime bridge for Deno","archived":false,"fork":false,"pushed_at":"2023-06-09T18:12:17.000Z","size":1498,"stargazers_count":20,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-31T01:51:18.341Z","etag":null,"topics":["bridge","deno","ffi","javascript","objc","objective-c","runtime","typescript"],"latest_commit_sha":null,"homepage":"https://deno.land/x/objc","language":"TypeScript","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/DjDeveloperr.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":"2022-01-29T09:24:14.000Z","updated_at":"2024-12-05T09:13:34.000Z","dependencies_parsed_at":"2024-10-23T11:47:41.864Z","dependency_job_id":null,"html_url":"https://github.com/DjDeveloperr/deno_objc","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/DjDeveloperr%2Fdeno_objc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DjDeveloperr%2Fdeno_objc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DjDeveloperr%2Fdeno_objc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DjDeveloperr%2Fdeno_objc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DjDeveloperr","download_url":"https://codeload.github.com/DjDeveloperr/deno_objc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252749565,"owners_count":21798539,"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":["bridge","deno","ffi","javascript","objc","objective-c","runtime","typescript"],"created_at":"2024-10-03T13:40:32.950Z","updated_at":"2025-05-06T18:48:44.885Z","avatar_url":"https://github.com/DjDeveloperr.png","language":"TypeScript","funding_links":["https://github.com/sponsors/DjDeveloperr"],"categories":[],"sub_categories":[],"readme":"# Deno Objective-C\n\n[![Tags](https://img.shields.io/github/release/DjDeveloperr/deno_objc)](https://github.com/DjDeveloperr/deno_objc/releases)\n[![Doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/objc@0.1.0/mod.ts)\n[![Checks](https://github.com/DjDeveloperr/deno_objc/actions/workflows/ci.yml/badge.svg)](https://github.com/DjDeveloperr/deno_objc/actions/workflows/ci.yml)\n[![License](https://img.shields.io/github/license/DjDeveloperr/deno_objc)](https://github.com/DjDeveloperr/deno_objc/blob/master/LICENSE)\n[![Sponsor](https://img.shields.io/static/v1?label=Sponsor\u0026message=%E2%9D%A4\u0026logo=GitHub\u0026color=%23fe8e86)](https://github.com/sponsors/DjDeveloperr)\n\nObjective-C Runtime Bridge for Deno.\n\n```ts\nimport objc from \"https://deno.land/x/objc@0.1.0/mod.ts\";\n\nobjc.import(\"AppKit\");\n\nconst { NSPasteboard } = objc.classes;\n\nconst pasteboard = NSPasteboard.generalPasteboard();\n\nconst result = pasteboard.stringForType(\"public.utf8-plain-text\");\n// or\nconst result = objc\n  .send`${pasteboard} stringForType:${\"public.utf8-plain-text\"}`;\n\n// Convert to JS String\nconsole.log(result.UTF8String());\n```\n\n## Usage\n\nThis is mainly for interfacing with macOS Frameworks, but it can also be used\nwith GNUstep libobjc2.\n\nBy default, `libobjc.dylib`, `libobjc.so` or `objc.dll` will be loaded depending\non the platform.\n\nIf you want to override that, use `DENO_OBJC_PATH` env variable.\n\n## API\n\nTo retrieve a class, use `objc.classes`:\n\n```ts\nconst { NSPasteboard } = objc.classes;\n```\n\nTo retrieve a protocol, use `objc.protocols`:\n\n```ts\nconst { NSPasteboardReading } = objc.protocols;\n```\n\nIn Obj-C, take the following method:\n\n```cpp\n- (void)setString:(NSString *)string;\n```\n\nNow to send it, you do\n\n```cpp\n[self setString:@\"Hello World\"];\n```\n\nBut in JavaScript, you can do it in two ways. One is using the proxied method:\n\n```js\nself.setString_(\"Hello World\");\n// or\nself.setString(\"Hello World\");\n```\n\nAlternative way is to use `objc.send`:\n\n```js\nobjc.send`${self} setString:${\"Hello World\"}`;\n```\n\nWhen sending a message, the types of course need to be converted into native\nones. For example, by default the native string type in Obj-C is actually just\nnull terminated C string. So the JS string will be converted to that if the\nmethod needs.\n\nOtherwise, if we find that the method takes an `id` type, we will try to convert\nit to `NSString` instead.\n\nImporting frameworks at runtime is done via `NSBundle`. By default, only\n`Foundation` framework is loaded.\n\n## Security\n\nSince this module makes heavy use of FFI, it is inherently unsafe and gives\naccess to low level system primitives.\n\nAs such, to use this module you need to pass these flags:\n\n- `--allow-env`: To check for a possible `DENO_OBJC_PATH` value\n- `--allow-ffi`: To load ObjC runtime dynamic library\n- `--unstable`: The FFI API in Deno is an unstable API (it can change)\n\nThe allow-ffi permission basically breaks through entire security sandbox, so\nyou can also just pass `-A`/`--allow-all`.\n\n## License\n\n[Apache-2.0](./LICENSE) licensed.\n\nCopyright 2022 © DjDeveloperr\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjdeveloperr%2Fdeno_objc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdjdeveloperr%2Fdeno_objc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjdeveloperr%2Fdeno_objc/lists"}