Giter Club home page Giter Club logo

netunonavigationpod's Introduction

GitHub stars GitHub forks GitHub watchers

GitHub license platform Open Source Love

Actions:

Swift: master

๐Ÿ”ฑ NetunoNavigation ๐Ÿ”ฑ

Navigate like a god.

NetunoNavigation is a pod to iOS to take navigation to the next level on the platform.

Installation

You can install NetunoNavigation with CocoaPods.

pod 'NetunoNavigation', '~> 1.0.0'

Implementing

After you install NetunoNavigation with CocoaPods you can to import NetunoNavigation into your class:

import NetunoNavigation

When you to import navigation you can start utilize Navigator class, and implement it:

import UIKit
import NetunoNavigation

class ExampleViewController : UIViewController {

	var navigate: Navigator?
	
	override  func  viewDidLoad() {
		super.viewDidLoad()
		self.navigate = Navigator(navigationController: self.navigationController)
	}	
}

This is the basic of how to start to use this pod.

Basic about NetunoNavigate

Navigate to another UIViewController

> to

Params Example
_ currenctViewController UIViewController
viewControllerToGo T.Type
prepare ((T?) -> Void)? = nil

Return: Go

> toGo

if you don't need to use prepare you can use .toGo:

Params Example
_ currenctViewController UIViewController
viewControllerToGo T.Type
segue Segue = .push(animated: Go.defaultAnimated)

Return: Bool

//Transparent
toGo<T: UIViewController>(
  _ currentViewController: String
  viewControllerToGo _: T.Type
  segue: Segue = .push(animated: Go.defaultAnimated)
)

to<T: UIViewController>(
  _ currentViewController: UIViewController
  viewControllerToGo _: T.Type
  prepare: ((T?) -> Void)? = nil
) -> Go

.go(
  segue: Segue = .push(animated: Go.defaultAnimated)
) -> Bool
 
//Example without prepare you can use `toGo`
navigator.toGo(self, viewControllerToGo: AnotherViewController.self)

//Example with prepare
navigator.to(self, viewControllerToGo: AnotherViewController.self) { nextViewController: AnotherViewController? in
	nextViewController.title = "New Title"
}.go()
Navigate to another UIViewController on another Storyboard

> to

Params Example
_ storyboardToGo String
viewControllerToGo T.Type
prepare ((T?) -> Void)? = nil

Return: Go

> toGo

if you don't need to use prepare you can use .toGo:

Params Example
_ storyboardToGo String
viewControllerToGo T.Type
segue Segue = .push(animated: Go.defaultAnimated)

Return: Bool

//Transparent
toGo<T: UIViewController>(
  _ storyboardToGo: String
  viewControllerToGo _: T.Type
  segue: Segue = .push(animated: Go.defaultAnimated)
)

to<T: UIViewController>(
  _ storyboardToGo: String
  viewControllerToGo _: T.Type
  prepare: ((T?) -> Void)? = nil
) -> Go

.go(
  segue: Segue = .push(animated: Go.defaultAnimated)
) -> Bool
 
//Example without prepare you can use `toGo`
navigator.toGo("AnotherStoryboard", viewControllerToGo: AnotherViewController.self)

//Example with prepare
navigator.to("AnotherStoryboard", viewControllerToGo: AnotherViewController.self) { nextViewController: AnotherViewController? in
	nextViewController.title = "New Title"
}.go()
Navigate to another UINavigationController

.newStack is used to configure UINavigationController and/or UIStoryboard that you want to navigate. To navigate to another screen you need to use .to to configure UIViewController and/or prepare and .go to configure how you want to open your screen. But if you want only go you can use .toGo.

If you want to navigate to another Storyboard use storyboardToGo param

> newStack

Params Example
navControllerToGo String
_ storyboardToGo String? = nil

Return: Stack?

.to

Params Example
viewControllerToGo T.Type
prepare ((T?) -> Void)? = nil

Return: StackGo

.go

Params Example
_ style ModalStyleEnum = .none

Return: Void

**Code .newStack example**
//Transparent
.newStack(
  navControllerToGo: String,
  _ storyboardToGo: String? = nil
) -> Stack?

.to<T: UIViewController>(
  viewControllerToGo: T.Type,
  prepare: ((T?) -> Void)? = nil
) -> StackGo

.go(
  _ style: ModalStyleEnum = .none
)

//Example same storyboard
let stack = navigate.newStack("NavigationControllerToGo")
//Example another storyboard
let another = navigate.newStack("NavigationControllerToGo", "AnotherStoryboard")

//Without prepare
stack.to(AnotherViewController.self).go()

//With prepare
stack.to(AnotherViewController.self) { nextViewController in
  nextViewController.title = "new title"
}.go()
**Code .newStack with .toGo example**
//Transparent
.newStack(
  navControllerToGo: String,
  _ storyboardToGo: String? = nil
) -> Stack?

.toGo<T: UIViewController>(
  _ viewControllerToGo: T.Type? = nil
  style: ModalStyleEnum = .modal(modalTransitionStyle: .crossDissolve, modalPresentationStyle: .fullScreen, animated: true, completion: nil)
) -> Stack

//Example
navigate.newStack("NavigationControllerToGo")
  .toGo(AnotherViewController.self)

--

If you don't need to use prepare you can use .newStackToGo:

> newStackToGo

Params Example
_ navControllerToGo String
_ storyboardToGo String? = nil
viewControllerToGo T.Type? = nil
style ModalStyleEnum = .none

Return: Stack?

//Transparent
newStackToGo<T: UIViewController>(
  _ navControllerToGo: String,
  _ storyboardToGo: String? = nil,
  viewControllerToGo: T.Type,
  style: ModalStyleEnum = .none
) -> Stack?

//Example same storyboard
navigate.newStackToGo("NavigationControllerToGo", viewControllerToGo: AnotherViewController.self, .default)

//Example another storyboard
navigate.newStackToGo(
  "NavigationControllerToGo", //navControllerToGo
  "AnotherStoryboard", //storyboardToGo
  viewControllerToGo: AnotherViewController.self,
  style: .default(animated: true, completion: nil)
)

License

MIT License

Copyright (c) 2020 Lucas Cruz Wottrich.

netunonavigationpod's People

Contributors

wottrich avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  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.