Skip to content

Commit

Permalink
Router embed navigation controller as open (#102)
Browse files Browse the repository at this point in the history
* embedNavigationController function is now declared as open

* Bump version to 1.3.1
  • Loading branch information
ferranabello authored May 14, 2019
1 parent d6d34a9 commit b54c781
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Viperit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions Viperit/Core/Router.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Viperit/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit b54c781

Please sign in to comment.