Skip to content

Commit c28bf23

Browse files
authored
CGPoint, CGSize, CGRect Conforms Hashable (#5134)
1 parent 731f3ae commit c28bf23

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Diff for: Sources/Foundation/NSGeometry.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ extension CGPoint: Equatable {
3939
}
4040
}
4141

42-
extension CGPoint: NSSpecialValueCoding {
42+
extension CGPoint: NSSpecialValueCoding, Hashable {
4343
init(bytes: UnsafeRawPointer) {
4444
self.x = bytes.load(as: CGFloat.self)
4545
self.y = bytes.load(fromByteOffset: MemoryLayout<CGFloat>.stride, as: CGFloat.self)
@@ -75,7 +75,7 @@ extension CGPoint: NSSpecialValueCoding {
7575
}
7676
}
7777

78-
func hash(into hasher: inout Hasher) {
78+
public func hash(into hasher: inout Hasher) {
7979
hasher.combine(x)
8080
hasher.combine(y)
8181
}
@@ -132,7 +132,7 @@ extension CGSize: Equatable {
132132
}
133133
}
134134

135-
extension CGSize: NSSpecialValueCoding {
135+
extension CGSize: NSSpecialValueCoding, Hashable {
136136
init(bytes: UnsafeRawPointer) {
137137
self.width = bytes.load(as: CGFloat.self)
138138
self.height = bytes.load(fromByteOffset: MemoryLayout<CGFloat>.stride, as: CGFloat.self)
@@ -168,7 +168,7 @@ extension CGSize: NSSpecialValueCoding {
168168
}
169169
}
170170

171-
func hash(into hasher: inout Hasher) {
171+
public func hash(into hasher: inout Hasher) {
172172
hasher.combine(width)
173173
hasher.combine(height)
174174
}
@@ -451,7 +451,7 @@ public typealias NSRect = CGRect
451451
public typealias NSRectPointer = UnsafeMutablePointer<NSRect>
452452
public typealias NSRectArray = UnsafeMutablePointer<NSRect>
453453

454-
extension CGRect: NSSpecialValueCoding {
454+
extension CGRect: NSSpecialValueCoding, Hashable {
455455
init(bytes: UnsafeRawPointer) {
456456
self.origin = CGPoint(
457457
x: bytes.load(as: CGFloat.self),
@@ -491,7 +491,7 @@ extension CGRect: NSSpecialValueCoding {
491491
}
492492
}
493493

494-
func hash(into hasher: inout Hasher) {
494+
public func hash(into hasher: inout Hasher) {
495495
origin.hash(into: &hasher)
496496
size.hash(into: &hasher)
497497
}

0 commit comments

Comments
 (0)