Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

416
Vistas
SwiftUI `navigationBarItems` vs `toolbar` what are the differences?

What are the differences between navigationBarItems vs toolbar in SwiftUI? I've been using them interchangeably and feel like they are doing the same things with different syntax, eg: put buttons on navigationBar (.leading/.trailing).

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

As mentioned by Lorem Ipsum, .toolbar is the way to go forward. The biggest difference is that .navigationBarItems is iOS/iPad OS only, whereas .toolbar works on macOS as well.

This makes it much easier to create universal views.

If you're just targeting mobile devices, there isn't really any difference in outcome at the moment.

over 4 years ago · Santiago Trujillo Denunciar

0

.toolbar will (by default) automatically display the button on the leading or trailing edge depending on the locale.

.toolbar(
    Button("Edit") {
        print("Editing ...")
    }
)

This will show the button on the trailing edge for left- to-right languages, or on the leading edge for right-to-left. You can put it where you want by wrapping it in a ToolbarItem().

.toolbar(
    ToolbarItem(placement: .navigationBarLeading) {
        // Button
    }
)
over 4 years ago · Santiago Trujillo Denunciar

0

In addition to what has been said: .toolbar requires iOS 14. A lots of projects need to be backward-compatible to iOS 13 and then navigationBarItems is the only way to achieve this

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda