Skip to content

Codable support, array in completion, - #12

Open
krtc wants to merge 13 commits into
Nickelfox:developfrom
krtc:master
Open

krtc wants to merge 13 commits into
Nickelfox:developfrom
krtc:master

Conversation

@krtc

@krtc krtc commented Sep 27, 2021

Copy link
Copy Markdown

1. Add Codable Support

extension User: Codable { public enum CodingKeys: String, CodingKey { case name } }

2. Pass simple array in completion in replacement of ListResponse

func fetchNumbers(completion: @escaping (APIResult<[Number]>) -> Void)

@krtc

krtc commented Sep 27, 2021

Copy link
Copy Markdown
Author

@krtc
krtc changed the base branch from master to develop September 28, 2021 09:49
@krtc

krtc commented Sep 29, 2021

Copy link
Copy Markdown
Author

Adding open func requestForceJSONParseable to force parse object as JSONParseable.

Reason:

In functions like:

static func verify(otp: String, countryCode: String, number: String, completion: @escaping APICompletion<String>)

Here we try to parse a single string, and String confirms to both Codable and JSONParseable.
When we try to parse only one string, it by default try to parse it as Codable, and Codable is not able to parse a single string because it is not in JSON/Dictionary format.

@vaibhav-nickelfox
vaibhav-nickelfox changed the base branch from develop to codable January 9, 2022 05:35
@vaibhav-nickelfox
vaibhav-nickelfox changed the base branch from codable to develop January 9, 2022 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants