How To Add Buttons to the Navigation Bar in SwiftUI

Поділитися
Вставка
  • Опубліковано 11 вер 2024
  • Learn how to add buttons and icons to the navigation bar in your SwiftUI app.
    👋 Our "Launch Your First App" program will help you build up your iOS skills to publish your very own feature rich app even if you’re a beginner starting from scratch. cwc.to/youtube...
    In this SwiftUI tutorial, we’ll cover:
    How to use the toolbar modifier
    How to use the ToolbarItem SwiftUI component
    How to position the buttons on the left or right
    Get started on building iOS apps with our free beginner course:
    cwc.to/start
    Article version of this tutorial:
    codewithchris....
    For tutorials of other SwiftUI components, check out our playlist here:
    • SwiftUI Components

КОМЕНТАРІ • 9

  • @CodeWithChris
    @CodeWithChris  3 місяці тому

    👋 Our "Launch Your First App" program will help you build up your iOS skills to publish your very own feature rich app even if you’re a beginner starting from scratch. cwc.to/youtubeoffer

  • @mohamethseck
    @mohamethseck 4 місяці тому +1

    I love these short form videos!

    • @CodeWithChris
      @CodeWithChris  4 місяці тому

      Thank for you for letting me know this! It's encouraging for me to hear because it's a new format for me to record something so short. Knowing that you still find value in it is validation for me to continue doing it :)

  • @pat0181
    @pat0181 3 місяці тому

    Love the short and to the point video

  • @danielcrompton7818
    @danielcrompton7818 4 місяці тому +1

    I love the different placements, especially how I can add items to a bottom bar or the keyboard!
    I often find this useful when dealing with keyboards without a return button, eg. TextFields modified with `.keyboardType(.decimalPad)` . I will simply add a toolbar to the text field eg: `TextField(...).toolbar {}` and add a `ToolbarItemGroup` containing a Spacer (to push the button the the right of the toolbar so the user can reach it easily) and a `Button("Done") {}` that dismisses the keyboard. This can be done easilly by simply adding a `@FocusState` in conjunction with the `TextField.isFocused(...)` modifier. I could just use a ToolbarItem containing a button but ToolbarItemGroup allows you to add more items and so even more layouts are possible.

    • @CodeWithChris
      @CodeWithChris  4 місяці тому +1

      Hey Daniel, thank you so much for sharing these additional tips! Pinning your comment for visibility :)

    • @danielcrompton7818
      @danielcrompton7818 4 місяці тому

      @@CodeWithChris Thanks very much!

  • @Joeron79
    @Joeron79 2 місяці тому

    How to do center title?

  • @wildanalifr9583
    @wildanalifr9583 4 місяці тому

    Can we change navigationTitleBar font?.