@@ -33,10 +33,10 @@ public struct NSAffineTransformStruct {
33
33
34
34
public class NSAffineTransform : NSObject , NSCopying , NSSecureCoding {
35
35
36
- public func encodeWithCoder( aCoder: NSCoder ) {
36
+ public func encodeWithCoder( _ aCoder: NSCoder ) {
37
37
NSUnimplemented ( )
38
38
}
39
- public func copyWithZone( zone: NSZone ) -> AnyObject {
39
+ public func copyWithZone( _ zone: NSZone ) -> AnyObject {
40
40
return NSAffineTransform ( transform: self )
41
41
}
42
42
// Necessary because `NSObject.copy()` returns `self`.
@@ -65,30 +65,30 @@ public class NSAffineTransform : NSObject, NSCopying, NSSecureCoding {
65
65
}
66
66
67
67
// Translating
68
- public func translateXBy( deltaX: CGFloat , yBy deltaY: CGFloat ) {
68
+ public func translateXBy( _ deltaX: CGFloat , yBy deltaY: CGFloat ) {
69
69
let translation = NSAffineTransformStruct . translation ( tX: deltaX, tY: deltaY)
70
70
71
71
transformStruct = translation. concat ( transformStruct)
72
72
}
73
73
74
74
// Rotating
75
- public func rotateByDegrees( angle: CGFloat ) {
75
+ public func rotateByDegrees( _ angle: CGFloat ) {
76
76
let rotation = NSAffineTransformStruct . rotation ( degrees: angle)
77
77
78
78
transformStruct = rotation. concat ( transformStruct)
79
79
}
80
- public func rotateByRadians( angle: CGFloat ) {
80
+ public func rotateByRadians( _ angle: CGFloat ) {
81
81
let rotation = NSAffineTransformStruct . rotation ( radians: angle)
82
82
83
83
transformStruct = rotation. concat ( transformStruct)
84
84
}
85
85
86
86
// Scaling
87
- public func scaleBy( scale: CGFloat ) {
87
+ public func scaleBy( _ scale: CGFloat ) {
88
88
scaleXBy ( scale, yBy: scale)
89
89
}
90
90
91
- public func scaleXBy( scaleX: CGFloat , yBy scaleY: CGFloat ) {
91
+ public func scaleXBy( _ scaleX: CGFloat , yBy scaleY: CGFloat ) {
92
92
let scale = NSAffineTransformStruct . scale ( sX: scaleX, sY: scaleY)
93
93
94
94
transformStruct = scale. concat ( transformStruct)
@@ -105,19 +105,19 @@ public class NSAffineTransform : NSObject, NSCopying, NSSecureCoding {
105
105
}
106
106
107
107
// Transforming with transform
108
- public func appendTransform( transform: NSAffineTransform ) {
108
+ public func appendTransform( _ transform: NSAffineTransform ) {
109
109
transformStruct = transformStruct. concat ( transform. transformStruct)
110
110
}
111
- public func prependTransform( transform: NSAffineTransform ) {
111
+ public func prependTransform( _ transform: NSAffineTransform ) {
112
112
transformStruct = transform. transformStruct. concat ( transformStruct)
113
113
}
114
114
115
115
// Transforming points and sizes
116
- public func transformPoint( aPoint: NSPoint ) -> NSPoint {
116
+ public func transformPoint( _ aPoint: NSPoint ) -> NSPoint {
117
117
return transformStruct. applied ( toPoint: aPoint)
118
118
}
119
119
120
- public func transformSize( aSize: NSSize ) -> NSSize {
120
+ public func transformSize( _ aSize: NSSize ) -> NSSize {
121
121
return transformStruct. applied ( toSize: aSize)
122
122
}
123
123
@@ -141,7 +141,7 @@ private extension NSAffineTransformStruct {
141
141
[ 0 1 0 ]
142
142
[ tX tY 1 ]
143
143
*/
144
- static func translation( tX tX : CGFloat , tY: CGFloat ) -> NSAffineTransformStruct {
144
+ static func translation( tX: CGFloat , tY: CGFloat ) -> NSAffineTransformStruct {
145
145
return NSAffineTransformStruct (
146
146
m11: CGFloat ( 1.0 ) , m12: CGFloat ( ) ,
147
147
m21: CGFloat ( ) , m22: CGFloat ( 1.0 ) ,
@@ -157,7 +157,7 @@ private extension NSAffineTransformStruct {
157
157
[ 0 sY 0 ]
158
158
[ 0 0 1 ]
159
159
*/
160
- static func scale( sX sX : CGFloat , sY: CGFloat ) -> NSAffineTransformStruct {
160
+ static func scale( sX: CGFloat , sY: CGFloat ) -> NSAffineTransformStruct {
161
161
return NSAffineTransformStruct (
162
162
m11: sX, m12: CGFloat ( ) ,
163
163
m21: CGFloat ( ) , m22: sY,
@@ -214,7 +214,7 @@ private extension NSAffineTransformStruct {
214
214
= [ (m21_T*m11_M + m22_T*m21_M) (m21_T*m12_M + m22_T*m22_M) 0 ]
215
215
[ (tX_T*m11_M + tY_T*m21_M + tX_M) (tX_T*m12_M + tY_T*m22_M + tY_M) 1 ]
216
216
*/
217
- func concat( transformStruct: NSAffineTransformStruct ) -> NSAffineTransformStruct {
217
+ func concat( _ transformStruct: NSAffineTransformStruct ) -> NSAffineTransformStruct {
218
218
let ( t, m) = ( self , transformStruct)
219
219
220
220
return NSAffineTransformStruct (
0 commit comments