@@ -8,54 +8,34 @@ MJExtension
8
8
9
9
[ 📜✍🏻** Release Notes** : more details] ( https://github.com/CoderMJLee/MJExtension/releases )
10
10
11
- ### ‼️ 纯Swift版的JSON与Model转换框架已经开源上架 ‼️
12
-
13
- - [ KakaJSON] ( https://github.com/kakaopensource/KakaJSON )
14
- - [ 中文教程] ( https://www.cnblogs.com/mjios/p/11352776.html )
15
- - 如果你的项目是用Swift写的Model,墙裂推荐使用[ KakaJSON] ( https://github.com/kakaopensource/KakaJSON )
16
- - 已经对各种常用的数据场景进行了大量的单元测试
17
- - 简单易用、功能丰富、转换快速
18
-
19
-
20
-
21
- ### Use the Framework in Swift [ 关于在Swift中使用MJExtension] ‼️
22
-
23
- > Example:
24
- >
25
- > - [ Model - MJTester.swift] ( MJExtensionTests/SwiftModel/MJTester.swift )
26
- >
27
- > - [ Usage - SwiftModelTests.swift] ( MJExtensionTests/SwiftModelTests.swift )
28
-
29
- #### ‼️ ` @objc ` or ` objcMembers ` attributes should be added to class or property for declaration of Objc accessibility [ 在 Swift4 之后, 请在属性前加 ` @objc ` 修饰或在类前增加 ` objcMembers ` . 以保证 Swift 的属性能够暴露给 Objc 使用. ] ‼️
30
- #### ‼️ Use ` NSNumber ` instead of ` Bool ` , which is not bridged to ` BOOL ` . [ 请勿使用 ` Bool ` 类型, 因为在 Swift 中并没有桥接该类型, 不能显式的对应 ` BOOL ` , 请使用 ` NSNumber ` 替代] ‼️
31
-
32
11
## Contents
33
12
34
13
* [ Getting Started 【开始使用】] ( #Getting_Started )
35
14
* [Features 【能做什么】](#Features)
36
15
* [Installation 【安装】](#Installation)
37
16
* [ Examples 【示例】] ( #Examples )
38
- * [JSON -> Model](#JSON_Model)
39
- * [JSONString -> Model](#JSONString_Model)
40
- * [Model contains model](#Model_contains_model)
41
- * [Model contains model-array](#Model_contains_model_array)
42
- * [Model name - JSON key mapping](#Model_name_JSON_key_mapping)
43
- * [JSON array -> model array](#JSON_array_model_array)
44
- * [Model -> JSON](#Model_JSON)
45
- * [Model array -> JSON array](#Model_array_JSON_array)
46
- * [Core Data](#Core_Data)
47
- * [Coding](#Coding)
48
- * [Secure Coding](#SecureCoding)
49
- * [Camel -> underline](#Camel_underline)
50
- * [NSString -> NSDate, nil -> @""](#NSString_NSDate)
51
- * [NSDate -> NSString](#NSDate_NSString)
52
- * [More use cases](#More_use_cases)
17
+ * [ Usage in Swift] ( #usage_in_swift )
18
+ * [ JSON -> Model] ( #JSON_Model )
19
+ * [ JSONString -> Model] ( #JSONString_Model )
20
+ * [ Model contains model] ( #Model_contains_model )
21
+ * [ Model contains model-array] ( #Model_contains_model_array )
22
+ * [ Model name - JSON key mapping] ( #Model_name_JSON_key_mapping )
23
+ * [ JSON array -> model array] ( #JSON_array_model_array )
24
+ * [ Model -> JSON] ( #Model_JSON )
25
+ * [ Model array -> JSON array] ( #Model_array_JSON_array )
26
+ * [ Core Data] ( #Core_Data )
27
+ * [ Coding] ( #Coding )
28
+ * [ Secure Coding] ( #SecureCoding )
29
+ * [ Camel -> underline] ( #Camel_underline )
30
+ * [ NSString -> NSDate, nil -> @""] ( #NSString_NSDate )
31
+ * [ NSDate -> NSString] ( #NSDate_NSString )
32
+ * [ More use cases] ( #More_use_cases )
53
33
54
34
---
55
35
56
- # <a id =" Getting_Started " ></a > Getting Started【开始使用】
36
+ ## <a id =" Getting_Started " ></a > Getting Started【开始使用】
57
37
58
- ## <a id =" Features " ></a > Features【能做什么】
38
+ ### <a id =" Features " ></a > Features【能做什么】
59
39
- MJExtension是一套字典和模型之间互相转换的超轻量级框架
60
40
* ` JSON ` --> ` Model ` 、` Core Data Model `
61
41
* ` JSONString ` --> ` Model ` 、` Core Data Model `
@@ -66,15 +46,15 @@ MJExtension
66
46
* Coding all properties of a model with only one line of code.
67
47
* 只需要一行代码,就能实现模型的所有属性进行Coding / SecureCoding(归档和解档)
68
48
69
- ## <a id =" Installation " ></a > Installation【安装】
49
+ ### <a id =" Installation " ></a > Installation【安装】
70
50
71
- ### From CocoaPods【使用CocoaPods】
51
+ #### From CocoaPods【使用CocoaPods】
72
52
73
53
``` ruby
74
54
pod ' MJExtension'
75
55
```
76
56
77
- ### Manually【手动导入】
57
+ #### Manually【手动导入】
78
58
- Drag all source files under folder ` MJExtension ` to your project.【将` MJExtension ` 文件夹中的所有源代码拽入项目中】
79
59
- Import the main header file:` #import "MJExtension.h" ` 【导入主头文件:` #import "MJExtension.h" ` 】
80
60
@@ -89,10 +69,29 @@ NSObject+MJProperty.h NSObject+MJProperty.m
89
69
NSObject +MJKeyValue.h NSObject +MJKeyValue.m
90
70
```
91
71
92
- # <a id =" Examples " ></a > Examples【示例】
72
+ ## <a id =" Examples " ></a > Examples【示例】
93
73
94
74
** Add ` MJKeyValue ` protocol to your model if needed【如果有需要, 请在模型中加入 ` MJKeyValue ` 协议】**
95
75
76
+ ### <a id =" usage_in_swift " ></a > Usage in Swift [ 关于在Swift中使用MJExtension] ‼️
77
+
78
+ > Example:
79
+ >
80
+ > - [ Model - MJTester.swift] ( MJExtensionTests/SwiftModel/MJTester.swift )
81
+ >
82
+ > - [ Usage - SwiftModelTests.swift] ( MJExtensionTests/SwiftModelTests.swift )
83
+
84
+ 1 . ` @objc ` or ` @objcMembers ` attributes should be added to class or property for declaration of Objc accessibility [ 在 Swift4 之后, 请在属性前加 ` @objc ` 修饰或在类前增加 ` @objcMembers ` . 以保证 Swift 的属性能够暴露给 Objc 使用. ]
85
+ 2 . If you let ` Bool ` & ` Int ` as property type, make sure that using ` dynamic ` to attribute it. It must be ` Non-Optional ` type and assign ` a default value ` .
86
+
87
+ > 纯Swift版的JSON与Model转换框架已经开源上架
88
+ >
89
+ > - [ KakaJSON] ( https://github.com/kakaopensource/KakaJSON )
90
+ > - [ 中文教程] ( https://www.cnblogs.com/mjios/p/11352776.html )
91
+ > - 如果你的项目是用Swift写的Model,墙裂推荐使用[ KakaJSON] ( https://github.com/kakaopensource/KakaJSON )
92
+ > - 已经对各种常用的数据场景进行了大量的单元测试
93
+ > - 简单易用、功能丰富、转换快速
94
+
96
95
### <a id =" JSON_Model " ></a > The most simple JSON -> Model【最简单的字典转模型】
97
96
98
97
``` objc
0 commit comments