From 87d5f91d2d75cb3c0421f00425d53e45862e1575 Mon Sep 17 00:00:00 2001 From: Sergey Kopytov Date: Thu, 3 Oct 2019 21:01:12 +0300 Subject: [PATCH 1/5] add UIViewController extension with full screen present --- CHANGELOG.md | 3 +++ LeadKit.podspec | 2 +- LeadKit.xcodeproj/project.pbxproj | 10 ++++++++++ .../UIViewController+PresentFullScreen.swift | 11 +++++++++++ Sources/Info-iOS.plist | 2 +- Sources/Info-tvOS.plist | 2 +- Sources/Info-watchOS.plist | 2 +- 7 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 Sources/Extensions/UIKit/UIViewController/UIViewController+PresentFullScreen.swift diff --git a/CHANGELOG.md b/CHANGELOG.md index 29c113e1..db85e0fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # 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) + ### 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/LeadKit.podspec b/LeadKit.podspec index 241f1d0f..09aa8890 100644 --- a/LeadKit.podspec +++ b/LeadKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "LeadKit" - s.version = "0.9.27" + s.version = "0.9.28" s.summary = "iOS framework with a bunch of tools for rapid development" s.homepage = "https://github.com/TouchInstinct/LeadKit" s.license = "Apache License, Version 2.0" diff --git a/LeadKit.xcodeproj/project.pbxproj b/LeadKit.xcodeproj/project.pbxproj index 4078dba1..7f2853a9 100644 --- a/LeadKit.xcodeproj/project.pbxproj +++ b/LeadKit.xcodeproj/project.pbxproj @@ -15,6 +15,7 @@ 36FE777320F669E300284C09 /* String+ConvertToHost.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36FE776F20F669E300284C09 /* String+ConvertToHost.swift */; }; 40F118471F8FEF97004AADAF /* AppearanceConfigurable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40F118461F8FEF97004AADAF /* AppearanceConfigurable.swift */; }; 40F118491F8FF223004AADAF /* TableRow+AppearanceExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40F118481F8FF223004AADAF /* TableRow+AppearanceExtension.swift */; }; + 411073AF23466B41002DD9B9 /* UIViewController+PresentFullScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 411073AE23466B41002DD9B9 /* UIViewController+PresentFullScreen.swift */; }; 67051ADB1EBC7C36008EADC0 /* SpinnerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67051ADA1EBC7C36008EADC0 /* SpinnerView.swift */; }; 67051ADD1EBC7C36008EADC0 /* SpinnerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67051ADA1EBC7C36008EADC0 /* SpinnerView.swift */; }; 6713C23720AF0C4D00875921 /* NetworkOperationState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6713C23620AF0C4D00875921 /* NetworkOperationState.swift */; }; @@ -548,6 +549,7 @@ 36FE776F20F669E300284C09 /* String+ConvertToHost.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+ConvertToHost.swift"; sourceTree = ""; }; 40F118461F8FEF97004AADAF /* AppearanceConfigurable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppearanceConfigurable.swift; sourceTree = ""; }; 40F118481F8FF223004AADAF /* TableRow+AppearanceExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TableRow+AppearanceExtension.swift"; sourceTree = ""; }; + 411073AE23466B41002DD9B9 /* UIViewController+PresentFullScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+PresentFullScreen.swift"; sourceTree = ""; }; 67051ADA1EBC7C36008EADC0 /* SpinnerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SpinnerView.swift; sourceTree = ""; }; 6713C23620AF0C4D00875921 /* NetworkOperationState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkOperationState.swift; sourceTree = ""; }; 6713C23B20AF0D5900875921 /* NetworkOperationModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkOperationModel.swift; sourceTree = ""; }; @@ -1109,6 +1111,7 @@ 671462191EB3396E00EAB194 /* UIViewController+DefaultXibName.swift */, 6714621A1EB3396E00EAB194 /* UIViewController+TopVisibleViewController.swift */, 7295474321E66328009558E7 /* UIViewController+UpdateNavigationItemTitle.swift */, + 411073AE23466B41002DD9B9 /* UIViewController+PresentFullScreen.swift */, ); path = UIViewController; sourceTree = ""; @@ -2531,6 +2534,7 @@ 67745280206256A20024EEEF /* RxDataLoadingModel.swift in Sources */, A6F32C081F6EBDAA00AC08EE /* String+LocalizedComponent.swift in Sources */, 671462881EB3396E00EAB194 /* CGFloat+Pixels.swift in Sources */, + 411073AF23466B41002DD9B9 /* UIViewController+PresentFullScreen.swift in Sources */, 671462941EB3396E00EAB194 /* CGSize+CGContextSize.swift in Sources */, 6741CEA920E2418B00FEC4D9 /* CollectionViewHolder.swift in Sources */, 67745279206252020024EEEF /* DataLoadingState.swift in Sources */, @@ -2927,6 +2931,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MARKETING_VERSION = 0.9.28; OTHER_SWIFT_FLAGS = "$(inherited) -Xfrontend -warn-long-expression-type-checking=200 -Xfrontend -warn-long-function-bodies=200 -Xfrontend -debug-time-function-bodies"; PRODUCT_BUNDLE_IDENTIFIER = "ru.touchin.LeadKit-iOS"; PRODUCT_NAME = LeadKit; @@ -2957,6 +2962,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MARKETING_VERSION = 0.9.28; OTHER_SWIFT_FLAGS = "$(inherited) -Xfrontend -warn-long-expression-type-checking=200 -Xfrontend -warn-long-function-bodies=200 -Xfrontend -debug-time-function-bodies"; PRODUCT_BUNDLE_IDENTIFIER = "ru.touchin.LeadKit-iOS"; PRODUCT_NAME = LeadKit; @@ -2985,6 +2991,7 @@ INFOPLIST_FILE = "$(SRCROOT)/Sources/Info-watchOS.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MARKETING_VERSION = 0.9.28; OTHER_SWIFT_FLAGS = "$(inherited) -Xfrontend -warn-long-expression-type-checking=200 -Xfrontend -warn-long-function-bodies=200 -Xfrontend -debug-time-function-bodies"; PRODUCT_BUNDLE_IDENTIFIER = "ru.touchin.LeadKit-watchOS"; PRODUCT_NAME = LeadKit; @@ -3017,6 +3024,7 @@ INFOPLIST_FILE = "$(SRCROOT)/Sources/Info-watchOS.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MARKETING_VERSION = 0.9.28; OTHER_SWIFT_FLAGS = "$(inherited) -Xfrontend -warn-long-expression-type-checking=200 -Xfrontend -warn-long-function-bodies=200 -Xfrontend -debug-time-function-bodies"; PRODUCT_BUNDLE_IDENTIFIER = "ru.touchin.LeadKit-watchOS"; PRODUCT_NAME = LeadKit; @@ -3047,6 +3055,7 @@ INFOPLIST_FILE = "$(SRCROOT)/Sources/Info-tvOS.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MARKETING_VERSION = 0.9.28; OTHER_SWIFT_FLAGS = "$(inherited) -Xfrontend -warn-long-expression-type-checking=200 -Xfrontend -warn-long-function-bodies=200 -Xfrontend -debug-time-function-bodies"; PRODUCT_BUNDLE_IDENTIFIER = "ru.touchin.LeadKit-tvOS"; PRODUCT_NAME = LeadKit; @@ -3078,6 +3087,7 @@ INFOPLIST_FILE = "$(SRCROOT)/Sources/Info-tvOS.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MARKETING_VERSION = 0.9.28; OTHER_SWIFT_FLAGS = "$(inherited) -Xfrontend -warn-long-expression-type-checking=200 -Xfrontend -warn-long-function-bodies=200 -Xfrontend -debug-time-function-bodies"; PRODUCT_BUNDLE_IDENTIFIER = "ru.touchin.LeadKit-tvOS"; PRODUCT_NAME = LeadKit; diff --git a/Sources/Extensions/UIKit/UIViewController/UIViewController+PresentFullScreen.swift b/Sources/Extensions/UIKit/UIViewController/UIViewController+PresentFullScreen.swift new file mode 100644 index 00000000..74233b33 --- /dev/null +++ b/Sources/Extensions/UIKit/UIViewController/UIViewController+PresentFullScreen.swift @@ -0,0 +1,11 @@ +import UIkit + +public extension UIViewController { + func presentFullScreen(_ viewController: UIViewController, + animated: Bool = true, + completion: (() -> Void)? = nil) { + + viewController.modalPresentationStyle = .fullScreen + present(viewController, animated: animated, completion: completion) + } +} diff --git a/Sources/Info-iOS.plist b/Sources/Info-iOS.plist index fb705838..ec0cc7b0 100644 --- a/Sources/Info-iOS.plist +++ b/Sources/Info-iOS.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.9.27 + $(MARKETING_VERSION) CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass diff --git a/Sources/Info-tvOS.plist b/Sources/Info-tvOS.plist index fb705838..ec0cc7b0 100644 --- a/Sources/Info-tvOS.plist +++ b/Sources/Info-tvOS.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.9.27 + $(MARKETING_VERSION) CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass diff --git a/Sources/Info-watchOS.plist b/Sources/Info-watchOS.plist index fb705838..ec0cc7b0 100644 --- a/Sources/Info-watchOS.plist +++ b/Sources/Info-watchOS.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.9.27 + $(MARKETING_VERSION) CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass From 8b13419da476e5838b21cab6d86f795e913f8ce6 Mon Sep 17 00:00:00 2001 From: Sergey Kopytov Date: Thu, 3 Oct 2019 23:08:39 +0300 Subject: [PATCH 2/5] fix version --- Sources/Info-iOS.plist | 2 +- Sources/Info-tvOS.plist | 2 +- Sources/Info-watchOS.plist | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Info-iOS.plist b/Sources/Info-iOS.plist index ec0cc7b0..24cd7b7e 100644 --- a/Sources/Info-iOS.plist +++ b/Sources/Info-iOS.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - $(MARKETING_VERSION) + 0.9.28 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass diff --git a/Sources/Info-tvOS.plist b/Sources/Info-tvOS.plist index ec0cc7b0..24cd7b7e 100644 --- a/Sources/Info-tvOS.plist +++ b/Sources/Info-tvOS.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - $(MARKETING_VERSION) + 0.9.28 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass diff --git a/Sources/Info-watchOS.plist b/Sources/Info-watchOS.plist index ec0cc7b0..24cd7b7e 100644 --- a/Sources/Info-watchOS.plist +++ b/Sources/Info-watchOS.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - $(MARKETING_VERSION) + 0.9.28 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass From 090c066a75a34bd691980dd15a8275987edaa9ed Mon Sep 17 00:00:00 2001 From: Sergey Kopytov Date: Thu, 3 Oct 2019 23:15:18 +0300 Subject: [PATCH 3/5] add comment --- LeadKit.xcodeproj/project.pbxproj | 6 ------ .../UIViewController+PresentFullScreen.swift | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/LeadKit.xcodeproj/project.pbxproj b/LeadKit.xcodeproj/project.pbxproj index 7f2853a9..c68d70e9 100644 --- a/LeadKit.xcodeproj/project.pbxproj +++ b/LeadKit.xcodeproj/project.pbxproj @@ -2931,7 +2931,6 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 0.9.28; OTHER_SWIFT_FLAGS = "$(inherited) -Xfrontend -warn-long-expression-type-checking=200 -Xfrontend -warn-long-function-bodies=200 -Xfrontend -debug-time-function-bodies"; PRODUCT_BUNDLE_IDENTIFIER = "ru.touchin.LeadKit-iOS"; PRODUCT_NAME = LeadKit; @@ -2962,7 +2961,6 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 0.9.28; OTHER_SWIFT_FLAGS = "$(inherited) -Xfrontend -warn-long-expression-type-checking=200 -Xfrontend -warn-long-function-bodies=200 -Xfrontend -debug-time-function-bodies"; PRODUCT_BUNDLE_IDENTIFIER = "ru.touchin.LeadKit-iOS"; PRODUCT_NAME = LeadKit; @@ -2991,7 +2989,6 @@ INFOPLIST_FILE = "$(SRCROOT)/Sources/Info-watchOS.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 0.9.28; OTHER_SWIFT_FLAGS = "$(inherited) -Xfrontend -warn-long-expression-type-checking=200 -Xfrontend -warn-long-function-bodies=200 -Xfrontend -debug-time-function-bodies"; PRODUCT_BUNDLE_IDENTIFIER = "ru.touchin.LeadKit-watchOS"; PRODUCT_NAME = LeadKit; @@ -3024,7 +3021,6 @@ INFOPLIST_FILE = "$(SRCROOT)/Sources/Info-watchOS.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 0.9.28; OTHER_SWIFT_FLAGS = "$(inherited) -Xfrontend -warn-long-expression-type-checking=200 -Xfrontend -warn-long-function-bodies=200 -Xfrontend -debug-time-function-bodies"; PRODUCT_BUNDLE_IDENTIFIER = "ru.touchin.LeadKit-watchOS"; PRODUCT_NAME = LeadKit; @@ -3055,7 +3051,6 @@ INFOPLIST_FILE = "$(SRCROOT)/Sources/Info-tvOS.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 0.9.28; OTHER_SWIFT_FLAGS = "$(inherited) -Xfrontend -warn-long-expression-type-checking=200 -Xfrontend -warn-long-function-bodies=200 -Xfrontend -debug-time-function-bodies"; PRODUCT_BUNDLE_IDENTIFIER = "ru.touchin.LeadKit-tvOS"; PRODUCT_NAME = LeadKit; @@ -3087,7 +3082,6 @@ INFOPLIST_FILE = "$(SRCROOT)/Sources/Info-tvOS.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 0.9.28; OTHER_SWIFT_FLAGS = "$(inherited) -Xfrontend -warn-long-expression-type-checking=200 -Xfrontend -warn-long-function-bodies=200 -Xfrontend -debug-time-function-bodies"; PRODUCT_BUNDLE_IDENTIFIER = "ru.touchin.LeadKit-tvOS"; PRODUCT_NAME = LeadKit; diff --git a/Sources/Extensions/UIKit/UIViewController/UIViewController+PresentFullScreen.swift b/Sources/Extensions/UIKit/UIViewController/UIViewController+PresentFullScreen.swift index 74233b33..a7fb4209 100644 --- a/Sources/Extensions/UIKit/UIViewController/UIViewController+PresentFullScreen.swift +++ b/Sources/Extensions/UIKit/UIViewController/UIViewController+PresentFullScreen.swift @@ -1,6 +1,12 @@ import UIkit public extension UIViewController { + /// Method present new ViewController modally in full screen mode + /// + /// - 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) { From cdebfbebddcc5aeecda7e1d10f6ea248ba1b9b84 Mon Sep 17 00:00:00 2001 From: Sergey Kopytov Date: Fri, 4 Oct 2019 14:19:05 +0300 Subject: [PATCH 4/5] 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) From 6de58594eac4d0c425639510ad87b83e3c83a35b Mon Sep 17 00:00:00 2001 From: Sergey Kopytov Date: Fri, 4 Oct 2019 14:21:50 +0300 Subject: [PATCH 5/5] fix typo --- .../UIViewController/UIViewController+PresentFullScreen.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Extensions/UIKit/UIViewController/UIViewController+PresentFullScreen.swift b/Sources/Extensions/UIKit/UIViewController/UIViewController+PresentFullScreen.swift index c7e7d287..5f048b8a 100644 --- a/Sources/Extensions/UIKit/UIViewController/UIViewController+PresentFullScreen.swift +++ b/Sources/Extensions/UIKit/UIViewController/UIViewController+PresentFullScreen.swift @@ -14,7 +14,7 @@ public extension UIViewController { animated: Bool = true, completion: (() -> Void)? = nil) { - viewController.modalPresentationStyle = .fullScreen + viewController.modalPresentationStyle = presentationStyle present(viewController, animated: animated, completion: completion) } }