Conflicting with parent property “description” in Swift












0















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?



enter image description here



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











share|improve this question























  • 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











  • 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
















0















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?



enter image description here



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











share|improve this question























  • 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











  • 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














0












0








0


1






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?



enter image description here



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











share|improve this question














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?



enter image description here



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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 3 at 10:24









Zin Win HtetZin Win Htet

1,30321938




1,30321938













  • 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











  • 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



















  • 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











  • 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

















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












4 Answers
4






active

oldest

votes


















4














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.






share|improve this answer

































    0














    The by far easiest work-around with be to rename the property. Ex: var announcementDescription : String?






    share|improve this answer































      0














      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.






      share|improve this answer































        0














        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.






        share|improve this answer























          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
          });


          }
          });














          draft saved

          draft discarded


















          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









          4














          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.






          share|improve this answer






























            4














            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.






            share|improve this answer




























              4












              4








              4







              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.






              share|improve this answer















              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.







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Jan 3 at 10:56

























              answered Jan 3 at 10:39









              SateeshSateesh

              2,14711020




              2,14711020

























                  0














                  The by far easiest work-around with be to rename the property. Ex: var announcementDescription : String?






                  share|improve this answer




























                    0














                    The by far easiest work-around with be to rename the property. Ex: var announcementDescription : String?






                    share|improve this answer


























                      0












                      0








                      0







                      The by far easiest work-around with be to rename the property. Ex: var announcementDescription : String?






                      share|improve this answer













                      The by far easiest work-around with be to rename the property. Ex: var announcementDescription : String?







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Jan 3 at 10:42









                      doingSomeSwiftHeredoingSomeSwiftHere

                      84212




                      84212























                          0














                          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.






                          share|improve this answer




























                            0














                            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.






                            share|improve this answer


























                              0












                              0








                              0







                              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.






                              share|improve this answer













                              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.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Jan 3 at 11:23









                              Jeesson_7Jeesson_7

                              230325




                              230325























                                  0














                                  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.






                                  share|improve this answer




























                                    0














                                    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.






                                    share|improve this answer


























                                      0












                                      0








                                      0







                                      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.






                                      share|improve this answer













                                      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.







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Jan 21 at 9:17









                                      Zin Win HtetZin Win Htet

                                      1,30321938




                                      1,30321938






























                                          draft saved

                                          draft discarded




















































                                          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.




                                          draft saved


                                          draft discarded














                                          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





















































                                          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







                                          Popular posts from this blog

                                          Monofisismo

                                          Angular Downloading a file using contenturl with Basic Authentication

                                          Olmecas