Skip to content

Implementation of NSByteCountFormatter default values #80

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

Closed
wants to merge 1 commit into from
Closed

Implementation of NSByteCountFormatter default values #80

wants to merge 1 commit into from

Conversation

bolshedvorsky
Copy link
Contributor

Default values are added.
Unit test for the NSByteCountFormatter added.

Based on comments from the closed pull request #61

public class func stringFromByteCount(byteCount: Int64, countStyle: NSByteCountFormatterCountStyle) -> String { NSUnimplemented() }

public class func stringFromByteCount(byteCount: Int64, countStyle: NSByteCountFormatterCountStyle) -> String {
let byteCountFormatter = NSByteCountFormatter()

Choose a reason for hiding this comment

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

contradicts the docs, which say without creating an NSByteCountFormatter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From my understating this is a convenience method, when you are getting a result without manual creation of the NSByteCountFormatter, however this method suppose to use the NSByteCountFormatter logic in order to create a formatted string.

The Foundation documentation is saying "Converts a byte count into the specified string format without creating an NSNumber object." https://developer.apple.com/library/prerelease/ios/documentation/Foundation/Reference/NSByteCountFormatter_Class/index.html#//apple_ref/occ/clm/NSByteCountFormatter/stringFromByteCount:countStyle:

Choose a reason for hiding this comment

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

then the docs here need to be updated. I'd also be tempted to disassemble foundation and see if it's using a cached singleton there

Copy link
Contributor

Choose a reason for hiding this comment

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

It just calls into a private function which is shared with the formatter object.

atrick pushed a commit to atrick/swift-corelibs-foundation that referenced this pull request Jan 12, 2021
kateinoigakukun pushed a commit to kateinoigakukun/swift-corelibs-foundation that referenced this pull request Apr 29, 2021
[test] Disable failing check in test-sourcekit-lsp
kateinoigakukun pushed a commit to kateinoigakukun/swift-corelibs-foundation that referenced this pull request Oct 11, 2023
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