Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Xcoder1011/SKGenerateModelTool

Repository files navigation

SKGenerateModelTool

  • 支持Objective-C / Swift / Dart / TypeScript

  • 支持通过URL链接或json字符串一键生成 model 文件

  • 兼容YYModel / MJExtension / HandyJSON解析

  • Swift 模型默认使用Codable协议

  • 支持字符串加密及可扩展的自定义加密算法实现

  • 支持自定义模型基类、命名前缀、作者信息及注释

  • 支持代码高亮(使用highlight.js)

  • 支持导出TypeScript Interfaces

  • 支持自定义导出文件路径

  • Flutter Model解析兼容了服务端返回string/int/double时数据类型混用的情况

  • 兼容服务端字段类型混用场景

  • 支持驼峰命名

  • Support Objective-C / Swift / Dart / TypeScript

  • Supports one-click generation of model files through URL links or json strings

  • Compatible with YYModel / MJExtension / HandyJSON analysis

  • Swift models use the Codable protocol by default

  • Support string encryption (different keys can be set, developers can modify the encryption algorithm)

  • Support custom model superclass name, custom model prefix, custom author name, add comments

  • Support code highlighting(It uses highlight.js as it core)

  • Support for exporting TypeScript Interfaces

  • Support custom output folder path

  • Flutter model parsing is compatible with mixed data types when the server returns string / int / double

  • Compatible server returns "id" field

  • Supports hump naming

Usage

  • 方式一:直接下载软件安装 点击下载
  • 方式二:下载代码运行

Objective-C

Objective-C

Swift

Swift

Dart

Dart

TypeScript Interfaces

TypeScript

字符串加密示例

字符串加密示例

加密后的内容添加到项目中(声明和定义可以分别放.h 和.m),因为代码依赖 SKEncryptString 结构体,所以需要导入头文件SKEncryptHeader.h引用。

只需把此头文件(SKEncryptHeader.h)加入到项目,并在 pch 文件中导入该头文件即可使用; Just add this header file (SKEncryptHeader.h) to the project and import the header file in the pch file to use;

SKEncryptHeader.h

加密后的数据申明:

/** 需要加密的重要字符,比如AppKey、AppSecret、AppID、数据库密码等 */
extern const SKEncryptString * const _3596508958;
/** Important characters that need to be encrypted, such as appkey, appsecret, appid, database password, etc */
extern const SKEncryptString * const _4038772756;
/** appkeyhdfoashiodfowehfowefjqwehgpqegpifhwappkey */
extern const SKEncryptString * const _3908173925;

定义:

/** 需要加密的重要字符,比如AppKey、AppSecret、AppID、数据库密码等 */
const SKEncryptString * const _3596508958 = &(SKEncryptString){
 .factor = (char)9,
 .value = (char[]){-125,-10,-22,-126,-52,-21,-113,-32,-54,-113,-59,-20,-115,-16,-18,-125,-19,-25,-126,-52,-21,-113,-57,-3,-115,-58,-52,-123,-42,-26,-116,-59,-2,-113,-52,-24,43,26,26,33,15,19,-119,-22,-21,43,26,26,57,15,9,24,15,30,-119,-22,-21,43,26,26,35,46,-119,-22,-21,-116,-1,-38,-116,-25,-60,-113,-48,-7,-113,-59,-20,-115,-54,-21,-115,-57,-29,0},
 .length = 83,
};
/** Important characters that need to be encrypted, such as appkey, appsecret, appid, database password, etc */
const SKEncryptString * const _4038772756 = &(SKEncryptString){
 .factor = (char)100,
 .value = (char[]){57,31,4,0,20,29,1,2,6,73,19,26,21,29,7,10,20,9,0,26,80,6,28,14,18,73,14,9,23,13,80,6,27,79,4,12,64,9,28,10,2,11,4,27,3,13,76,76,1,28,19,26,84,14,21,73,1,28,2,2,21,11,88,79,7,25,16,31,23,10,2,23,0,67,70,8,16,28,27,13,92,82,16,14,18,8,2,13,1,12,80,2,21,28,21,30,15,30,22,69,80,23,0,12,0},
 .length = 104,
 .key = (char[]){119,117,115,104,97,110,103,107,117,110,0},
 .kl = 10
};
/** appkeyhdfoashiodfowehfowefjqwehgpqegpifhwappkey */
const SKEncryptString * const _3908173925 = &(SKEncryptString){
 .factor = (char)50,
 .value = (char[]){4,20,23,14,1,30,13,0,1,10,5,20,13,13,8,1,2,8,18,1,15,3,11,16,0,2,13,20,19,2,13,3,23,20,1,0,21,13,1,13,19,6,21,20,12,0,29,0},
 .length = 47,
 .key = (char[]){98,99,96,0},
 .kl = 3
};

使用时

 if let string = sk_OCString(_3596508958) {
 print("示例:解密后的数据为:\(string)")
 }
 if let string = sk_OCString(_4038772756) {
 print("The decrypted data is:\(string)")
 }

encrypt_result

Tip:本工具仅用到简单的 XOR 加密算法,开发者可自行下载项目进行加密算法修改,另外也可直接下载项目里的 dmg 文件进行安装使用。

About

Automatically generate model files, support JSON and URL requests. JSON转model工具(Mac软件)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /