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

226
Visualizações
How can I access a swift convenience variable from objc in lldb?

I'm trying to set some convenience variable in a swift context and to access it from a ObjC context.

(lldb) expression -l swift -- var $answerSwift = 42
(lldb) expression -o -l swift -- $answerSwift
42
(lldb) expression -o -l objc -- $answerSwift
error: use of undeclared identifier '$answerSwift'

The other way around works perfectly fine:

(lldb) expression -l objc -- int $answerObjc = 42
(lldb) expression -o -l swift -- $answerObjc
42

How can I move a value from the swift scope (?) to the objC scope?

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

0

It's possible to create a "temporary context" that will be evaluated and then passed in as a variable to the expression by putting it in backticks.

So this is going to work for breakpoints in swift code:

(lldb) expression -l swift -- var $answerSwift = 42
(lldb) expression -o -l objc -- `$answerSwift`
42

When I have a breakpoint in swift code I tried to set an objc var like this:

(lldb) expression -l objc -- id $label = (id)self.label
error: use of undeclared identifier 'self'

The objc context can't access the swift variable self, so it fails.

But when putting self.label in backticks to create the temporary swift context I can assign it to the objc variable:

(lldb) expression -l objc -- id $label = (id)`self.label`
(lldb) expression -l objc -O -- $label
<UILabel: 0x7f8030c03c40; frame = (44 44; 42 21); text = 'Label'; opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x6000019b35c0>>

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