SwiftUI-WRNavigationBar
custom navigationBar in swiftui
Requirements
iOS 14.0
Installation
pod 'SwiftUI-WRNavigationBar', '~>1.1.1'
Overview
debug
custom title view
custom title view search
leadingView&trailingView
foreground
hidden bottom line
background image
background linearGradient
update background alpha
intercept back event
ignore top area
Example
struct ForegroundView : View {
var body : some View {
WRNavigationBar {
ListView ()
}
.title ("set foreground" )
.foreground (.white)
.isBackButtonBlack (false)
.background (Color.blue)
}
}
Api
api
description
foreground(_ foreground: Color)
foreground
title(_ title: String)
title (titleView is default)
hiddenLine(_ hidden: Bool)
Is the line at the bottom of the navigationBar hidden
backButtonImageName(_ named: String)
Set backButton image name
backButtonHidden(_ hidden: Bool)
Is the backButton hidden
isBackButtonBlack(_ isBlack: Bool)
Is the backButton black style
ignoringTopArea(_ ignore: Bool)
Is the content align with the top of the navigationBar
maxWidth(leading: CGFloat = 80, trailing: CGFloat = 80)
Max width of leadingView and max width of trailingView
background(_ background: Background)
background
backButtonTapAction(_ tapAction: @escaping WRBlock)
backButton intercept( hasBackButton == true)
debug(_ debug: Bool)
debug
navigationBarTitleView(@ViewBuilder titleView: () -> Content)
titleView
wrNavigationBarItems(leading:xx, trailing:xx)
navigationBarItems leading & trailing
wrNavigationBarItems(@ViewBuilder leading: () -> Content)
navigationBarItems leading
wrNavigationBarItems(trailing: () -> Content)
navigationBarItems trailing
More
扫码回复1获取面试资料(持续更新)
License
SwiftUI-WRNavigationBar is available under the MIT license. See the LICENSE file for more info.