From cdebfbebddcc5aeecda7e1d10f6ea248ba1b9b84 Mon Sep 17 00:00:00 2001 From: Sergey Kopytov Date: Fri, 4 Oct 2019 14:19:05 +0300 Subject: [PATCH] add presentation mode property --- CHANGELOG.md | 2 +- .../UIViewController+PresentFullScreen.swift | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db85e0fb..e6806cee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Changelog ### 0.9.28 -- **Add**: method `presentFullScreen(_ viewController:animated:completion:)` for `UIViewController` that present `viewController` in full screen mode (avoid problems with *iOS13* default prsentation mode changed to `.automatic` stork) +- **Add**: method `presentFullScreen(_ viewController:presentationStyle:animated:completion:)` for `UIViewController` that present any `viewController` modally in full screen mode by default (avoid problems with *iOS13* default presentation mode changed to `.automatic` stork) ### 0.9.27 - **Add**: method `date(from string:formats:parsedIn:)` method for `DateFormattingService` that parses date from string in one of the given formats with current region. diff --git a/Sources/Extensions/UIKit/UIViewController/UIViewController+PresentFullScreen.swift b/Sources/Extensions/UIKit/UIViewController/UIViewController+PresentFullScreen.swift index a7fb4209..c7e7d287 100644 --- a/Sources/Extensions/UIKit/UIViewController/UIViewController+PresentFullScreen.swift +++ b/Sources/Extensions/UIKit/UIViewController/UIViewController+PresentFullScreen.swift @@ -1,15 +1,18 @@ import UIkit public extension UIViewController { - /// Method present new ViewController modally in full screen mode + + /// Method present new ViewController modally in full screen mode by default /// /// - Parameters: /// - viewController: ViewController to present - /// - animated: ppresent with animation - /// - completion: completion block after present ended - func presentFullScreen(_ viewController: UIViewController, - animated: Bool = true, - completion: (() -> Void)? = nil) { + /// - presentationStyle: presentation style (default is `fullScreen` + /// - animated: present with animation or not + /// - completion: completion block after present finish + func presentModal(_ viewController: UIViewController, + presentationStyle: UIModalPresentationStyle = .fullScreen, + animated: Bool = true, + completion: (() -> Void)? = nil) { viewController.modalPresentationStyle = .fullScreen present(viewController, animated: animated, completion: completion)