diff --git a/CHANGELOG.md b/CHANGELOG.md index e327679..5f3ba8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ Changelog ========== +### 2.1.0 + +- Add push transition with `pushOpenSourceController(from: self)` ### 2.0.1 diff --git a/Exemple/OpenSourceControllerDemo.xcodeproj/project.xcworkspace/xcuserdata/florian.gabach.xcuserdatad/UserInterfaceState.xcuserstate b/Exemple/OpenSourceControllerDemo.xcodeproj/project.xcworkspace/xcuserdata/florian.gabach.xcuserdatad/UserInterfaceState.xcuserstate index 785e699..0c9fb61 100644 Binary files a/Exemple/OpenSourceControllerDemo.xcodeproj/project.xcworkspace/xcuserdata/florian.gabach.xcuserdatad/UserInterfaceState.xcuserstate and b/Exemple/OpenSourceControllerDemo.xcodeproj/project.xcworkspace/xcuserdata/florian.gabach.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Exemple/OpenSourceControllerDemo/Base.lproj/Main.storyboard b/Exemple/OpenSourceControllerDemo/Base.lproj/Main.storyboard index 7f8aef6..e188514 100644 --- a/Exemple/OpenSourceControllerDemo/Base.lproj/Main.storyboard +++ b/Exemple/OpenSourceControllerDemo/Base.lproj/Main.storyboard @@ -1,11 +1,11 @@ - + - + @@ -37,10 +37,11 @@ + - + diff --git a/Exemple/OpenSourceControllerDemo/ViewController.swift b/Exemple/OpenSourceControllerDemo/ViewController.swift index 769ebee..ff579e4 100644 --- a/Exemple/OpenSourceControllerDemo/ViewController.swift +++ b/Exemple/OpenSourceControllerDemo/ViewController.swift @@ -49,7 +49,7 @@ class ViewController: UIViewController { url: "https://raw.githubusercontent.com/kishikawakatsumi/KeychainAccess/master/LICENSE")] // Present controller - openSourceVC.presentOpenSourceController(from: self) + openSourceVC.pushOpenSourceController(from: self) } // Customization diff --git a/OpenSourceController.xcodeproj/project.xcworkspace/xcuserdata/florian.gabach.xcuserdatad/UserInterfaceState.xcuserstate b/OpenSourceController.xcodeproj/project.xcworkspace/xcuserdata/florian.gabach.xcuserdatad/UserInterfaceState.xcuserstate index 8afa7d6..63e8610 100644 Binary files a/OpenSourceController.xcodeproj/project.xcworkspace/xcuserdata/florian.gabach.xcuserdatad/UserInterfaceState.xcuserstate and b/OpenSourceController.xcodeproj/project.xcworkspace/xcuserdata/florian.gabach.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/README.md b/README.md index d13296a..f4203d9 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,9 @@ url: "https://raw.githubusercontent.com/jessesquires/JSQMessagesViewController/d // Present controller openSourceVC.presentOpenSourceController(from: self) + +// OR push the controller if the source controller is embeded in navigation controller +openSourceVC.pushOpenSourceController(from: self) ``` ## Customisation diff --git a/Sources/Controller/OpenSourceController.swift b/Sources/Controller/OpenSourceController.swift index d926b98..b1942c7 100644 --- a/Sources/Controller/OpenSourceController.swift +++ b/Sources/Controller/OpenSourceController.swift @@ -33,4 +33,25 @@ public class OpenSourceController: NSObject { // Present controller from.present(navController, animated: true) } + + /// Push OpenSourceViewController from navigation controller + /// + /// - Parameter from: the source controller + open func pushOpenSourceController(from: UIViewController) { + // Create open source controller + let licenceController = OpenSourceViewController() + + // Init licence + licenceController.licences = self.licences + + // Init config + licenceController.config = self.config + + // Push controller + guard let navigationController = from.navigationController else { + print("Source controller isn't embeded in navigation controller. Can't push.") + return + } + navigationController.pushViewController(licenceController, animated: true) + } }