Swiftpack.co - haifengkao/SwiftUI-Navigation-Bar-Color as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by haifengkao.
haifengkao/SwiftUI-Navigation-Bar-Color 0.10.0
Change SwiftUI Navigation Bar Color for different View
⭐️ 25
🕓 2 years ago
iOS macOS
.package(url: "https://github.com/haifengkao/SwiftUI-Navigation-Bar-Color.git", from: "0.10.0")

SwiftUINavigationBarColor

Version License Platform

Change SwiftUI NavigationBar background color per screen.

NavigationColorBar

Usage

For NavigationBarColor to work, you have to set the NavigationBar's background to be transparent. If you want to change the navigation bar's text color, you have to set it here as well.

import SwiftUINavigationBarColor
...

NavigationView {
    VStack {
        Text("Hello, world!").padding()
    }
}.navigationTransparentBar(tintColor: .white) // mandatory

After that, we can set the NavigationBar's background for each screen.

VStack {
    Text("Hello, Red!").padding()
}.navigationBarBackground {
    Color.red.shadow(radius: 1) // don't forget the shadow under the opaque navigation bar
}

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

ios 14

Installation

NavigationBarColor is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'NavigationBarColor'

Author

Hai Feng Kao, [email protected]

License

NavigationBarColor is available under the MIT license. See the LICENSE file for more info.

GitHub

link
Stars: 25
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Dependencies

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics