-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Conversation
} | ||
|
||
// MARK: - CGRect | ||
lazy var cgrectValues: [CGRect] = [ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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()
.
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this 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
@swift-ci Please test |
This PR mirrors some changes from swiftlang/swift#10404
Added conformances + unit tests for
Not mirrored from swiftlang/swift#10404
📝 I've stumbled across this, which leads me to believe that
CGVector
is not supposed to be implemented inswift-corelibs-foundation
.I suppose same goes for
CGAffineTransform
, since we already haveAffineTransform
/NSAffineTransform
implemented.