Skip to content

Commit 322e7b4

Browse files
committed
Mechanically add 'open' to all public classes.
This applies 'open' to all public classes and all of their non-final public methods, properties, and subscripts, preserving the existing behavior when SE-0117 is implemented. This transformation was performed mechanically using the following sed script (run with sed -E): /(init|mutating|struct|enum|typealias|final|let|static)/ { p d } /public class/,/^}/ s/public/open/ This should probably be refined soon, but for now this allows us to implement SE-0117 without immediately requiring updates in all clients. Specifically, there are two areas where this change may not be correct to match Foundation on Apple platforms: - Members in extensions cannot yet be overridden, so none of them have been marked 'open'. - Some classes are /not/ intended to be overridden, even in Objective-C. Specifying this requires input from the Foundation team. Groundwork for SE-0117 "Allow distinguishing between public access and public overridability"
1 parent e3a5c96 commit 322e7b4

File tree

87 files changed

+2095
-2095
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+2095
-2095
lines changed

Foundation/NSAffineTransform.swift

+15-15
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ public struct NSAffineTransformStruct {
3131
}
3232
}
3333

34-
public class NSAffineTransform : NSObject, NSCopying, NSSecureCoding {
34+
open class NSAffineTransform : NSObject, NSCopying, NSSecureCoding {
3535

36-
public func encode(with aCoder: NSCoder) {
36+
open func encode(with aCoder: NSCoder) {
3737
NSUnimplemented()
3838
}
39-
public func copy(with zone: NSZone? = nil) -> AnyObject {
39+
open func copy(with zone: NSZone? = nil) -> AnyObject {
4040
return NSAffineTransform(transform: self)
4141
}
4242
// Necessary because `NSObject.copy()` returns `self`.
43-
public override func copy() -> AnyObject {
43+
open override func copy() -> AnyObject {
4444
return copy(with: nil)
4545
}
4646
public required init?(coder aDecoder: NSCoder) {
@@ -65,37 +65,37 @@ public class NSAffineTransform : NSObject, NSCopying, NSSecureCoding {
6565
}
6666

6767
// Translating
68-
public func translateXBy(_ deltaX: CGFloat, yBy deltaY: CGFloat) {
68+
open func translateXBy(_ deltaX: CGFloat, yBy deltaY: CGFloat) {
6969
let translation = NSAffineTransformStruct.translation(tX: deltaX, tY: deltaY)
7070

7171
transformStruct = translation.concat(transformStruct)
7272
}
7373

7474
// Rotating
75-
public func rotateByDegrees(_ angle: CGFloat) {
75+
open func rotateByDegrees(_ angle: CGFloat) {
7676
let rotation = NSAffineTransformStruct.rotation(degrees: angle)
7777

7878
transformStruct = rotation.concat(transformStruct)
7979
}
80-
public func rotateByRadians(_ angle: CGFloat) {
80+
open func rotateByRadians(_ angle: CGFloat) {
8181
let rotation = NSAffineTransformStruct.rotation(radians: angle)
8282

8383
transformStruct = rotation.concat(transformStruct)
8484
}
8585

8686
// Scaling
87-
public func scaleBy(_ scale: CGFloat) {
87+
open func scaleBy(_ scale: CGFloat) {
8888
scaleXBy(scale, yBy: scale)
8989
}
9090

91-
public func scaleXBy(_ scaleX: CGFloat, yBy scaleY: CGFloat) {
91+
open func scaleXBy(_ scaleX: CGFloat, yBy scaleY: CGFloat) {
9292
let scale = NSAffineTransformStruct.scale(sX: scaleX, sY: scaleY)
9393

9494
transformStruct = scale.concat(transformStruct)
9595
}
9696

9797
// Inverting
98-
public func invert() {
98+
open func invert() {
9999
if let inverse = transformStruct.inverse {
100100
transformStruct = inverse
101101
}
@@ -105,24 +105,24 @@ public class NSAffineTransform : NSObject, NSCopying, NSSecureCoding {
105105
}
106106

107107
// Transforming with transform
108-
public func appendTransform(_ transform: NSAffineTransform) {
108+
open func appendTransform(_ transform: NSAffineTransform) {
109109
transformStruct = transformStruct.concat(transform.transformStruct)
110110
}
111-
public func prependTransform(_ transform: NSAffineTransform) {
111+
open func prependTransform(_ transform: NSAffineTransform) {
112112
transformStruct = transform.transformStruct.concat(transformStruct)
113113
}
114114

115115
// Transforming points and sizes
116-
public func transformPoint(_ aPoint: NSPoint) -> NSPoint {
116+
open func transformPoint(_ aPoint: NSPoint) -> NSPoint {
117117
return transformStruct.applied(toPoint: aPoint)
118118
}
119119

120-
public func transformSize(_ aSize: NSSize) -> NSSize {
120+
open func transformSize(_ aSize: NSSize) -> NSSize {
121121
return transformStruct.applied(toSize: aSize)
122122
}
123123

124124
// Transform Struct
125-
public var transformStruct: NSAffineTransformStruct
125+
open var transformStruct: NSAffineTransformStruct
126126
}
127127

128128
/**

0 commit comments

Comments
 (0)