Conflicting with parent property “description” in Swift
I'm using EVNetworkningObject of EVReflection library to serialize or deserialize json response from web service. It means I can't change the property name "description" as "description_" or something like that. At the same time, backend will not change their response property for me. How possibly can I fix this error?
The error message says
Getter for 'description' with Objective-C selector 'description'
conflicts with getter for 'description' from superclass 'NSObject'
with the same Objective-C selector
swift nsobject
add a comment |
I'm using EVNetworkningObject of EVReflection library to serialize or deserialize json response from web service. It means I can't change the property name "description" as "description_" or something like that. At the same time, backend will not change their response property for me. How possibly can I fix this error?
The error message says
Getter for 'description' with Objective-C selector 'description'
conflicts with getter for 'description' from superclass 'NSObject'
with the same Objective-C selector
swift nsobject
Use a struct or useCodable
. IfEVReflection
is not able to map property names it's unqualified anyway.
– vadian
Jan 3 at 10:34
@vadian, how? I'm new to iOS.
– Zin Win Htet
Jan 3 at 10:34
plus, it's not about EVReflection problem. It's NSObject problem.
– Zin Win Htet
Jan 3 at 10:36
1
All third party libraries to (de)serialize JSON became obsolete in favor ofCodable
in Swift 4+
– vadian
Jan 3 at 10:42
add a comment |
I'm using EVNetworkningObject of EVReflection library to serialize or deserialize json response from web service. It means I can't change the property name "description" as "description_" or something like that. At the same time, backend will not change their response property for me. How possibly can I fix this error?
The error message says
Getter for 'description' with Objective-C selector 'description'
conflicts with getter for 'description' from superclass 'NSObject'
with the same Objective-C selector
swift nsobject
I'm using EVNetworkningObject of EVReflection library to serialize or deserialize json response from web service. It means I can't change the property name "description" as "description_" or something like that. At the same time, backend will not change their response property for me. How possibly can I fix this error?
The error message says
Getter for 'description' with Objective-C selector 'description'
conflicts with getter for 'description' from superclass 'NSObject'
with the same Objective-C selector
swift nsobject
swift nsobject
asked Jan 3 at 10:24
Zin Win HtetZin Win Htet
1,30321938
1,30321938
Use a struct or useCodable
. IfEVReflection
is not able to map property names it's unqualified anyway.
– vadian
Jan 3 at 10:34
@vadian, how? I'm new to iOS.
– Zin Win Htet
Jan 3 at 10:34
plus, it's not about EVReflection problem. It's NSObject problem.
– Zin Win Htet
Jan 3 at 10:36
1
All third party libraries to (de)serialize JSON became obsolete in favor ofCodable
in Swift 4+
– vadian
Jan 3 at 10:42
add a comment |
Use a struct or useCodable
. IfEVReflection
is not able to map property names it's unqualified anyway.
– vadian
Jan 3 at 10:34
@vadian, how? I'm new to iOS.
– Zin Win Htet
Jan 3 at 10:34
plus, it's not about EVReflection problem. It's NSObject problem.
– Zin Win Htet
Jan 3 at 10:36
1
All third party libraries to (de)serialize JSON became obsolete in favor ofCodable
in Swift 4+
– vadian
Jan 3 at 10:42
Use a struct or use
Codable
. If EVReflection
is not able to map property names it's unqualified anyway.– vadian
Jan 3 at 10:34
Use a struct or use
Codable
. If EVReflection
is not able to map property names it's unqualified anyway.– vadian
Jan 3 at 10:34
@vadian, how? I'm new to iOS.
– Zin Win Htet
Jan 3 at 10:34
@vadian, how? I'm new to iOS.
– Zin Win Htet
Jan 3 at 10:34
plus, it's not about EVReflection problem. It's NSObject problem.
– Zin Win Htet
Jan 3 at 10:36
plus, it's not about EVReflection problem. It's NSObject problem.
– Zin Win Htet
Jan 3 at 10:36
1
1
All third party libraries to (de)serialize JSON became obsolete in favor of
Codable
in Swift 4+– vadian
Jan 3 at 10:42
All third party libraries to (de)serialize JSON became obsolete in favor of
Codable
in Swift 4+– vadian
Jan 3 at 10:42
add a comment |
4 Answers
4
active
oldest
votes
description
is a property of the protocol named NSObjectProtocol
of NSObject
.
public var description: String { get }
So you can't initiate any variable with the same name in any NSObject
subclasses.
For more please visit https://developer.apple.com/documentation/objectivec/nsobjectprotocol/1418746-description.
Please try either by initiating the variable with different names or by implementing with Codable
protocol of what @vadian
suggested in comments.
add a comment |
The by far easiest work-around with be to rename the property. Ex: var announcementDescription : String?
add a comment |
I assume you are using JSON decodable for getting JSON data. if so , You don't need to make your super class of type NSObject
. The reason you are getting this error is because the name conflicts with getter for 'description' from superclass 'NSObject'. So make EVNetworking
(which is your super class) object a class which conforms to only decodable protocol and not a class of type NSObject.
add a comment |
As vadian suggested in comments, I decided to use Codable
protocol instead of EVReflection
as Codable
is way easy to use. I read this link for Codable
and this video link for parsing json data.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54020369%2fconflicting-with-parent-property-description-in-swift%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
description
is a property of the protocol named NSObjectProtocol
of NSObject
.
public var description: String { get }
So you can't initiate any variable with the same name in any NSObject
subclasses.
For more please visit https://developer.apple.com/documentation/objectivec/nsobjectprotocol/1418746-description.
Please try either by initiating the variable with different names or by implementing with Codable
protocol of what @vadian
suggested in comments.
add a comment |
description
is a property of the protocol named NSObjectProtocol
of NSObject
.
public var description: String { get }
So you can't initiate any variable with the same name in any NSObject
subclasses.
For more please visit https://developer.apple.com/documentation/objectivec/nsobjectprotocol/1418746-description.
Please try either by initiating the variable with different names or by implementing with Codable
protocol of what @vadian
suggested in comments.
add a comment |
description
is a property of the protocol named NSObjectProtocol
of NSObject
.
public var description: String { get }
So you can't initiate any variable with the same name in any NSObject
subclasses.
For more please visit https://developer.apple.com/documentation/objectivec/nsobjectprotocol/1418746-description.
Please try either by initiating the variable with different names or by implementing with Codable
protocol of what @vadian
suggested in comments.
description
is a property of the protocol named NSObjectProtocol
of NSObject
.
public var description: String { get }
So you can't initiate any variable with the same name in any NSObject
subclasses.
For more please visit https://developer.apple.com/documentation/objectivec/nsobjectprotocol/1418746-description.
Please try either by initiating the variable with different names or by implementing with Codable
protocol of what @vadian
suggested in comments.
edited Jan 3 at 10:56
answered Jan 3 at 10:39
SateeshSateesh
2,14711020
2,14711020
add a comment |
add a comment |
The by far easiest work-around with be to rename the property. Ex: var announcementDescription : String?
add a comment |
The by far easiest work-around with be to rename the property. Ex: var announcementDescription : String?
add a comment |
The by far easiest work-around with be to rename the property. Ex: var announcementDescription : String?
The by far easiest work-around with be to rename the property. Ex: var announcementDescription : String?
answered Jan 3 at 10:42
doingSomeSwiftHeredoingSomeSwiftHere
84212
84212
add a comment |
add a comment |
I assume you are using JSON decodable for getting JSON data. if so , You don't need to make your super class of type NSObject
. The reason you are getting this error is because the name conflicts with getter for 'description' from superclass 'NSObject'. So make EVNetworking
(which is your super class) object a class which conforms to only decodable protocol and not a class of type NSObject.
add a comment |
I assume you are using JSON decodable for getting JSON data. if so , You don't need to make your super class of type NSObject
. The reason you are getting this error is because the name conflicts with getter for 'description' from superclass 'NSObject'. So make EVNetworking
(which is your super class) object a class which conforms to only decodable protocol and not a class of type NSObject.
add a comment |
I assume you are using JSON decodable for getting JSON data. if so , You don't need to make your super class of type NSObject
. The reason you are getting this error is because the name conflicts with getter for 'description' from superclass 'NSObject'. So make EVNetworking
(which is your super class) object a class which conforms to only decodable protocol and not a class of type NSObject.
I assume you are using JSON decodable for getting JSON data. if so , You don't need to make your super class of type NSObject
. The reason you are getting this error is because the name conflicts with getter for 'description' from superclass 'NSObject'. So make EVNetworking
(which is your super class) object a class which conforms to only decodable protocol and not a class of type NSObject.
answered Jan 3 at 11:23
Jeesson_7Jeesson_7
230325
230325
add a comment |
add a comment |
As vadian suggested in comments, I decided to use Codable
protocol instead of EVReflection
as Codable
is way easy to use. I read this link for Codable
and this video link for parsing json data.
add a comment |
As vadian suggested in comments, I decided to use Codable
protocol instead of EVReflection
as Codable
is way easy to use. I read this link for Codable
and this video link for parsing json data.
add a comment |
As vadian suggested in comments, I decided to use Codable
protocol instead of EVReflection
as Codable
is way easy to use. I read this link for Codable
and this video link for parsing json data.
As vadian suggested in comments, I decided to use Codable
protocol instead of EVReflection
as Codable
is way easy to use. I read this link for Codable
and this video link for parsing json data.
answered Jan 21 at 9:17
Zin Win HtetZin Win Htet
1,30321938
1,30321938
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54020369%2fconflicting-with-parent-property-description-in-swift%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Use a struct or use
Codable
. IfEVReflection
is not able to map property names it's unqualified anyway.– vadian
Jan 3 at 10:34
@vadian, how? I'm new to iOS.
– Zin Win Htet
Jan 3 at 10:34
plus, it's not about EVReflection problem. It's NSObject problem.
– Zin Win Htet
Jan 3 at 10:36
1
All third party libraries to (de)serialize JSON became obsolete in favor of
Codable
in Swift 4+– vadian
Jan 3 at 10:42