Skip to content

Codable conformance to some Foundation types #1148

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 6 commits into from
Aug 1, 2017

Conversation

bubski
Copy link
Contributor

@bubski bubski commented Jul 31, 2017

Continuation of #1108 & #1127
This PR mirrors some changes from swiftlang/swift#9715


Added conformances + unit tests for

  • Calendar
  • DateComponents
  • TimeZone

📝 I had to disable or work around some issues on Linux caused by https://bugs.swift.org/browse/SR-5598.
Broken TimeZone.current == TimeZone(identifier: TimeZone.current.identifier) equality causes encode -> decode -> compare roundtrip tests to fail.

Not included in this PR

  • Measurement

Already implemented

  • PersonNameComponents
  • UUID
  • URL
  • NSRange
  • Locale
  • IndexSet
  • IndexPath
  • AffineTransform
  • Decimal
  • DateInterval
  • CGFloat (unit tested indirectly)
  • CharacterSet

@ianpartridge
Copy link
Contributor

@swift-ci please test

@ianpartridge
Copy link
Contributor

@itaiferber does this look good to go?

@ianpartridge ianpartridge requested a review from itaiferber August 1, 2017 09:53
@bubski
Copy link
Contributor Author

bubski commented Aug 1, 2017

Copy link
Contributor

@itaiferber itaiferber left a comment

Choose a reason for hiding this comment

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

LGTM!

@itaiferber itaiferber merged commit 9b4cebe into swiftlang:master Aug 1, 2017

public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(self.calendar, forKey: .calendar)
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for applying this, BTW. I need to make a similar fix in the Foundation overlay itself.

@ianpartridge
Copy link
Contributor

@bubski Just wondering if there is any further Codable work to be done? Is Measurement still pending?

@bubski
Copy link
Contributor Author

bubski commented Aug 14, 2017

@ianpartridge I believe Measurement is the last one to go.
It's in progress. I've just been a bit busy with other stuff recently, but will pick this up again this week.

@ianpartridge
Copy link
Contributor

Great to hear - thanks @bubski!

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