[swift-users] Foundation bug or indended?

Zhao Xin owenzx at gmail.com
Mon Sep 4 07:33:13 CDT 2017


It is intended.
The swift version you provided is the swift version of Objective-C header.
So they are the same.

Zhao Xin



On Mon, Sep 4, 2017 at 8:01 PM, Adrian Zubarev via swift-users <
swift-users at swift.org> wrote:

> 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?
>
>
>
>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170904/9352469e/attachment.html>


More information about the swift-users mailing list