{"id":16923818,"url":"https://github.com/bugaevc/one-base-class-to-rule-them-all","last_synced_at":"2025-03-21T00:29:54.993Z","repository":{"id":71726766,"uuid":"260484047","full_name":"bugaevc/one-base-class-to-rule-them-all","owner":"bugaevc","description":"Objective-C port of the universal Base https://www.destroyallsoftware.com/blog/2011/one-base-class-to-rule-them-all","archived":false,"fork":false,"pushed_at":"2020-05-01T15:11:41.000Z","size":2,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-25T21:12:01.553Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-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/bugaevc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","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":"2020-05-01T14:50:18.000Z","updated_at":"2020-05-01T15:44:58.000Z","dependencies_parsed_at":"2023-05-18T02:30:39.333Z","dependency_job_id":null,"html_url":"https://github.com/bugaevc/one-base-class-to-rule-them-all","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/bugaevc%2Fone-base-class-to-rule-them-all","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugaevc%2Fone-base-class-to-rule-them-all/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugaevc%2Fone-base-class-to-rule-them-all/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugaevc%2Fone-base-class-to-rule-them-all/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bugaevc","download_url":"https://codeload.github.com/bugaevc/one-base-class-to-rule-them-all/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244716892,"owners_count":20498278,"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-10-13T20:00:51.258Z","updated_at":"2025-03-21T00:29:54.969Z","avatar_url":"https://github.com/bugaevc.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# One Base Class to Rule Them All\n\nThis is an Objective-C port of the universal `Base` class as described in\nhttps://www.destroyallsoftware.com/blog/2011/one-base-class-to-rule-them-all.\nInstances of the `Base` class (or its subclasses) respond to any selector any\nother class responds to.\n\nLet's make a subclass of `Base`:\n\n```objc\n#import \"Base.h\"\n\n@interface Cantaloupe : Base\n@end\n\n@implementation Cantaloupe\n@end\n```\n\n(This is not required, but the original post does it, and we'll do it as well.)\nNow we can create an instance of this class:\n\n```objc\nCantaloupe *cantaloupe = [Cantaloupe new];\n```\n\nIf you're lucky, you'll get the `new` method from `NSObject`, and the call will\nsucceed, giving you a fresh cantaloupe. What can we do with it? Let's try\n`count`:\n\n```objc\nNSLog(@\"count = %lu\", (unsigned long) [cantaloupe count]);\n```\n\nwhich gives us 0! Why is it zero? What class was that method from, and where\ndid it get that value from? Who cares! Let's call more methods:\n\n```objc\nNSLog(@\"options = %lu\", (unsigned long) [cantaloupe options]);\nNSLog(@\"length = %lu\", (unsigned long) [cantaloupe length]);\nNSLog(@\"isDirectory = %d\", (BOOL) [cantaloupe isDirectory]);\nNSLog(@\"UTF8String = \\\"%s\\\"\", [cantaloupe UTF8String]);\n```\n\nApparently, it also has a length of zero and is not a directory. On the system\nI'm testing this on, the options returned are 64. What options are there? Where\ndoes that value come from? Who cares!\n\nIts UTF-8 representation is an empty C string. That is, an actual `char`\npointer which points to a zero byte. This is even consistent with its `length`\nbeing 0. Cool!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugaevc%2Fone-base-class-to-rule-them-all","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbugaevc%2Fone-base-class-to-rule-them-all","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugaevc%2Fone-base-class-to-rule-them-all/lists"}