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

Codable conformance added to some CG types #1128

Merged
merged 3 commits into from
Jul 25, 2017

Conversation

bubski
Copy link
Contributor

@bubski bubski commented Jul 23, 2017

This PR mirrors some changes from swiftlang/swift#10404


Added conformances + unit tests for

  • CGPoint
  • CGSize
  • CGRect

Not mirrored from swiftlang/swift#10404

  • CGVector 📝
  • CGAffineTransform 📝

📝 I've stumbled across this, which leads me to believe that CGVector is not supposed to be implemented in swift-corelibs-foundation.
I suppose same goes for CGAffineTransform, since we already have AffineTransform/NSAffineTransform implemented.

}

// MARK: - CGRect
lazy var cgrectValues: [CGRect] = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also test CGRect.zero and CGRect.null like in swiftlang/swift#10404?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ianpartridge These are not implemented in swift-corelibs-foundation yet, and I intend to add that in a separate PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I see, thanks. It looks like the CG types are missing quite a few properties etc. I didn't notice that because usually we stub them out with NSUnimplemented().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ianpartridge btw, let me ask something.
Do we expect to have

CGRect.init(x: Double, y: Double, width: Double, height: Double)
CGRect.init(x: Int, y: Int, width: Int, height: Int)

implemented too in swift-corelibs-foundation?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would say yes, but defer to @parkera?

Copy link
Contributor

Choose a reason for hiding this comment

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

We decided to provide some ultra-basic CG geometry type primitives in swift-corelibs-foundation just to help people with things like cross-platform archiving. So it seems appropriate to add the inits if we have to.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@parkera Wasn't fact that Foundation has typealias NSRect = CGRect and others the key reason?

PS. I'll add those inits in a seperate PR

@ianpartridge ianpartridge requested a review from itaiferber July 25, 2017 11:19
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.

Seeing as these are basically cherry-picks of the existing implementations, looks good to me

@itaiferber
Copy link
Contributor

@swift-ci Please test

@ianpartridge ianpartridge merged commit 79322e9 into swiftlang:master Jul 25, 2017
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.

4 participants