{"id":18854868,"url":"https://github.com/noear/perona_ios","last_synced_at":"2026-02-05T18:30:19.716Z","repository":{"id":145378757,"uuid":"228589305","full_name":"noear/perona_ios","owner":"noear","description":"noear::将客户端的组件功能服务化的一个框架","archived":false,"fork":false,"pushed_at":"2019-12-24T13:58:14.000Z","size":70,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-30T18:38:50.999Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/noear.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":"2019-12-17T10:14:21.000Z","updated_at":"2019-12-24T13:58:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"109a5394-ec4c-4778-baad-207c797739da","html_url":"https://github.com/noear/perona_ios","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/noear%2Fperona_ios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noear%2Fperona_ios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noear%2Fperona_ios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noear%2Fperona_ios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noear","download_url":"https://codeload.github.com/noear/perona_ios/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239793064,"owners_count":19697893,"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-11-08T03:52:00.052Z","updated_at":"2026-02-05T18:30:19.634Z","avatar_url":"https://github.com/noear.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# perona for ios\nperona是一个跨平台的服务启动框架。是服务端版本solon的情侣版，有android版本，有ios版本。\n\n\n借签了B/S模式，在客户端实现组件功能的服务化，进而为大项目的组件化开发，提供一套弱偶合的方案。比如像支付宝那种有N多组件组成的项目...\n\n\n基于客户端的需要，框架里也支持消息总线功能。用于组件之间的消息分发.\n\n\n最佳的效果：开发一个动态的框架性主项目，所有组件功能全在服务端进行配置。\n\n\n\n### perona使用说明\n\n#### 1、相关项目添加引用\n\n`pod 'perona',:git=\u003e\"https://github.com/noear/perona_ios.git\"`\n\n#### 2、主项目启动服务\n```Objective-C\n#import \u003cperona/perona.h\u003e  //:不要太纠结大小写的问题：）\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n    //启动服务（内置了正则路由表 和 HASH路由表，也可以自己定义一个）\n    [XApp start:application];\n}\n```\n\n#### 3、组件项目进行适配（例组件名：module2）\n##### 3.1 适配XMoudle接口\n```Objective-C\n//XModule2.h\n@interface XModule2 : NSObject\u003cXModule\u003e\n\n@end\n\n//XModule2.m\n@implementation XModule2\n-(void)start:(XApp*) app{\n    //app.application; //此对象可用\n\n    //注册路由\n    [app reg:self expr:@\"xapp://module2/xxx\" handler:^(XContext*  c) {\n        [c output:@\"m2\"]; //跳转控制器等...业务处理（可以输出结果，或不输出）\n    }];\n}\n@end\n```\n##### 3.2 添加配置文件 perona.plist （完成组件自发现的配置）\n`perona.xmodule = XModule2`\n\n#### 4、主项目引入组module2（内部配置需要自己完成）\n`pod 'module2'`\n\n#### 5 调用\n##### 5.1 本地代码调用\n```Objective-C\n//调用功能\n////不需要回调的\n[XClient call:self url:@\"xapp://module2/xxx?id=1\" params:nil]; \n////需要回调的\n[XClient call:self url:@\"xapp://module2/xxx?id=1\" params:nil callback:^(XContext* c,id data) {\n    NSLog(@\"%@\", data); \n}];\n\n//分发消息\n[XClient send:self url:@\"msg://topic/xxx\" params:nil];\n```\n##### 5.2 内嵌WEB调用（需要适配一下WebView）\n```html\n\u003ca href=\"xapp://module2/xxx?id=1\"\u003exxx\u003c/a\u003e\n```\n\n# 复杂一点的XModule示例\n有助于了解期作用...\n\n```Objective-C\n\n#import \"XModuleXxxx.h\"\n#import \"XxxxApp.h\"\n\n@implementation XModuleXxxx\n\n- (void)start:(XApp *)app\n{\n    [app reg:self expr:@\"xapp://Xxxx/*\" handler:^(XContext * _Nonnull context) {\n        \n        NSString *p = context.path;\n        NSDictionary *params = context.paramMap;\n        UIViewController *vc = (UIViewController *)context.requester;\n        \n        NSString *mobile = params[@\"mobile\"];\n        NSString *ugroupId = params[@\"ugroupId\"];\n        \n        if([p isEqualToString:@\"/id\"]){\n            [XxxxApp showIdOcrView:vc mobile:mobile ugroupId:ugroupId completion:^(BOOL success, NSString * message) {\n                [context output:@(success)];\n            }];\n        }\n        else if([p isEqualToString:@\"/face\"]){\n            [XxxxApp showFaceLiveView:vc mobile:mobile ugroupId:ugroupId completion:^(BOOL success, NSString * message) {\n                [context output:@(success)];\n            }];\n        }\n        else if([p isEqualToString:@\"/contacts\"]){\n            [XxxxApp showContactsView:vc mobile:mobile ugroupId:ugroupId completion:^(BOOL success, NSString * message) {\n                [context output:@(success)];\n            }];\n        }\n        else if([p isEqualToString:@\"/tele\"]){\n            [XxxxApp showWebView:vc mobile:mobile ugroupId:ugroupId AuthUrlType:AuthUrlTypeWechash completion:^(BOOL success, NSString * message) {\n                [context output:@(success)];\n            }];\n        }\n        else if([p isEqualToString:@\"/sesame\"]){\n            [XxxxApp showWebView:vc mobile:mobile ugroupId:ugroupId AuthUrlType:AuthUrlTypeZmxy completion:^(BOOL success, NSString * message) {\n                \n                [context output:@(success)];\n            }];\n        }\n    }];\n}\n\n@end\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoear%2Fperona_ios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoear%2Fperona_ios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoear%2Fperona_ios/lists"}