Skip to content

Commit

Permalink
新增plist的解析能力
Browse files Browse the repository at this point in the history
  • Loading branch information
Mccc committed Sep 3, 2024
1 parent 4ab6cef commit d69d3b9
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ PODS:
- FBSnapshotTestCase/SwiftSupport (2.1.4):
- FBSnapshotTestCase/Core
- HandyJSON (5.0.0-beta.1)
- SmartCodable (4.1.7)
- SmartCodable (4.1.9)
- SnapKit (5.6.0)

DEPENDENCIES:
Expand Down Expand Up @@ -39,7 +39,7 @@ SPEC CHECKSUMS:
CleanJSON: 910a36465ce4829e264a902ccf6d1455fdd9f980
FBSnapshotTestCase: 094f9f314decbabe373b87cc339bea235a63e07a
HandyJSON: 582477127ab3ab65bd2e471815f1a7b846856978
SmartCodable: d7272960c97bda49603b864be8453284de095f71
SmartCodable: 9057cf451ccf3f542e3608e65266e5c25d063286
SnapKit: e01d52ebb8ddbc333eefe2132acf85c8227d9c25

PODFILE CHECKSUM: 7f3af03f81934df0c035518074a7abbec8fa9d3f
Expand Down
4 changes: 2 additions & 2 deletions Example/Pods/Local Podspecs/SmartCodable.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Example/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 41 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
[![Swift Package Manager](https://img.shields.io/badge/spm-compatible-brightgreen.svg?style=flat)](https://swift.org/package-manager/)
[![Platforms](https://img.shields.io/cocoapods/p/ExCodable.svg)](#readme)
[![Build and Test](https://github.com/iwill/ExCodable/actions/workflows/build-and-test.yml/badge.svg)]()
[![GitHub Releases (latest SemVer)](https://img.shields.io/github/v/release/iwill/ExCodable.svg?sort=semver)](https://github.com/intsig171/SmartCodable/releases)
[![LICENSE](https://img.shields.io/github/license/iwill/ExCodable.svg)](https://github.com/intsig171/SmartCodable/blob/main/LICENSE)


**SmartCodable** is a data parsing library based on Swift's **Codable** protocol, designed to provide more powerful and flexible parsing capabilities. By optimizing and rewriting the standard features of **Codable**, **SmartCodable** effectively solves common problems in the traditional parsing process and improves the fault tolerance and flexibility of parsing.

**SmartCodable** 是一个基于Swift的**Codable**协议的数据解析库,旨在提供更为强大和灵活的解析能力。通过优化和重写**Codable**的标准功能,**SmartCodable** 有效地解决了传统解析过程中的常见问题,并提高了解析的容错性和灵活性。
Expand All @@ -28,6 +26,21 @@ let model = Model.deserialize(from: json)



SmartCodable在Codable基础上做了大幅度的优化,支持:

| 类型 | 特性 | 说明 |
| ------ | ---------------- | ------------------------------------------------------------ |
| 兼容 | 强大的异常兼容 | 当遇到数据类型错误/值为null/缺少数据等情况触发的Codable异常,可以完美兼容。 |
| 兼容 | 支持类型自适应 | 如JSON中是一个Int,但对应Model是String字段,会自动完成转化。 |
| 兼容 | 支持属性初始值 | 当解析失败时,使用此值填充。 |
| 兼容 | 内json的模型化 | 当某个数据是json时,支持进行Model化解析。 |
| 新特性 | 支持Any的解析 | Codable不支持Any,SmartCodable支持! |
| 新特性 | 自定义Key映射 | 当数据字段和Model属性名不一致时,可以方便的自定义映射关系。 |
| 新特性 | 自定义Value解析 | 支持自定义解析规则 |
| 新特性 | 提供多种全局策略 | 数据的蛇形命名转驼峰,首字母转小写,首字母转大写 |
| 新特性 | 解析完成的回调 | 你可以知道解析完成的时机,去做一些事情。 |
| 新特性 | 支持解析更新 | 对一个解析完成的model进行增量更新。 |

## Use SmartCodable

### Installation - cocopods
Expand Down Expand Up @@ -94,6 +107,32 @@ If you don't know how to use it, check it out.



### Supported types

只要遵循了Codable,就可以参与解析。

* Int/Int8/Int16/Int32/Int64

* UInt/UInt8/UInt16/UInt32/UInt64

* String

* Bool

* Float/CGFloat/Double

* Dictionary(如果包含Any,请使用@SmartAny修饰该字典)

* Array(如果包含Any,请使用@SmartAny修饰该数组)

* URL/Date/Data/UIColor/enum

* 其他遵循了Codable协议的类型。





## SmarCodable Test

[👉 To learn more about how SmartCodable is tested, click here](https://github.com/intsig171/SmartCodable/blob/main/Document/README/HowToTest.md)
Expand Down
2 changes: 1 addition & 1 deletion SmartCodable.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

Pod::Spec.new do |s|
s.name = 'SmartCodable'
s.version = '4.1.8'
s.version = '4.1.9'
s.summary = '数据解析库'

s.homepage = 'https://github.com/intsig171'
Expand Down

0 comments on commit d69d3b9

Please sign in to comment.