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

Add ListFormatter #4794

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add ListFormatter #4794

wants to merge 3 commits into from

Conversation

woxtu
Copy link
Contributor

@woxtu woxtu commented Jul 12, 2023

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

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

I'm a little on the fence about this as there is new API surface that we need to create and expose from CF. @parkera what is your take? The changes to CF are pretty minimal and for a good reason - they are supporting API equality.

func test_locale() throws {
XCTAssertEqual(formatter.locale, Locale.autoupdatingCurrent)

formatter.locale = Locale(identifier: "en_US_POSIX")
Copy link
Member

Choose a reason for hiding this comment

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

This is not portable (en_US is fine, en_US_POSIX is not a valid locale on Windows).

}

public required init?(coder: NSCoder) {
self.cfFormatter = _CFListFormatterCreate(kCFAllocatorSystemDefault, CFLocaleCopyCurrent())!
Copy link
Member

Choose a reason for hiding this comment

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

Most of the SCF does not support initWithCoder. Shall we follow precedent and fatalError() here?


open override func copy(with zone: NSZone? = nil) -> Any {
let copied = ListFormatter()
copied.locale = locale
Copy link
Member

Choose a reason for hiding this comment

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

I believe that we should just use the copy method instead

@parkera
Copy link
Contributor

parkera commented Jul 27, 2023

Our plan of record here is to focus on https://github.com/apple/swift-foundation/, where we actually already have the ListFormatStyle API. Why add it here to CF when we can focus on the more modern Swift-first approach?

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.

[SR-14247] ListFormatter missing
3 participants