Skip to content

Commit 2ff7e6d

Browse files
committed
Add some more docs
1 parent 1db0674 commit 2ff7e6d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Sources/ParseSwift/Coding/Extensions.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,21 @@ extension JSONEncoder {
3131

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

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

46+
/// The JSON decoder setup with the correct `dateDecodingStrategy`
47+
/// strategy to decode data from a Parse Server. This encoder is used to decode all data received
48+
/// from the server.
4249
func getDecoder() -> JSONDecoder {
4350
ParseCoding.jsonDecoder()
4451
}

Sources/ParseSwift/Coding/ParseCoding.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,25 @@ public enum ParseCoding {}
1414
// MARK: Coders
1515
extension ParseCoding {
1616

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

25+
/// The JSON Decoder setup with the correct `dateDecodingStrategy`
26+
/// strategy for `Parse`. This encoder is used to decode all data received
27+
/// from the server.
2428
static func jsonDecoder() -> JSONDecoder {
2529
let decoder = JSONDecoder()
2630
decoder.dateDecodingStrategy = dateDecodingStrategy
2731
return decoder
2832
}
2933

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

0 commit comments

Comments
 (0)