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/README.md b/README.md index 972f098..72d3cfb 100755 --- a/README.md +++ b/README.md @@ -266,6 +266,12 @@ 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 Package URL: `git@github.com:ibireme/YYModel.git` and add the `YYModel` library to your targets in `Link Binary With Libraries`. +3. `@import YYModel;` + + ### CocoaPods 1. Add `pod 'YYModel'` to your Podfile. @@ -577,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` 并将生成的 `YYModel` 库添加到 targets 当中的 `Link Binary With Libraries`。 +3. 导入 `@import YYModel;` + ### CocoaPods 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