The Demo

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

Usage Examples

struct ForegroundView: View {
    var body: some View {
        WRNavigationBar {
            ListView()
        }
        .title("set foreground")
        .foreground(.white)
        .isBackButtonBlack(false)
        .background(Color.blue)
    }
}
Copy the code

Relevant methods

api description
foreground(_ foreground: Color) foreground
title(_ title: String) TitleView is default
hiddenLine(_ hidden: Bool) Hide bottom line
backButtonImageName(_ named: String) Returns the button image resource name
backButtonHidden(_ hidden: Bool) Hide the back button
isBackButtonBlack(_ isBlack: Bool) Black backButton (backButton is default)
ignoringTopArea(_ ignore: Bool) Content ignores the top area of the navigation bar
maxWidth(leading: CGFloat = 80, trailing: CGFloat = 80) Maximum widths of leadingView and trailingView
background(_ background: Background) Background (Any view)
backButtonTapAction(_ tapAction: @escaping WRBlock) Intercept the return button event (hasBackButton == true)
debug(_ debug: Bool) Debug enables debugging
navigationBarTitleView<Content: View>(@ViewBuilder titleView: () -> Content) TitleView (any view)
wrNavigationBarItems<Leading: View, Trailing: View>(leading:xx, trailing:xx) Navigation bar Leading & trailing view
wrNavigationBarItems<Content: View>(@ViewBuilder leading: () -> Content) Navigation bar Leading view
wrNavigationBarItems(trailing: () -> Content) Navigation bar Trailing view

Details about the address

Github.com/wangrui460/…