SwiftUI .tabItem deprecated in iOS 18.1 -> replace it with new Tab

In the newest Xcode, you might see a deprecation warning if you try to use .tabItem view modifier.

💡

‘tabItem’ will be deprecated in a future version of iOS: Use Tab (title:image:value:content:) and related initializers instead

As shown on the Apple Developer documentation:

You can easily fix this by using the new Tab view:

You can also easily add a badge (that shows a number or a character text), and use the value parameter to control which tab is currently activated: