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

[NSData writeToURL:atomically:] converted incorrectly #127

Closed
cherryblossom000 opened this issue Oct 28, 2019 · 4 comments
Closed

[NSData writeToURL:atomically:] converted incorrectly #127

cherryblossom000 opened this issue Oct 28, 2019 · 4 comments
Assignees

Comments

@cherryblossom000
Copy link

cherryblossom000 commented Oct 28, 2019

[NSData writeToURL:url atomically:YES]

currently gets converted to

Data.write(to: url, atomically: true)

which causes the compiler error

Extra argument 'atomically' in call

Data.write(to:options:) could be used instead:

Data.write(to: url, options: .atomic)

However, that returns Void and throws when unsuccessful, whereas [NSData writeToURL:atomically] returns NO if unsuccessful. NSData.write(to:atomically) which returns a Bool could then be used instead of Data:

NSData.write(to: url, atomically: true)
@cherryblossom000
Copy link
Author

@tomattoz @alex-swiftify Any updates on this?

@alex-swiftify
Copy link
Member

@cherryblossom000 Thanks for the reminder! We'll prioritize this.

@tomattoz Please take a look at this at the earliest convenience.

@tomattoz
Copy link
Collaborator

@cherryblossom000 fixed this such way: NSData(data: data).write(to: url, atomically: true)

@tomattoz
Copy link
Collaborator

The fix will appear in 5.1.5 release.

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

No branches or pull requests

3 participants