├── screenshots ├── debug.gif ├── demo list.png ├── foreground.gif ├── ignore top area.gif ├── custom title view.gif ├── hidden bottom line.gif ├── set background image.gif ├── intercept backBtn event.gif ├── update background alpha.gif ├── LeadingView&TrailingView.gif ├── custom title view search.gif └── set background linearGradient.gif ├── Sources ├── WRNavigationBar.bundle │ ├── back_arrow@2x.png │ ├── back_arrow_white@2x.png │ ├── en.lproj │ │ └── Root.strings │ └── Root.plist ├── WRTitleView.swift ├── WRLeadingView.swift ├── WRBackgroundView.swift ├── WRTrailingView.swift ├── WRDefaultTitleView.swift ├── Bundle+WRNavigationBar.swift ├── WRHelper.swift ├── WRDefaultBackButton.swift └── WRNavigationBar.swift ├── SwiftUI-WRNavigationBar ├── SwiftUI-WRNavigationBar │ ├── Assets.xcassets │ │ ├── Contents.json │ │ ├── bg.imageset │ │ │ ├── bg.jpeg │ │ │ └── Contents.json │ │ ├── sky.imageset │ │ │ ├── sky.jpeg │ │ │ └── Contents.json │ │ ├── cus_back.imageset │ │ │ ├── cus_back@2x.png │ │ │ ├── cus_back@3x.png │ │ │ └── Contents.json │ │ ├── AccentColor.colorset │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ ├── WX20180115-171757@2x.png │ │ │ └── Contents.json │ ├── Preview Content │ │ └── Preview Assets.xcassets │ │ │ └── Contents.json │ ├── WRNavigationBar │ │ ├── WRNavigationBar.bundle │ │ │ ├── back_arrow@2x.png │ │ │ ├── en.lproj │ │ │ │ └── Root.strings │ │ │ ├── back_arrow_white@2x.png │ │ │ └── Root.plist │ │ ├── WRTitleView.swift │ │ ├── WRLeadingView.swift │ │ ├── WRTrailingView.swift │ │ ├── WRBackgroundView.swift │ │ ├── WRDefaultTitleView.swift │ │ ├── Bundle+WRNavigationBar.swift │ │ ├── WRHelper.swift │ │ ├── WRDefaultBackButton.swift │ │ └── WRNavigationBar.swift │ ├── Demo │ │ ├── HiddenBottomLineView.swift │ │ ├── SetBackButtonImageViewName.swift │ │ ├── BackgroundView1.swift │ │ ├── ForegroundView.swift │ │ ├── DebugView.swift │ │ ├── BackgroundView2.swift │ │ ├── TitleView.swift │ │ ├── LeadingAndTrailingView.swift │ │ ├── TitleSearchView.swift │ │ ├── IgnoreTopAreaView.swift │ │ ├── BackButtonTapActionView.swift │ │ └── BackgroundView3.swift │ ├── UINavigationController+Ex.swift │ ├── AppDelegate.swift │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ ├── Info.plist │ ├── SceneDelegate.swift │ └── ContentView.swift └── SwiftUI-WRNavigationBar.xcodeproj │ ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── project.pbxproj ├── SwiftUI-WRNavigationBar.podspec ├── LICENSE ├── .gitignore └── README.md /screenshots/debug.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/screenshots/debug.gif -------------------------------------------------------------------------------- /screenshots/demo list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/screenshots/demo list.png -------------------------------------------------------------------------------- /screenshots/foreground.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/screenshots/foreground.gif -------------------------------------------------------------------------------- /screenshots/ignore top area.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/screenshots/ignore top area.gif -------------------------------------------------------------------------------- /screenshots/custom title view.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/screenshots/custom title view.gif -------------------------------------------------------------------------------- /screenshots/hidden bottom line.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/screenshots/hidden bottom line.gif -------------------------------------------------------------------------------- /screenshots/set background image.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/screenshots/set background image.gif -------------------------------------------------------------------------------- /screenshots/intercept backBtn event.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/screenshots/intercept backBtn event.gif -------------------------------------------------------------------------------- /screenshots/update background alpha.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/screenshots/update background alpha.gif -------------------------------------------------------------------------------- /screenshots/LeadingView&TrailingView.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/screenshots/LeadingView&TrailingView.gif -------------------------------------------------------------------------------- /screenshots/custom title view search.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/screenshots/custom title view search.gif -------------------------------------------------------------------------------- /screenshots/set background linearGradient.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/screenshots/set background linearGradient.gif -------------------------------------------------------------------------------- /Sources/WRNavigationBar.bundle/back_arrow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/Sources/WRNavigationBar.bundle/back_arrow@2x.png -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Sources/WRNavigationBar.bundle/back_arrow_white@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/Sources/WRNavigationBar.bundle/back_arrow_white@2x.png -------------------------------------------------------------------------------- /Sources/WRNavigationBar.bundle/en.lproj/Root.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/Sources/WRNavigationBar.bundle/en.lproj/Root.strings -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Assets.xcassets/bg.imageset/bg.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Assets.xcassets/bg.imageset/bg.jpeg -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Assets.xcassets/sky.imageset/sky.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Assets.xcassets/sky.imageset/sky.jpeg -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Assets.xcassets/cus_back.imageset/cus_back@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Assets.xcassets/cus_back.imageset/cus_back@2x.png -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Assets.xcassets/cus_back.imageset/cus_back@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Assets.xcassets/cus_back.imageset/cus_back@3x.png -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/WRNavigationBar/WRNavigationBar.bundle/back_arrow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/WRNavigationBar/WRNavigationBar.bundle/back_arrow@2x.png -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Assets.xcassets/AppIcon.appiconset/WX20180115-171757@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Assets.xcassets/AppIcon.appiconset/WX20180115-171757@2x.png -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/WRNavigationBar/WRNavigationBar.bundle/en.lproj/Root.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/WRNavigationBar/WRNavigationBar.bundle/en.lproj/Root.strings -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/WRNavigationBar/WRNavigationBar.bundle/back_arrow_white@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangrui460/SwiftUI-WRNavigationBar/HEAD/SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/WRNavigationBar/WRNavigationBar.bundle/back_arrow_white@2x.png -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Sources/WRTitleView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WRTitleView.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/5/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | /// navigationBar title view 11 | struct WRTitleView: View { 12 | 13 | var content: AnyView? 14 | 15 | var body: some View { 16 | if content != nil { 17 | content 18 | } else { 19 | Color.clear 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/WRLeadingView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WRLeadingView.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/5/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | /// navigationBar leading view 11 | struct WRLeadingView: View { 12 | 13 | var content: AnyView? 14 | 15 | var body: some View { 16 | if content != nil { 17 | content 18 | } else { 19 | Color.clear 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/WRBackgroundView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WRBackgroundView.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/5/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | // navigationBar background view 11 | struct WRBackgroundView: View { 12 | 13 | var content: AnyView? 14 | 15 | var body: some View { 16 | if content != nil { 17 | content 18 | } else { 19 | Color.clear 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/WRTrailingView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WRTrailingView.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/5/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | /// navigationBar trailing view 11 | struct WRTrailingView: View { 12 | 13 | var content: AnyView? 14 | 15 | var body: some View { 16 | if content != nil { 17 | content 18 | } else { 19 | Color.clear 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Assets.xcassets/bg.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "bg.jpeg", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Assets.xcassets/sky.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "sky.jpeg", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/WRNavigationBar/WRTitleView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WRTitleView.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/5/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | /// navigationBar title view 11 | struct WRTitleView: View { 12 | 13 | var content: AnyView? 14 | 15 | var body: some View { 16 | if content != nil { 17 | content 18 | } else { 19 | Color.clear 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/WRNavigationBar/WRLeadingView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WRLeadingView.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/5/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | /// navigationBar leading view 11 | struct WRLeadingView: View { 12 | 13 | var content: AnyView? 14 | 15 | var body: some View { 16 | if content != nil { 17 | content 18 | } else { 19 | Color.clear 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/WRNavigationBar/WRTrailingView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WRTrailingView.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/5/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | /// navigationBar trailing view 11 | struct WRTrailingView: View { 12 | 13 | var content: AnyView? 14 | 15 | var body: some View { 16 | if content != nil { 17 | content 18 | } else { 19 | Color.clear 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/WRNavigationBar/WRBackgroundView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WRBackgroundView.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/5/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | // navigationBar background view 11 | struct WRBackgroundView: View { 12 | 13 | var content: AnyView? 14 | 15 | var body: some View { 16 | if content != nil { 17 | content 18 | } else { 19 | Color.clear 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Assets.xcassets/cus_back.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "cus_back@2x.png", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "filename" : "cus_back@3x.png", 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "author" : "xcode", 20 | "version" : 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Demo/HiddenBottomLineView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HiddenBottomLine.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by 王锐 on 2021/5/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct HiddenBottomLineView: View { 11 | var body: some View { 12 | WRNavigationBar { 13 | ListView() 14 | } 15 | .title("hidden bottoom line") 16 | .hiddenLine(true) 17 | } 18 | } 19 | 20 | struct HiddenBottomLineView_Previews: PreviewProvider { 21 | static var previews: some View { 22 | HiddenBottomLineView() 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Demo/SetBackButtonImageViewName.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SetBackButtonImageView.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by 王锐 on 2021/5/16. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct SetBackButtonImageViewName: View { 11 | var body: some View { 12 | WRNavigationBar { 13 | ListView() 14 | } 15 | .title("test") 16 | .backButtonImageName("cus_back") 17 | } 18 | } 19 | 20 | struct SetBackButtonImageViewName_Previews: PreviewProvider { 21 | static var previews: some View { 22 | DebugView() 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Demo/BackgroundView1.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BackgroundView1.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by 王锐 on 2021/5/16. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct BackgroundView1: View { 11 | var body: some View { 12 | WRNavigationBar { 13 | ListView() 14 | } 15 | .isBackButtonBlack(false) 16 | .background( 17 | Image("sky") 18 | ) 19 | } 20 | } 21 | 22 | struct BackgroundView1_Previews: PreviewProvider { 23 | static var previews: some View { 24 | BackgroundView1() 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Sources/WRDefaultTitleView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WRDefaultTitleView.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/5/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct WRDefaultTitleView: View { 11 | let title: String 12 | let foreground: Color 13 | var body: some View { 14 | Text(title) 15 | .lineLimit(1) 16 | .foregroundColor(foreground) 17 | .font(.system(size: 17)) 18 | } 19 | } 20 | 21 | struct WRDefaultTitleView_Previews: PreviewProvider { 22 | static var previews: some View { 23 | WRDefaultTitleView(title: "test", foreground: .black) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Demo/ForegroundView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ForegroundView.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by 王锐 on 2021/5/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ForegroundView: View { 11 | var body: some View { 12 | WRNavigationBar { 13 | ListView() 14 | } 15 | .title("set foreground") 16 | .foreground(.white) 17 | .isBackButtonBlack(false) 18 | .background(Color.blue) 19 | } 20 | } 21 | 22 | struct ForegroundView_Previews: PreviewProvider { 23 | static var previews: some View { 24 | ForegroundView() 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/WRNavigationBar/WRDefaultTitleView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WRDefaultTitleView.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/5/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct WRDefaultTitleView: View { 11 | let title: String 12 | let foreground: Color 13 | var body: some View { 14 | Text(title) 15 | .lineLimit(1) 16 | .foregroundColor(foreground) 17 | .font(.system(size: 17)) 18 | } 19 | } 20 | 21 | struct WRDefaultTitleView_Previews: PreviewProvider { 22 | static var previews: some View { 23 | WRDefaultTitleView(title: "test", foreground: .black) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Demo/DebugView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DebugView.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by 王锐 on 2021/5/16. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct DebugView: View { 11 | var body: some View { 12 | WRNavigationBar { 13 | ListView() 14 | } 15 | .title("test") 16 | .maxWidth(leading: 120, trailing: 120) 17 | .background(Color.blue) 18 | .debug(true) 19 | .wrNavigationBarItems(trailing: { 20 | Text("🐦") 21 | }) 22 | } 23 | } 24 | 25 | struct DebugView_Previews: PreviewProvider { 26 | static var previews: some View { 27 | DebugView() 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/UINavigationController+Ex.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationController.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/4/21. 6 | // 7 | 8 | import SwiftUI 9 | 10 | // https://stackoverflow.com/questions/59234958/swiftui-navigationbarbackbuttonhidden-swipe-back-gesture 11 | extension UINavigationController: UIGestureRecognizerDelegate { 12 | override open func viewDidLoad() { 13 | super.viewDidLoad() 14 | interactivePopGestureRecognizer?.delegate = self 15 | } 16 | 17 | public func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool { 18 | return viewControllers.count > 1 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Demo/BackgroundView2.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BackgroundView2.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by 王锐 on 2021/5/16. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct BackgroundView2: View { 11 | var body: some View { 12 | WRNavigationBar { 13 | ListView() 14 | } 15 | .isBackButtonBlack(false) 16 | .title("Beauty") 17 | .background( 18 | LinearGradient( 19 | gradient: Gradient(colors: [Color.red, Color.blue]), 20 | startPoint: .topLeading, 21 | endPoint: .bottomTrailing) 22 | ) 23 | } 24 | } 25 | 26 | struct BackgroundView2_Previews: PreviewProvider { 27 | static var previews: some View { 28 | BackgroundView2() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |spec| 2 | 3 | spec.name = "SwiftUI-WRNavigationBar" 4 | spec.version = "1.1.1" 5 | spec.summary = "Custom navigationBar in SwiftUI" 6 | 7 | spec.description = <<-DESC 8 | easy navigationBar in SwiftUI 9 | DESC 10 | 11 | spec.homepage = "https://github.com/wangrui460/SwiftUI-WRNavigationBar" 12 | 13 | spec.license = "MIT" 14 | 15 | spec.author = { "wangrui460" => "wangruidev@gmail.com" } 16 | 17 | spec.platform = :ios, "14.0" 18 | 19 | spec.source = { :git => "https://github.com/wangrui460/SwiftUI-WRNavigationBar.git", :tag => "#{spec.version}" } 20 | 21 | spec.source_files = "Sources/*.swift" 22 | spec.resources = 'Sources/*.{png,bundle}' 23 | 24 | spec.requires_arc = true 25 | 26 | end 27 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Demo/TitleView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TitleView.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by 王锐 on 2021/5/16. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct TitleView: View { 11 | var body: some View { 12 | WRNavigationBar { 13 | ListView() 14 | } 15 | .background(Color.blue) 16 | .isBackButtonBlack(false) 17 | .navigationBarTitleView(titleView: { 18 | VStack { 19 | Text("title") 20 | .font(.subheadline) 21 | Text("the desc") 22 | .font(.system(size: 10)) 23 | } 24 | .foregroundColor(.white) 25 | }) 26 | } 27 | } 28 | 29 | struct TitleView_Previews: PreviewProvider { 30 | static var previews: some View { 31 | TitleView() 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Demo/LeadingAndTrailingView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LeadingAndTrailingView.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by 王锐 on 2021/5/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct LeadingAndTrailingView: View { 11 | var body: some View { 12 | WRNavigationBar { 13 | ListView() 14 | } 15 | .title("leading & trailing") 16 | .foreground(.white) 17 | .isBackButtonBlack(false) 18 | .background(Color.blue) 19 | .wrNavigationBarItems(leading: { 20 | Image(systemName: "xmark") 21 | .padding(.leading, 10) 22 | }, trailing: { 23 | Image(systemName: "paperplane.fill") 24 | }) 25 | } 26 | } 27 | 28 | struct LeadingAndTrailingView_Previews: PreviewProvider { 29 | static var previews: some View { 30 | LeadingAndTrailingView() 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Demo/TitleSearchView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TitleView2.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by 王锐 on 2021/5/16. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct TitleSearchView: View { 11 | @State var searchText: String = "" 12 | var body: some View { 13 | WRNavigationBar { 14 | ListView() 15 | } 16 | .background(Color.blue) 17 | .isBackButtonBlack(false) 18 | .maxWidth(leading: 50, trailing: 50) 19 | .navigationBarTitleView(titleView: { 20 | TextField("WRNavigationBar", text: $searchText) 21 | .padding(.horizontal, 15) 22 | .frame(maxWidth: .infinity) 23 | .frame(height: 33) 24 | .background(Color.white) 25 | .clipShape(Capsule()) 26 | }) 27 | } 28 | } 29 | 30 | struct TitleSearchView_Previews: PreviewProvider { 31 | static var previews: some View { 32 | TitleSearchView() 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Sources/Bundle+WRNavigationBar.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Bundle+WRNavigationBar.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/5/16. 6 | // 7 | 8 | import Foundation 9 | 10 | extension Bundle { 11 | 12 | private static var bundle: Bundle? = nil 13 | 14 | static var normal_module: Bundle? = { 15 | let bundleName = "WRNavigationBar" 16 | 17 | var candidates = [ 18 | // Bundle should be present here when the package is linked into an App. 19 | Bundle.main.resourceURL, 20 | 21 | // For command-line tools. 22 | Bundle.main.bundleURL, 23 | ] 24 | 25 | for candidate in candidates { 26 | let bundlePath = candidate?.appendingPathComponent(bundleName + ".bundle") 27 | if let bundle = bundlePath.flatMap(Bundle.init(url:)) { 28 | return bundle 29 | } 30 | } 31 | 32 | return nil 33 | }() 34 | 35 | static var wrNavigationBarBundle: Bundle? { 36 | return normal_module 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/WRNavigationBar/Bundle+WRNavigationBar.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Bundle+WRNavigationBar.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/5/16. 6 | // 7 | 8 | import Foundation 9 | 10 | extension Bundle { 11 | 12 | private static var bundle: Bundle? = nil 13 | 14 | static var normal_module: Bundle? = { 15 | let bundleName = "WRNavigationBar" 16 | 17 | var candidates = [ 18 | // Bundle should be present here when the package is linked into an App. 19 | Bundle.main.resourceURL, 20 | 21 | // For command-line tools. 22 | Bundle.main.bundleURL, 23 | ] 24 | 25 | for candidate in candidates { 26 | let bundlePath = candidate?.appendingPathComponent(bundleName + ".bundle") 27 | if let bundle = bundlePath.flatMap(Bundle.init(url:)) { 28 | return bundle 29 | } 30 | } 31 | 32 | return nil 33 | }() 34 | 35 | static var wrNavigationBarBundle: Bundle? { 36 | return normal_module 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 wangrui460 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Demo/IgnoreTopAreaView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IgnoreTopAreaView.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by 王锐 on 2021/5/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct IgnoreTopAreaView: View { 11 | var body: some View { 12 | WRNavigationBar { 13 | ListView() 14 | } 15 | .isBackButtonBlack(false) 16 | .ignoringTopArea(true) 17 | } 18 | } 19 | 20 | struct ListView: View { 21 | var body: some View { 22 | ScrollView(.vertical, showsIndicators: false) { 23 | LazyVStack(spacing: 0) { 24 | ForEach(0 ..< 100) { item in 25 | Text("SwiftUI-WRNavigationBar \(item)") 26 | .foregroundColor(.white) 27 | .frame(maxWidth: UIScreen.main.bounds.width) 28 | .frame(height: 60) 29 | } 30 | .background(Color.gray) 31 | } 32 | } 33 | } 34 | } 35 | 36 | struct IgnoreTopAreaView_Previews: PreviewProvider { 37 | static var previews: some View { 38 | IgnoreTopAreaView() 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Demo/BackButtonTapActionView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BackButtonTapActionView.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by 王锐 on 2021/5/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct BackButtonTapActionView: View { 11 | @Environment(\.presentationMode) var presentationMode 12 | @State var show = false 13 | var body: some View { 14 | WRNavigationBar { 15 | ListView() 16 | .alert(isPresented: $show, content: { 17 | Alert(title: Text("提醒"), 18 | message: Text("确认要返回吗?"), 19 | primaryButton: Alert.Button.cancel(Text("取消")), 20 | secondaryButton: Alert.Button.destructive(Text("确认"), action: { 21 | self.presentationMode.wrappedValue.dismiss() 22 | })) 23 | }) 24 | } 25 | .title("setBackBtnTapAction") 26 | .hiddenLine(false) 27 | .backButtonTapAction { 28 | self.show.toggle() 29 | } 30 | } 31 | } 32 | 33 | struct BackButtonTapActionView_Previews: PreviewProvider { 34 | static var previews: some View { 35 | BackButtonTapActionView() 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/5/15. 6 | // 7 | 8 | import UIKit 9 | 10 | @main 11 | class AppDelegate: UIResponder, UIApplicationDelegate { 12 | 13 | 14 | 15 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 16 | // Override point for customization after application launch. 17 | return true 18 | } 19 | 20 | // MARK: UISceneSession Lifecycle 21 | 22 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 23 | // Called when a new scene session is being created. 24 | // Use this method to select a configuration to create the new scene with. 25 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 26 | } 27 | 28 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 29 | // Called when the user discards a scene session. 30 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 31 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 32 | } 33 | 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /Sources/WRHelper.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WRHelper.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/5/8. 6 | // 7 | 8 | import UIKit 9 | 10 | public typealias WRBlock = () -> Void 11 | 12 | enum WRHelper { 13 | static let height: CGFloat = UIScreen.main.bounds.size.height 14 | 15 | /// Portrait 16 | enum UnsafeArea { 17 | static var top: CGFloat { 18 | UIWindow.keyWindow?.safeAreaInsets.top ?? 0 19 | } 20 | } 21 | 22 | enum StatusBar { 23 | static var frame: CGRect { 24 | UIWindow.keyWindow?.windowScene?.statusBarManager?.statusBarFrame ?? .zero 25 | } 26 | static let height: CGFloat = frame.size.height 27 | } 28 | 29 | enum NavigationBar { 30 | static let height: CGFloat = 44 31 | static let bottom: CGFloat = height + StatusBar.height 32 | } 33 | 34 | static var iphoneXSeries: Bool { 35 | if UIDevice.current.userInterfaceIdiom != UIUserInterfaceIdiom.phone { 36 | debugPrint("not iPhone - \(UIDevice.current.userInterfaceIdiom.rawValue)") 37 | } 38 | if #available(iOS 11.0, *) { 39 | if let bottom = UIWindow.keyWindow?.safeAreaInsets.bottom, bottom > 0 { 40 | return true 41 | } 42 | } else { 43 | debugPrint("iOS11 previews") 44 | } 45 | return false 46 | } 47 | } 48 | 49 | extension UIWindow { 50 | static var keyWindow: UIWindow? { 51 | if #available(iOS 13.0, *) { 52 | return UIApplication.shared.windows.filter({ $0.isKeyWindow }).first 53 | } else { 54 | return UIApplication.shared.keyWindow 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Sources/WRNavigationBar.bundle/Root.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | StringsTable 6 | Root 7 | PreferenceSpecifiers 8 | 9 | 10 | Type 11 | PSGroupSpecifier 12 | Title 13 | Group 14 | 15 | 16 | Type 17 | PSTextFieldSpecifier 18 | Title 19 | Name 20 | Key 21 | name_preference 22 | DefaultValue 23 | 24 | IsSecure 25 | 26 | KeyboardType 27 | Alphabet 28 | AutocapitalizationType 29 | None 30 | AutocorrectionType 31 | No 32 | 33 | 34 | Type 35 | PSToggleSwitchSpecifier 36 | Title 37 | Enabled 38 | Key 39 | enabled_preference 40 | DefaultValue 41 | 42 | 43 | 44 | Type 45 | PSSliderSpecifier 46 | Key 47 | slider_preference 48 | DefaultValue 49 | 0.5 50 | MinimumValue 51 | 0 52 | MaximumValue 53 | 1 54 | MinimumValueImage 55 | 56 | MaximumValueImage 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/WRNavigationBar/WRHelper.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WRHelper.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/5/8. 6 | // 7 | 8 | import UIKit 9 | 10 | public typealias WRBlock = () -> Void 11 | 12 | enum WRHelper { 13 | static let height: CGFloat = UIScreen.main.bounds.size.height 14 | 15 | /// Portrait 16 | enum UnsafeArea { 17 | static var top: CGFloat { 18 | UIWindow.keyWindow?.safeAreaInsets.top ?? 0 19 | } 20 | } 21 | 22 | enum StatusBar { 23 | static var frame: CGRect { 24 | UIWindow.keyWindow?.windowScene?.statusBarManager?.statusBarFrame ?? .zero 25 | } 26 | static let height: CGFloat = frame.size.height 27 | } 28 | 29 | enum NavigationBar { 30 | static let height: CGFloat = 44 31 | static let bottom: CGFloat = height + StatusBar.height 32 | } 33 | 34 | static var iphoneXSeries: Bool { 35 | if UIDevice.current.userInterfaceIdiom != UIUserInterfaceIdiom.phone { 36 | debugPrint("not iPhone - \(UIDevice.current.userInterfaceIdiom.rawValue)") 37 | } 38 | if #available(iOS 11.0, *) { 39 | if let bottom = UIWindow.keyWindow?.safeAreaInsets.bottom, bottom > 0 { 40 | return true 41 | } 42 | } else { 43 | debugPrint("iOS11 previews") 44 | } 45 | return false 46 | } 47 | } 48 | 49 | extension UIWindow { 50 | static var keyWindow: UIWindow? { 51 | if #available(iOS 13.0, *) { 52 | return UIApplication.shared.windows.filter({ $0.isKeyWindow }).first 53 | } else { 54 | return UIApplication.shared.keyWindow 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/WRNavigationBar/WRNavigationBar.bundle/Root.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | StringsTable 6 | Root 7 | PreferenceSpecifiers 8 | 9 | 10 | Type 11 | PSGroupSpecifier 12 | Title 13 | Group 14 | 15 | 16 | Type 17 | PSTextFieldSpecifier 18 | Title 19 | Name 20 | Key 21 | name_preference 22 | DefaultValue 23 | 24 | IsSecure 25 | 26 | KeyboardType 27 | Alphabet 28 | AutocapitalizationType 29 | None 30 | AutocorrectionType 31 | No 32 | 33 | 34 | Type 35 | PSToggleSwitchSpecifier 36 | Title 37 | Enabled 38 | Key 39 | enabled_preference 40 | DefaultValue 41 | 42 | 43 | 44 | Type 45 | PSSliderSpecifier 46 | Key 47 | slider_preference 48 | DefaultValue 49 | 0.5 50 | MinimumValue 51 | 0 52 | MaximumValue 53 | 1 54 | MinimumValueImage 55 | 56 | MaximumValueImage 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Sources/WRDefaultBackButton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WRDefaultBackButton.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/4/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | // add @Environment(\.presentationMode) var presentationMode 11 | struct WRDefaultBackButton: View { 12 | 13 | @Environment(\.presentationMode) var presentationMode: Binding 14 | var named: String? 15 | var isBlack: Bool = true 16 | var foreground: Color = .black 17 | var action: WRBlock? 18 | 19 | init(named: String? = nil, tapAction: WRBlock? = nil, isBlack: Bool = true, foreground: Color = .black) { 20 | self.named = named 21 | self.action = tapAction 22 | self.isBlack = isBlack 23 | self.foreground = foreground 24 | } 25 | 26 | var body: some View { 27 | Button(action: { 28 | if let action = action { 29 | action() 30 | } else { 31 | self.presentationMode.wrappedValue.dismiss() 32 | } 33 | }) { 34 | backImage() 35 | .resizable() 36 | .frame(width: 13, height: 13) 37 | .aspectRatio(contentMode: .fit) 38 | .foregroundColor(foreground) 39 | } 40 | } 41 | 42 | private func backImage() -> Image { 43 | if named != nil { 44 | return Image(named!) 45 | } else { 46 | return Image(uiImage: isBlack ? wrImg(name: "back_arrow@2x") : wrImg(name: "back_arrow_white@2x")) 47 | } 48 | } 49 | 50 | private func wrImg(name: String, type: String = "png") -> UIImage { 51 | return UIImage(named: name, in: Bundle.wrNavigationBarBundle, compatibleWith: nil) ?? UIImage() 52 | } 53 | } 54 | 55 | struct WRDefaultBackButton_Previews: PreviewProvider { 56 | static var previews: some View { 57 | WRDefaultBackButton(isBlack: true) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/WRNavigationBar/WRDefaultBackButton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WRDefaultBackButton.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/4/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | // add @Environment(\.presentationMode) var presentationMode 11 | struct WRDefaultBackButton: View { 12 | 13 | @Environment(\.presentationMode) var presentationMode: Binding 14 | var named: String? 15 | var isBlack: Bool = true 16 | var foreground: Color = .black 17 | var action: WRBlock? 18 | 19 | init(named: String? = nil, tapAction: WRBlock? = nil, isBlack: Bool = true, foreground: Color = .black) { 20 | self.named = named 21 | self.action = tapAction 22 | self.isBlack = isBlack 23 | self.foreground = foreground 24 | } 25 | 26 | var body: some View { 27 | Button(action: { 28 | if let action = action { 29 | action() 30 | } else { 31 | self.presentationMode.wrappedValue.dismiss() 32 | } 33 | }) { 34 | backImage() 35 | .resizable() 36 | .frame(width: 13, height: 13) 37 | .aspectRatio(contentMode: .fit) 38 | .foregroundColor(foreground) 39 | } 40 | } 41 | 42 | private func backImage() -> Image { 43 | if named != nil { 44 | return Image(named!) 45 | } else { 46 | return Image(uiImage: isBlack ? wrImg(name: "back_arrow@2x") : wrImg(name: "back_arrow_white@2x")) 47 | } 48 | } 49 | 50 | private func wrImg(name: String, type: String = "png") -> UIImage { 51 | return UIImage(named: name, in: Bundle.wrNavigationBarBundle, compatibleWith: nil) ?? UIImage() 52 | } 53 | } 54 | 55 | struct WRDefaultBackButton_Previews: PreviewProvider { 56 | static var previews: some View { 57 | WRDefaultBackButton(isBlack: true) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | 37 | 38 | 39 | 40 | UIApplicationSupportsIndirectInputEvents 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UISupportedInterfaceOrientations 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | UISupportedInterfaceOrientations~ipad 55 | 56 | UIInterfaceOrientationPortrait 57 | UIInterfaceOrientationPortraitUpsideDown 58 | UIInterfaceOrientationLandscapeLeft 59 | UIInterfaceOrientationLandscapeRight 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "filename" : "WX20180115-171757@2x.png", 40 | "idiom" : "iphone", 41 | "scale" : "3x", 42 | "size" : "60x60" 43 | }, 44 | { 45 | "idiom" : "ipad", 46 | "scale" : "1x", 47 | "size" : "20x20" 48 | }, 49 | { 50 | "idiom" : "ipad", 51 | "scale" : "2x", 52 | "size" : "20x20" 53 | }, 54 | { 55 | "idiom" : "ipad", 56 | "scale" : "1x", 57 | "size" : "29x29" 58 | }, 59 | { 60 | "idiom" : "ipad", 61 | "scale" : "2x", 62 | "size" : "29x29" 63 | }, 64 | { 65 | "idiom" : "ipad", 66 | "scale" : "1x", 67 | "size" : "40x40" 68 | }, 69 | { 70 | "idiom" : "ipad", 71 | "scale" : "2x", 72 | "size" : "40x40" 73 | }, 74 | { 75 | "idiom" : "ipad", 76 | "scale" : "1x", 77 | "size" : "76x76" 78 | }, 79 | { 80 | "idiom" : "ipad", 81 | "scale" : "2x", 82 | "size" : "76x76" 83 | }, 84 | { 85 | "idiom" : "ipad", 86 | "scale" : "2x", 87 | "size" : "83.5x83.5" 88 | }, 89 | { 90 | "idiom" : "ios-marketing", 91 | "scale" : "1x", 92 | "size" : "1024x1024" 93 | } 94 | ], 95 | "info" : { 96 | "author" : "xcode", 97 | "version" : 1 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | ## Playgrounds 34 | timeline.xctimeline 35 | playground.xcworkspace 36 | 37 | # Swift Package Manager 38 | # 39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 40 | # Packages/ 41 | # Package.pins 42 | # Package.resolved 43 | # *.xcodeproj 44 | # 45 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 46 | # hence it is not needed unless you have added a package configuration file to your project 47 | # .swiftpm 48 | 49 | .build/ 50 | 51 | # CocoaPods 52 | # 53 | # We recommend against adding the Pods directory to your .gitignore. However 54 | # you should judge for yourself, the pros and cons are mentioned at: 55 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 56 | # 57 | # Pods/ 58 | # 59 | # Add this line if you want to avoid checking in source code from the Xcode workspace 60 | # *.xcworkspace 61 | 62 | # Carthage 63 | # 64 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 65 | # Carthage/Checkouts 66 | 67 | Carthage/Build/ 68 | 69 | # Accio dependency management 70 | Dependencies/ 71 | .accio/ 72 | 73 | # fastlane 74 | # 75 | # It is recommended to not store the screenshots in the git repo. 76 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 77 | # For more information about the recommended setup visit: 78 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 79 | 80 | fastlane/report.xml 81 | fastlane/Preview.html 82 | fastlane/screenshots/**/*.png 83 | fastlane/test_output 84 | 85 | # Code Injection 86 | # 87 | # After new code Injection tools there's a generated folder /iOSInjectionProject 88 | # https://github.com/johnno1962/injectionforxcode 89 | 90 | iOSInjectionProject/ 91 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/Demo/BackgroundView3.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BackgroundView3.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by 王锐 on 2021/5/16. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct BackgroundView3: View { 11 | @Environment(\.presentationMode) var presentationMode 12 | @State var opacity: Double = 0 13 | var body: some View { 14 | WRNavigationBar { 15 | ScrollView(.vertical, showsIndicators: false) { 16 | VStack(spacing: 0) { 17 | Image("bg") 18 | .resizable() 19 | .scaledToFill() 20 | .frame(width: UIScreen.main.bounds.width) 21 | .background( 22 | GeometryReader { geo in 23 | Color.clear.preference( 24 | key: ViewOffsetKey.self, 25 | value: geo.frame(in: .named("scroll")).origin.y) 26 | } 27 | ) 28 | LazyVStack(spacing: 0) { 29 | ForEach(0 ..< 100) { item in 30 | Text("SwiftUI-WRNavigationBar \(item)") 31 | .foregroundColor(.white) 32 | .frame(maxWidth: UIScreen.main.bounds.width) 33 | .frame(height: 60) 34 | } 35 | .background(Color.gray) 36 | } 37 | } 38 | .onPreferenceChange(ViewOffsetKey.self, perform: { value in 39 | if value > -200 { 40 | opacity = 0 41 | } else { 42 | opacity = 1 43 | } 44 | }) 45 | } 46 | .coordinateSpace(name: "scroll") 47 | } 48 | .ignoringTopArea(true) 49 | .title("标题") 50 | .foreground(opacity == 1 ? .black : .white) 51 | .background( 52 | Color.white 53 | .opacity(opacity) 54 | .animation(.default) 55 | ) 56 | .backButtonHidden(true) 57 | .wrNavigationBarItems(leading: { 58 | Button(action: { 59 | self.presentationMode.wrappedValue.dismiss() 60 | }, label: { 61 | Text("返回") 62 | .foregroundColor(opacity == 1 ? .black : .white) 63 | }) 64 | }) 65 | } 66 | } 67 | 68 | struct ViewOffsetKey: PreferenceKey { 69 | typealias Value = CGFloat 70 | static var defaultValue = CGFloat.zero 71 | static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) { 72 | value += nextValue() 73 | } 74 | } 75 | 76 | struct BackgroundView3_Previews: PreviewProvider { 77 | static var previews: some View { 78 | BackgroundView3() 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/5/15. 6 | // 7 | 8 | import UIKit 9 | import SwiftUI 10 | 11 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 12 | 13 | var window: UIWindow? 14 | 15 | 16 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 17 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 18 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 19 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 20 | 21 | // Create the SwiftUI view that provides the window contents. 22 | let contentView = ContentView() 23 | 24 | // Use a UIHostingController as window root view controller. 25 | if let windowScene = scene as? UIWindowScene { 26 | let window = UIWindow(windowScene: windowScene) 27 | window.rootViewController = UIHostingController(rootView: contentView) 28 | self.window = window 29 | window.makeKeyAndVisible() 30 | } 31 | } 32 | 33 | func sceneDidDisconnect(_ scene: UIScene) { 34 | // Called as the scene is being released by the system. 35 | // This occurs shortly after the scene enters the background, or when its session is discarded. 36 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 37 | // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). 38 | } 39 | 40 | func sceneDidBecomeActive(_ scene: UIScene) { 41 | // Called when the scene has moved from an inactive state to an active state. 42 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 43 | } 44 | 45 | func sceneWillResignActive(_ scene: UIScene) { 46 | // Called when the scene will move from an active state to an inactive state. 47 | // This may occur due to temporary interruptions (ex. an incoming phone call). 48 | } 49 | 50 | func sceneWillEnterForeground(_ scene: UIScene) { 51 | // Called as the scene transitions from the background to the foreground. 52 | // Use this method to undo the changes made on entering the background. 53 | } 54 | 55 | func sceneDidEnterBackground(_ scene: UIScene) { 56 | // Called as the scene transitions from the foreground to the background. 57 | // Use this method to save data, release shared resources, and store enough scene-specific state information 58 | // to restore the scene back to its current state. 59 | } 60 | 61 | 62 | } 63 | 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SwiftUI 技术交流 2 | 我创建了一个 SwiftUI 技术交流群,欢迎小伙伴们加入一起交流学习~ 3 | 4 | 可以加我微信我拉你进去(备注swiftui),我的微信号 wr1204607318 5 | 6 | # SwiftUI-WRNavigationBar 7 | custom navigationBar in swiftui 8 | 9 | 10 | ## Requirements 11 | iOS 14.0 12 | 13 | ## Installation 14 | pod 'SwiftUI-WRNavigationBar', '~>1.1.1' 15 | 16 | 17 | ## Overview 18 | |debug|custom title view|custom title view search| 19 | |:-:|:-:|:-:| 20 | |![](https://github.com/wangrui460/SwiftUI-WRNavigationBar/blob/main/screenshots/debug.gif)|![](https://github.com/wangrui460/SwiftUI-WRNavigationBar/blob/main/screenshots/custom%20title%20view.gif)|![](https://github.com/wangrui460/SwiftUI-WRNavigationBar/blob/main/screenshots/custom%20title%20view%20search.gif)| 21 | 22 | |leadingView&trailingView|foreground|hidden bottom line| 23 | |:-:|:-:|:-:| 24 | |![](https://github.com/wangrui460/SwiftUI-WRNavigationBar/blob/main/screenshots/LeadingView%26TrailingView.gif)|![](https://github.com/wangrui460/SwiftUI-WRNavigationBar/blob/main/screenshots/foreground.gif)|![](https://github.com/wangrui460/SwiftUI-WRNavigationBar/blob/main/screenshots/hidden%20bottom%20line.gif)| 25 | 26 | |background image|background linearGradient|update background alpha| 27 | |:-:|:-:|:-:| 28 | |![](https://github.com/wangrui460/SwiftUI-WRNavigationBar/blob/main/screenshots/set%20background%20image.gif)|![](https://github.com/wangrui460/SwiftUI-WRNavigationBar/blob/main/screenshots/set%20background%20linearGradient.gif)|![](https://github.com/wangrui460/SwiftUI-WRNavigationBar/blob/main/screenshots/update%20background%20alpha.gif)| 29 | 30 | |intercept back event|ignore top area| 31 | |:-:|:-:| 32 | |![](https://github.com/wangrui460/SwiftUI-WRNavigationBar/blob/main/screenshots/intercept%20backBtn%20event.gif)|![](https://github.com/wangrui460/SwiftUI-WRNavigationBar/blob/main/screenshots/ignore%20top%20area.gif)| 33 | 34 | 35 | ### Example 36 | 37 |

38 | struct ForegroundView: View {
39 |     var body: some View {
40 |         WRNavigationBar {
41 |             ListView()
42 |         }
43 |         .title("set foreground")
44 |         .foreground(.white)
45 |         .isBackButtonBlack(false)
46 |         .background(Color.blue)
47 |     }
48 | }
49 | 
50 | 51 | ### Api 52 | 53 | |api|description| 54 | |------|-------| 55 | | foreground(_ foreground: Color) | foreground | 56 | | title(_ title: String) | title (titleView is default) | 57 | | hiddenLine(_ hidden: Bool) | Is the line at the bottom of the navigationBar hidden | 58 | | backButtonImageName(_ named: String) | Set backButton image name | 59 | | backButtonHidden(_ hidden: Bool) | Is the backButton hidden | 60 | | isBackButtonBlack(_ isBlack: Bool) | Is the backButton black style | 61 | | ignoringTopArea(_ ignore: Bool) | Is the content align with the top of the navigationBar | 62 | | maxWidth(leading: CGFloat = 80, trailing: CGFloat = 80) | Max width of leadingView and max width of trailingView | 63 | | background(_ background: Background) | background | 64 | | backButtonTapAction(_ tapAction: @escaping WRBlock) | backButton intercept( hasBackButton == true) | 65 | | debug(_ debug: Bool) | debug | 66 | | navigationBarTitleView(@ViewBuilder titleView: () -> Content) | titleView | 67 | | wrNavigationBarItems(leading:xx, trailing:xx) | navigationBarItems leading & trailing | 68 | | wrNavigationBarItems(@ViewBuilder leading: () -> Content) | navigationBarItems leading | 69 | | wrNavigationBarItems(trailing: () -> Content) | navigationBarItems trailing | 70 | 71 | 72 | # License 73 | SwiftUI-WRNavigationBar is available under the MIT license. See the LICENSE file for more info. 74 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/5/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ContentView: View { 11 | var body: some View { 12 | NavigationView { 13 | WRNavigationBar { 14 | ScrollView(.vertical) { 15 | LazyVStack(spacing: 0) { 16 | VStack(spacing: 0) { 17 | NavigationLink( 18 | destination: LeadingAndTrailingView(), 19 | label: { 20 | DemoCell(title: "leadingView and trailingView") 21 | }) 22 | 23 | NavigationLink( 24 | destination: ForegroundView(), 25 | label: { 26 | DemoCell(title: "set foreground white") 27 | }) 28 | 29 | NavigationLink( 30 | destination: HiddenBottomLineView(), 31 | label: { 32 | DemoCell(title: "hidden bottom line") 33 | }) 34 | 35 | NavigationLink( 36 | destination: IgnoreTopAreaView(), 37 | label: { 38 | DemoCell(title: "ignoreTopArea") 39 | }) 40 | 41 | NavigationLink( 42 | destination: BackButtonTapActionView(), 43 | label: { 44 | DemoCell(title: "intercept backButton event") 45 | }) 46 | } 47 | 48 | VStack { 49 | NavigationLink( 50 | destination: BackgroundView1(), 51 | label: { 52 | DemoCell(title: "set background image") 53 | }) 54 | 55 | NavigationLink( 56 | destination: BackgroundView2(), 57 | label: { 58 | DemoCell(title: "set background LinearGradient") 59 | }) 60 | 61 | NavigationLink( 62 | destination: BackgroundView3(), 63 | label: { 64 | DemoCell(title: "update background alpha when scroll") 65 | }) 66 | 67 | NavigationLink( 68 | destination: TitleView(), 69 | label: { 70 | DemoCell(title: "set titleView") 71 | }) 72 | 73 | NavigationLink( 74 | destination: TitleSearchView(), 75 | label: { 76 | DemoCell(title: "set titleView search") 77 | }) 78 | } 79 | 80 | VStack { 81 | NavigationLink( 82 | destination: SetBackButtonImageViewName(), 83 | label: { 84 | DemoCell(title: "set backButton image name") 85 | }) 86 | 87 | NavigationLink( 88 | destination: DebugView(), 89 | label: { 90 | DemoCell(title: "debug") 91 | }) 92 | } 93 | } 94 | } 95 | } 96 | .title("SwiftUI-WRNavigationBar") 97 | .hiddenLine(false) 98 | .background(Color.blue) 99 | .backButtonHidden(true) 100 | } 101 | } 102 | } 103 | 104 | struct DemoCell: View { 105 | var title: String 106 | var body: some View { 107 | VStack(spacing: 0) { 108 | Text(title) 109 | .font(.title3) 110 | .foregroundColor(.black) 111 | .frame(height: 60) 112 | Divider() 113 | .frame(maxWidth: UIScreen.main.bounds.width) 114 | .padding(.leading, 15) 115 | } 116 | } 117 | } 118 | 119 | struct ContentView_Previews: PreviewProvider { 120 | static var previews: some View { 121 | ContentView() 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /Sources/WRNavigationBar.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WRNavigationBar.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/4/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct WRNavigationBar_Previews: PreviewProvider { 11 | static var previews: some View { 12 | WRNavigationBar { 13 | Text("test") 14 | } 15 | } 16 | } 17 | 18 | /// custom navigationBar 19 | public struct WRNavigationBar: View where Content: View { 20 | 21 | // The title of navigationBar (titleView default) 22 | private var title: String = "" 23 | 24 | // The titleView is default 25 | private var isDefaultTitleView: Bool = true 26 | 27 | // TitleView of navigationBar 28 | private var titleView: WRTitleView 29 | 30 | // The foreground of navigationBar 31 | private var foreground: Color = .black 32 | 33 | // Background of navigationBar 34 | private var background: WRBackgroundView 35 | 36 | // Hide the line at the bottom of the navigationBar 37 | private var hiddenLine: Bool = true 38 | 39 | // Has backButton of default on the navigationBar 40 | private var hasBackButton: Bool = true 41 | 42 | // Set backButton image name 43 | private var backButtonImageName: String? 44 | 45 | // Set backButton tapAction 46 | private var backButtonTapAction: WRBlock? = nil 47 | 48 | // Is backButton black style 49 | private var isBackButtonBlack: Bool = true 50 | 51 | // Is the content align with the top of the navigationBar 52 | private var ignoringTopArea: Bool = false 53 | 54 | // LeadingView of navigationBar 55 | private var leadingView: WRLeadingView 56 | 57 | // TrailingView of navigationBar 58 | private var trailingView: WRTrailingView 59 | 60 | // Max width of leadingView 61 | private var leadingMaxWidth: CGFloat = 80 62 | 63 | // Max width of trailingView 64 | private var trailingMaxWidth: CGFloat = 80 65 | 66 | // isDebug 67 | private var isDebug: Bool = false 68 | 69 | // Content view between navigationBar 70 | private let content: Content 71 | 72 | public var body: some View { 73 | ZStack(alignment: .top) { 74 | ZStack { 75 | Color.clear 76 | content 77 | } 78 | .padding(.top, ignoringTopArea ? 0 : WRHelper.NavigationBar.bottom) 79 | .frame(maxHeight: WRHelper.height) 80 | 81 | ZStack(alignment: .bottom) { 82 | HStack(alignment: .center, spacing: 0) { 83 | // leading 84 | HStack(spacing: 0) { 85 | if hasBackButton { 86 | WRDefaultBackButton(named: backButtonImageName, tapAction: backButtonTapAction, isBlack: isBackButtonBlack, foreground: foreground) 87 | } 88 | leadingView 89 | Spacer() 90 | } 91 | .padding(.leading, 15) 92 | .frame(maxWidth: leadingMaxWidth) 93 | .background(isDebug ? Color.red : Color.clear) 94 | 95 | // title 96 | titleView 97 | .frame(maxWidth: .infinity) 98 | .background(isDebug ? Color.green : Color.clear) 99 | 100 | // trailing 101 | HStack(spacing: 0) { 102 | Spacer() 103 | trailingView 104 | } 105 | .padding(.trailing, 15) 106 | .frame(maxWidth: trailingMaxWidth) 107 | .background(isDebug ? Color.red : Color.clear) 108 | } 109 | .frame(height: WRHelper.NavigationBar.height) 110 | .padding(.top, WRHelper.UnsafeArea.top) 111 | .foregroundColor(foreground) 112 | .background(background) 113 | .clipped() 114 | 115 | // line 116 | if !hiddenLine { 117 | Divider() 118 | .frame(maxWidth: .infinity) 119 | } 120 | } 121 | } 122 | .navigationBarHidden(true) 123 | .edgesIgnoringSafeArea(.all) 124 | } 125 | } 126 | 127 | extension WRNavigationBar { 128 | 129 | public init(@ViewBuilder content: () -> Content) { 130 | self.background = WRBackgroundView() 131 | self.titleView = WRTitleView() 132 | self.leadingView = WRLeadingView() 133 | self.trailingView = WRTrailingView() 134 | self.content = content() 135 | } 136 | 137 | /// The foreground of navigationBar 138 | public func foreground(_ foreground: Color) -> WRNavigationBar { 139 | var result = self 140 | result.foreground = foreground 141 | if isDefaultTitleView { 142 | result.titleView.content = AnyView(WRDefaultTitleView(title: self.title, foreground: foreground)) 143 | } 144 | return result 145 | } 146 | 147 | /// The title of navigationBar (titleView default) 148 | public func title(_ title: String) -> WRNavigationBar { 149 | var result = self 150 | result.title = title 151 | result.titleView.content = AnyView(WRDefaultTitleView(title: title, foreground: self.foreground)) 152 | return result 153 | } 154 | 155 | /// Is the line at the bottom of the navigationBar hidden 156 | public func hiddenLine(_ hidden: Bool) -> WRNavigationBar { 157 | var result = self 158 | result.hiddenLine = hidden 159 | return result 160 | } 161 | 162 | /// Set backButton image name 163 | public func backButtonImageName(_ named: String) 164 | -> WRNavigationBar { 165 | var result = self 166 | result.backButtonImageName = named 167 | return result 168 | } 169 | 170 | /// Is the backButton hidden 171 | public func backButtonHidden(_ hidden: Bool) 172 | -> WRNavigationBar { 173 | var result = self 174 | result.hasBackButton = !hidden 175 | return result 176 | } 177 | 178 | /// Is the backButton black style 179 | public func isBackButtonBlack(_ isBlack: Bool) -> WRNavigationBar { 180 | var result = self 181 | result.isBackButtonBlack = isBlack 182 | return result 183 | } 184 | 185 | /// Is the content align with the top of the navigationBar 186 | public func ignoringTopArea(_ ignore: Bool) -> WRNavigationBar { 187 | var result = self 188 | result.ignoringTopArea = ignore 189 | return result 190 | } 191 | 192 | /// Max width of leadingView and max width of trailingView 193 | public func maxWidth(leading: CGFloat = 80, trailing: CGFloat = 80) -> WRNavigationBar { 194 | var result = self 195 | result.leadingMaxWidth = leading 196 | result.trailingMaxWidth = trailing 197 | return result 198 | } 199 | 200 | /// background 201 | public func background(_ background: Background) 202 | -> WRNavigationBar where Background: View { 203 | var result = self 204 | result.background.content = AnyView(background) 205 | return result 206 | } 207 | 208 | /// backButton intercept( hasBackButton == true) 209 | public func backButtonTapAction(_ tapAction: @escaping WRBlock) 210 | -> WRNavigationBar { 211 | var result = self 212 | result.backButtonTapAction = tapAction 213 | return result 214 | } 215 | 216 | /// debug 217 | public func debug(_ debug: Bool) -> WRNavigationBar { 218 | var result = self 219 | #if DEBUG 220 | result.isDebug = debug 221 | #endif 222 | return result 223 | } 224 | 225 | /// titleView 226 | public func navigationBarTitleView(@ViewBuilder titleView: () -> Content) -> WRNavigationBar { 227 | let titleV = titleView() 228 | var result = self 229 | result.isDefaultTitleView = false 230 | result.titleView.content = AnyView(titleV) 231 | return result 232 | } 233 | 234 | /// navigationBarItems leading & trailing 235 | public func wrNavigationBarItems( 236 | @ViewBuilder leading: () -> Leading, 237 | @ViewBuilder trailing: () -> Trailing) 238 | -> some View { 239 | let vL = leading() 240 | let vT = trailing() 241 | var result = self 242 | result.leadingView.content = AnyView(vL) 243 | result.trailingView.content = AnyView(vT) 244 | return result 245 | } 246 | 247 | /// navigationBarItems leading 248 | public func wrNavigationBarItems(@ViewBuilder leading: () -> Content) -> some View { 249 | let v = leading() 250 | var result = self 251 | result.leadingView.content = AnyView(v) 252 | return result 253 | } 254 | 255 | /// navigationBarItems trailing 256 | public func wrNavigationBarItems(@ViewBuilder trailing: () -> Content) -> some View { 257 | let v = trailing() 258 | var result = self 259 | result.trailingView.content = AnyView(v) 260 | return result 261 | } 262 | } 263 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar/WRNavigationBar/WRNavigationBar.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WRNavigationBar.swift 3 | // SwiftUI-WRNavigationBar 4 | // 5 | // Created by wangrui460 on 2021/4/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct WRNavigationBar_Previews: PreviewProvider { 11 | static var previews: some View { 12 | WRNavigationBar { 13 | Text("test") 14 | } 15 | } 16 | } 17 | 18 | /// custom navigationBar 19 | public struct WRNavigationBar: View where Content: View { 20 | 21 | // The title of navigationBar (titleView default) 22 | private var title: String = "" 23 | 24 | // The titleView is default 25 | private var isDefaultTitleView: Bool = true 26 | 27 | // TitleView of navigationBar 28 | private var titleView: WRTitleView 29 | 30 | // The foreground of navigationBar 31 | private var foreground: Color = .black 32 | 33 | // Background of navigationBar 34 | private var background: WRBackgroundView 35 | 36 | // Hide the line at the bottom of the navigationBar 37 | private var hiddenLine: Bool = true 38 | 39 | // Has backButton of default on the navigationBar 40 | private var hasBackButton: Bool = true 41 | 42 | // Set backButton image name 43 | private var backButtonImageName: String? 44 | 45 | // Set backButton tapAction 46 | private var backButtonTapAction: WRBlock? = nil 47 | 48 | // Is backButton black style 49 | private var isBackButtonBlack: Bool = true 50 | 51 | // Is the content align with the top of the navigationBar 52 | private var ignoringTopArea: Bool = false 53 | 54 | // LeadingView of navigationBar 55 | private var leadingView: WRLeadingView 56 | 57 | // TrailingView of navigationBar 58 | private var trailingView: WRTrailingView 59 | 60 | // Max width of leadingView 61 | private var leadingMaxWidth: CGFloat = 80 62 | 63 | // Max width of trailingView 64 | private var trailingMaxWidth: CGFloat = 80 65 | 66 | // isDebug 67 | private var isDebug: Bool = false 68 | 69 | // Content view between navigationBar 70 | private let content: Content 71 | 72 | public var body: some View { 73 | ZStack(alignment: .top) { 74 | ZStack { 75 | Color.clear 76 | content 77 | } 78 | .padding(.top, ignoringTopArea ? 0 : WRHelper.NavigationBar.bottom) 79 | .frame(maxHeight: WRHelper.height) 80 | 81 | ZStack(alignment: .bottom) { 82 | HStack(alignment: .center, spacing: 0) { 83 | // leading 84 | HStack(spacing: 0) { 85 | if hasBackButton { 86 | WRDefaultBackButton(named: backButtonImageName, tapAction: backButtonTapAction, isBlack: isBackButtonBlack, foreground: foreground) 87 | } 88 | leadingView 89 | Spacer() 90 | } 91 | .padding(.leading, 15) 92 | .frame(maxWidth: leadingMaxWidth) 93 | .background(isDebug ? Color.red : Color.clear) 94 | 95 | // title 96 | titleView 97 | .frame(maxWidth: .infinity) 98 | .background(isDebug ? Color.green : Color.clear) 99 | 100 | // trailing 101 | HStack(spacing: 0) { 102 | Spacer() 103 | trailingView 104 | } 105 | .padding(.trailing, 15) 106 | .frame(maxWidth: trailingMaxWidth) 107 | .background(isDebug ? Color.red : Color.clear) 108 | } 109 | .frame(height: WRHelper.NavigationBar.height) 110 | .padding(.top, WRHelper.UnsafeArea.top) 111 | .foregroundColor(foreground) 112 | .background(background) 113 | .clipped() 114 | 115 | // line 116 | if !hiddenLine { 117 | Divider() 118 | .frame(maxWidth: .infinity) 119 | } 120 | } 121 | } 122 | .navigationBarHidden(true) 123 | .edgesIgnoringSafeArea(.all) 124 | } 125 | } 126 | 127 | extension WRNavigationBar { 128 | 129 | public init(@ViewBuilder content: () -> Content) { 130 | self.background = WRBackgroundView() 131 | self.titleView = WRTitleView() 132 | self.leadingView = WRLeadingView() 133 | self.trailingView = WRTrailingView() 134 | self.content = content() 135 | } 136 | 137 | /// The foreground of navigationBar 138 | public func foreground(_ foreground: Color) -> WRNavigationBar { 139 | var result = self 140 | result.foreground = foreground 141 | if isDefaultTitleView { 142 | result.titleView.content = AnyView(WRDefaultTitleView(title: self.title, foreground: foreground)) 143 | } 144 | return result 145 | } 146 | 147 | /// The title of navigationBar (titleView default) 148 | public func title(_ title: String) -> WRNavigationBar { 149 | var result = self 150 | result.title = title 151 | result.titleView.content = AnyView(WRDefaultTitleView(title: title, foreground: self.foreground)) 152 | return result 153 | } 154 | 155 | /// Is the line at the bottom of the navigationBar hidden 156 | public func hiddenLine(_ hidden: Bool) -> WRNavigationBar { 157 | var result = self 158 | result.hiddenLine = hidden 159 | return result 160 | } 161 | 162 | /// Set backButton image name 163 | public func backButtonImageName(_ named: String) 164 | -> WRNavigationBar { 165 | var result = self 166 | result.backButtonImageName = named 167 | return result 168 | } 169 | 170 | /// Is the backButton hidden 171 | public func backButtonHidden(_ hidden: Bool) 172 | -> WRNavigationBar { 173 | var result = self 174 | result.hasBackButton = !hidden 175 | return result 176 | } 177 | 178 | /// Is the backButton black style 179 | public func isBackButtonBlack(_ isBlack: Bool) -> WRNavigationBar { 180 | var result = self 181 | result.isBackButtonBlack = isBlack 182 | return result 183 | } 184 | 185 | /// Is the content align with the top of the navigationBar 186 | public func ignoringTopArea(_ ignore: Bool) -> WRNavigationBar { 187 | var result = self 188 | result.ignoringTopArea = ignore 189 | return result 190 | } 191 | 192 | /// Max width of leadingView and max width of trailingView 193 | public func maxWidth(leading: CGFloat = 80, trailing: CGFloat = 80) -> WRNavigationBar { 194 | var result = self 195 | result.leadingMaxWidth = leading 196 | result.trailingMaxWidth = trailing 197 | return result 198 | } 199 | 200 | /// background 201 | public func background(_ background: Background) 202 | -> WRNavigationBar where Background: View { 203 | var result = self 204 | result.background.content = AnyView(background) 205 | return result 206 | } 207 | 208 | /// backButton intercept( hasBackButton == true) 209 | public func backButtonTapAction(_ tapAction: @escaping WRBlock) 210 | -> WRNavigationBar { 211 | var result = self 212 | result.backButtonTapAction = tapAction 213 | return result 214 | } 215 | 216 | /// debug 217 | public func debug(_ debug: Bool) -> WRNavigationBar { 218 | var result = self 219 | #if DEBUG 220 | result.isDebug = debug 221 | #endif 222 | return result 223 | } 224 | 225 | /// titleView 226 | public func navigationBarTitleView(@ViewBuilder titleView: () -> Content) -> WRNavigationBar { 227 | let titleV = titleView() 228 | var result = self 229 | result.isDefaultTitleView = false 230 | result.titleView.content = AnyView(titleV) 231 | return result 232 | } 233 | 234 | /// navigationBarItems leading & trailing 235 | public func wrNavigationBarItems( 236 | @ViewBuilder leading: () -> Leading, 237 | @ViewBuilder trailing: () -> Trailing) 238 | -> some View { 239 | let vL = leading() 240 | let vT = trailing() 241 | var result = self 242 | result.leadingView.content = AnyView(vL) 243 | result.trailingView.content = AnyView(vT) 244 | return result 245 | } 246 | 247 | /// navigationBarItems leading 248 | public func wrNavigationBarItems(@ViewBuilder leading: () -> Content) -> some View { 249 | let v = leading() 250 | var result = self 251 | result.leadingView.content = AnyView(v) 252 | return result 253 | } 254 | 255 | /// navigationBarItems trailing 256 | public func wrNavigationBarItems(@ViewBuilder trailing: () -> Content) -> some View { 257 | let v = trailing() 258 | var result = self 259 | result.trailingView.content = AnyView(v) 260 | return result 261 | } 262 | } 263 | -------------------------------------------------------------------------------- /SwiftUI-WRNavigationBar/SwiftUI-WRNavigationBar.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1A91306B265154CC007608DE /* WRNavigationBar.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 1A91306A265154CC007608DE /* WRNavigationBar.bundle */; }; 11 | 1A91307226515E43007608DE /* Bundle+WRNavigationBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A91307126515E43007608DE /* Bundle+WRNavigationBar.swift */; }; 12 | 1A91307726516348007608DE /* SetBackButtonImageViewName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A91307626516348007608DE /* SetBackButtonImageViewName.swift */; }; 13 | 1AA41AE6264FBFC200F286C2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41AE5264FBFC200F286C2 /* AppDelegate.swift */; }; 14 | 1AA41AE8264FBFC200F286C2 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41AE7264FBFC200F286C2 /* SceneDelegate.swift */; }; 15 | 1AA41AEA264FBFC200F286C2 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41AE9264FBFC200F286C2 /* ContentView.swift */; }; 16 | 1AA41AEC264FBFC500F286C2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1AA41AEB264FBFC500F286C2 /* Assets.xcassets */; }; 17 | 1AA41AEF264FBFC500F286C2 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1AA41AEE264FBFC500F286C2 /* Preview Assets.xcassets */; }; 18 | 1AA41AF2264FBFC500F286C2 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1AA41AF0264FBFC500F286C2 /* LaunchScreen.storyboard */; }; 19 | 1AA41AFD264FC0CF00F286C2 /* WRDefaultTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41AFB264FC0CF00F286C2 /* WRDefaultTitleView.swift */; }; 20 | 1AA41AFE264FC0CF00F286C2 /* WRNavigationBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41AFC264FC0CF00F286C2 /* WRNavigationBar.swift */; }; 21 | 1AA41B01264FC0D700F286C2 /* WRDefaultBackButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41B00264FC0D700F286C2 /* WRDefaultBackButton.swift */; }; 22 | 1AA41B06264FC1F700F286C2 /* WRHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41B05264FC1F700F286C2 /* WRHelper.swift */; }; 23 | 1AA41B09264FC2A200F286C2 /* WRLeadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41B08264FC2A200F286C2 /* WRLeadingView.swift */; }; 24 | 1AA41B0C264FC2DD00F286C2 /* WRTrailingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41B0B264FC2DD00F286C2 /* WRTrailingView.swift */; }; 25 | 1AA41B0F264FC38B00F286C2 /* WRTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41B0E264FC38B00F286C2 /* WRTitleView.swift */; }; 26 | 1AA41B13264FC48800F286C2 /* WRBackgroundView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41B12264FC48800F286C2 /* WRBackgroundView.swift */; }; 27 | 1AA41B1B265017C100F286C2 /* LeadingAndTrailingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41B1A265017C100F286C2 /* LeadingAndTrailingView.swift */; }; 28 | 1AA41B1E2650198B00F286C2 /* UINavigationController+Ex.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41B1D2650198B00F286C2 /* UINavigationController+Ex.swift */; }; 29 | 1AA41B2126501ABB00F286C2 /* ForegroundView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41B2026501ABB00F286C2 /* ForegroundView.swift */; }; 30 | 1AA41B2426501B6C00F286C2 /* BackButtonTapActionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41B2326501B6C00F286C2 /* BackButtonTapActionView.swift */; }; 31 | 1AA41B2726501BAF00F286C2 /* HiddenBottomLineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41B2626501BAF00F286C2 /* HiddenBottomLineView.swift */; }; 32 | 1AA41B2B2650202200F286C2 /* IgnoreTopAreaView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41B2A2650202200F286C2 /* IgnoreTopAreaView.swift */; }; 33 | 1AA41B3326502A5300F286C2 /* BackgroundView1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41B3226502A5300F286C2 /* BackgroundView1.swift */; }; 34 | 1AA41B3626502C9900F286C2 /* BackgroundView2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41B3526502C9900F286C2 /* BackgroundView2.swift */; }; 35 | 1AA41B3926502DCB00F286C2 /* BackgroundView3.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41B3826502DCB00F286C2 /* BackgroundView3.swift */; }; 36 | 1AA41B3C2650350100F286C2 /* TitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41B3B2650350100F286C2 /* TitleView.swift */; }; 37 | 1AA41B3F2650363A00F286C2 /* TitleSearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41B3E2650363A00F286C2 /* TitleSearchView.swift */; }; 38 | 1AA41B4326503C5100F286C2 /* DebugView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA41B4226503C5100F286C2 /* DebugView.swift */; }; 39 | /* End PBXBuildFile section */ 40 | 41 | /* Begin PBXFileReference section */ 42 | 1A91306A265154CC007608DE /* WRNavigationBar.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = WRNavigationBar.bundle; sourceTree = ""; }; 43 | 1A91307126515E43007608DE /* Bundle+WRNavigationBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Bundle+WRNavigationBar.swift"; sourceTree = ""; }; 44 | 1A91307626516348007608DE /* SetBackButtonImageViewName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SetBackButtonImageViewName.swift; sourceTree = ""; }; 45 | 1AA41AE2264FBFC200F286C2 /* SwiftUI-WRNavigationBar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "SwiftUI-WRNavigationBar.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 1AA41AE5264FBFC200F286C2 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 47 | 1AA41AE7264FBFC200F286C2 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 48 | 1AA41AE9264FBFC200F286C2 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 49 | 1AA41AEB264FBFC500F286C2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 50 | 1AA41AEE264FBFC500F286C2 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 51 | 1AA41AF1264FBFC500F286C2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 52 | 1AA41AF3264FBFC500F286C2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | 1AA41AFB264FC0CF00F286C2 /* WRDefaultTitleView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WRDefaultTitleView.swift; sourceTree = ""; }; 54 | 1AA41AFC264FC0CF00F286C2 /* WRNavigationBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WRNavigationBar.swift; sourceTree = ""; }; 55 | 1AA41B00264FC0D700F286C2 /* WRDefaultBackButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WRDefaultBackButton.swift; sourceTree = ""; }; 56 | 1AA41B05264FC1F700F286C2 /* WRHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WRHelper.swift; sourceTree = ""; }; 57 | 1AA41B08264FC2A200F286C2 /* WRLeadingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WRLeadingView.swift; sourceTree = ""; }; 58 | 1AA41B0B264FC2DD00F286C2 /* WRTrailingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WRTrailingView.swift; sourceTree = ""; }; 59 | 1AA41B0E264FC38B00F286C2 /* WRTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WRTitleView.swift; sourceTree = ""; }; 60 | 1AA41B12264FC48800F286C2 /* WRBackgroundView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WRBackgroundView.swift; sourceTree = ""; }; 61 | 1AA41B1A265017C100F286C2 /* LeadingAndTrailingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeadingAndTrailingView.swift; sourceTree = ""; }; 62 | 1AA41B1D2650198B00F286C2 /* UINavigationController+Ex.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UINavigationController+Ex.swift"; sourceTree = ""; }; 63 | 1AA41B2026501ABB00F286C2 /* ForegroundView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForegroundView.swift; sourceTree = ""; }; 64 | 1AA41B2326501B6C00F286C2 /* BackButtonTapActionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackButtonTapActionView.swift; sourceTree = ""; }; 65 | 1AA41B2626501BAF00F286C2 /* HiddenBottomLineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HiddenBottomLineView.swift; sourceTree = ""; }; 66 | 1AA41B2A2650202200F286C2 /* IgnoreTopAreaView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IgnoreTopAreaView.swift; sourceTree = ""; }; 67 | 1AA41B3226502A5300F286C2 /* BackgroundView1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundView1.swift; sourceTree = ""; }; 68 | 1AA41B3526502C9900F286C2 /* BackgroundView2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundView2.swift; sourceTree = ""; }; 69 | 1AA41B3826502DCB00F286C2 /* BackgroundView3.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundView3.swift; sourceTree = ""; }; 70 | 1AA41B3B2650350100F286C2 /* TitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TitleView.swift; sourceTree = ""; }; 71 | 1AA41B3E2650363A00F286C2 /* TitleSearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TitleSearchView.swift; sourceTree = ""; }; 72 | 1AA41B4226503C5100F286C2 /* DebugView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebugView.swift; sourceTree = ""; }; 73 | /* End PBXFileReference section */ 74 | 75 | /* Begin PBXFrameworksBuildPhase section */ 76 | 1AA41ADF264FBFC200F286C2 /* Frameworks */ = { 77 | isa = PBXFrameworksBuildPhase; 78 | buildActionMask = 2147483647; 79 | files = ( 80 | ); 81 | runOnlyForDeploymentPostprocessing = 0; 82 | }; 83 | /* End PBXFrameworksBuildPhase section */ 84 | 85 | /* Begin PBXGroup section */ 86 | 1AA41AD9264FBFC200F286C2 = { 87 | isa = PBXGroup; 88 | children = ( 89 | 1AA41AE4264FBFC200F286C2 /* SwiftUI-WRNavigationBar */, 90 | 1AA41AE3264FBFC200F286C2 /* Products */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | 1AA41AE3264FBFC200F286C2 /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 1AA41AE2264FBFC200F286C2 /* SwiftUI-WRNavigationBar.app */, 98 | ); 99 | name = Products; 100 | sourceTree = ""; 101 | }; 102 | 1AA41AE4264FBFC200F286C2 /* SwiftUI-WRNavigationBar */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 1AA41AE9264FBFC200F286C2 /* ContentView.swift */, 106 | 1AA41B18264FEFA200F286C2 /* Demo */, 107 | 1AA41AFA264FBFDE00F286C2 /* WRNavigationBar */, 108 | 1AA41B1D2650198B00F286C2 /* UINavigationController+Ex.swift */, 109 | 1AA41AE5264FBFC200F286C2 /* AppDelegate.swift */, 110 | 1AA41AE7264FBFC200F286C2 /* SceneDelegate.swift */, 111 | 1AA41AEB264FBFC500F286C2 /* Assets.xcassets */, 112 | 1AA41AF0264FBFC500F286C2 /* LaunchScreen.storyboard */, 113 | 1AA41AF3264FBFC500F286C2 /* Info.plist */, 114 | 1AA41AED264FBFC500F286C2 /* Preview Content */, 115 | ); 116 | path = "SwiftUI-WRNavigationBar"; 117 | sourceTree = ""; 118 | }; 119 | 1AA41AED264FBFC500F286C2 /* Preview Content */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 1AA41AEE264FBFC500F286C2 /* Preview Assets.xcassets */, 123 | ); 124 | path = "Preview Content"; 125 | sourceTree = ""; 126 | }; 127 | 1AA41AFA264FBFDE00F286C2 /* WRNavigationBar */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | 1A91306A265154CC007608DE /* WRNavigationBar.bundle */, 131 | 1AA41B05264FC1F700F286C2 /* WRHelper.swift */, 132 | 1AA41B00264FC0D700F286C2 /* WRDefaultBackButton.swift */, 133 | 1AA41AFC264FC0CF00F286C2 /* WRNavigationBar.swift */, 134 | 1AA41B08264FC2A200F286C2 /* WRLeadingView.swift */, 135 | 1AA41B0B264FC2DD00F286C2 /* WRTrailingView.swift */, 136 | 1AA41B0E264FC38B00F286C2 /* WRTitleView.swift */, 137 | 1AA41B12264FC48800F286C2 /* WRBackgroundView.swift */, 138 | 1AA41AFB264FC0CF00F286C2 /* WRDefaultTitleView.swift */, 139 | 1A91307126515E43007608DE /* Bundle+WRNavigationBar.swift */, 140 | ); 141 | path = WRNavigationBar; 142 | sourceTree = ""; 143 | }; 144 | 1AA41B18264FEFA200F286C2 /* Demo */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | 1AA41B1A265017C100F286C2 /* LeadingAndTrailingView.swift */, 148 | 1AA41B2026501ABB00F286C2 /* ForegroundView.swift */, 149 | 1AA41B2326501B6C00F286C2 /* BackButtonTapActionView.swift */, 150 | 1AA41B2626501BAF00F286C2 /* HiddenBottomLineView.swift */, 151 | 1AA41B2A2650202200F286C2 /* IgnoreTopAreaView.swift */, 152 | 1AA41B3226502A5300F286C2 /* BackgroundView1.swift */, 153 | 1AA41B3526502C9900F286C2 /* BackgroundView2.swift */, 154 | 1AA41B3826502DCB00F286C2 /* BackgroundView3.swift */, 155 | 1AA41B3B2650350100F286C2 /* TitleView.swift */, 156 | 1AA41B3E2650363A00F286C2 /* TitleSearchView.swift */, 157 | 1AA41B4226503C5100F286C2 /* DebugView.swift */, 158 | 1A91307626516348007608DE /* SetBackButtonImageViewName.swift */, 159 | ); 160 | path = Demo; 161 | sourceTree = ""; 162 | }; 163 | /* End PBXGroup section */ 164 | 165 | /* Begin PBXNativeTarget section */ 166 | 1AA41AE1264FBFC200F286C2 /* SwiftUI-WRNavigationBar */ = { 167 | isa = PBXNativeTarget; 168 | buildConfigurationList = 1AA41AF6264FBFC500F286C2 /* Build configuration list for PBXNativeTarget "SwiftUI-WRNavigationBar" */; 169 | buildPhases = ( 170 | 1AA41ADE264FBFC200F286C2 /* Sources */, 171 | 1AA41ADF264FBFC200F286C2 /* Frameworks */, 172 | 1AA41AE0264FBFC200F286C2 /* Resources */, 173 | ); 174 | buildRules = ( 175 | ); 176 | dependencies = ( 177 | ); 178 | name = "SwiftUI-WRNavigationBar"; 179 | productName = "SwiftUI-WRNavigationBar"; 180 | productReference = 1AA41AE2264FBFC200F286C2 /* SwiftUI-WRNavigationBar.app */; 181 | productType = "com.apple.product-type.application"; 182 | }; 183 | /* End PBXNativeTarget section */ 184 | 185 | /* Begin PBXProject section */ 186 | 1AA41ADA264FBFC200F286C2 /* Project object */ = { 187 | isa = PBXProject; 188 | attributes = { 189 | LastSwiftUpdateCheck = 1240; 190 | LastUpgradeCheck = 1240; 191 | TargetAttributes = { 192 | 1AA41AE1264FBFC200F286C2 = { 193 | CreatedOnToolsVersion = 12.4; 194 | }; 195 | }; 196 | }; 197 | buildConfigurationList = 1AA41ADD264FBFC200F286C2 /* Build configuration list for PBXProject "SwiftUI-WRNavigationBar" */; 198 | compatibilityVersion = "Xcode 9.3"; 199 | developmentRegion = en; 200 | hasScannedForEncodings = 0; 201 | knownRegions = ( 202 | en, 203 | Base, 204 | ); 205 | mainGroup = 1AA41AD9264FBFC200F286C2; 206 | productRefGroup = 1AA41AE3264FBFC200F286C2 /* Products */; 207 | projectDirPath = ""; 208 | projectRoot = ""; 209 | targets = ( 210 | 1AA41AE1264FBFC200F286C2 /* SwiftUI-WRNavigationBar */, 211 | ); 212 | }; 213 | /* End PBXProject section */ 214 | 215 | /* Begin PBXResourcesBuildPhase section */ 216 | 1AA41AE0264FBFC200F286C2 /* Resources */ = { 217 | isa = PBXResourcesBuildPhase; 218 | buildActionMask = 2147483647; 219 | files = ( 220 | 1A91306B265154CC007608DE /* WRNavigationBar.bundle in Resources */, 221 | 1AA41AF2264FBFC500F286C2 /* LaunchScreen.storyboard in Resources */, 222 | 1AA41AEF264FBFC500F286C2 /* Preview Assets.xcassets in Resources */, 223 | 1AA41AEC264FBFC500F286C2 /* Assets.xcassets in Resources */, 224 | ); 225 | runOnlyForDeploymentPostprocessing = 0; 226 | }; 227 | /* End PBXResourcesBuildPhase section */ 228 | 229 | /* Begin PBXSourcesBuildPhase section */ 230 | 1AA41ADE264FBFC200F286C2 /* Sources */ = { 231 | isa = PBXSourcesBuildPhase; 232 | buildActionMask = 2147483647; 233 | files = ( 234 | 1AA41B06264FC1F700F286C2 /* WRHelper.swift in Sources */, 235 | 1AA41B0C264FC2DD00F286C2 /* WRTrailingView.swift in Sources */, 236 | 1A91307226515E43007608DE /* Bundle+WRNavigationBar.swift in Sources */, 237 | 1AA41AFD264FC0CF00F286C2 /* WRDefaultTitleView.swift in Sources */, 238 | 1AA41AE6264FBFC200F286C2 /* AppDelegate.swift in Sources */, 239 | 1AA41AE8264FBFC200F286C2 /* SceneDelegate.swift in Sources */, 240 | 1AA41B3626502C9900F286C2 /* BackgroundView2.swift in Sources */, 241 | 1AA41AEA264FBFC200F286C2 /* ContentView.swift in Sources */, 242 | 1AA41AFE264FC0CF00F286C2 /* WRNavigationBar.swift in Sources */, 243 | 1AA41B2426501B6C00F286C2 /* BackButtonTapActionView.swift in Sources */, 244 | 1AA41B2B2650202200F286C2 /* IgnoreTopAreaView.swift in Sources */, 245 | 1AA41B09264FC2A200F286C2 /* WRLeadingView.swift in Sources */, 246 | 1A91307726516348007608DE /* SetBackButtonImageViewName.swift in Sources */, 247 | 1AA41B13264FC48800F286C2 /* WRBackgroundView.swift in Sources */, 248 | 1AA41B2726501BAF00F286C2 /* HiddenBottomLineView.swift in Sources */, 249 | 1AA41B4326503C5100F286C2 /* DebugView.swift in Sources */, 250 | 1AA41B1E2650198B00F286C2 /* UINavigationController+Ex.swift in Sources */, 251 | 1AA41B3926502DCB00F286C2 /* BackgroundView3.swift in Sources */, 252 | 1AA41B0F264FC38B00F286C2 /* WRTitleView.swift in Sources */, 253 | 1AA41B3326502A5300F286C2 /* BackgroundView1.swift in Sources */, 254 | 1AA41B3C2650350100F286C2 /* TitleView.swift in Sources */, 255 | 1AA41B3F2650363A00F286C2 /* TitleSearchView.swift in Sources */, 256 | 1AA41B01264FC0D700F286C2 /* WRDefaultBackButton.swift in Sources */, 257 | 1AA41B1B265017C100F286C2 /* LeadingAndTrailingView.swift in Sources */, 258 | 1AA41B2126501ABB00F286C2 /* ForegroundView.swift in Sources */, 259 | ); 260 | runOnlyForDeploymentPostprocessing = 0; 261 | }; 262 | /* End PBXSourcesBuildPhase section */ 263 | 264 | /* Begin PBXVariantGroup section */ 265 | 1AA41AF0264FBFC500F286C2 /* LaunchScreen.storyboard */ = { 266 | isa = PBXVariantGroup; 267 | children = ( 268 | 1AA41AF1264FBFC500F286C2 /* Base */, 269 | ); 270 | name = LaunchScreen.storyboard; 271 | sourceTree = ""; 272 | }; 273 | /* End PBXVariantGroup section */ 274 | 275 | /* Begin XCBuildConfiguration section */ 276 | 1AA41AF4264FBFC500F286C2 /* Debug */ = { 277 | isa = XCBuildConfiguration; 278 | buildSettings = { 279 | ALWAYS_SEARCH_USER_PATHS = NO; 280 | CLANG_ANALYZER_NONNULL = YES; 281 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 282 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 283 | CLANG_CXX_LIBRARY = "libc++"; 284 | CLANG_ENABLE_MODULES = YES; 285 | CLANG_ENABLE_OBJC_ARC = YES; 286 | CLANG_ENABLE_OBJC_WEAK = YES; 287 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 288 | CLANG_WARN_BOOL_CONVERSION = YES; 289 | CLANG_WARN_COMMA = YES; 290 | CLANG_WARN_CONSTANT_CONVERSION = YES; 291 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 292 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 293 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 294 | CLANG_WARN_EMPTY_BODY = YES; 295 | CLANG_WARN_ENUM_CONVERSION = YES; 296 | CLANG_WARN_INFINITE_RECURSION = YES; 297 | CLANG_WARN_INT_CONVERSION = YES; 298 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 299 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 300 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 301 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 302 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 303 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 304 | CLANG_WARN_STRICT_PROTOTYPES = YES; 305 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 306 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 307 | CLANG_WARN_UNREACHABLE_CODE = YES; 308 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 309 | COPY_PHASE_STRIP = NO; 310 | DEBUG_INFORMATION_FORMAT = dwarf; 311 | ENABLE_STRICT_OBJC_MSGSEND = YES; 312 | ENABLE_TESTABILITY = YES; 313 | GCC_C_LANGUAGE_STANDARD = gnu11; 314 | GCC_DYNAMIC_NO_PIC = NO; 315 | GCC_NO_COMMON_BLOCKS = YES; 316 | GCC_OPTIMIZATION_LEVEL = 0; 317 | GCC_PREPROCESSOR_DEFINITIONS = ( 318 | "DEBUG=1", 319 | "$(inherited)", 320 | ); 321 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 322 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 323 | GCC_WARN_UNDECLARED_SELECTOR = YES; 324 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 325 | GCC_WARN_UNUSED_FUNCTION = YES; 326 | GCC_WARN_UNUSED_VARIABLE = YES; 327 | IPHONEOS_DEPLOYMENT_TARGET = 14.4; 328 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 329 | MTL_FAST_MATH = YES; 330 | ONLY_ACTIVE_ARCH = YES; 331 | SDKROOT = iphoneos; 332 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 333 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 334 | }; 335 | name = Debug; 336 | }; 337 | 1AA41AF5264FBFC500F286C2 /* Release */ = { 338 | isa = XCBuildConfiguration; 339 | buildSettings = { 340 | ALWAYS_SEARCH_USER_PATHS = NO; 341 | CLANG_ANALYZER_NONNULL = YES; 342 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 343 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 344 | CLANG_CXX_LIBRARY = "libc++"; 345 | CLANG_ENABLE_MODULES = YES; 346 | CLANG_ENABLE_OBJC_ARC = YES; 347 | CLANG_ENABLE_OBJC_WEAK = YES; 348 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 349 | CLANG_WARN_BOOL_CONVERSION = YES; 350 | CLANG_WARN_COMMA = YES; 351 | CLANG_WARN_CONSTANT_CONVERSION = YES; 352 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 353 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 354 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 355 | CLANG_WARN_EMPTY_BODY = YES; 356 | CLANG_WARN_ENUM_CONVERSION = YES; 357 | CLANG_WARN_INFINITE_RECURSION = YES; 358 | CLANG_WARN_INT_CONVERSION = YES; 359 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 360 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 361 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 362 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 363 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 364 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 365 | CLANG_WARN_STRICT_PROTOTYPES = YES; 366 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 367 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 368 | CLANG_WARN_UNREACHABLE_CODE = YES; 369 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 370 | COPY_PHASE_STRIP = NO; 371 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 372 | ENABLE_NS_ASSERTIONS = NO; 373 | ENABLE_STRICT_OBJC_MSGSEND = YES; 374 | GCC_C_LANGUAGE_STANDARD = gnu11; 375 | GCC_NO_COMMON_BLOCKS = YES; 376 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 377 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 378 | GCC_WARN_UNDECLARED_SELECTOR = YES; 379 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 380 | GCC_WARN_UNUSED_FUNCTION = YES; 381 | GCC_WARN_UNUSED_VARIABLE = YES; 382 | IPHONEOS_DEPLOYMENT_TARGET = 14.4; 383 | MTL_ENABLE_DEBUG_INFO = NO; 384 | MTL_FAST_MATH = YES; 385 | SDKROOT = iphoneos; 386 | SWIFT_COMPILATION_MODE = wholemodule; 387 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 388 | VALIDATE_PRODUCT = YES; 389 | }; 390 | name = Release; 391 | }; 392 | 1AA41AF7264FBFC500F286C2 /* Debug */ = { 393 | isa = XCBuildConfiguration; 394 | buildSettings = { 395 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 396 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 397 | CODE_SIGN_STYLE = Automatic; 398 | DEVELOPMENT_ASSET_PATHS = "\"SwiftUI-WRNavigationBar/Preview Content\""; 399 | ENABLE_PREVIEWS = YES; 400 | INFOPLIST_FILE = "SwiftUI-WRNavigationBar/Info.plist"; 401 | LD_RUNPATH_SEARCH_PATHS = ( 402 | "$(inherited)", 403 | "@executable_path/Frameworks", 404 | ); 405 | PRODUCT_BUNDLE_IDENTIFIER = "com.wangrui.test.SwiftUI-WRNavigationBar"; 406 | PRODUCT_NAME = "$(TARGET_NAME)"; 407 | SWIFT_VERSION = 5.0; 408 | TARGETED_DEVICE_FAMILY = "1,2"; 409 | }; 410 | name = Debug; 411 | }; 412 | 1AA41AF8264FBFC500F286C2 /* Release */ = { 413 | isa = XCBuildConfiguration; 414 | buildSettings = { 415 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 416 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 417 | CODE_SIGN_STYLE = Automatic; 418 | DEVELOPMENT_ASSET_PATHS = "\"SwiftUI-WRNavigationBar/Preview Content\""; 419 | ENABLE_PREVIEWS = YES; 420 | INFOPLIST_FILE = "SwiftUI-WRNavigationBar/Info.plist"; 421 | LD_RUNPATH_SEARCH_PATHS = ( 422 | "$(inherited)", 423 | "@executable_path/Frameworks", 424 | ); 425 | PRODUCT_BUNDLE_IDENTIFIER = "com.wangrui.test.SwiftUI-WRNavigationBar"; 426 | PRODUCT_NAME = "$(TARGET_NAME)"; 427 | SWIFT_VERSION = 5.0; 428 | TARGETED_DEVICE_FAMILY = "1,2"; 429 | }; 430 | name = Release; 431 | }; 432 | /* End XCBuildConfiguration section */ 433 | 434 | /* Begin XCConfigurationList section */ 435 | 1AA41ADD264FBFC200F286C2 /* Build configuration list for PBXProject "SwiftUI-WRNavigationBar" */ = { 436 | isa = XCConfigurationList; 437 | buildConfigurations = ( 438 | 1AA41AF4264FBFC500F286C2 /* Debug */, 439 | 1AA41AF5264FBFC500F286C2 /* Release */, 440 | ); 441 | defaultConfigurationIsVisible = 0; 442 | defaultConfigurationName = Release; 443 | }; 444 | 1AA41AF6264FBFC500F286C2 /* Build configuration list for PBXNativeTarget "SwiftUI-WRNavigationBar" */ = { 445 | isa = XCConfigurationList; 446 | buildConfigurations = ( 447 | 1AA41AF7264FBFC500F286C2 /* Debug */, 448 | 1AA41AF8264FBFC500F286C2 /* Release */, 449 | ); 450 | defaultConfigurationIsVisible = 0; 451 | defaultConfigurationName = Release; 452 | }; 453 | /* End XCConfigurationList section */ 454 | }; 455 | rootObject = 1AA41ADA264FBFC200F286C2 /* Project object */; 456 | } 457 | --------------------------------------------------------------------------------