-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b45da43
Showing
11 changed files
with
1,269 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"object": { | ||
"pins": [ | ||
{ | ||
"package": "CwlCatchException", | ||
"repositoryURL": "https://github.com/mattgallagher/CwlCatchException.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "682841464136f8c66e04afe5dbd01ab51a3a56f2", | ||
"version": "2.1.0" | ||
} | ||
}, | ||
{ | ||
"package": "CwlPreconditionTesting", | ||
"repositoryURL": "https://github.com/mattgallagher/CwlPreconditionTesting.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "0630439888c94657a235ffcd5977d6047ef3c87b", | ||
"version": "2.0.1" | ||
} | ||
}, | ||
{ | ||
"package": "Nimble", | ||
"repositoryURL": "https://github.com/Quick/Nimble.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "c93f16c25af5770f0d3e6af27c9634640946b068", | ||
"version": "9.2.1" | ||
} | ||
}, | ||
{ | ||
"package": "Quick", | ||
"repositoryURL": "https://github.com/Quick/Quick.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "bd86ca0141e3cfb333546de5a11ede63f0c4a0e6", | ||
"version": "4.0.0" | ||
} | ||
} | ||
] | ||
}, | ||
"version": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// swift-tools-version:5.3 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "Json", | ||
products: [ | ||
// Products define the executables and libraries a package produces, and make them visible to other packages. | ||
.library( | ||
name: "Json", | ||
targets: ["Json"]), | ||
], | ||
dependencies: [ | ||
// Dependencies declare other packages that this package depends on. | ||
.package(url: "https://github.com/Quick/Quick.git", from: "4.0.0"), | ||
.package(url: "https://github.com/Quick/Nimble.git", from: "9.2.0"), | ||
|
||
], | ||
targets: [ | ||
// Targets are the basic building blocks of a package. A target can define a module or a test suite. | ||
// Targets can depend on other targets in this package, and on products in packages this package depends on. | ||
.target( | ||
name: "Json", | ||
dependencies: [ | ||
|
||
]), | ||
.testTarget( | ||
name: "JsonTests", | ||
dependencies: ["Json", "Quick", "Nimble"]), | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Json | ||
|
||
A description of this package. | ||
```swift | ||
let json = "".toJson() | ||
let json = data.toJson() | ||
let json = dictionary.toJson() | ||
let json = model.toJson() | ||
``` | ||
|
||
```swift | ||
let data = json.toData() | ||
let string = json.toString() | ||
let dictionary = json.toDictionary() | ||
let model = json.toModel(Model.self) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import Foundation | ||
|
||
|
||
public extension String { | ||
|
||
func toJson() -> Json { | ||
Json(parseJson: self) | ||
} | ||
|
||
} | ||
|
||
public extension Data { | ||
func toJson() -> Json { | ||
Json(data: toDataPrettyPrinted()) | ||
} | ||
} | ||
|
||
public extension Dictionary { | ||
func toJson()-> Json { | ||
Json(self) | ||
} | ||
} | ||
|
||
public extension Encodable { | ||
|
||
func toJson() -> Json { | ||
Json(toData() as Any) | ||
} | ||
|
||
} |
Oops, something went wrong.