{"id":19805615,"url":"https://github.com/remirobert/rroloadswizzle","last_synced_at":"2025-05-01T06:31:17.482Z","repository":{"id":62452149,"uuid":"182246498","full_name":"remirobert/RROLoadSwizzle","owner":"remirobert","description":"Method swizzling, change the implementation of an existing selector.","archived":false,"fork":false,"pushed_at":"2019-04-20T08:46:24.000Z","size":40,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-19T09:28:45.012Z","etag":null,"topics":["objective-c","swizzle","unittest"],"latest_commit_sha":null,"homepage":"","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/remirobert.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}},"created_at":"2019-04-19T10:16:29.000Z","updated_at":"2019-04-20T08:45:30.000Z","dependencies_parsed_at":"2022-11-01T23:46:02.240Z","dependency_job_id":null,"html_url":"https://github.com/remirobert/RROLoadSwizzle","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remirobert%2FRROLoadSwizzle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remirobert%2FRROLoadSwizzle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remirobert%2FRROLoadSwizzle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remirobert%2FRROLoadSwizzle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remirobert","download_url":"https://codeload.github.com/remirobert/RROLoadSwizzle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251835597,"owners_count":21651678,"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":["objective-c","swizzle","unittest"],"created_at":"2024-11-12T09:04:40.511Z","updated_at":"2025-05-01T06:31:17.202Z","avatar_url":"https://github.com/remirobert.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RROLoadSwizzle\n\n![buid status](https://app.bitrise.io/app/14d90a9dfd5ce2e8/status.svg?token=uQY671hjdyKtODwsl18vfA) [![codecov](https://codecov.io/gh/remirobert/RROLoadSwizzle/branch/master/graph/badge.svg)](https://codecov.io/gh/remirobert/RROLoadSwizzle)\n\nUsed to assist in unit testing.\nCheck **Tests** for usage.\n\n```Objective-c\n\n//A function which is the implementation of original method. \n//The function must take at least two arguments—self and _cmd.\nvoid (*gOriginalViewDidLoad)(id, SEL);\n\n- (void)tearDown {\n    RRO_REVERT_SWIZZLE_ALL_METHOD([UIViewController class]);\n}\n\n- (void)testThatViewDidLoadIsCalledWhenShowWindow {\n  __block BOOL isViewDidLoadCalled = NO;\n  \n  void (^viewDidLoadBlock)(UIViewController *, SEL) = ^void (UIViewController *nav, SEL _cmd) {\n    isViewDidLoadCalled = true;\n    NSLog(@\"viewDidLoad called here\");\n\n    //call original @selector(viewDidLoad) if needed\n    gOriginalViewDidLoad(nav, _cmd); \n  };\n  \n  RRO_SWIZZLE_BLOCK([UIViewController class], @selector(viewDidLoad), viewDidLoadBlock, \u0026gOriginalViewDidLoad);\n  \n  UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];\n  window.rootViewController = [[UIViewController alloc] init];\n  [window makeKeyAndVisible];\n  \n  XCTAssertTrue(isViewDidLoadCalled);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremirobert%2Frroloadswizzle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremirobert%2Frroloadswizzle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremirobert%2Frroloadswizzle/lists"}