From c02a0ab447ae612d4f7a76e3f1218db146bcd0aa Mon Sep 17 00:00:00 2001 From: GavinXiang Date: Wed, 18 Dec 2024 16:19:40 +0800 Subject: [PATCH 1/4] Compatiable with Swift Package Manager(SPM) --- .gitignore | 5 +++++ Package.swift | 31 +++++++++++++++++++++++++++++++ include/NSObject+YYModel.h | 1 + include/YYClassInfo.h | 1 + include/YYModel.h | 1 + 5 files changed, 39 insertions(+) create mode 100644 Package.swift create mode 120000 include/NSObject+YYModel.h create mode 120000 include/YYClassInfo.h create mode 120000 include/YYModel.h diff --git a/.gitignore b/.gitignore index 0187506..72b4f95 100644 --- a/.gitignore +++ b/.gitignore @@ -65,3 +65,8 @@ fastlane/test_output # https://github.com/johnno1962/injectionforxcode iOSInjectionProject/ + +# Swift PM +.swiftpm/config/registries.json +.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata + diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..4a547b8 --- /dev/null +++ b/Package.swift @@ -0,0 +1,31 @@ +// swift-tools-version:5.10 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "YYModel", + platforms: [ + .iOS(.v12), + .tvOS(.v12), + .macOS(.v10_13), + .watchOS(.v4) + ], + products: [ + .library(name: "YYModel", targets: ["YYModel"]) + ], + dependencies: [], + targets: [ + .target( + name: "YYModel", + dependencies: [], + path: "YYModel", + publicHeadersPath: ".", + cSettings: [ + .headerSearchPath("../include"), + ] + ), + .testTarget(name: "YYModelTests", dependencies: ["YYModel"], path: "YYModelTests") + ], + swiftLanguageVersions: [.v5] +) diff --git a/include/NSObject+YYModel.h b/include/NSObject+YYModel.h new file mode 120000 index 0000000..d3380cc --- /dev/null +++ b/include/NSObject+YYModel.h @@ -0,0 +1 @@ +NSObject+YYModel.h \ No newline at end of file diff --git a/include/YYClassInfo.h b/include/YYClassInfo.h new file mode 120000 index 0000000..7f3768d --- /dev/null +++ b/include/YYClassInfo.h @@ -0,0 +1 @@ +YYClassInfo.h \ No newline at end of file diff --git a/include/YYModel.h b/include/YYModel.h new file mode 120000 index 0000000..18c66b0 --- /dev/null +++ b/include/YYModel.h @@ -0,0 +1 @@ +YYModel.h \ No newline at end of file From de5646c00ff937fec689e893b51c7332b7cc8c88 Mon Sep 17 00:00:00 2001 From: MichaelLedger <42952016+MichaelLedger@users.noreply.github.com> Date: Wed, 18 Dec 2024 16:37:18 +0800 Subject: [PATCH 2/4] Update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 972f098..d02c48e 100755 --- a/README.md +++ b/README.md @@ -266,6 +266,11 @@ You can map a json key (key path) or an array of json key (key path) to one or m Installation ============== +### Swift Package Manager +1. Xcode -> File-> Add Package Dependencies... +2. Search YYModel Package URL +3. `@import YYModel;` + ### CocoaPods 1. Add `pod 'YYModel'` to your Podfile. @@ -279,7 +284,6 @@ Installation 2. Run `carthage update --platform ios` and add the framework to your project. 3. Import \. - ### Manually 1. Download all the files in the YYModel subdirectory. From 890c51fbc160942a77be31b6f4efb85285a5d3b4 Mon Sep 17 00:00:00 2001 From: GavinXiang Date: Wed, 18 Dec 2024 16:46:10 +0800 Subject: [PATCH 3/4] Update README.md --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d02c48e..6824423 100755 --- a/README.md +++ b/README.md @@ -267,10 +267,11 @@ Installation ============== ### Swift Package Manager -1. Xcode -> File-> Add Package Dependencies... -2. Search YYModel Package URL +1. Xcode -> File -> Add Package Dependencies... +2. Search Package URL: `git@github.com:ibireme/YYModel.git` 3. `@import YYModel;` + ### CocoaPods 1. Add `pod 'YYModel'` to your Podfile. @@ -284,6 +285,7 @@ Installation 2. Run `carthage update --platform ios` and add the framework to your project. 3. Import \. + ### Manually 1. Download all the files in the YYModel subdirectory. @@ -581,6 +583,11 @@ EEE MMM dd HH:mm:ss Z yyyy 安装 ============== +### Swift Package Manager +1. Xcode -> File -> Add Package Dependencies... +2. 搜索 Package URL: `git@github.com:ibireme/YYModel.git` +3. 导入 `@import YYModel;` + ### CocoaPods From d928780e6d3f53467b9e38758eaf8f15a499fd11 Mon Sep 17 00:00:00 2001 From: GavinXiang Date: Wed, 18 Dec 2024 17:12:43 +0800 Subject: [PATCH 4/4] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6824423..72d3cfb 100755 --- a/README.md +++ b/README.md @@ -268,7 +268,7 @@ Installation ### Swift Package Manager 1. Xcode -> File -> Add Package Dependencies... -2. Search Package URL: `git@github.com:ibireme/YYModel.git` +2. Search Package URL: `git@github.com:ibireme/YYModel.git` and add the `YYModel` library to your targets in `Link Binary With Libraries`. 3. `@import YYModel;` @@ -585,7 +585,7 @@ EEE MMM dd HH:mm:ss Z yyyy ============== ### Swift Package Manager 1. Xcode -> File -> Add Package Dependencies... -2. 搜索 Package URL: `git@github.com:ibireme/YYModel.git` +2. 搜索 Package URL: `git@github.com:ibireme/YYModel.git` 并将生成的 `YYModel` 库添加到 targets 当中的 `Link Binary With Libraries`。 3. 导入 `@import YYModel;`