Skip to content
This repository was archived by the owner on Jan 11, 2024. It is now read-only.

Commit 4e53ceb

Browse files
committed
feat: add CocoaPods support
1 parent 6379c6c commit 4e53ceb

File tree

6 files changed

+65
-11
lines changed

6 files changed

+65
-11
lines changed

DynamicCodableKit.podspec

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
require 'json'
2+
3+
Pod::Spec.new do |s|
4+
package = JSON.parse(File.read('package.json'), {object_class: OpenStruct})
5+
6+
s.name = 'DynamicCodableKit'
7+
s.version = package.version.to_s
8+
s.homepage = package.homepage
9+
s.summary = package.summary
10+
s.description = package.description
11+
s.license = { :type => package.license, :file => 'LICENSE' }
12+
s.documentation_url = ''
13+
s.social_media_url = package.author.url
14+
15+
s.source = {
16+
package.repository.type.to_sym => package.repository.url,
17+
:tag => s.version
18+
}
19+
20+
s.authors = {
21+
package.author.name => package.author.email
22+
}
23+
24+
s.swift_version = '5.0'
25+
s.ios.deployment_target = '8.0'
26+
s.macos.deployment_target = '10.10'
27+
s.tvos.deployment_target = '9.0'
28+
s.watchos.deployment_target = '2.0'
29+
s.osx.deployment_target = '10.10'
30+
31+
s.source_files = "Sources/#{s.name}/**/*.swift"
32+
s.preserve_paths = "{Sources,Tests}/#{s.name}*/**/*", "*.md"
33+
s.test_spec do |ts|
34+
ts.source_files = "Tests/#{s.name}Tests/**/*.swift", "Tests/*.swift"
35+
ts.resources = "Tests/#{s.name}Tests/**/*.json"
36+
end
37+
end

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import PackageDescription
44

55
let package = Package(
6-
name: "DynamicCodableKit",
6+
name: "dynamic-codable-kit",
77
platforms: [
88
.iOS(.v8),
99
.macOS(.v10_10),

Scripts/pod-lint.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env node
2+
const { execSync } = require('node:child_process');
3+
4+
execSync(
5+
'pod lib lint --no-clean --allow-warnings --verbose', {
6+
stdio: ['inherit', 'inherit', 'inherit'],
7+
encoding: 'utf-8'
8+
}
9+
);

Tests/Bundle.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import Foundation
2+
3+
extension Bundle {
4+
private final class BundleClass {}
5+
6+
static var module: Bundle { Bundle(for: BundleClass.self) }
7+
}

Tests/DynamicCodableKitTests/DynamicDecodingCollectionWrapper.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ final class DynamicDecodingCollectionWrapperTests: XCTestCase {
3535
XCTAssertEqual(postPage.content.map(\.type), [.text, .picture, .audio, .video])
3636
}
3737

38-
func testLossyDecodingPerformance() throws {
39-
let url = Bundle.module.url(forResource: "identifier-decode-with-invalid-data", withExtension: "json")!
40-
let data = try Data(contentsOf: url)
41-
measure {
42-
let decoder = JSONDecoder()
43-
for _ in 0..<100 {
44-
_ = try? decoder.decode(LossyPostPage.self, from: data)
45-
}
46-
}
47-
}
38+
// func testLossyDecodingPerformance() throws {
39+
// let url = Bundle.module.url(forResource: "identifier-decode-with-invalid-data", withExtension: "json")!
40+
// let data = try Data(contentsOf: url)
41+
// measure {
42+
// let decoder = JSONDecoder()
43+
// for _ in 0..<100 {
44+
// _ = try? decoder.decode(LossyPostPage.self, from: data)
45+
// }
46+
// }
47+
// }
4848

4949
func testDecodingWithSet() throws {
5050
let url = Bundle.module.url(forResource: "identifier-decode", withExtension: "json")!

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"scripts": {
2222
"build": "Scripts/build.js",
2323
"test": "Scripts/test.js",
24+
"pod-lint": "Scripts/pod-lint.js",
2425
"preview-doc": "Scripts/preview-doc.js",
2526
"build-doc": "Scripts/build-doc.js",
2627
"serve-doc": "Scripts/serve-doc.js"

0 commit comments

Comments
 (0)