Skip to content
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

move Mapper static func to MapperParse #1061

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yixiaojichunqiu
Copy link

later code,when i use public static func toJSONString(_ JSONObject: Any, prettyPrint: Bool) -> String? very inconvenient. Mapper use generic and these func will happen Generic parameter 'N' could not be inferred.I think these static func not in Mapper will be better.

public static func toJSONString(_ JSONObject: Any, prettyPrint: Bool) -> String? {
let options: JSONSerialization.WritingOptions = prettyPrint ? .prettyPrinted : []
if let JSON = MapperParse.toJSONData(JSONObject, options: options) {
return String(data: JSON, encoding: String.Encoding.utf8)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please pass just .utf8 instead of String.Encoding.utf8

return String(data: JSON, encoding: .utf8)

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.

None yet

2 participants