Skip to content

[Feedback] Initial NSByteCountFormatter implementation #61

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 0 commits into from
Closed

[Feedback] Initial NSByteCountFormatter implementation #61

wants to merge 0 commits into from

Conversation

bolshedvorsky
Copy link
Contributor

I used NSDateFormatter and some other classes as a reference point. Shall I continue with the implementation?

/* Convenience method on stringForObjectValue:. Convert a byte count into a string without creating an NSNumber.
*/
public func stringFromByteCount(byteCount: Int64) -> String { NSUnimplemented() }

/* Specify the units that can be used in the output. If NSByteCountFormatterUseDefault, uses platform-appropriate settings; otherwise will only use the specified units. This is the default value. Note that ZB and YB cannot be covered by the range of possible values, but you can still choose to use these units to get fractional display ("0.0035 ZB" for instance).
*/
public var allowedUnits: NSByteCountFormatterUnits
internal var _allowedUnits: NSByteCountFormatterUnits = .UseDefault
Copy link
Contributor

Choose a reason for hiding this comment

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

technically this pattern is not needed and you could write it as the simpler version like:

public var allowedUnits: NSByteCountFormatterUnits = .UseDefault

@phausler
Copy link
Contributor

phausler commented Dec 7, 2015

The default values look correct to me.

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 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.

2 participants