-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1004 from appwrite/fix-apple-generic-serialization
Fix nested object serialization with generics
- Loading branch information
Showing
5 changed files
with
24 additions
and
32 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
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
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
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 |
---|---|---|
@@ -1,13 +1,12 @@ | ||
import Foundation | ||
|
||
public enum {{ enum.name | caseUcfirst | overrideIdentifier }}: String, Codable { | ||
public enum {{ enum.name | caseUcfirst | overrideIdentifier }}: String, CustomStringConvertible { | ||
{%~ for value in enum.enum %} | ||
{%~ set key = enum.keys is empty ? value : enum.keys[loop.index0] %} | ||
case {{ key | caseEnumKey | escapeSwiftKeyword }} = "{{ value }}" | ||
{%~ endfor %} | ||
|
||
public func encode(to encoder: Encoder) throws { | ||
var container = encoder.singleValueContainer() | ||
try container.encode(rawValue) | ||
public var description: String { | ||
return rawValue | ||
} | ||
} |
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