https://github.com/wangrui460/swiftui-wrnavigationbar
custom navigationBar in swiftui
https://github.com/wangrui460/swiftui-wrnavigationbar
custom ios navigation navigationbar swiftui
Last synced: 8 months ago
JSON representation
custom navigationBar in swiftui
- Host: GitHub
- URL: https://github.com/wangrui460/swiftui-wrnavigationbar
- Owner: wangrui460
- License: mit
- Created: 2021-05-15T08:30:21.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-07-19T07:31:29.000Z (almost 5 years ago)
- Last Synced: 2025-01-24T22:17:21.443Z (over 1 year ago)
- Topics: custom, ios, navigation, navigationbar, swiftui
- Language: Swift
- Homepage:
- Size: 4.26 MB
- Stars: 48
- Watchers: 2
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SwiftUI 技术交流
我创建了一个 SwiftUI 技术交流群,欢迎小伙伴们加入一起交流学习~
可以加我微信我拉你进去(备注swiftui),我的微信号 wr1204607318
# 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 |
# License
SwiftUI-WRNavigationBar is available under the MIT license. See the LICENSE file for more info.