Skip to content

Implementation for NSDictionary.write(toFile:) #627

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 1 commit into from
Sep 14, 2016

Conversation

saiHemak
Copy link
Contributor

No description provided.

@saiHemak saiHemak force-pushed the nsdictWriteTo-branch branch from 9b88e78 to a81cb15 Compare September 13, 2016 10:08
let pListData = try PropertyListSerialization.data(fromPropertyList: self, format: PropertyListSerialization.PropertyListFormat.xml, options: 0)
let xmlDocument = try XMLDocument.init(data: pListData, options: XMLNode.Options.documentValidate)
let xmlData = xmlDocument.xmlData(withOptions: XMLNode.Options.nodePrettyPrint)
try xmlData.write(to: URL(fileURLWithPath: path), options: useAuxiliaryFile ? .atomic : [])
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should skip this XMLDocument step. Here is the ObjC implementation:

NSData *data = [NSPropertyListSerialization dataWithPropertyList:self format:NSPropertyListXMLFormat_v1_0 options:0 error:NULL];
BOOL result = [data writeToFile:path atomically:useAuxiliaryFile];
return result;

@saiHemak saiHemak force-pushed the nsdictWriteTo-branch branch from a81cb15 to d47db67 Compare September 14, 2016 12:11
@saiHemak
Copy link
Contributor Author

@parkera Thanks for the review ..I have addressed your comments

@parkera
Copy link
Contributor

parkera commented Sep 14, 2016

@swift-ci please test and merge

@swift-ci swift-ci merged commit 0dfe36a into swiftlang:master Sep 14, 2016
@saiHemak saiHemak deleted the nsdictWriteTo-branch branch February 28, 2017 07:02
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