diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Derived/InfoPlists/PanModal-Info.plist b/Derived/InfoPlists/PanModal-Info.plist new file mode 100644 index 00000000..323e5ecf --- /dev/null +++ b/Derived/InfoPlists/PanModal-Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/PanModal.podspec b/PanModal.podspec index 22b04eeb..7f50bf31 100644 --- a/PanModal.podspec +++ b/PanModal.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'PanModal' - s.version = '1.2.7' + s.version = '1.2.11' s.summary = 'PanModal is an elegant and highly customizable presentation API for constructing bottom sheet modals on iOS.' # This description is used to generate tags and improve search results. diff --git a/PanModal.xcodeproj/project.pbxproj b/PanModal.xcodeproj/project.pbxproj new file mode 100644 index 00000000..a31f4962 --- /dev/null +++ b/PanModal.xcodeproj/project.pbxproj @@ -0,0 +1,738 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 0E391F2415A5726AC9E18186 /* PanModalKeyboardPresentable+Defaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82F2FF2E7898D35F82E277D6 /* PanModalKeyboardPresentable+Defaults.swift */; }; + 1D34D9B02EB1AC010D28A788 /* PanModalHeight.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABF65B3D44F3AC87AC56675B /* PanModalHeight.swift */; }; + 2D12137F8718A3970F14AFA1 /* PanModalAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 247F269CB9E79F921797C868 /* PanModalAnimator.swift */; }; + 3FE4AC79C0FFC08A763B73CA /* PanModalPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = B88988866B1E9B8041D8CDBC /* PanModalPresenter.swift */; }; + 4ADB47FF2175663ADCA39476 /* PanModalPresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEF747134DCC92CD1E6B1A1C /* PanModalPresentable.swift */; }; + 564E41966241D7803EA68C20 /* PanModalKeyboardPresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F99DE1EC61D2721C1D5BD49E /* PanModalKeyboardPresentable.swift */; }; + 568E31FE1C634747DF96BF89 /* PanModalPresentationAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE33C1773BA187DC156A1573 /* PanModalPresentationAnimator.swift */; }; + 7F6A9D4296C19BBC01898E49 /* PanModalPresentable+Defaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3BE99A40E84171281F1D649 /* PanModalPresentable+Defaults.swift */; }; + 847DF45F2EE236DC6632D86B /* PanContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6182FE3A8D6D219CE0CDCCCF /* PanContainerView.swift */; }; + A5E91380A4091F2092B662CE /* PanModalPresentable+LayoutHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = BCF005E45B676AD3F7B78FAD /* PanModalPresentable+LayoutHelpers.swift */; }; + A7D3582C1ADA0E60361A9B30 /* UIViewController+PanModalPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E9105024A9438C1AC2D8D29 /* UIViewController+PanModalPresenter.swift */; }; + B9E8259F773D27BAA416DCDB /* PanModalPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D58F1F9245FCF277E33A16FE /* PanModalPresentationController.swift */; }; + BD2A2F384AA6A669BB094AFE /* DimmedView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D9359135D025D85DF75DE4F5 /* DimmedView.swift */; }; + C5212562E96EB66723FA4AF5 /* PanModalNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BAE1B81D3CE5D181BF9FEC5 /* PanModalNavigationController.swift */; }; + DF004916923A0853BE2A6EF3 /* PanModalPresentable+UIViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A6D777902F927D45E55BD58 /* PanModalPresentable+UIViewController.swift */; }; + EB726BFFEE56C0BF9E060581 /* PanModalPresentationDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 666A2C96EA5A339D2BF1AFD7 /* PanModalPresentationDelegate.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 4B713D3FD1A9A1B3FD2103F6 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 20E8316EBC147D20D0D4AFCC /* PanModal.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PanModal.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 247F269CB9E79F921797C868 /* PanModalAnimator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PanModalAnimator.swift; sourceTree = ""; }; + 5D4E1B52C8DEB3611236C530 /* PanModal-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = "PanModal-Info.plist"; sourceTree = ""; }; + 6182FE3A8D6D219CE0CDCCCF /* PanContainerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PanContainerView.swift; sourceTree = ""; }; + 666A2C96EA5A339D2BF1AFD7 /* PanModalPresentationDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PanModalPresentationDelegate.swift; sourceTree = ""; }; + 6E9105024A9438C1AC2D8D29 /* UIViewController+PanModalPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+PanModalPresenter.swift"; sourceTree = ""; }; + 82F2FF2E7898D35F82E277D6 /* PanModalKeyboardPresentable+Defaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PanModalKeyboardPresentable+Defaults.swift"; sourceTree = ""; }; + 9A6D777902F927D45E55BD58 /* PanModalPresentable+UIViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PanModalPresentable+UIViewController.swift"; sourceTree = ""; }; + 9BAE1B81D3CE5D181BF9FEC5 /* PanModalNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PanModalNavigationController.swift; sourceTree = ""; }; + ABF65B3D44F3AC87AC56675B /* PanModalHeight.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PanModalHeight.swift; sourceTree = ""; }; + B3BE99A40E84171281F1D649 /* PanModalPresentable+Defaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PanModalPresentable+Defaults.swift"; sourceTree = ""; }; + B88988866B1E9B8041D8CDBC /* PanModalPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PanModalPresenter.swift; sourceTree = ""; }; + BCF005E45B676AD3F7B78FAD /* PanModalPresentable+LayoutHelpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PanModalPresentable+LayoutHelpers.swift"; sourceTree = ""; }; + BE33C1773BA187DC156A1573 /* PanModalPresentationAnimator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PanModalPresentationAnimator.swift; sourceTree = ""; }; + CEF747134DCC92CD1E6B1A1C /* PanModalPresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PanModalPresentable.swift; sourceTree = ""; }; + D58F1F9245FCF277E33A16FE /* PanModalPresentationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PanModalPresentationController.swift; sourceTree = ""; }; + D9359135D025D85DF75DE4F5 /* DimmedView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DimmedView.swift; sourceTree = ""; }; + F99DE1EC61D2721C1D5BD49E /* PanModalKeyboardPresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PanModalKeyboardPresentable.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 9B001E5E298EBB4F06957710 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0E15AB33DF0F04ED376AD871 /* Products */ = { + isa = PBXGroup; + children = ( + 20E8316EBC147D20D0D4AFCC /* PanModal.framework */, + ); + name = Products; + sourceTree = ""; + }; + 1EE8AF31D3AD6ADAE5A2F5B4 /* KeyboardPresentable */ = { + isa = PBXGroup; + children = ( + F99DE1EC61D2721C1D5BD49E /* PanModalKeyboardPresentable.swift */, + 82F2FF2E7898D35F82E277D6 /* PanModalKeyboardPresentable+Defaults.swift */, + ); + path = KeyboardPresentable; + sourceTree = ""; + }; + 1FDDFE36812B21100970C573 = { + isa = PBXGroup; + children = ( + D3D84F2F13701F701BFE149E /* Project */, + 357EF2A08DF98FB9EFAF2C72 /* Frameworks */, + 0E15AB33DF0F04ED376AD871 /* Products */, + ); + sourceTree = ""; + }; + 26D371B632C7963B57350947 /* Animator */ = { + isa = PBXGroup; + children = ( + 247F269CB9E79F921797C868 /* PanModalAnimator.swift */, + BE33C1773BA187DC156A1573 /* PanModalPresentationAnimator.swift */, + ); + path = Animator; + sourceTree = ""; + }; + 357EF2A08DF98FB9EFAF2C72 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; + 50511DA5F1A1D1544D4692A1 /* InfoPlists */ = { + isa = PBXGroup; + children = ( + 5D4E1B52C8DEB3611236C530 /* PanModal-Info.plist */, + ); + path = InfoPlists; + sourceTree = ""; + }; + 5741396B55D075D098E40E92 /* Presentable */ = { + isa = PBXGroup; + children = ( + ABF65B3D44F3AC87AC56675B /* PanModalHeight.swift */, + CEF747134DCC92CD1E6B1A1C /* PanModalPresentable.swift */, + B3BE99A40E84171281F1D649 /* PanModalPresentable+Defaults.swift */, + BCF005E45B676AD3F7B78FAD /* PanModalPresentable+LayoutHelpers.swift */, + 9A6D777902F927D45E55BD58 /* PanModalPresentable+UIViewController.swift */, + ); + path = Presentable; + sourceTree = ""; + }; + 5B2E705D3A9A0381ED241E6A /* Presenter */ = { + isa = PBXGroup; + children = ( + B88988866B1E9B8041D8CDBC /* PanModalPresenter.swift */, + 6E9105024A9438C1AC2D8D29 /* UIViewController+PanModalPresenter.swift */, + ); + path = Presenter; + sourceTree = ""; + }; + 6230FC53F41790705FFE9704 /* View */ = { + isa = PBXGroup; + children = ( + D9359135D025D85DF75DE4F5 /* DimmedView.swift */, + 6182FE3A8D6D219CE0CDCCCF /* PanContainerView.swift */, + ); + path = View; + sourceTree = ""; + }; + 72C84C35A71A983A26D3CC70 /* Controller */ = { + isa = PBXGroup; + children = ( + 9BAE1B81D3CE5D181BF9FEC5 /* PanModalNavigationController.swift */, + D58F1F9245FCF277E33A16FE /* PanModalPresentationController.swift */, + ); + path = Controller; + sourceTree = ""; + }; + C5E5E974319C26486287CE0D /* Delegate */ = { + isa = PBXGroup; + children = ( + 666A2C96EA5A339D2BF1AFD7 /* PanModalPresentationDelegate.swift */, + ); + path = Delegate; + sourceTree = ""; + }; + CBC53B798DC85A88A0F37788 /* PanModal */ = { + isa = PBXGroup; + children = ( + 26D371B632C7963B57350947 /* Animator */, + 72C84C35A71A983A26D3CC70 /* Controller */, + C5E5E974319C26486287CE0D /* Delegate */, + 1EE8AF31D3AD6ADAE5A2F5B4 /* KeyboardPresentable */, + 5741396B55D075D098E40E92 /* Presentable */, + 5B2E705D3A9A0381ED241E6A /* Presenter */, + 6230FC53F41790705FFE9704 /* View */, + ); + path = PanModal; + sourceTree = ""; + }; + D3D84F2F13701F701BFE149E /* Project */ = { + isa = PBXGroup; + children = ( + E2BEA16CB73FB082C98CE042 /* Derived */, + CBC53B798DC85A88A0F37788 /* PanModal */, + ); + name = Project; + sourceTree = ""; + }; + E2BEA16CB73FB082C98CE042 /* Derived */ = { + isa = PBXGroup; + children = ( + 50511DA5F1A1D1544D4692A1 /* InfoPlists */, + ); + path = Derived; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + A1D7F00CED08E18E42393F30 /* PanModal */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1EF84CF17AB6EB3D75687471 /* Build configuration list for PBXNativeTarget "PanModal" */; + buildPhases = ( + 94AAB8E6AC75DF47314D92B0 /* Sources */, + F66597CDECE92B03C3CEA1E8 /* Resources */, + 4B713D3FD1A9A1B3FD2103F6 /* Embed Frameworks */, + 9B001E5E298EBB4F06957710 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = PanModal; + productName = PanModal; + productReference = 20E8316EBC147D20D0D4AFCC /* PanModal.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 51DD5472E1F398FE6B6A5302 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 9999; + TargetAttributes = { + }; + }; + buildConfigurationList = CCC9A83A9BFD2A0A523DC090 /* Build configuration list for PBXProject "PanModal" */; + compatibilityVersion = "Xcode 13.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + Base, + en, + ); + mainGroup = 1FDDFE36812B21100970C573; + productRefGroup = 0E15AB33DF0F04ED376AD871 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + A1D7F00CED08E18E42393F30 /* PanModal */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + F66597CDECE92B03C3CEA1E8 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 94AAB8E6AC75DF47314D92B0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2D12137F8718A3970F14AFA1 /* PanModalAnimator.swift in Sources */, + 568E31FE1C634747DF96BF89 /* PanModalPresentationAnimator.swift in Sources */, + C5212562E96EB66723FA4AF5 /* PanModalNavigationController.swift in Sources */, + B9E8259F773D27BAA416DCDB /* PanModalPresentationController.swift in Sources */, + EB726BFFEE56C0BF9E060581 /* PanModalPresentationDelegate.swift in Sources */, + 0E391F2415A5726AC9E18186 /* PanModalKeyboardPresentable+Defaults.swift in Sources */, + 564E41966241D7803EA68C20 /* PanModalKeyboardPresentable.swift in Sources */, + 1D34D9B02EB1AC010D28A788 /* PanModalHeight.swift in Sources */, + 7F6A9D4296C19BBC01898E49 /* PanModalPresentable+Defaults.swift in Sources */, + A5E91380A4091F2092B662CE /* PanModalPresentable+LayoutHelpers.swift in Sources */, + DF004916923A0853BE2A6EF3 /* PanModalPresentable+UIViewController.swift in Sources */, + 4ADB47FF2175663ADCA39476 /* PanModalPresentable.swift in Sources */, + 3FE4AC79C0FFC08A763B73CA /* PanModalPresenter.swift in Sources */, + A7D3582C1ADA0E60361A9B30 /* UIViewController+PanModalPresenter.swift in Sources */, + BD2A2F384AA6A669BB094AFE /* DimmedView.swift in Sources */, + 847DF45F2EE236DC6632D86B /* PanContainerView.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 0668EADCA7021F53E887B1AD /* RC */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0.0; + VALIDATE_PRODUCT = YES; + }; + name = RC; + }; + 1D56DC7D6BC19BC32E163F99 /* Beta */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0.0; + VALIDATE_PRODUCT = YES; + }; + name = Beta; + }; + 22DDDC7256B72FA8475E139A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0.0; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 9F845F0EE0D93C7D3FF56572 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0.0; + }; + name = Debug; + }; + AFB1220559985510119E2D47 /* Beta */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + CLANG_ENABLE_OBJC_WEAK = NO; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO; + CODE_SIGN_IDENTITY = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PLATFORM_DIR)/Developer/Library/Frameworks", + ); + GCC_NO_COMMON_BLOCKS = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "SWIFT_PACKAGE=1", + ); + GCC_WARN_INHIBIT_ALL_WARNINGS = YES; + INFOPLIST_FILE = "Derived/InfoPlists/PanModal-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = PanModal; + PRODUCT_NAME = PanModal; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SUPPORTS_MACCATALYST = NO; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = ( + "$(inherited)", + SWIFT_PACKAGE, + ); + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_SUPPRESS_WARNINGS = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + USE_HEADERMAP = NO; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Beta; + }; + B2DA13120AF1D024E631DAC6 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + CLANG_ENABLE_OBJC_WEAK = NO; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO; + CODE_SIGN_IDENTITY = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PLATFORM_DIR)/Developer/Library/Frameworks", + ); + GCC_NO_COMMON_BLOCKS = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "SWIFT_PACKAGE=1", + ); + GCC_WARN_INHIBIT_ALL_WARNINGS = YES; + INFOPLIST_FILE = "Derived/InfoPlists/PanModal-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = PanModal; + PRODUCT_NAME = PanModal; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SUPPORTS_MACCATALYST = NO; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = ( + "$(inherited)", + SWIFT_PACKAGE, + ); + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_SUPPRESS_WARNINGS = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + USE_HEADERMAP = NO; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + F97D3E78614357A71CE33B7F /* RC */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + CLANG_ENABLE_OBJC_WEAK = NO; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO; + CODE_SIGN_IDENTITY = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PLATFORM_DIR)/Developer/Library/Frameworks", + ); + GCC_NO_COMMON_BLOCKS = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "SWIFT_PACKAGE=1", + ); + GCC_WARN_INHIBIT_ALL_WARNINGS = YES; + INFOPLIST_FILE = "Derived/InfoPlists/PanModal-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = PanModal; + PRODUCT_NAME = PanModal; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SUPPORTS_MACCATALYST = NO; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = ( + "$(inherited)", + SWIFT_PACKAGE, + ); + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_SUPPRESS_WARNINGS = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + USE_HEADERMAP = NO; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = RC; + }; + FE85DC51A522D595FA5E00E8 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + CLANG_ENABLE_OBJC_WEAK = NO; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO; + CODE_SIGN_IDENTITY = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PLATFORM_DIR)/Developer/Library/Frameworks", + ); + GCC_NO_COMMON_BLOCKS = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "SWIFT_PACKAGE=1", + ); + GCC_WARN_INHIBIT_ALL_WARNINGS = YES; + INFOPLIST_FILE = "Derived/InfoPlists/PanModal-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = PanModal; + PRODUCT_NAME = PanModal; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SUPPORTS_MACCATALYST = NO; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = ( + "$(inherited)", + DEBUG, + SWIFT_PACKAGE, + ); + SWIFT_COMPILATION_MODE = singlefile; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_SUPPRESS_WARNINGS = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + USE_HEADERMAP = NO; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1EF84CF17AB6EB3D75687471 /* Build configuration list for PBXNativeTarget "PanModal" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + AFB1220559985510119E2D47 /* Beta */, + FE85DC51A522D595FA5E00E8 /* Debug */, + F97D3E78614357A71CE33B7F /* RC */, + B2DA13120AF1D024E631DAC6 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + CCC9A83A9BFD2A0A523DC090 /* Build configuration list for PBXProject "PanModal" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1D56DC7D6BC19BC32E163F99 /* Beta */, + 9F845F0EE0D93C7D3FF56572 /* Debug */, + 0668EADCA7021F53E887B1AD /* RC */, + 22DDDC7256B72FA8475E139A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 51DD5472E1F398FE6B6A5302 /* Project object */; +} diff --git a/PanModal.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/PanModal.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/PanModal.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/PanModal/Controller/PanModalNavigationController.swift b/PanModal/Controller/PanModalNavigationController.swift new file mode 100644 index 00000000..41b6335b --- /dev/null +++ b/PanModal/Controller/PanModalNavigationController.swift @@ -0,0 +1,143 @@ +// +// PanModalNavigationController.swift +// PanModal +// +// Created by Semen Kologrivov on 07.07.2022. +// +import UIKit + +open class PanModalNavController: UINavigationController, PanModalPresentable { + + public var currentHeight: CGFloat = .zero + public var currentStateKeyboardIsShown = false + + public var presentViewController: (UIViewController & PanModalPresentable) { + guard let viewControllers = self.viewControllers.last as? (UIViewController & PanModalPresentable) else { + fatalError("impl top controller PanModalPresentable") + } + + return viewControllers + } + + open func updatePanModal(toState state: PanModalPresentationController.PresentationState = .longForm) { + let inset = self.panScrollable?.contentInset ?? .zero + + self.panModalSetNeedsLayoutUpdate() + self.panModalTransition(to: state) + + self.panScrollable?.contentInset = inset + } + +// MARK: - PanModalPresentable + open var panScrollable: UIScrollView? { + self.presentViewController.panScrollable + } + + open var topOffset: CGFloat { + self.presentViewController.topOffset + } + + open var longFormHeight: PanModalHeight { + guard let panScrollable = self.presentViewController as? PanModalKeyboardPresentable else { + return self.presentViewController.longFormHeight + } + + let height = panScrollable.contentWithKeyboardHeight + + if abs(height - self.currentHeight) < 5 { + return .contentHeight(self.currentHeight) + } + + self.currentHeight = height + + return .contentHeight(height) + } + + open var cornerRadius: CGFloat { + self.presentViewController.cornerRadius + } + + open var springDamping: CGFloat { + 1 + } + + open var transitionDuration: Double { + self.presentViewController.transitionDuration + } + + open var transitionAnimationOptions: UIView.AnimationOptions { + self.presentViewController.transitionAnimationOptions + } + + open var panModalBackgroundColor: UIColor { + self.presentViewController.panModalBackgroundColor + } + + open var dragIndicatorBackgroundColor: UIColor { + self.presentViewController.dragIndicatorBackgroundColor + } + + open var scrollIndicatorInsets: UIEdgeInsets { + self.presentViewController.scrollIndicatorInsets + } + + open var anchorModalToLongForm: Bool { + self.presentViewController.anchorModalToLongForm + } + + open var allowsExtendedPanScrolling: Bool { + self.presentViewController.allowsExtendedPanScrolling + } + + open var allowsDragToDismiss: Bool { + self.presentViewController.allowsDragToDismiss + } + + open var allowsTapToDismiss: Bool { + self.presentViewController.allowsTapToDismiss + } + + open var isUserInteractionEnabled: Bool { + self.presentViewController.isUserInteractionEnabled + } + + open var isHapticFeedbackEnabled: Bool { + self.presentViewController.isHapticFeedbackEnabled + } + + open var shouldRoundTopCorners: Bool { + self.presentViewController.shouldRoundTopCorners + } + + open var showDragIndicator: Bool { + self.presentViewController.showDragIndicator + } + + open func shouldRespond(to panModalGestureRecognizer: UIPanGestureRecognizer) -> Bool { + self.presentViewController.shouldRespond(to: panModalGestureRecognizer) + } + + open func willRespond(to panModalGestureRecognizer: UIPanGestureRecognizer) { + self.presentViewController.willRespond(to: panModalGestureRecognizer) + } + + open func shouldPrioritize(panModalGestureRecognizer: UIPanGestureRecognizer) -> Bool { + self.presentViewController.shouldPrioritize(panModalGestureRecognizer: panModalGestureRecognizer) + } + + open func shouldTransition(to state: PanModalPresentationController.PresentationState) -> Bool { + self.presentViewController.shouldTransition(to: state) + } + + open func willTransition(to state: PanModalPresentationController.PresentationState) { + self.presentViewController.willTransition(to: state) + } + + open func panModalWillDismiss() { + self.presentViewController.panModalWillDismiss() + } + + open func panModalDidDismiss() { + self.presentViewController.panModalDidDismiss() + } +} diff --git a/PanModal/Controller/PanModalPresentationController.swift b/PanModal/Controller/PanModalPresentationController.swift index 11fb2a6e..c986e796 100644 --- a/PanModal/Controller/PanModalPresentationController.swift +++ b/PanModal/Controller/PanModalPresentationController.swift @@ -67,6 +67,8 @@ open class PanModalPresentationController: UIPresentationController { */ private var scrollViewYOffset: CGFloat = 0.0 + private var scrollView: UIScrollView? + /** An observer for the scroll view content offset */ @@ -84,6 +86,8 @@ open class PanModalPresentationController: UIPresentationController { */ private var longFormYPosition: CGFloat = 0 + private var enableCustomInteractiveKeyboard: Bool = true + /** Determine anchored Y postion based on the `anchorModalToLongForm` flag */ @@ -219,7 +223,7 @@ open class PanModalPresentationController: UIPresentationController { override public func dismissalTransitionDidEnd(_ completed: Bool) { if !completed { return } - + presentable?.panModalDidDismiss() } @@ -303,7 +307,6 @@ public extension PanModalPresentationController { configureViewLayout() adjustPresentedViewFrame() observe(scrollView: presentable?.panScrollable) - configureScrollViewInsets() } } @@ -370,7 +373,7 @@ private extension PanModalPresentationController { let adjustedSize = CGSize(width: frame.size.width, height: frame.size.height - anchoredYPosition) let panFrame = panContainerView.frame panContainerView.frame.size = frame.size - + if ![shortFormYPosition, longFormYPosition].contains(panFrame.origin.y) { // if the container is already in the correct position, no need to adjust positioning // (rotations & size changes cause positioning to be out of sync) @@ -429,6 +432,8 @@ private extension PanModalPresentationController { longFormYPosition = layoutPresentable.longFormYPos anchorModalToLongForm = layoutPresentable.anchorModalToLongForm extendsPanScrolling = layoutPresentable.allowsExtendedPanScrolling + scrollView = layoutPresentable.panScrollable + enableCustomInteractiveKeyboard = layoutPresentable.enableCustomInteractiveKeyboard containerView?.isUserInteractionEnabled = layoutPresentable.isUserInteractionEnabled } @@ -582,11 +587,41 @@ private extension PanModalPresentationController { if presentedView.frame.origin.y < longFormYPosition { yDisplacement /= 2.0 } + + var contentOffset = scrollView?.contentOffset ?? .zero adjust(toYPosition: presentedView.frame.origin.y + yDisplacement) + if enableCustomInteractiveKeyboard { + moveKeyboardView(displacement: yDisplacement) + } + panGestureRecognizer.setTranslation(.zero, in: presentedView) } + func moveKeyboardView(displacement: CGFloat) { + let windows = UIApplication.shared.windows + + if let keyboardWindow = windows + .first(where: { NSStringFromClass($0.classForCoder) == "UIRemoteKeyboardWindow" }) { + + var frame = keyboardWindow.frame ?? .zero + frame.origin.y = max(displacement + frame.origin.y, .zero) + + keyboardWindow.frame = frame ?? .zero + + let accessoryView = windows + .first(where: { NSStringFromClass($0.classForCoder) == "UITextEffectsWindow" }) + + var accessoryFrame = accessoryView?.frame ?? .zero + accessoryFrame.origin.y = max( + displacement + (accessoryFrame.origin.y ?? .zero), + .zero + ) + + accessoryView?.frame = accessoryFrame ?? .zero + } + } + /** Determines if we should fail the gesture recognizer based on certain conditions @@ -643,6 +678,11 @@ private extension PanModalPresentationController { PanModalAnimator.animate({ [weak self] in self?.adjust(toYPosition: yPos) self?.isPresentedViewAnimating = true + + if self?.enableCustomInteractiveKeyboard ?? false { + self?.moveKeyboardView(displacement: -.greatestFiniteMagnitude) + } + }, config: presentable) { [weak self] didComplete in self?.isPresentedViewAnimating = !didComplete } @@ -653,7 +693,7 @@ private extension PanModalPresentationController { */ func adjust(toYPosition yPos: CGFloat) { presentedView.frame.origin.y = max(yPos, anchoredYPosition) - + guard presentedView.frame.origin.y > shortFormYPosition else { backgroundView.dimState = .max return @@ -828,7 +868,7 @@ extension PanModalPresentationController: UIGestureRecognizerDelegate { is the pan scrollable view */ public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool { - return otherGestureRecognizer.view == presentable?.panScrollable + return true//otherGestureRecognizer.view == presentable?.panScrollable } } diff --git a/PanModal/KeyboardPresentable/PanModalKeyboardPresentable+Defaults.swift b/PanModal/KeyboardPresentable/PanModalKeyboardPresentable+Defaults.swift new file mode 100644 index 00000000..d08a8fd4 --- /dev/null +++ b/PanModal/KeyboardPresentable/PanModalKeyboardPresentable+Defaults.swift @@ -0,0 +1,31 @@ +// +// PanModalKeyboardPresentable+Defaults.swift +// PanModal +// +// Created by Semen Kologrivov on 07.07.2022. +// + +import UIKit + +public extension PanModalKeyboardPresentable where Self: UIViewController { + + var extrasHeight: CGFloat { + .zero + } + + var minimumHeight: CGFloat { + .zero + } + + var keyboardScrollView: UIScrollView? { + self.panScrollable + } + + var contentWithKeyboardHeight: CGFloat { + let height = (self.keyboardScrollView?.contentSize.height ?? .zero) + + (self.titleView?.frame.height ?? .zero) + + self.keyboardHeight + + self.extrasHeight + return max(height, self.minimumHeight) + } +} diff --git a/PanModal/KeyboardPresentable/PanModalKeyboardPresentable.swift b/PanModal/KeyboardPresentable/PanModalKeyboardPresentable.swift new file mode 100644 index 00000000..897a076e --- /dev/null +++ b/PanModal/KeyboardPresentable/PanModalKeyboardPresentable.swift @@ -0,0 +1,20 @@ +// +// PanModalKeyboardPresentable.swift +// PanModal +// +// Created by Semen Kologrivov on 07.07.2022. +// + +import UIKit + +public protocol PanModalKeyboardPresentable: PanModalPresentable { + + var keyboardIsShown: Bool { get } + + var minimumHeight: CGFloat { get } + var keyboardHeight: CGFloat { get } + var extrasHeight: CGFloat { get } + var contentWithKeyboardHeight: CGFloat { get } + + var keyboardScrollView: UIScrollView? { get } +} diff --git a/PanModal/Presentable/PanModalPresentable+Defaults.swift b/PanModal/Presentable/PanModalPresentable+Defaults.swift index 76a0679f..11163896 100644 --- a/PanModal/Presentable/PanModalPresentable+Defaults.swift +++ b/PanModal/Presentable/PanModalPresentable+Defaults.swift @@ -64,6 +64,10 @@ public extension PanModalPresentable where Self: UIViewController { return true } + var enableCustomInteractiveKeyboard: Bool { + return true + } + var allowsExtendedPanScrolling: Bool { guard let scrollView = panScrollable @@ -124,5 +128,26 @@ public extension PanModalPresentable where Self: UIViewController { func panModalDidDismiss() { } + + var titleView: UIView? { + nil + } + + func updatePanModal() { + self.updatePanModal(toState: .longForm) + } + + func updatePanModal(toState state: PanModalPresentationController.PresentationState) { + guard let panNavigation = self.navigationController as? PanModalNavController else { + let inset = self.panScrollable?.contentInset ?? .zero + + self.panModalSetNeedsLayoutUpdate() + self.panModalTransition(to: state) + + self.panScrollable?.contentInset = inset + return + } + panNavigation.updatePanModal(toState: state) + } } #endif diff --git a/PanModal/Presentable/PanModalPresentable+UIViewController.swift b/PanModal/Presentable/PanModalPresentable+UIViewController.swift index 8de82fd5..075c4ea5 100644 --- a/PanModal/Presentable/PanModalPresentable+UIViewController.swift +++ b/PanModal/Presentable/PanModalPresentable+UIViewController.swift @@ -59,5 +59,18 @@ public extension PanModalPresentable where Self: UIViewController { PanModalAnimator.animate(animationBlock, config: self, completion) } + func panModalPresentWithNavController(parentVC: UIViewController?) { + let navController = PanModalNavController(rootViewController: self) + parentVC?.presentPanModal(navController) + } + + func panModalPush(parentVC: UIViewController?, animated: Bool = false) { + let navController = parentVC?.navigationController as? PanModalNavController + + DispatchQueue.main.async { + navController?.pushViewController(self, animated: animated) + } + } + } #endif diff --git a/PanModal/Presentable/PanModalPresentable.swift b/PanModal/Presentable/PanModalPresentable.swift index 76c15015..55f61e4b 100644 --- a/PanModal/Presentable/PanModalPresentable.swift +++ b/PanModal/Presentable/PanModalPresentable.swift @@ -126,6 +126,7 @@ public protocol PanModalPresentable: AnyObject { */ var allowsExtendedPanScrolling: Bool { get } + var enableCustomInteractiveKeyboard: Bool { get } /** A flag to determine if dismissal should be initiated when swiping down on the presented view. @@ -233,5 +234,11 @@ public protocol PanModalPresentable: AnyObject { Default value is an empty implementation. */ func panModalDidDismiss() + + var titleView: UIView? { get } + + func updatePanModal() + + func updatePanModal(toState state: PanModalPresentationController.PresentationState) } #endif