Skip to content

Commit 591c8fb

Browse files
committed
update readme for explaining use of @Decodable or @Encodable alone
1 parent 6b4dfa1 commit 591c8fb

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Main features include:
5656
- Flexible copying with updates:
5757
The `@Copyable` macro generates a powerful `copy()` method that allows both
5858
full copies and selective property updates in a single call
59+
- Support the use of `@Decodable` or `@Encodable` alone
5960

6061
# Requirements
6162
XCode 16.0+
@@ -767,4 +768,18 @@ func copy(
767768
}
768769
```
769770

771+
### 20. Use `@Decodable` or `@Encodable` alone
772+
773+
```
774+
@Decodable
775+
struct Item: Equatable {
776+
let id: Int
777+
}
778+
779+
@Encodable
780+
struct User3: Equatable {
781+
let name: String
782+
}
783+
```
784+
770785
These examples demonstrate the main features of ReerCodable, which can help developers greatly simplify the encoding/decoding process, improving code readability and maintainability.

README_CN.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ ReerCodable 框架提供了一系列自定义宏,用于生成动态的 Codable
4949
- 支持通过 `@Copyable` 生成 `copy()` 方法, 并且支持部分属性值的 update
5050
- 自动生成默认实例:使用 `@DefaultInstance` 自动创建类型的默认实例, 可通过 Model.default 访问
5151
- 灵活的复制与更新:`@Copyable` 宏会生成一个 copy() 方法, 支持在一次调用中实现完整复制或选择性地更新属性值
52+
- 支持单独使用 `@Decodable``@Encodable`
5253

5354

5455
# 环境要求
@@ -762,4 +763,18 @@ func copy(
762763
}
763764
```
764765

766+
### 20. 单独使用 `@Decodable``@Encodable`
767+
768+
```
769+
@Decodable
770+
struct Item: Equatable {
771+
let id: Int
772+
}
773+
774+
@Encodable
775+
struct User3: Equatable {
776+
let name: String
777+
}
778+
```
779+
765780
以上示例展示了 ReerCodable 的主要特性,这些特性可以帮助开发者大大简化编解码过程,提高代码的可读性和可维护性。

0 commit comments

Comments
 (0)