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

231
Visualizações
How to make custom segue with IBInspectable data

I have used IBInspectable in my custom UIViewController, and it works, I can modify the value in interface builder.

However, when I use IBInspectable in my custom UIStoryboardSegue, it does not work, I can't see the variables in interface builder.

Is it impossible to use IBInspectable in a UIStoryboardSegue, or am I doing something wrong?

Here is my code.

class EmbedSegue: UIStoryboardSegue {
    @IBInspectable var childLevel = 0
    override func perform() {
        var container:ContainerVC?
        if childLevel == 0 {
            container = source as? ContainerVC
        } else if childLevel > 0 {
            var target:UIViewController? = source
            for _ in 0..<childLevel {
                target = target?.children.first
                if target == nil {
                    break
                }
            }
            container = target as? ContainerVC
        } else if childLevel < 0 {
            var target:UIViewController? = source
            for _ in 0 ..< -childLevel {
                target = target?.parent
                if target == nil {
                    break
                }
            }
            container = target as? ContainerVC
        }
        guard let _container = container else {
            var vcName = Utility.className(source)
            if let name = source.nibName {
                vcName = name
            }
            print("Unable to perform embed from \(vcName) with child level \(childLevel)")
            return
        }
        _container.embed(destination)
    }
}
over 4 years ago · Santiago Trujillo
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