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

182
Visualizações
When can I remove convertToUIApplicationOpenExternalURLOptionsKeyDictionary helper function?

When I migrated to Swift 4.2 last year, Swift 4.2 migrator added a helper function in some of my controllers:

// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertToUIApplicationOpenExternalURLOptionsKeyDictionary(_ input: [String: Any]) -> [UIApplication.OpenExternalURLOptionsKey: Any] {
    return Dictionary(uniqueKeysWithValues: input.map { key, value in (UIApplication.OpenExternalURLOptionsKey(rawValue: key), value)})
}

When is it safe to remove?

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

0

Presumably, some function in that file (or in a prior version of the file) calls this UIApplication method:

func open(_ url: URL, options: [UIApplication.OpenExternalURLOptionsKey : Any] = [:], completionHandler completion: ((Bool) -> Void)? = nil)

Prior to iOS 12, the method had a different signature:

func open(_ url: URL, options: [String : Any] = [:], completionHandler completion: ((Bool) -> Void)? = nil)

When Xcode 10 migrated your project, it added the convertToUIApplicationOpenExternalURLOptionsKeyDictionary function and inserted a call to that function in each call to the open(_:options:completionHandler:) method to translate the options dictionary.

If you update each call to the open(_:options:completionHandler:) method to use the UIApplication.OpenExternalURLOptionsKey constants, you can remove the calls to convertToUIApplicationOpenExternalURLOptionsKeyDictionary and remove the function entirely.

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