{"id":13732231,"url":"https://github.com/garettbass/oc","last_synced_at":"2025-05-08T06:31:39.973Z","repository":{"id":88957482,"uuid":"188869688","full_name":"garettbass/oc","owner":"garettbass","description":"Macro magic for declaring/calling Objective-C APIs from C11 or C++.  Preloads selectors, chooses the correct objc_msgSend to call per method/platform.","archived":false,"fork":false,"pushed_at":"2024-04-19T13:54:07.000Z","size":35,"stargazers_count":56,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-08-04T02:10:56.850Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/garettbass.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}},"created_at":"2019-05-27T15:38:55.000Z","updated_at":"2024-07-12T04:39:54.000Z","dependencies_parsed_at":"2023-06-13T08:15:37.501Z","dependency_job_id":null,"html_url":"https://github.com/garettbass/oc","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/garettbass%2Foc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garettbass%2Foc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garettbass%2Foc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garettbass%2Foc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/garettbass","download_url":"https://codeload.github.com/garettbass/oc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224707949,"owners_count":17356447,"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-03T02:01:49.930Z","updated_at":"2024-11-14T23:31:35.446Z","avatar_url":"https://github.com/garettbass.png","language":"C","funding_links":[],"categories":["Scripting"],"sub_categories":[],"readme":"# OC - Easily Declare/Invoke Objective-C APIs from C11 or C++11\n\n## Usage\n\n```c\n// Call class and instance methods:\nNSWindow* const nswindow = oc_cls(NSWindow,new);\noc_obj(nswindow,NSWindow,setRestorable,false);\noc_obj(nswindow,NSWindow,setReleasedWhenClosed,false);\noc_obj(nswindow,NSWindow,setStyleMask,windowStyle);\noc_obj(nswindow,NSWindow,setFrame,windowRect,display,true);\noc_obj(nswindow,NSWindow,setIsVisible,true);\noc_obj(nswindow,NSWindow,center);\n```\n\n```c\n// Swizzle methods:\noc_obj_swizzle(void,NSWindow,dealloc) {\n    printf(\"NSWindow.%s\\n\",(const char*)cmd);\n    imp(self, cmd);\n}\n```\n\n```c\n// Declare and implement classes:\noc_interface(\n    AppDelegate,\n)\n\noc_implementation(\n    AppDelegate, NSObject,\n    obj(void,\n        applicationDidFinishLaunching,NSNotification*),\n    obj(NSApplicationTerminateReply,\n        applicationShouldTerminate,NSApplication*),\n    obj(void,\n        applicationWillTerminate,NSNotification*),\n)\n\noc_method(\n    void,\n    AppDelegate,\n    applicationDidFinishLaunching,NSNotification*\n) {\n    puts(__func__);\n}\n\noc_method(\n    NSApplicationTerminateReply,\n    AppDelegate,\n    applicationShouldTerminate,NSApplication*\n) {\n    puts(__func__);\n    app_quit();\n    return NSApplicationTerminateCancel;\n}\n\noc_method(\n    void,\n    AppDelegate,\n    applicationWillTerminate,NSNotification*\n) {\n    puts(__func__);\n    app_quit();\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarettbass%2Foc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgarettbass%2Foc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarettbass%2Foc/lists"}