Skip to content

Add missing documentation #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import PackageDescription
let package = Package(
name: "YOUR_PROJECT_NAME",
dependencies: [
.package(url: "https://github.com/parse-community/Parse-Swift.git", from: "1.0.0"),
.package(url: "https://github.com/parse-community/Parse-Swift", from: "1.1.1"),
]
)
```
Expand Down
7 changes: 7 additions & 0 deletions Sources/ParseSwift/Coding/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,21 @@ extension JSONEncoder {

// MARK: ParseObject
public extension ParseObject {
/// The Parse encoder is used to JSON encode all `ParseObject`s and
/// types in a way meaninful for a Parse Server to consume.
func getEncoder() -> ParseEncoder {
return ParseCoding.parseEncoder()
}

/// The JSON encoder setup with the correct `dateEncodingStrategy`
/// strategy to send data to a Parse Server.
func getJSONEncoder() -> JSONEncoder {
return ParseCoding.jsonEncoder()
}

/// The JSON decoder setup with the correct `dateDecodingStrategy`
/// strategy to decode data from a Parse Server. This encoder is used to decode all data received
/// from the server.
func getDecoder() -> JSONDecoder {
ParseCoding.jsonDecoder()
}
Expand Down
8 changes: 7 additions & 1 deletion Sources/ParseSwift/Coding/ParseCoding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,25 @@ public enum ParseCoding {}
// MARK: Coders
extension ParseCoding {

///This should only be used for Unit tests, don't use in SDK
/// The JSON Encoder setup with the correct `dateEncodingStrategy`
/// strategy for `Parse`.
static func jsonEncoder() -> JSONEncoder {
let encoder = JSONEncoder()
encoder.dateEncodingStrategy = jsonDateEncodingStrategy
return encoder
}

/// The JSON Decoder setup with the correct `dateDecodingStrategy`
/// strategy for `Parse`. This encoder is used to decode all data received
/// from the server.
static func jsonDecoder() -> JSONDecoder {
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = dateDecodingStrategy
return decoder
}

/// The Parse Encoder is used to JSON encode all `ParseObject`s and
/// types in a way meaninful for the Parse Server to consume.
static func parseEncoder() -> ParseEncoder {
ParseEncoder(
dateEncodingStrategy: parseDateEncodingStrategy
Expand Down