NavX

1.0.2

mkaulfers/NavX

What's New

v1.0.1

2023-08-30T02:02:10Z

NavX Release Notes - v1.0.2 (Made a snafu with readme, don't judge.)

🚀 Introduction

We're thrilled to announce the first official release of NavX! After extensive development and testing, NavX v1.0.0 is ready for public use. This release lays the foundation of the NavX ecosystem, offering developers a robust solution for their navigation needs.

🌟 Features

  • PageX Integration: Easily define any view as a PageXItem for seamless navigation.
  • Dynamic Navigation Bar: Customize the look and feel of the navigation bar to match your application's aesthetic.
  • Safe Area Management: Intuitive safe area management to ensure content always looks its best.
  • SwiftUI Compatibility: Designed to work flawlessly with SwiftUI.

🐛 Bug Fixes

  • Addressed layout issues when integrating with certain SwiftUI components.
  • Fixed occasional crashes when rapidly switching between tabs.

📘 Documentation

  • Comprehensive README to guide users on integrating and leveraging NavX in their projects.
  • Contributing guidelines for developers interested in contributing to the project's future development.

💬 Final Words

This release is just the beginning! We're looking forward to building upon this foundation and continuously enhancing NavX. Feedback and contributions from the community are invaluable, and we eagerly await your insights.

For any commercial usage or further inquiries, please reach out to matt@getnovara.com.

Thank you for supporting NavX!

NavX

Version SwiftUI iOS Minimum iOS version

An intuitive SwiftUI navigation framework designed to simplify the integration and management of custom navigation patterns. With the power of PageXItem and dynamic navigation bars, NavX offers developers a fluid and customizable navigation experience, seamlessly bridging design and functionality in modern iOS applications.

Table of Contents

"Buy Me A Coffee"

Installation

Swift Package Manager

In Xcode, navigate to your project's settings Select the "Swift Packages" tab Click the "+" icon to add a new package Paste the repository URL (https://github.com/mkaulfers/NavX.git) and click "Next" For the version rule, select "Up to Next Major" and specify 1.0.0 as the minimum version, then click "Next" Choose the target where you want to use the package, and then click "Finish"

Alternatively, you can add the package directly via Xcode:

You can use The Swift Package Manager to install [NavX] by adding the proper description to your Package.swift file:

// swift-tools-version:5.2
import PackageDescription

let package = Package(
    name: "YOUR_PROJECT_NAME",
    dependencies: [
        .package(url: "https://github.com/YOUR_GITHUB_USERNAME/YourPackageName.git", from: "1.0.0")
    ],
    targets: [
        .target(name: "YOUR_TARGET_NAME", dependencies: ["YourPackageName"])
    ]
)

Replace YOUR_PROJECT_NAME, YOUR_GITHUB_USERNAME, YourPackageName, and YOUR_TARGET_NAME with appropriate values for your project.

Features

NavX View

The primary navigation view that manages and displays a series of PageXItem views. Key features include:

NavX(selecedIndex: $selectedIndex) {...}
    .barAlignment(.center)
    .barX { bar in ... }
    .respectedBarSafeAreas(.all)
    .ignoredPageSafeAreas(.all)
    .pageScrollIndicator(.always)
  • barAlignment(_ value: Alignment): Aligns the navigation bar.
  • barX(_ newView: @escaping (any View) -> any View): Modify the tab bar view.
  • respectedBarSafeAreas(_ value: Edge.Set): Add spacing between the bottom of the TabBar and the top of the PageView.
  • ignoredPageSafeAreas(_ value: Edge.Set): Ignore specific safe areas, causing content to overlay the navigation stack and safe area.
  • pageScrollIndicator(_ value: ScrollIndicatorVisibility): Configure scroll bar visibility.

PageX View

A concrete implementation of the PageXItem protocol, which represents an individual page item within the NavX navigation system. It provides several chaining methods to customize. This should contain your page content.

NavX { ...
    PageX { ... }
    .iconX("house")
    .titleX("Home")
    .foregroundColorX(.black)
    .tabX {
        Circle()
            .fill(.gray)
            .frame(width: 40, height: 40)
    
}
  • iconX(_ iconName: String): Set an icon for the tab.
  • titleX(_ newTitle: String): Set the title for the tab.
  • foregroundColorX(_ newColor: Color): Define a custom foreground color.
  • tabX(_ newView: @escaping () -> any View): Offer a custom tab view.

PageXItem Protocol

/// A protocol that represents an individual page item to be used within a `NavX` navigation system.
///
/// By conforming to `PageXItem`, a view becomes suitable for integration within the `NavX` tab-based navigation interface.
/// Each `PageXItem` can provide an icon, a title, a foreground color, and a custom tab view.
public protocol PageXItem: View {
    
    /// An optional system name of the icon to be displayed on the tab bar.
    var iconX: String? { get }
    
    /// An optional title to be displayed on the tab bar.
    /// This title typically represents the content or purpose of the associated view.
    var titleX: String? { get }
    
    /// An optional foreground color for the tab item.
    /// This color will be applied to the icon and title of the tab item.
    var foregroundColorX: Color? { get }
    
    /// An optional closure that returns a custom view for the tab.
    /// This allows for more advanced customization of the tab beyond just an icon and title.
    var tabX: (() -> any View)? { get }
}

Usage

let navView = NavX(selectedIndex: .constant(0)) {
    PageX {
        Text("First Page")
    }
    .iconX("house")
    .titleX("Home")

    PageX {
        Text("Second Page")
    }
    .iconX("person")
    .titleX("Profile")
}

Advanced Usage

Using the combination of NavX(...) and PageX(...) with their respective modifiers, you can create a fully customized tab bar system.

NavX(selectedIndex: $selectedIndex) {
    PageX {
        Color.red
            .frame(height: UIScreen.main.bounds.height)
    }
    .foregroundColorX(.black)
    .tabX {
        Circle()
            .fill(.gray)
            .frame(width: 40, height: 40)
    }
    
    PageX {
        Color.blue
            .frame(height: UIScreen.main.bounds.height)
    }
    .foregroundColorX(.black)
    .titleX("B")
    .iconX("person.circle")
    
    PageX {
        Color.green
            .frame(height: UIScreen.main.bounds.height)
    }
    .foregroundColorX(.yellow)
    .tabX {
        Rectangle()
            .fill(.red)
            .frame(width: 50, height: 50)
    }
}
.ignoredPageSafeAreas(.top)
.respectedBarSafeAreas(.bottom)
.barX { bar in
    bar.padding()
        .background {
            Color.white
        }
        .cornerRadius(5)
        .shadow(radius: 5)
}

Contributing

We welcome contributions! Please see CONTRIBUTING for details.

License

Copyright

All rights reserved. This work is copyrighted to the original author.

Permission for Non-commercial Use

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to use the Software in non-commercial applications, including the rights to use, copy, and modify the Software, subject to the following conditions:

  • The Software may not be used for commercial purposes without express written permission.
  • The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Commercial Use

For permission to use the Software in commercial applications, please reach out to the original author for written consent:

Email: matt@getnovara.com

Disclaimer

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Description

  • Swift Tools 5.8.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sat Oct 19 2024 02:54:48 GMT-0900 (Hawaii-Aleutian Daylight Time)