Skip to content

Commit eb781d3

Browse files
author
Sergey Minakov
committed
fix 'NSRequiresConcreteImplementation' usage for init
1 parent ed83da7 commit eb781d3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Foundation/NSTextCheckingResult.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,19 @@ extension NSTextCheckingResult {
2222
open class NSTextCheckingResult: NSObject, NSCopying, NSCoding {
2323

2424
public override init() {
25-
super.init()
25+
if type(of: self) == NSTextCheckingResult.self {
26+
NSRequiresConcreteImplementation()
27+
}
2628
}
2729

2830
open class func regularExpressionCheckingResultWithRanges(_ ranges: NSRangePointer, count: Int, regularExpression: NSRegularExpression) -> NSTextCheckingResult {
2931
return _NSRegularExpressionNSTextCheckingResultResult(ranges: ranges, count: count, regularExpression: regularExpression)
3032
}
3133

3234
public required init?(coder aDecoder: NSCoder) {
33-
NSRequiresConcreteImplementation()
35+
if type(of: self) == NSTextCheckingResult.self {
36+
NSRequiresConcreteImplementation()
37+
}
3438
}
3539

3640
open func encode(with aCoder: NSCoder) {
@@ -57,6 +61,7 @@ open class NSTextCheckingResult: NSObject, NSCopying, NSCoding {
5761
internal class _NSRegularExpressionNSTextCheckingResultResult : NSTextCheckingResult {
5862
var _ranges = [NSRange]()
5963
let _regularExpression: NSRegularExpression
64+
6065
init(ranges: NSRangePointer, count: Int, regularExpression: NSRegularExpression) {
6166
_regularExpression = regularExpression
6267
super.init()

0 commit comments

Comments
 (0)