Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Remove potentially problematic conformances.
Browse files Browse the repository at this point in the history
  • Loading branch information
schwa committed Jun 25, 2023
1 parent 8032fa4 commit bdfd61e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import CoreGraphics

// MARK: Printable

extension CGAffineTransform: CustomStringConvertible {
public var description: String {
"CGAffineTransform(\(a), \(b), \(c), \(d), \(tx), \(ty))"
}
}

// MARK: Constructors

public extension CGAffineTransform {
Expand Down Expand Up @@ -44,15 +36,14 @@ public extension CGAffineTransform {
}

init(rotation: CGFloat, origin: CGPoint) {
self = CGAffineTransform(translation: -origin) + CGAffineTransform(rotation: rotation) + CGAffineTransform(translation: origin)
self = CGAffineTransform(translation: -origin) * CGAffineTransform(rotation: rotation) * CGAffineTransform(translation: origin)
}
}

// MARK: -

@available(*, deprecated, message: "Deprecated")
public extension CGAffineTransform {
// TODO: Most of these should be removed and the normal CGAffineTransform code relied on

func translated(_ translation: CGPoint) -> CGAffineTransform {
translatedBy(x: translation.x, y: translation.y)
}
Expand All @@ -74,7 +65,7 @@ public extension CGAffineTransform {
}

func scaled(_ scale: CGFloat, origin: CGPoint) -> CGAffineTransform {
self + CGAffineTransform(scale: scale, origin: origin)
self * CGAffineTransform(scale: scale, origin: origin)
}

func rotated(_ angle: CGFloat) -> CGAffineTransform {
Expand All @@ -86,6 +77,7 @@ public extension CGAffineTransform {
}
}

@available(*, deprecated, message: "Deprecated")
public extension CGAffineTransform {
mutating func translate(translation: CGPoint) -> CGAffineTransform {
self = translated(tx: translation.x, ty: translation.y)
Expand Down Expand Up @@ -140,6 +132,7 @@ public extension CGAffineTransform {

// MARK: Concatination via the + and += operators

@available(*, deprecated, message: "Use operator * instead of +")
public extension CGAffineTransform {
static func + (lhs: CGAffineTransform, rhs: CGAffineTransform) -> CGAffineTransform {
lhs.concatenating(rhs)
Expand All @@ -150,6 +143,16 @@ public extension CGAffineTransform {
}
}

public extension CGAffineTransform {
static func * (lhs: CGAffineTransform, rhs: CGAffineTransform) -> CGAffineTransform {
lhs.concatenating(rhs)
}

static func *= (lhs: inout CGAffineTransform, rhs: CGAffineTransform) {
lhs = lhs.concat(other: rhs)
}
}

// MARK: Transform a vector

public extension CGAffineTransform {
Expand Down
16 changes: 0 additions & 16 deletions Sources/CoreGraphicsGeometrySupport/CGPoint+CGize.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,6 @@ public extension CGSize {
}
}

// MARK: Hashable

extension CGPoint: Hashable {
public func hash(into hasher: inout Hasher) {
x.hash(into: &hasher)
y.hash(into: &hasher)
}
}

extension CGSize: Hashable {
public func hash(into hasher: inout Hasher) {
width.hash(into: &hasher)
height.hash(into: &hasher)
}
}

// MARK: Math with Self types

public extension CGPoint {
Expand Down
7 changes: 0 additions & 7 deletions Sources/CoreGraphicsGeometrySupport/CGRect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,6 @@ public extension CGRect {
}
}

extension CGRect: Hashable {
public func hash(into hasher: inout Hasher) {
origin.hash(into: &hasher)
size.hash(into: &hasher)
}
}

// MARK: -

public extension CGRect {
Expand Down

0 comments on commit bdfd61e

Please sign in to comment.