Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

354
Visualizações
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?

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

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

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.

over 4 years ago · Santiago Trujillo Relatório

0

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

over 4 years ago · Santiago Trujillo Relatório

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.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda