Skip to content
Permalink
Browse files

Router embed navigation controller as open (#102)

* embedNavigationController function is now declared as open

* Bump version to 1.3.1
  • Loading branch information...
ferranabello committed May 14, 2019
1 parent d6d34a9 commit b54c7817fc3ed60b5aaf289784ab5fd374a446ce
Showing with 9 additions and 9 deletions.
  1. +1 −1 Viperit.podspec
  2. +7 −7 Viperit/Core/Router.swift
  3. +1 −1 Viperit/Info.plist
@@ -2,7 +2,7 @@
#
Pod::Spec.new do |s|
s.name = 'Viperit'
s.version = '1.3.0'
s.version = '1.3.1'
s.summary = 'Viper Framework for iOS written in Swift'

s.description = <<-DESC
@@ -31,6 +31,10 @@ open class Router: RouterProtocol {
return _presenter._view
}

open func embedInNavigationController() -> UINavigationController {
return getNavigationController() ?? UINavigationController(rootViewController: _view as! UIViewController)
}

open func show(inWindow window: UIWindow?, embedInNavController: Bool = false, setupData: Any? = nil, makeKeyAndVisible: Bool = true) {
process(setupData: setupData)
let view = embedInNavController ? embedInNavigationController() : _view as? UIViewController
@@ -77,9 +81,9 @@ private extension Router {
}
}

//MARK: - Embed view in navigation controller
public extension Router {
private func getNavigationController() -> UINavigationController? {
//MARK: - Get navigation controller helper
private extension Router {
func getNavigationController() -> UINavigationController? {
guard let view = _view as? UIViewController else { return nil }
if let nav = view.navigationController {
return nav
@@ -90,10 +94,6 @@ public extension Router {
}
return nil
}

func embedInNavigationController() -> UINavigationController {
return getNavigationController() ?? UINavigationController(rootViewController: _view as! UIViewController)
}
}

//MARK: - Embed view in a container view
@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.3.0</string>
<string>1.3.1</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>

0 comments on commit b54c781

Please sign in to comment.
You can’t perform that action at this time.