Giter VIP home page Giter VIP logo

navidux's Introduction

Navidux

SPM compatible Swift 5.7

Navidux is easy and simple module to build your navigation without thinking about complicated routes in factories.

Table of Contents

About Navidux

We create this package with router to facilitate routing duties and improve reading in complicated projects. Analyzing previous project give us idea of creating independently navigation. It's did not depend on your project and may use in different combination and variations. Of course it can uses with Storyboard, UIKit and SwiftUI screens. The goals we want to achieve:

  • Easy using and create routes in screen modules.
  • Use with most architectual approaches (MVVM, MVC, VIPER, MVI, MVP etc).
  • Not complicated logic of library engine.

Navidux scheme

NavigationCoordinator core consists from:

  • Reducer function - actionReducer(action:);
  • ScreenAssembler - that implements in navigation depended module;
  • State - contains important properties for better functionality;
  • NavigationController - component that directry implements routing and hold some important information, like Screen Stack. Most core components have documentation on the spot with some examples.

Requirements

  • iOS 13.0+

Installation

Swift Package Manager

Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.

Xcode 11+ is required to build Navidux using Swift Package Manager. To integrate Navidux into your Xcode project using Swift Package Manager, add it to the dependencies value of your Package.swift:

dependencies: [
    .package(url: "https://github.com/RedMadRobot/navidux.git")
]

Preparation

Next you have to extends 2 object and implement 1 to use Navidux at maximum. Some were in your APP module extends:

extension NaviduxScreen {
    static let newScreen = NaviduxScreen(
        description: "someDescription",
        screenClass: YourScreenTypeInheritedFromUIViewController.self
    )
}
extension Navidux.ScreenFactory {
public var someScreenFactory: (NavigationCoordinator?, ScreenConfig) -> any NavigationScreen {
    { coordinator, config
        return MyViewControllerConformedNavigationScreen()
    }
}

And implement Navidux.ScreenAssembler protocol.

Usage

Initialisation phase

To set Navidux as initial navigation controller. You need do installation and preparation phases. After you may initialise NavigationCoordinator like example below.

let navigationController = NavigationControllerImpl()
let screenFactory: ScreenFactory = NaviduxScreenFactory()
let alertFactory: AlertFactory = AlertFactoryImpl()
let navigationCoordinatorProxy = NavigationCoordinatorProxy()
let screenAssembler = NaviduxScreenAssembler(
    screenFactory: screenFactory,
    alertFactory: alertFactory,
    screenCoordinator: navigationCoordinatorProxy
)

let navigationCoordinator = NavigationCoordinator(
    navigationController,
    screenAssembler: screenAssembler
)
navigationCoordinatorProxy.subject = navigationCoordinator
navigationCoordinator.actionReducer(
    action: .push(.firstScreen, .init(navigationTitle: ""), .fullscreen)
)

window?.rootViewController = navigationController

Using phase

For example in your UIViewController you may call NavigationCoordinator and ask it for action:

navigation?.actionReducer(
    action: .push(.nextScreen, .init(navigationTitle: "My title"), .fullscreen)
)

Roadmap

Roadmap there

navidux's People

Contributors

darkkifir avatar haidentenno avatar laqiguy avatar baluhman avatar bananzaaa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.