I am having trouble using KeyPath to KVC (Key Value Code) in Swift 4.
I have a subclass of Operation and I am overriding the isFinished and isExecuting property.
Problem:
- When I use KeyPath, the completionBlock of the operation is not invoked.
- However when I use String instead of KeyPath, the completionBlock is invoked.
Questions:
- Am I missing something ?
- Is there a way to fix it using KeyPath ?
Hi, Muthu. This is a longstanding issue with Operation—the Objective-C name of the property is just "executing", but the KVO keys that the implementors used is "isExecuting". Swift isn't set up to deal with this difference.
Fortunately, the base implementation of Operation already knows how to send the KVO notifications, so you shouldn't have to override these properties at all. If you still want to for some other reason, you can call super instead of storing to a private property.
Hope that helps,
Jordan
···
On Jun 13, 2017, at 06:40, somu subscribe via swift-users <swift-users@swift.org> wrote:
Hi,
I am having trouble using KeyPath to KVC (Key Value Code) in Swift 4.
I have a subclass of Operation and I am overriding the isFinished and isExecuting property.
Problem:
- When I use KeyPath, the completionBlock of the operation is not invoked.
- However when I use String instead of KeyPath, the completionBlock is invoked.
Questions:
- Am I missing something ?
- Is there a way to fix it using KeyPath ?
Thanks a lot Jordan for pointing out the root cause.
The underlying executing and finished properties are readonly properties.
For an Asynchronous operation I had to override it tell when the asynchronous operation completes.
Since they are readonly properties I am unable to call the super on them to set values.
I can still use String, was just wondering if there was a way to do it using KeyPath. It is more out of enthusiasm to try out the KeyPath feature in the project
Would it be appropriate to file a bug report for the implementation of Operation ?
Hi, Muthu. This is a longstanding issue with Operation—the Objective-C name of the property is just "executing", but the KVO keys that the implementors used is "isExecuting". Swift isn't set up to deal with this difference.
Fortunately, the base implementation of Operation already knows how to send the KVO notifications, so you shouldn't have to override these properties at all. If you still want to for some other reason, you can call super instead of storing to a private property.
I am having trouble using KeyPath to KVC (Key Value Code) in Swift 4.
I have a subclass of Operation and I am overriding the isFinished and isExecuting property.
Problem:
- When I use KeyPath, the completionBlock of the operation is not invoked.
- However when I use String instead of KeyPath, the completionBlock is invoked.
Questions:
- Am I missing something ?
- Is there a way to fix it using KeyPath ?
You can certainly file a bug for us. It may be something we are already tracking or already fixed, but the bug report will let us double check that.
Thanks,
- Tony
···
On Jun 13, 2017, at 12:33 PM, somu subscribe via swift-users <swift-users@swift.org> wrote:
Thanks a lot Jordan for pointing out the root cause.
The underlying executing and finished properties are readonly properties.
For an Asynchronous operation I had to override it tell when the asynchronous operation completes.
Since they are readonly properties I am unable to call the super on them to set values.
I can still use String, was just wondering if there was a way to do it using KeyPath. It is more out of enthusiasm to try out the KeyPath feature in the project
Would it be appropriate to file a bug report for the implementation of Operation ?
Hi, Muthu. This is a longstanding issue with Operation—the Objective-C name of the property is just "executing", but the KVO keys that the implementors used is "isExecuting". Swift isn't set up to deal with this difference.
Fortunately, the base implementation of Operation already knows how to send the KVO notifications, so you shouldn't have to override these properties at all. If you still want to for some other reason, you can call super instead of storing to a private property.
I am having trouble using KeyPath to KVC (Key Value Code) in Swift 4.
I have a subclass of Operation and I am overriding the isFinished and isExecuting property.
Problem:
- When I use KeyPath, the completionBlock of the operation is not invoked.
- However when I use String instead of KeyPath, the completionBlock is invoked.
Questions:
- Am I missing something ?
- Is there a way to fix it using KeyPath ?
You can certainly file a bug for us. It may be something we are already tracking or already fixed, but the bug report will let us double check that.
Thanks,
- Tony
On Jun 13, 2017, at 12:33 PM, somu subscribe via swift-users <swift-users@swift.org> wrote:
Thanks a lot Jordan for pointing out the root cause.
The underlying executing and finished properties are readonly properties.
For an Asynchronous operation I had to override it tell when the asynchronous operation completes.
Since they are readonly properties I am unable to call the super on them to set values.
I can still use String, was just wondering if there was a way to do it using KeyPath. It is more out of enthusiasm to try out the KeyPath feature in the project
Would it be appropriate to file a bug report for the implementation of Operation ?
Hi, Muthu. This is a longstanding issue with Operation—the Objective-C name of the property is just "executing", but the KVO keys that the implementors used is "isExecuting". Swift isn't set up to deal with this difference.
Fortunately, the base implementation of Operation already knows how to send the KVO notifications, so you shouldn't have to override these properties at all. If you still want to for some other reason, you can call super instead of storing to a private property.
Hope that helps,
Jordan
On Jun 13, 2017, at 06:40, somu subscribe via swift-users <swift-users@swift.org> wrote:
Hi,
I am having trouble using KeyPath to KVC (Key Value Code) in Swift 4.
I have a subclass of Operation and I am overriding the isFinished and isExecuting property.
Problem:
- When I use KeyPath, the completionBlock of the operation is not invoked.
- However when I use String instead of KeyPath, the completionBlock is invoked.
Questions:
- Am I missing something ?
- Is there a way to fix it using KeyPath ?
Thanks a lot Jordan for pointing out the root cause.
The underlying executing and finished properties are readonly properties.
For an Asynchronous operation I had to override it tell when the asynchronous operation completes.
Since they are readonly properties I am unable to call the super on them to set values.
I can still use String, was just wondering if there was a way to do it using KeyPath. It is more out of enthusiasm to try out the KeyPath feature in the project
Would it be appropriate to file a bug report for the implementation of Operation ?
Hi, Muthu. This is a longstanding issue with Operation—the Objective-C name of the property is just "executing", but the KVO keys that the implementors used is "isExecuting". Swift isn't set up to deal with this difference.
Fortunately, the base implementation of Operation already knows how to send the KVO notifications, so you shouldn't have to override these properties at all. If you still want to for some other reason, you can call super instead of storing to a private property.
I am having trouble using KeyPath to KVC (Key Value Code) in Swift 4.
I have a subclass of Operation and I am overriding the isFinished and isExecuting property.
Problem:
- When I use KeyPath, the completionBlock of the operation is not invoked.
- However when I use String instead of KeyPath, the completionBlock is invoked.
Questions:
- Am I missing something ?
- Is there a way to fix it using KeyPath ?
Thanks a lot Jordan for pointing out the root cause.
The underlying executing and finished properties are readonly properties.
For an Asynchronous operation I had to override it tell when the asynchronous operation completes.
Since they are readonly properties I am unable to call the super on them to set values.
I can still use String, was just wondering if there was a way to do it using KeyPath. It is more out of enthusiasm to try out the KeyPath feature in the project
Would it be appropriate to file a bug report for the implementation of Operation ?
Hi, Muthu. This is a longstanding issue with Operation—the Objective-C name of the property is just "executing", but the KVO keys that the implementors used is "isExecuting". Swift isn't set up to deal with this difference.
Fortunately, the base implementation of Operation already knows how to send the KVO notifications, so you shouldn't have to override these properties at all. If you still want to for some other reason, you can call super instead of storing to a private property.
I am having trouble using KeyPath to KVC (Key Value Code) in Swift 4.
I have a subclass of Operation and I am overriding the isFinished and isExecuting property.
Problem:
- When I use KeyPath, the completionBlock of the operation is not invoked.
- However when I use String instead of KeyPath, the completionBlock is invoked.
Questions:
- Am I missing something ?
- Is there a way to fix it using KeyPath ?
I have an open radar for this one which has been outstanding for a few months.
Radar #32191242
Hope this helps.
- Rod
On 15 Jun 2017, at 10:27 am, Tony Parker via swift-users <swift-users@swift.org> wrote:
Hi Somu,
You can certainly file a bug for us. It may be something we are already tracking or already fixed, but the bug report will let us double check that.
Thanks,
- Tony
On Jun 13, 2017, at 12:33 PM, somu subscribe via swift-users <swift-users@swift.org> wrote:
Thanks a lot Jordan for pointing out the root cause.
The underlying executing and finished properties are readonly properties.
For an Asynchronous operation I had to override it tell when the asynchronous operation completes.
Since they are readonly properties I am unable to call the super on them to set values.
I can still use String, was just wondering if there was a way to do it using KeyPath. It is more out of enthusiasm to try out the KeyPath feature in the project
Would it be appropriate to file a bug report for the implementation of Operation ?
Hi, Muthu. This is a longstanding issue with Operation—the Objective-C name of the property is just "executing", but the KVO keys that the implementors used is "isExecuting". Swift isn't set up to deal with this difference.
Fortunately, the base implementation of Operation already knows how to send the KVO notifications, so you shouldn't have to override these properties at all. If you still want to for some other reason, you can call super instead of storing to a private property.
Hope that helps,
Jordan
On Jun 13, 2017, at 06:40, somu subscribe via swift-users <swift-users@swift.org> wrote:
Hi,
I am having trouble using KeyPath to KVC (Key Value Code) in Swift 4.
I have a subclass of Operation and I am overriding the isFinished and isExecuting property.
Problem:
- When I use KeyPath, the completionBlock of the operation is not invoked.
- However when I use String instead of KeyPath, the completionBlock is invoked.
Questions:
- Am I missing something ?
- Is there a way to fix it using KeyPath ?
Thanks a lot Jordan for pointing out the root cause.
The underlying executing and finished properties are readonly properties.
For an Asynchronous operation I had to override it tell when the asynchronous operation completes.
Since they are readonly properties I am unable to call the super on them to set values.
I can still use String, was just wondering if there was a way to do it using KeyPath. It is more out of enthusiasm to try out the KeyPath feature in the project
Would it be appropriate to file a bug report for the implementation of Operation ?
Hi, Muthu. This is a longstanding issue with Operation—the Objective-C name of the property is just "executing", but the KVO keys that the implementors used is "isExecuting". Swift isn't set up to deal with this difference.
Fortunately, the base implementation of Operation already knows how to send the KVO notifications, so you shouldn't have to override these properties at all. If you still want to for some other reason, you can call super instead of storing to a private property.
I am having trouble using KeyPath to KVC (Key Value Code) in Swift 4.
I have a subclass of Operation and I am overriding the isFinished and isExecuting property.
Problem:
- When I use KeyPath, the completionBlock of the operation is not invoked.
- However when I use String instead of KeyPath, the completionBlock is invoked.
Questions:
- Am I missing something ?
- Is there a way to fix it using KeyPath ?
I have an open radar for this one which has been outstanding for a few months.
Radar #32191242
Hope this helps.
- Rod
On 15 Jun 2017, at 10:27 am, Tony Parker via swift-users <swift-users@swift.org> wrote:
Hi Somu,
You can certainly file a bug for us. It may be something we are already tracking or already fixed, but the bug report will let us double check that.
Thanks,
- Tony
On Jun 13, 2017, at 12:33 PM, somu subscribe via swift-users <swift-users@swift.org> wrote:
Thanks a lot Jordan for pointing out the root cause.
The underlying executing and finished properties are readonly properties.
For an Asynchronous operation I had to override it tell when the asynchronous operation completes.
Since they are readonly properties I am unable to call the super on them to set values.
I can still use String, was just wondering if there was a way to do it using KeyPath. It is more out of enthusiasm to try out the KeyPath feature in the project
Would it be appropriate to file a bug report for the implementation of Operation ?
Hi, Muthu. This is a longstanding issue with Operation—the Objective-C name of the property is just "executing", but the KVO keys that the implementors used is "isExecuting". Swift isn't set up to deal with this difference.
Fortunately, the base implementation of Operation already knows how to send the KVO notifications, so you shouldn't have to override these properties at all. If you still want to for some other reason, you can call super instead of storing to a private property.
Hope that helps,
Jordan
On Jun 13, 2017, at 06:40, somu subscribe via swift-users <swift-users@swift.org> wrote:
Hi,
I am having trouble using KeyPath to KVC (Key Value Code) in Swift 4.
I have a subclass of Operation and I am overriding the isFinished and isExecuting property.
Problem:
- When I use KeyPath, the completionBlock of the operation is not invoked.
- However when I use String instead of KeyPath, the completionBlock is invoked.
Questions:
- Am I missing something ?
- Is there a way to fix it using KeyPath ?