From d69d3b92ab4cd302553bb8e541f8ad6744df2f6a Mon Sep 17 00:00:00 2001 From: Mccc <> Date: Tue, 3 Sep 2024 18:16:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Eplist=E7=9A=84=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E8=83=BD=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Example/Podfile.lock | 4 +- .../Local Podspecs/SmartCodable.podspec.json | 4 +- Example/Pods/Manifest.lock | 4 +- .../SmartCodable/SmartCodable-Info.plist | 2 +- README.md | 43 ++++++++++++++++++- SmartCodable.podspec | 2 +- 6 files changed, 49 insertions(+), 10 deletions(-) diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 2a9aabc..ac9c0fd 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -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: @@ -39,7 +39,7 @@ SPEC CHECKSUMS: CleanJSON: 910a36465ce4829e264a902ccf6d1455fdd9f980 FBSnapshotTestCase: 094f9f314decbabe373b87cc339bea235a63e07a HandyJSON: 582477127ab3ab65bd2e471815f1a7b846856978 - SmartCodable: d7272960c97bda49603b864be8453284de095f71 + SmartCodable: 9057cf451ccf3f542e3608e65266e5c25d063286 SnapKit: e01d52ebb8ddbc333eefe2132acf85c8227d9c25 PODFILE CHECKSUM: 7f3af03f81934df0c035518074a7abbec8fa9d3f diff --git a/Example/Pods/Local Podspecs/SmartCodable.podspec.json b/Example/Pods/Local Podspecs/SmartCodable.podspec.json index 444eca2..43290e7 100644 --- a/Example/Pods/Local Podspecs/SmartCodable.podspec.json +++ b/Example/Pods/Local Podspecs/SmartCodable.podspec.json @@ -1,6 +1,6 @@ { "name": "SmartCodable", - "version": "4.1.7", + "version": "4.1.9", "summary": "数据解析库", "homepage": "https://github.com/intsig171", "license": { @@ -12,7 +12,7 @@ }, "source": { "git": "https://github.com/intsig171/SmartCodable.git", - "tag": "4.1.7" + "tag": "4.1.9" }, "platforms": { "ios": "11.0", diff --git a/Example/Pods/Manifest.lock b/Example/Pods/Manifest.lock index 2a9aabc..ac9c0fd 100644 --- a/Example/Pods/Manifest.lock +++ b/Example/Pods/Manifest.lock @@ -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: @@ -39,7 +39,7 @@ SPEC CHECKSUMS: CleanJSON: 910a36465ce4829e264a902ccf6d1455fdd9f980 FBSnapshotTestCase: 094f9f314decbabe373b87cc339bea235a63e07a HandyJSON: 582477127ab3ab65bd2e471815f1a7b846856978 - SmartCodable: d7272960c97bda49603b864be8453284de095f71 + SmartCodable: 9057cf451ccf3f542e3608e65266e5c25d063286 SnapKit: e01d52ebb8ddbc333eefe2132acf85c8227d9c25 PODFILE CHECKSUM: 7f3af03f81934df0c035518074a7abbec8fa9d3f diff --git a/Example/Pods/Target Support Files/SmartCodable/SmartCodable-Info.plist b/Example/Pods/Target Support Files/SmartCodable/SmartCodable-Info.plist index cbfa5f8..fff6a3e 100644 --- a/Example/Pods/Target Support Files/SmartCodable/SmartCodable-Info.plist +++ b/Example/Pods/Target Support Files/SmartCodable/SmartCodable-Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 4.1.7 + 4.1.9 CFBundleSignature ???? CFBundleVersion diff --git a/README.md b/README.md index 0ae9e6e..3bdda3f 100644 --- a/README.md +++ b/README.md @@ -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** 有效地解决了传统解析过程中的常见问题,并提高了解析的容错性和灵活性。 @@ -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 @@ -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) diff --git a/SmartCodable.podspec b/SmartCodable.podspec index c6f2ae2..80ace22 100644 --- a/SmartCodable.podspec +++ b/SmartCodable.podspec @@ -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'