Skip to content

Commit

Permalink
Conform CGSize and UIEdgeInsets to Hashable
Browse files Browse the repository at this point in the history
  • Loading branch information
wiruzx committed Feb 3, 2019
1 parent 97a2976 commit 9ca32f3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ChattoAdditions/Source/Common/CGSize+Additions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,10 @@ public extension CGSize {
return CGRect(origin: CGPoint(x: originX, y: originY).bma_offsetBy(dx: dx, dy: dy), size: self)
}
}

extension CGSize: Hashable {
public func hash(into hasher: inout Hasher) {
hasher.combine(self.width)
hasher.combine(self.height)
}
}
9 changes: 9 additions & 0 deletions ChattoAdditions/Source/Common/UIEdgeInsets+Additions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,12 @@ public extension UIEdgeInsets {
return self.top.hashValue ^ self.left.hashValue ^ self.bottom.hashValue ^ self.right.hashValue
}
}

extension UIEdgeInsets: Hashable {
public func hash(into hasher: inout Hasher) {
hasher.combine(self.top)
hasher.combine(self.left)
hasher.combine(self.bottom)
hasher.combine(self.right)
}
}

0 comments on commit 9ca32f3

Please sign in to comment.