[swift-users] Foundation bug or indended?

Adrian Zubarev adrian.zubarev at devandartist.com
Mon Sep 4 07:01:11 CDT 2017


Hi there,

before filing a new issue I would like to ask if this is intended behaviour or a bug:

The Foundation class Operation which has it’s roots in Objective-C has a few readonly properties like the following one:

@available(iOS 2.0, *)
open class Operation : NSObject {
    ...
    open var isExecuting: Bool { get }
    ...
}
On the other hand the Objective-C header looks like this:

NS_CLASS_AVAILABLE(10_5, 2_0)
@interface NSOperation : NSObject {
...
@property (readonly, getter=isExecuting) BOOL executing;
...
@end
Now I want to create a custom subclass of Operation and override isExecuting, everything works fine until I try to create a private stored property named executing:

final class TransitionOperation : Operation {
    // error: cannot override with a stored property 'executing'
    private var executing = false

    override var isExecuting: Bool {
        ...
    }
}
I’m a little bit confused here:

Is this intended behaviour or a bug?
The Foundation implemented in Swift is not used for iOS deployment, instead the Obj-C one is used right?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170904/23b4266c/attachment.html>


More information about the swift-users mailing list