Reputation: 908
I'm facing a little bit of a problem customizing the SwiftUI toolbar. First let me share my code and then I will provide you more information.
// MARK: - Toolbar
.toolbar {
/// Top bar
ToolbarItem(placement: .topBarLeading) {
Text("")
.frame(width: 50, height: 50)
}
ToolbarItem(placement: .topBarTrailing) {
Button(action: {
viewModel.presentDismissOnboardingDialog()
}, label: {
R.image.abort.image
.frame(width: 50, height: 50)
.contentShape(Rectangle())
})
}
/// Bottom bar - pager view
ToolbarItem(placement: .bottomBar) {
pagerView
}
}
.toolbar {
ToolbarItem(placement: .navigation) {
Text(titleText)
.lineLimit(2)
.font(.liebherrHeadRegular(size: 24))
.foregroundColor(.textPrimary)
.multilineTextAlignment(.center)
.frame(alignment: .center)
.fixedSize(horizontal: false, vertical: true)
.padding()
}
}
So, the ToolbarItem(placement: navigation) is multiline. I want this one and .topBarTrailing one to be aligned on top of each other. I tried many solution but nothing is working. I am sharing a screenshot so that you understand how it looks. Any kind of help is appreciated.
Upvotes: 0
Views: 63