diff --git a/Example/Podfile b/Example/Podfile new file mode 100644 index 0000000..e47dc1d --- /dev/null +++ b/Example/Podfile @@ -0,0 +1,5 @@ +use_frameworks! + +target 'liquid-swipe_Example' do + pod 'liquid-swipe', :path => '../' +end diff --git a/Example/liquid-swipe.xcodeproj/project.pbxproj b/Example/liquid-swipe.xcodeproj/project.pbxproj new file mode 100644 index 0000000..9d1bf37 --- /dev/null +++ b/Example/liquid-swipe.xcodeproj/project.pbxproj @@ -0,0 +1,412 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 04007A44A771CD16080686D7 /* Pods_liquid_swipe_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 166F519E68E496ADEDD4CAF8 /* Pods_liquid_swipe_Example.framework */; }; + 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; }; + 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; }; + 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; }; + 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; }; + CE4F1B3021E12DA0005D390E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CE4F1B2F21E12DA0005D390E /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 00D68FE080F32A5BA76177B7 /* Pods_liquid_swipe_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_liquid_swipe_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 166F519E68E496ADEDD4CAF8 /* Pods_liquid_swipe_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_liquid_swipe_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 550584F37CE3B6E0ACC04758 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; + 607FACD01AFB9204008FA782 /* liquid-swipe_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "liquid-swipe_Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 607FACD71AFB9204008FA782 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 607FACDA1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + 7B87C4D9A5AACEB5D267C3CA /* Pods-liquid-swipe_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-liquid-swipe_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-liquid-swipe_Example/Pods-liquid-swipe_Example.debug.xcconfig"; sourceTree = ""; }; + B04044F3DD70349A7E51AA04 /* Pods-liquid-swipe_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-liquid-swipe_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-liquid-swipe_Tests/Pods-liquid-swipe_Tests.debug.xcconfig"; sourceTree = ""; }; + BB102C476AA5E9F45EF60868 /* liquid-swipe.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = "liquid-swipe.podspec"; path = "../liquid-swipe.podspec"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + C099E5B39D14266F35B0662A /* Pods-liquid-swipe_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-liquid-swipe_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-liquid-swipe_Example/Pods-liquid-swipe_Example.release.xcconfig"; sourceTree = ""; }; + CB2F6D9070038B2A7E56DD49 /* Pods-liquid-swipe_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-liquid-swipe_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-liquid-swipe_Tests/Pods-liquid-swipe_Tests.release.xcconfig"; sourceTree = ""; }; + CE4F1B2F21E12DA0005D390E /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; + D91B2BF93306E5BC7A4D90D1 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 607FACCD1AFB9204008FA782 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 04007A44A771CD16080686D7 /* Pods_liquid_swipe_Example.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 607FACC71AFB9204008FA782 = { + isa = PBXGroup; + children = ( + 607FACF51AFB993E008FA782 /* Podspec Metadata */, + 607FACD21AFB9204008FA782 /* Example for liquid-swipe */, + 607FACD11AFB9204008FA782 /* Products */, + ECCEFC1CE326C8F4E1965E8E /* Pods */, + C92C294964A3158D54D88280 /* Frameworks */, + ); + sourceTree = ""; + }; + 607FACD11AFB9204008FA782 /* Products */ = { + isa = PBXGroup; + children = ( + 607FACD01AFB9204008FA782 /* liquid-swipe_Example.app */, + ); + name = Products; + sourceTree = ""; + }; + 607FACD21AFB9204008FA782 /* Example for liquid-swipe */ = { + isa = PBXGroup; + children = ( + 607FACD51AFB9204008FA782 /* AppDelegate.swift */, + 607FACD71AFB9204008FA782 /* ViewController.swift */, + 607FACD91AFB9204008FA782 /* Main.storyboard */, + 607FACDC1AFB9204008FA782 /* Images.xcassets */, + 607FACD31AFB9204008FA782 /* Supporting Files */, + ); + name = "Example for liquid-swipe"; + path = "liquid-swipe"; + sourceTree = ""; + }; + 607FACD31AFB9204008FA782 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + CE4F1B2F21E12DA0005D390E /* LaunchScreen.storyboard */, + 607FACD41AFB9204008FA782 /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 607FACF51AFB993E008FA782 /* Podspec Metadata */ = { + isa = PBXGroup; + children = ( + BB102C476AA5E9F45EF60868 /* liquid-swipe.podspec */, + D91B2BF93306E5BC7A4D90D1 /* README.md */, + 550584F37CE3B6E0ACC04758 /* LICENSE */, + ); + name = "Podspec Metadata"; + sourceTree = ""; + }; + C92C294964A3158D54D88280 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 166F519E68E496ADEDD4CAF8 /* Pods_liquid_swipe_Example.framework */, + 00D68FE080F32A5BA76177B7 /* Pods_liquid_swipe_Tests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + ECCEFC1CE326C8F4E1965E8E /* Pods */ = { + isa = PBXGroup; + children = ( + 7B87C4D9A5AACEB5D267C3CA /* Pods-liquid-swipe_Example.debug.xcconfig */, + C099E5B39D14266F35B0662A /* Pods-liquid-swipe_Example.release.xcconfig */, + B04044F3DD70349A7E51AA04 /* Pods-liquid-swipe_Tests.debug.xcconfig */, + CB2F6D9070038B2A7E56DD49 /* Pods-liquid-swipe_Tests.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 607FACCF1AFB9204008FA782 /* liquid-swipe_Example */ = { + isa = PBXNativeTarget; + buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "liquid-swipe_Example" */; + buildPhases = ( + 2C693F0DB61DE1500109F1D2 /* [CP] Check Pods Manifest.lock */, + 607FACCC1AFB9204008FA782 /* Sources */, + 607FACCD1AFB9204008FA782 /* Frameworks */, + 607FACCE1AFB9204008FA782 /* Resources */, + 1B6E09F80165C7EE89697BA0 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "liquid-swipe_Example"; + productName = "liquid-swipe"; + productReference = 607FACD01AFB9204008FA782 /* liquid-swipe_Example.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 607FACC81AFB9204008FA782 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0830; + LastUpgradeCheck = 1010; + ORGANIZATIONNAME = CocoaPods; + TargetAttributes = { + 607FACCF1AFB9204008FA782 = { + CreatedOnToolsVersion = 6.3.1; + DevelopmentTeam = SK7A63GXF6; + LastSwiftMigration = 1010; + }; + }; + }; + buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "liquid-swipe" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 607FACC71AFB9204008FA782; + productRefGroup = 607FACD11AFB9204008FA782 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 607FACCF1AFB9204008FA782 /* liquid-swipe_Example */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 607FACCE1AFB9204008FA782 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CE4F1B3021E12DA0005D390E /* LaunchScreen.storyboard in Resources */, + 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */, + 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 1B6E09F80165C7EE89697BA0 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-liquid-swipe_Example/Pods-liquid-swipe_Example-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/liquid-swipe/liquid_swipe.framework", + "${BUILT_PRODUCTS_DIR}/pop/pop.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/liquid_swipe.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/pop.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-liquid-swipe_Example/Pods-liquid-swipe_Example-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 2C693F0DB61DE1500109F1D2 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-liquid-swipe_Example-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 607FACCC1AFB9204008FA782 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */, + 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 607FACD91AFB9204008FA782 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 607FACDA1AFB9204008FA782 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 607FACED1AFB9204008FA782 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = 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_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_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + 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; + IPHONEOS_DEPLOYMENT_TARGET = 9.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 607FACEE1AFB9204008FA782 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = 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_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_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + 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; + IPHONEOS_DEPLOYMENT_TARGET = 9.3; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 607FACF01AFB9204008FA782 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7B87C4D9A5AACEB5D267C3CA /* Pods-liquid-swipe_Example.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = SK7A63GXF6; + INFOPLIST_FILE = "liquid-swipe/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MODULE_NAME = ExampleApp; + PRODUCT_BUNDLE_IDENTIFIER = com.cuberto.components.liquidswipe; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + }; + name = Debug; + }; + 607FACF11AFB9204008FA782 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C099E5B39D14266F35B0662A /* Pods-liquid-swipe_Example.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = SK7A63GXF6; + INFOPLIST_FILE = "liquid-swipe/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MODULE_NAME = ExampleApp; + PRODUCT_BUNDLE_IDENTIFIER = com.cuberto.components.liquidswipe; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "liquid-swipe" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 607FACED1AFB9204008FA782 /* Debug */, + 607FACEE1AFB9204008FA782 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "liquid-swipe_Example" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 607FACF01AFB9204008FA782 /* Debug */, + 607FACF11AFB9204008FA782 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 607FACC81AFB9204008FA782 /* Project object */; +} diff --git a/Example/liquid-swipe.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Example/liquid-swipe.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..385805a --- /dev/null +++ b/Example/liquid-swipe.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Example/liquid-swipe.xcodeproj/xcshareddata/xcschemes/liquid-swipe-Example.xcscheme b/Example/liquid-swipe.xcodeproj/xcshareddata/xcschemes/liquid-swipe-Example.xcscheme new file mode 100644 index 0000000..261e101 --- /dev/null +++ b/Example/liquid-swipe.xcodeproj/xcshareddata/xcschemes/liquid-swipe-Example.xcscheme @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/liquid-swipe.xcworkspace/contents.xcworkspacedata b/Example/liquid-swipe.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..fa9613c --- /dev/null +++ b/Example/liquid-swipe.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/Example/liquid-swipe.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/liquid-swipe.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Example/liquid-swipe.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Example/liquid-swipe/AppDelegate.swift b/Example/liquid-swipe/AppDelegate.swift new file mode 100644 index 0000000..d67a002 --- /dev/null +++ b/Example/liquid-swipe/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// liquid-swipe +// +// Created by askopin@gmail.com on 01/06/2019. +// Copyright (c) 2019 askopin@gmail.com. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(_ application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/Example/liquid-swipe/Base.lproj/Main.storyboard b/Example/liquid-swipe/Base.lproj/Main.storyboard new file mode 100644 index 0000000..1abbafe --- /dev/null +++ b/Example/liquid-swipe/Base.lproj/Main.storyboard @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/liquid-swipe/Images.xcassets/AppIcon.appiconset/Contents.json b/Example/liquid-swipe/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..955beb7 --- /dev/null +++ b/Example/liquid-swipe/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,103 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon_60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon_60@3x.png", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon_76.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon_76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon_83@2x.png", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/liquid-swipe/Images.xcassets/AppIcon.appiconset/Icon_60@2x.png b/Example/liquid-swipe/Images.xcassets/AppIcon.appiconset/Icon_60@2x.png new file mode 100644 index 0000000..08b120f Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/AppIcon.appiconset/Icon_60@2x.png differ diff --git a/Example/liquid-swipe/Images.xcassets/AppIcon.appiconset/Icon_60@3x.png b/Example/liquid-swipe/Images.xcassets/AppIcon.appiconset/Icon_60@3x.png new file mode 100644 index 0000000..0fd4ca2 Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/AppIcon.appiconset/Icon_60@3x.png differ diff --git a/Example/liquid-swipe/Images.xcassets/AppIcon.appiconset/Icon_76.png b/Example/liquid-swipe/Images.xcassets/AppIcon.appiconset/Icon_76.png new file mode 100644 index 0000000..ebcc9f5 Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/AppIcon.appiconset/Icon_76.png differ diff --git a/Example/liquid-swipe/Images.xcassets/AppIcon.appiconset/Icon_76@2x.png b/Example/liquid-swipe/Images.xcassets/AppIcon.appiconset/Icon_76@2x.png new file mode 100644 index 0000000..e216cf7 Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/AppIcon.appiconset/Icon_76@2x.png differ diff --git a/Example/liquid-swipe/Images.xcassets/AppIcon.appiconset/Icon_83@2x.png b/Example/liquid-swipe/Images.xcassets/AppIcon.appiconset/Icon_83@2x.png new file mode 100644 index 0000000..d634cf8 Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/AppIcon.appiconset/Icon_83@2x.png differ diff --git a/Example/liquid-swipe/Images.xcassets/Contents.json b/Example/liquid-swipe/Images.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/Example/liquid-swipe/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/liquid-swipe/Images.xcassets/cuberto-logo.imageset/Contents.json b/Example/liquid-swipe/Images.xcassets/cuberto-logo.imageset/Contents.json new file mode 100644 index 0000000..cf0fd58 --- /dev/null +++ b/Example/liquid-swipe/Images.xcassets/cuberto-logo.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "cuberto-logo.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "cuberto-logo@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "cuberto-logo@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/liquid-swipe/Images.xcassets/cuberto-logo.imageset/cuberto-logo.png b/Example/liquid-swipe/Images.xcassets/cuberto-logo.imageset/cuberto-logo.png new file mode 100644 index 0000000..dd33fa3 Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/cuberto-logo.imageset/cuberto-logo.png differ diff --git a/Example/liquid-swipe/Images.xcassets/cuberto-logo.imageset/cuberto-logo@2x.png b/Example/liquid-swipe/Images.xcassets/cuberto-logo.imageset/cuberto-logo@2x.png new file mode 100644 index 0000000..c0d96dd Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/cuberto-logo.imageset/cuberto-logo@2x.png differ diff --git a/Example/liquid-swipe/Images.xcassets/cuberto-logo.imageset/cuberto-logo@3x.png b/Example/liquid-swipe/Images.xcassets/cuberto-logo.imageset/cuberto-logo@3x.png new file mode 100644 index 0000000..785b76a Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/cuberto-logo.imageset/cuberto-logo@3x.png differ diff --git a/Example/liquid-swipe/Images.xcassets/firstPageImage.imageset/Contents.json b/Example/liquid-swipe/Images.xcassets/firstPageImage.imageset/Contents.json new file mode 100644 index 0000000..bb122c8 --- /dev/null +++ b/Example/liquid-swipe/Images.xcassets/firstPageImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "firstPageImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "firstPageImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "firstPageImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/liquid-swipe/Images.xcassets/firstPageImage.imageset/firstPageImage.png b/Example/liquid-swipe/Images.xcassets/firstPageImage.imageset/firstPageImage.png new file mode 100644 index 0000000..ef399f4 Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/firstPageImage.imageset/firstPageImage.png differ diff --git a/Example/liquid-swipe/Images.xcassets/firstPageImage.imageset/firstPageImage@2x.png b/Example/liquid-swipe/Images.xcassets/firstPageImage.imageset/firstPageImage@2x.png new file mode 100644 index 0000000..f26bdb9 Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/firstPageImage.imageset/firstPageImage@2x.png differ diff --git a/Example/liquid-swipe/Images.xcassets/firstPageImage.imageset/firstPageImage@3x.png b/Example/liquid-swipe/Images.xcassets/firstPageImage.imageset/firstPageImage@3x.png new file mode 100644 index 0000000..5c5b151 Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/firstPageImage.imageset/firstPageImage@3x.png differ diff --git a/Example/liquid-swipe/Images.xcassets/firstPagePager.imageset/Contents.json b/Example/liquid-swipe/Images.xcassets/firstPagePager.imageset/Contents.json new file mode 100644 index 0000000..66cec04 --- /dev/null +++ b/Example/liquid-swipe/Images.xcassets/firstPagePager.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "firstPagePager.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "firstPagePager@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "firstPagePager@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/liquid-swipe/Images.xcassets/firstPagePager.imageset/firstPagePager.png b/Example/liquid-swipe/Images.xcassets/firstPagePager.imageset/firstPagePager.png new file mode 100644 index 0000000..3b4f87d Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/firstPagePager.imageset/firstPagePager.png differ diff --git a/Example/liquid-swipe/Images.xcassets/firstPagePager.imageset/firstPagePager@2x.png b/Example/liquid-swipe/Images.xcassets/firstPagePager.imageset/firstPagePager@2x.png new file mode 100644 index 0000000..09835fb Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/firstPagePager.imageset/firstPagePager@2x.png differ diff --git a/Example/liquid-swipe/Images.xcassets/firstPagePager.imageset/firstPagePager@3x.png b/Example/liquid-swipe/Images.xcassets/firstPagePager.imageset/firstPagePager@3x.png new file mode 100644 index 0000000..b4ce104 Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/firstPagePager.imageset/firstPagePager@3x.png differ diff --git a/Example/liquid-swipe/Images.xcassets/page1.imageset/Contents.json b/Example/liquid-swipe/Images.xcassets/page1.imageset/Contents.json new file mode 100644 index 0000000..17827f8 --- /dev/null +++ b/Example/liquid-swipe/Images.xcassets/page1.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "page1.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "page1@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "page1@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/liquid-swipe/Images.xcassets/page1.imageset/page1.png b/Example/liquid-swipe/Images.xcassets/page1.imageset/page1.png new file mode 100644 index 0000000..b1f541e Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/page1.imageset/page1.png differ diff --git a/Example/liquid-swipe/Images.xcassets/page1.imageset/page1@2x.png b/Example/liquid-swipe/Images.xcassets/page1.imageset/page1@2x.png new file mode 100644 index 0000000..ea33ed8 Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/page1.imageset/page1@2x.png differ diff --git a/Example/liquid-swipe/Images.xcassets/page1.imageset/page1@3x.png b/Example/liquid-swipe/Images.xcassets/page1.imageset/page1@3x.png new file mode 100644 index 0000000..16b708f Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/page1.imageset/page1@3x.png differ diff --git a/Example/liquid-swipe/Images.xcassets/page2.imageset/Contents.json b/Example/liquid-swipe/Images.xcassets/page2.imageset/Contents.json new file mode 100644 index 0000000..3b795db --- /dev/null +++ b/Example/liquid-swipe/Images.xcassets/page2.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "page2.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "page2@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "page2@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/liquid-swipe/Images.xcassets/page2.imageset/page2.png b/Example/liquid-swipe/Images.xcassets/page2.imageset/page2.png new file mode 100644 index 0000000..1e892cf Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/page2.imageset/page2.png differ diff --git a/Example/liquid-swipe/Images.xcassets/page2.imageset/page2@2x.png b/Example/liquid-swipe/Images.xcassets/page2.imageset/page2@2x.png new file mode 100644 index 0000000..862965d Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/page2.imageset/page2@2x.png differ diff --git a/Example/liquid-swipe/Images.xcassets/page2.imageset/page2@3x.png b/Example/liquid-swipe/Images.xcassets/page2.imageset/page2@3x.png new file mode 100644 index 0000000..42bce24 Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/page2.imageset/page2@3x.png differ diff --git a/Example/liquid-swipe/Images.xcassets/secondPageImage.imageset/Contents.json b/Example/liquid-swipe/Images.xcassets/secondPageImage.imageset/Contents.json new file mode 100644 index 0000000..b464d60 --- /dev/null +++ b/Example/liquid-swipe/Images.xcassets/secondPageImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "secondPageImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "secondPageImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "secondPageImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/liquid-swipe/Images.xcassets/secondPageImage.imageset/secondPageImage.png b/Example/liquid-swipe/Images.xcassets/secondPageImage.imageset/secondPageImage.png new file mode 100644 index 0000000..4149caa Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/secondPageImage.imageset/secondPageImage.png differ diff --git a/Example/liquid-swipe/Images.xcassets/secondPageImage.imageset/secondPageImage@2x.png b/Example/liquid-swipe/Images.xcassets/secondPageImage.imageset/secondPageImage@2x.png new file mode 100644 index 0000000..2aec73e Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/secondPageImage.imageset/secondPageImage@2x.png differ diff --git a/Example/liquid-swipe/Images.xcassets/secondPageImage.imageset/secondPageImage@3x.png b/Example/liquid-swipe/Images.xcassets/secondPageImage.imageset/secondPageImage@3x.png new file mode 100644 index 0000000..04a9fa8 Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/secondPageImage.imageset/secondPageImage@3x.png differ diff --git a/Example/liquid-swipe/Images.xcassets/secondPagePager.imageset/Contents.json b/Example/liquid-swipe/Images.xcassets/secondPagePager.imageset/Contents.json new file mode 100644 index 0000000..f6289a4 --- /dev/null +++ b/Example/liquid-swipe/Images.xcassets/secondPagePager.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "secondPagePager.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "secondPagePager@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "secondPagePager@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/liquid-swipe/Images.xcassets/secondPagePager.imageset/secondPagePager.png b/Example/liquid-swipe/Images.xcassets/secondPagePager.imageset/secondPagePager.png new file mode 100644 index 0000000..a6ee98c Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/secondPagePager.imageset/secondPagePager.png differ diff --git a/Example/liquid-swipe/Images.xcassets/secondPagePager.imageset/secondPagePager@2x.png b/Example/liquid-swipe/Images.xcassets/secondPagePager.imageset/secondPagePager@2x.png new file mode 100644 index 0000000..7b8854f Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/secondPagePager.imageset/secondPagePager@2x.png differ diff --git a/Example/liquid-swipe/Images.xcassets/secondPagePager.imageset/secondPagePager@3x.png b/Example/liquid-swipe/Images.xcassets/secondPagePager.imageset/secondPagePager@3x.png new file mode 100644 index 0000000..526af63 Binary files /dev/null and b/Example/liquid-swipe/Images.xcassets/secondPagePager.imageset/secondPagePager@3x.png differ diff --git a/Example/liquid-swipe/Info.plist b/Example/liquid-swipe/Info.plist new file mode 100644 index 0000000..cecc25a --- /dev/null +++ b/Example/liquid-swipe/Info.plist @@ -0,0 +1,41 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + Liquid Swipe + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + + + diff --git a/Example/liquid-swipe/LaunchScreen.storyboard b/Example/liquid-swipe/LaunchScreen.storyboard new file mode 100644 index 0000000..3c22a11 --- /dev/null +++ b/Example/liquid-swipe/LaunchScreen.storyboard @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/liquid-swipe/ViewController.swift b/Example/liquid-swipe/ViewController.swift new file mode 100644 index 0000000..1614f8a --- /dev/null +++ b/Example/liquid-swipe/ViewController.swift @@ -0,0 +1,54 @@ +// +// ViewController.swift +// elasticOnboard +// +// Created by Anton Skopin on 28/12/2018. +// Copyright © 2018 cuberto. All rights reserved. +// + +import UIKit +import liquid_swipe + +class ColoredController: UIViewController { + var viewColor: UIColor = .white { + didSet { + viewIfLoaded?.backgroundColor = viewColor + } + } + + override func viewDidLoad() { + super.viewDidLoad() + view.backgroundColor = viewColor + } +} + +class ViewController: LiquidSwipeContainerController, LiquidSwipeContainerDataSource { + + var viewControllers: [UIViewController] = { + let firstPageVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "page1") + let secondPageVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "page2") + var controllers: [UIViewController] = [firstPageVC, secondPageVC] + let vcColors: [UIColor] = [#colorLiteral(red: 0.3647058904, green: 0.06666667014, blue: 0.9686274529, alpha: 1),#colorLiteral(red: 1, green: 0.3529352546, blue: 0.2339158952, alpha: 1),#colorLiteral(red: 0.1215686277, green: 0.01176470611, blue: 0.4235294163, alpha: 1),#colorLiteral(red: 0.3411764801, green: 0.6235294342, blue: 0.1686274558, alpha: 1)] + controllers.append(contentsOf: vcColors.map { + let vc = ColoredController() + vc.viewColor = $0 + return vc + }) + return controllers + }() + + override func viewDidLoad() { + super.viewDidLoad() + datasource = self + } + + func numberOfControllersInLiquidSwipeContainer(_ liquidSwipeContainer: LiquidSwipeContainerController) -> Int { + return viewControllers.count + } + + func liquidSwipeContainer(_ liquidSwipeContainer: LiquidSwipeContainerController, viewControllerAtIndex index: Int) -> UIViewController { + return viewControllers[index] + } + +} + diff --git a/LICENSE b/LICENSE index a3e96d5..130c5a5 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,4 @@ -MIT License - -Copyright (c) 2018 Cuberto +Copyright (c) 2019 Cuberto Design Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -9,13 +7,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md index fa4f4da..f320016 100644 --- a/README.md +++ b/README.md @@ -1 +1,39 @@ -# liquid-swipe \ No newline at end of file +# liquid-swipe + +[![GitHub license](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://raw.githubusercontent.com/Cuberto/liquid-swipe/master/LICENSE) +[![CocoaPods](https://img.shields.io/cocoapods/v/CBFlashyTabBarController.svg)](http://cocoapods.org/pods/liquid-swiper) +[![Swift 4.2](https://img.shields.io/badge/Swift-4.2-green.svg?style=flat)](https://developer.apple.com/swift/) + + +## Example + +To run the example project, clone the repo, and run `pod install` from the Example directory first. + +## Requirements + +- iOS 9.3+ +- Xcode 10 + +## Installation + +liquid-swipe is available through [CocoaPods](https://cocoapods.org). To install +it, simply add the following line to your Podfile: + +```ruby +pod 'liquid-swipe' +``` +Then run `pod install`. + +## Usage + +Instantiate `LiquidSwipeContainerController` from storyboard or from code and set properly configured datasource +The data source for a controller is responsible for providing the content view controllers on demand and must conform to the `LiquidSwipeContainerDataSource` +Container delegate can be used for monitoring conent changes + +## Author + +Cuberto Design, info@cuberto.com + +## License + +liquid-swipe is available under the MIT license. See the LICENSE file for more info. diff --git a/_Pods.xcodeproj b/_Pods.xcodeproj new file mode 120000 index 0000000..3c5a8e7 --- /dev/null +++ b/_Pods.xcodeproj @@ -0,0 +1 @@ +Example/Pods/Pods.xcodeproj \ No newline at end of file diff --git a/liquid-swipe.podspec b/liquid-swipe.podspec new file mode 100644 index 0000000..54ab1b5 --- /dev/null +++ b/liquid-swipe.podspec @@ -0,0 +1,40 @@ +# +# Be sure to run `pod lib lint liquid-swipe.podspec' to ensure this is a +# valid spec before submitting. +# +# Any lines starting with a # are optional, but their use is encouraged +# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html +# + +Pod::Spec.new do |s| + s.name = 'liquid-swipe' + s.version = '0.7.0' + s.summary = 'An page conroller with liquid animation' + +# This description is used to generate tags and improve search results. +# * Think: What does it do? Why did you write it? What is the focus? +# * Try to keep it short, snappy and to the point. +# * Write the description between the DESC delimiters below. +# * Finally, don't worry about the indent, CocoaPods strips it! + +# s.description = <<-DESC +#TODO: Add long description of the pod here. +# DESC + + s.homepage = 'https://github.com/askopin@gmail.com/liquid-swipe' + # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' + s.license = { :type => 'MIT', :file => 'LICENSE' } + s.author = { 'askopin@gmail.com' => 'askopin@gmail.com' } + s.source = { :git => 'https://github.com/Cuberto/liquid-swipe.git', :tag => s.version.to_s } + s.social_media_url = 'https://twitter.com/cuberto' + + s.ios.deployment_target = '9.3' + + s.source_files = 'liquid-swipe/Classes/**/*' + + s.resource_bundles = { + 'liquid-swipe' => ['liquid-swipe/Assets/*.png'] + } + + s.dependency 'pop', '~> 1.0' +end diff --git a/liquid-swipe/Assets/.gitkeep b/liquid-swipe/Assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/liquid-swipe/Assets/btnNext.png b/liquid-swipe/Assets/btnNext.png new file mode 100644 index 0000000..18a9932 Binary files /dev/null and b/liquid-swipe/Assets/btnNext.png differ diff --git a/liquid-swipe/Assets/btnNext@2x.png b/liquid-swipe/Assets/btnNext@2x.png new file mode 100644 index 0000000..177ca67 Binary files /dev/null and b/liquid-swipe/Assets/btnNext@2x.png differ diff --git a/liquid-swipe/Assets/btnNext@3x.png b/liquid-swipe/Assets/btnNext@3x.png new file mode 100644 index 0000000..c889d67 Binary files /dev/null and b/liquid-swipe/Assets/btnNext@3x.png differ diff --git a/liquid-swipe/Classes/.gitkeep b/liquid-swipe/Classes/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/liquid-swipe/Classes/Bundle.swift b/liquid-swipe/Classes/Bundle.swift new file mode 100644 index 0000000..272048a --- /dev/null +++ b/liquid-swipe/Classes/Bundle.swift @@ -0,0 +1,18 @@ +// +// Bundle.swift +// liquid-swipe +// +// Created by Anton Skopin on 06/01/2019. +// + +import Foundation + +extension Bundle { + static var resourseBundle: Bundle { + let frameworkBundle = Bundle(for: LiquidSwipeContainerController.self) + if let resourseBundlePath = frameworkBundle.path(forResource: "liquid-swipe", ofType: "bundle") { + return Bundle(path: resourseBundlePath) ?? frameworkBundle + } + return frameworkBundle + } +} diff --git a/liquid-swipe/Classes/LiquidSwipeContainerController.swift b/liquid-swipe/Classes/LiquidSwipeContainerController.swift new file mode 100644 index 0000000..2e240d9 --- /dev/null +++ b/liquid-swipe/Classes/LiquidSwipeContainerController.swift @@ -0,0 +1,648 @@ +// +// LiquidSwipeContainerController.swift +// liquid-swipe +// +// Created by Anton Skopin on 28/12/2018. +// Copyright © 2018 cuberto. All rights reserved. +// + +import UIKit +import pop + +public protocol LiquidSwipeContainerDataSource { + func numberOfControllersInLiquidSwipeContainer(_ liquidSwipeContainer: LiquidSwipeContainerController) -> Int + func liquidSwipeContainer(_ liquidSwipeContainer: LiquidSwipeContainerController, viewControllerAtIndex index: Int) -> UIViewController +} + +public protocol LiquidSwipeContainerDelegate { + func liquidSwipeContainer(_ liquidSwipeContainer: LiquidSwipeContainerController, willTransitionTo: UIViewController) + func liquidSwipeContainer(_ liquidSwipeContainer: LiquidSwipeContainerController, didFinishTransitionTo: UIViewController, transitionCompleted: Bool) +} + +open class LiquidSwipeContainerController: UIViewController { + + public var datasource: LiquidSwipeContainerDataSource? { + didSet { + configureInitialState() + } + } + public var delegate: LiquidSwipeContainerDelegate? + public private(set) var currentPageIndex: Int = 0 + private var currentPage: UIView? { + return currentViewController?.view + } + private var currentViewController: UIViewController? + private var nextViewController: UIViewController? + private var previousViewController: UIViewController? + private var btnNext: UIButton = { + let button = UIButton() + button.translatesAutoresizingMaskIntoConstraints = false + button.backgroundColor = .clear + button.setImage(UIImage(named: "btnNext.png", in: Bundle.resourseBundle, compatibleWith: nil), for: .normal) + return button + }() + + private var initialHorRadius: CGFloat = 48.0 + private var maxHorRadius: CGFloat { + return view.bounds.width * 0.8 + } + + private var initialVertRadius: CGFloat = 82.0 + private var maxVertRadius: CGFloat { + return view.bounds.height * 0.9 + } + private var initialSideWidth: CGFloat = 15.0 + private var initialWaveCenter: CGFloat { + return view.bounds.height * 0.7167487685 + } + private var animationStartTime: CFTimeInterval? + private var animating: Bool = false + private var duration: CFTimeInterval = 0.8 + + private var rightEdgeGesture = UIScreenEdgePanGestureRecognizer() + private var leftEdgeGesture = UIScreenEdgePanGestureRecognizer() + + private var csBtnNextLeading: NSLayoutConstraint? + private var csBtnNextCenterY: NSLayoutConstraint? + + override open var preferredStatusBarStyle: UIStatusBarStyle { + return currentViewController?.preferredStatusBarStyle ?? .default + } + + override open func viewDidLoad() { + super.viewDidLoad() + configureBtnNext() + configureGestures() + configureInitialState() + } + + private func configureBtnNext() { + view.addSubview(btnNext) + csBtnNextLeading = btnNext.leadingAnchor.constraint(equalTo: view.trailingAnchor, constant: -(initialHorRadius + initialSideWidth) + 8.0) + csBtnNextLeading?.isActive = true + csBtnNextCenterY = btnNext.centerYAnchor.constraint(equalTo: view.topAnchor, constant: initialWaveCenter) + csBtnNextCenterY?.isActive = true + btnNext.addTarget(self, action: #selector(btnTapped(_:)), for: .touchUpInside) + } + + private func configureGestures() { + rightEdgeGesture.addTarget(self, action: #selector(rightEdgePan)) + rightEdgeGesture.edges = .right + view.addGestureRecognizer(rightEdgeGesture) + + leftEdgeGesture.addTarget(self, action: #selector(leftEdgePan)) + leftEdgeGesture.edges = .left + view.addGestureRecognizer(leftEdgeGesture) + leftEdgeGesture.isEnabled = false + } + + private func animate(view: UIView, forProgress progress: CGFloat, waveCenterY: CGFloat? = nil) { + guard let mask = view.layer.mask as? WaveLayer else { + return + } + if let centerY = waveCenterY { + mask.waveCenterY = centerY + csBtnNextCenterY?.constant = centerY + } + btnNext.alpha = btnAlpha(forProgress: progress) + mask.sideWidth = sideWidth(forProgress: progress) + mask.waveHorRadius = waveHorRadius(forProgress: progress) + mask.waveVertRadius = waveVertRadius(forProgress: progress) + csBtnNextLeading?.constant = -(mask.waveHorRadius + mask.sideWidth - 8.0) + mask.updatePath() + + self.btnNext.layoutIfNeeded() + } + + private func animateBack(view: UIView, forProgress progress: CGFloat, waveCenterY: CGFloat? = nil) { + guard let mask = view.layer.mask as? WaveLayer else { + return + } + if let centerY = waveCenterY { + mask.waveCenterY = centerY + } + mask.sideWidth = sideWidth(forProgress: progress) + mask.waveHorRadius = waveHorRadiusBack(forProgress: progress) + mask.waveVertRadius = waveVertRadius(forProgress: progress) + mask.updatePath() + self.btnNext.layoutIfNeeded() + } + + + private var shouldFinish: Bool = false + private var shouldCancel: Bool = false + private var animationProgress: CGFloat = 0.0 + @objc private func rightEdgePan(_ sender: UIPanGestureRecognizer) { + guard !animating else { + return + } + if sender.state == .began { + shouldCancel = false + shouldFinish = false + animating = true + if let viewController = nextViewController { + delegate?.liquidSwipeContainer(self, willTransitionTo: viewController) + } + let animation = POPCustomAnimation {[weak sender] (target, animation) -> Bool in + guard let gesture = sender, + let view = target as? UIView, + let mask = view.layer.mask as? WaveLayer, + let time = animation?.elapsedTime else { + if let viewController = self.nextViewController { + self.delegate?.liquidSwipeContainer(self, didFinishTransitionTo: viewController, transitionCompleted: false) + } + return false + } + let speed: CGFloat = 2000 + let direction: CGFloat = (gesture.location(in: view).y - mask.waveCenterY).sign == .plus ? 1 : -1 + let distance = min(CGFloat(time) * speed, abs(mask.waveCenterY - gesture.location(in: view).y)) + let centerY = mask.waveCenterY + distance * direction + let change = -gesture.translation(in: view).x + let maxChange: CGFloat = self.view.bounds.width * (1.0/0.45) + if !(self.shouldFinish || self.shouldCancel) { + let progress: CGFloat = min(1.0, max(0, change / maxChange)) + self.animate(view: view, forProgress: progress, waveCenterY: centerY) + switch gesture.state { + case .began, .changed: + return true + default: + if progress >= 0.15 { + self.shouldFinish = true + self.shouldCancel = false + self.animationStartTime = CACurrentMediaTime() - CFTimeInterval(CGFloat(self.duration) * progress) + } else { + self.shouldFinish = false + self.shouldCancel = true + self.animationProgress = progress + self.animationStartTime = CACurrentMediaTime() + } + } + } + let cTime = (animation?.currentTime ?? CACurrentMediaTime()) - (self.animationStartTime ?? CACurrentMediaTime()) + if self.shouldFinish { + let progress = CGFloat(cTime/self.duration) + self.animate(view: view, forProgress: progress) + self.animating = progress <= 1.0 + return self.animating + } else if self.shouldCancel { + let progress = self.animationProgress - CGFloat(cTime/self.duration) + let direction: CGFloat = (self.initialWaveCenter - mask.waveCenterY).sign == .plus ? 1 : -1 + let distance = min(CGFloat(time) * speed, abs(self.initialWaveCenter - mask.waveCenterY)) + let centerY = mask.waveCenterY + distance * direction + self.animate(view: view, forProgress: progress, waveCenterY: centerY) + self.animating = progress >= 0.0 || abs(self.initialWaveCenter - mask.waveCenterY) > 0.01 + return self.animating + } else { + return false + } + } + animation?.completionBlock = { (animation, isFinished) in + self.animating = false + if self.shouldFinish { + self.showNextPage() + } + if self.shouldCancel, + let viewController = self.nextViewController { + self.delegate?.liquidSwipeContainer(self, didFinishTransitionTo: viewController, transitionCompleted: false) + } + } + currentPage?.pop_add(animation, forKey: "animation") + } + } + + @objc private func leftEdgePan(_ sender: UIPanGestureRecognizer) { + guard !animating else { + return + } + if sender.state == .began { + shouldCancel = false + shouldFinish = false + animating = true + previousViewController?.view.isHidden = false + if let viewController = previousViewController { + delegate?.liquidSwipeContainer(self, willTransitionTo: viewController) + } + let previousViewAnimation = POPCustomAnimation {[weak sender] (target, animation) -> Bool in + guard let gesture = sender, + let view = target as? UIView, + let mask = view.layer.mask as? WaveLayer, + let time = animation?.elapsedTime else { + if let nextViewController = self.nextViewController { + self.delegate?.liquidSwipeContainer(self, didFinishTransitionTo: nextViewController, transitionCompleted: false) + } + return false + } + let speed: CGFloat = 2000 + let direction: CGFloat = (gesture.location(in: view).y - mask.waveCenterY).sign == .plus ? 1 : -1 + let distance = min(CGFloat(time) * speed, abs(mask.waveCenterY - gesture.location(in: view).y)) + let centerY = mask.waveCenterY + distance * direction + let change = gesture.translation(in: view).x + let maxChange: CGFloat = self.view.bounds.width + if !(self.shouldFinish || self.shouldCancel) { + let progress: CGFloat = min(1.0, max(0, 1 - change / maxChange)) + self.animateBack(view: view, forProgress: progress, waveCenterY: centerY) + switch gesture.state { + case .began, .changed: + return true + default: + if progress <= 0.6 { + self.shouldFinish = true + self.shouldCancel = false + self.animationProgress = progress + self.animationStartTime = CACurrentMediaTime() + } else { + self.shouldFinish = false + self.shouldCancel = true + self.animationStartTime = CACurrentMediaTime() - CFTimeInterval(CGFloat(self.duration) * progress) + } + } + } + let cTime = (animation?.currentTime ?? CACurrentMediaTime()) - (self.animationStartTime ?? CACurrentMediaTime()) + if self.shouldFinish { + let progress = self.animationProgress - CGFloat(cTime/self.duration) + let direction: CGFloat = (self.initialWaveCenter - mask.waveCenterY).sign == .plus ? 1 : -1 + let distance = min(CGFloat(time) * speed, abs(self.initialWaveCenter - mask.waveCenterY)) + let centerY = mask.waveCenterY + distance * direction + self.animateBack(view: view, forProgress: progress, waveCenterY: centerY) + self.animating = progress >= 0 || abs(self.initialWaveCenter - mask.waveCenterY) > 0.01 + return self.animating + } else if self.shouldCancel { + let progress = CGFloat(cTime/self.duration) + self.animateBack(view: view, forProgress: progress) + self.animating = progress <= 1.0 + return self.animating + } else { + return false + } + } + previousViewAnimation?.completionBlock = { (animation, isFinished) in + self.animating = false + if self.shouldFinish { + self.showPreviousPage() + } + if self.shouldCancel, + let viewController = self.previousViewController { + self.delegate?.liquidSwipeContainer(self, didFinishTransitionTo: viewController, transitionCompleted: false) + } + } + previousViewController?.view.pop_add(previousViewAnimation, forKey: "animation") + guard nextViewController != nil else { + return + } + let startTime = CACurrentMediaTime() + var cancelTime: CFTimeInterval? + let currentViewAnimation = POPCustomAnimation {[weak sender] (target, animation) -> Bool in + guard let gesture = sender, + let view = target as? UIView, + let mask = view.layer.mask as? WaveLayer, + let time = animation?.currentTime else { + return false + } + let duration: CGFloat = 0.3 + if !self.shouldCancel { + let progress: CGFloat = 1.0 - min(1.0, max(0, CGFloat(time - startTime) / duration)) + mask.sideWidth = self.initialSideWidth * progress + mask.waveHorRadius = self.initialHorRadius * progress + self.csBtnNextLeading?.constant = -(mask.waveHorRadius + mask.sideWidth - 8.0) + self.btnNext.transform = CGAffineTransform(scaleX: progress, y: progress) + mask.updatePath() + switch gesture.state { + case .began, .changed: + return true + default: + break + } + } + if self.shouldFinish { + return self.animating + } else if self.shouldCancel { + if cancelTime == nil { + cancelTime = CACurrentMediaTime() + } + let progress = min(1.0, max(0, CGFloat(time - (cancelTime ?? CACurrentMediaTime())) / duration)) + mask.sideWidth = self.initialSideWidth * progress + mask.waveHorRadius = self.initialHorRadius * progress + self.csBtnNextLeading?.constant = -(mask.waveHorRadius + mask.sideWidth - 8.0) + self.btnNext.transform = CGAffineTransform(scaleX: progress, y: progress) + self.btnNext.layoutIfNeeded() + mask.updatePath() + return progress < 1.0 + } else { + return self.animating + } + } + currentPage?.pop_add(currentViewAnimation, forKey: "animation") + } + } + + private func layoutPageView(_ page: UIView) { + page.translatesAutoresizingMaskIntoConstraints = false + page.topAnchor.constraint(equalTo: view.topAnchor).isActive = true + page.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true + page.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true + page.widthAnchor.constraint(equalTo: view.widthAnchor).isActive = true + } + + private func clearSubviews() { + if previousViewController?.view.superview == view { + previousViewController?.view.removeFromSuperview() + } + previousViewController = nil + if currentViewController?.view.superview == view { + currentViewController?.view.removeFromSuperview() + } + currentViewController = nil + if nextViewController?.view.superview == view { + nextViewController?.view.removeFromSuperview() + } + nextViewController = nil + } + + private func configureInitialState() { + clearSubviews() + guard let datasource = datasource else { + return + } + let pagesCount = datasource.numberOfControllersInLiquidSwipeContainer(self) + guard pagesCount > 0 else { + return + } + let firstVC = datasource.liquidSwipeContainer(self, viewControllerAtIndex: 0) + guard let firstPage = firstVC.view else { + return + } + view.addSubview(firstPage) + layoutPageView(firstPage) + + if pagesCount > 1 { + let maskLayer = WaveLayer(waveCenterY: initialWaveCenter, waveHorRadius: initialHorRadius, waveVertRadius: initialVertRadius, sideWidth: initialSideWidth) + apply(mask: maskLayer, on: firstPage) + } + currentViewController = firstVC + configureNextPage() + view.bringSubviewToFront(btnNext) + } + + private func showNextPage() { + previousViewController?.view.removeFromSuperview() + currentPage?.isHidden = true + previousViewController = currentViewController + currentViewController = nextViewController + currentPageIndex += 1 + leftEdgeGesture.isEnabled = true + let maskLayer = WaveLayer(waveCenterY: initialWaveCenter, + waveHorRadius: 0, + waveVertRadius: initialVertRadius, + sideWidth: 0) + if let currentPage = currentPage { + apply(mask: maskLayer, on: currentPage) + } + configureNextPage() + setNeedsStatusBarAppearanceUpdate() + guard nextViewController != nil else { + btnNext.isHidden = true + rightEdgeGesture.isEnabled = false + if let viewController = currentViewController { + delegate?.liquidSwipeContainer(self, didFinishTransitionTo: viewController, transitionCompleted: true) + } + return + } + + let startTime = CACurrentMediaTime() + let duration: CFTimeInterval = 0.3 + csBtnNextCenterY?.constant = initialWaveCenter + let animation = POPCustomAnimation {(target, animation) -> Bool in + guard let view = target as? UIView, + let mask = view.layer.mask as? WaveLayer, + let time = animation?.currentTime else { + return false + } + let cTime = time - startTime + let progress = CGFloat(cTime/duration) + mask.waveHorRadius = self.initialHorRadius * progress + mask.waveVertRadius = self.initialVertRadius + mask.sideWidth = self.initialSideWidth * progress + mask.updatePath() + self.btnNext.alpha = progress + self.csBtnNextLeading?.constant = -(mask.waveHorRadius + mask.sideWidth - 8.0) + self.btnNext.transform = CGAffineTransform(scaleX: progress, y: progress) + self.btnNext.layoutIfNeeded() + return progress <= 1.0 + } + animation?.completionBlock = { (_,_) in + if let viewController = self.currentViewController { + self.delegate?.liquidSwipeContainer(self, didFinishTransitionTo: viewController, transitionCompleted: true) + } + } + currentPage?.pop_add(animation, forKey: "animation") + } + + private func showPreviousPage() { + nextViewController?.view.removeFromSuperview() + nextViewController = currentViewController + currentViewController = previousViewController + currentPageIndex -= 1 + btnNext.isHidden = false + rightEdgeGesture.isEnabled = true + let maskLayer = WaveLayer(waveCenterY: initialWaveCenter, + waveHorRadius: 0, + waveVertRadius: maxVertRadius, + sideWidth: view.bounds.width) + configurePreviousPage() + setNeedsStatusBarAppearanceUpdate() + if let prevPage = previousViewController?.view { + apply(mask: maskLayer, on: prevPage) + } else { + leftEdgeGesture.isEnabled = false + } + let startTime = CACurrentMediaTime() + let duration: CFTimeInterval = 0.3 + csBtnNextCenterY?.constant = initialWaveCenter + view.bringSubviewToFront(btnNext) + let animation = POPCustomAnimation {(target, animation) -> Bool in + guard let view = target as? UIView, + let mask = view.layer.mask as? WaveLayer, + let time = animation?.currentTime else { + return false + } + let cTime = time - startTime + let progress = CGFloat(cTime/duration) + self.btnNext.alpha = progress + self.csBtnNextLeading?.constant = -(mask.waveHorRadius + mask.sideWidth - 8.0) + self.btnNext.transform = CGAffineTransform(scaleX: progress, y: progress) + self.btnNext.layoutIfNeeded() + return progress <= 1.0 + } + animation?.completionBlock = { (_,_) in + if let viewController = self.currentViewController { + self.delegate?.liquidSwipeContainer(self, didFinishTransitionTo: viewController, transitionCompleted: true) + } + } + currentPage?.pop_add(animation, forKey: "animation") + } + + private func configureNextPage() { + guard let datasource = datasource else { + return + } + let pagesCount = datasource.numberOfControllersInLiquidSwipeContainer(self) + guard pagesCount > currentPageIndex + 1 else { + nextViewController = nil + rightEdgeGesture.isEnabled = false + return + } + let nextVC = datasource.liquidSwipeContainer(self, viewControllerAtIndex: currentPageIndex + 1) + nextViewController = nextVC + guard let page = nextVC.view else { + return + } + if let currentPage = currentPage { + view.insertSubview(page, belowSubview: currentPage) + } else { + view.addSubview(page) + } + layoutPageView(page) + } + + private func configurePreviousPage() { + guard let datasource = datasource else { + return + } + let pagesCount = datasource.numberOfControllersInLiquidSwipeContainer(self) + guard currentPageIndex > 0 && pagesCount > 0 else { + previousViewController = nil + leftEdgeGesture.isEnabled = false + return + } + let previousVC = datasource.liquidSwipeContainer(self, viewControllerAtIndex: currentPageIndex - 1) + previousViewController = previousVC + guard let page = previousVC.view else { + return + } + if let currentPage = currentPage { + view.insertSubview(page, aboveSubview: currentPage) + } else { + view.addSubview(page) + } + layoutPageView(page) + page.isHidden = true + } + + private func apply(mask: WaveLayer, on view: UIView) { + mask.frame = view.bounds + mask.updatePath() + view.layer.mask = mask + } + + @objc private func btnTapped(_ sender: AnyObject) { + animationStartTime = CACurrentMediaTime() + guard !animating else { + return + } + animating = true + if let viewController = nextViewController { + delegate?.liquidSwipeContainer(self, willTransitionTo: viewController) + } + let animation = POPCustomAnimation {(target, animation) -> Bool in + guard let view = target as? UIView, + let time = animation?.currentTime else { + return false + } + let cTime = time - (self.animationStartTime ?? CACurrentMediaTime()) + let progress = CGFloat(cTime/self.duration) + self.animate(view: view, forProgress: progress) + self.animating = progress <= 1.0 + return progress <= 1.0 + } + animation?.completionBlock = { (animation, isFinished) in + self.animating = false + self.showNextPage() + } + currentPage?.pop_add(animation, forKey: "animation") + } +} + +//MARK: Animation helpers +private extension LiquidSwipeContainerController { + + private func btnAlpha(forProgress progress: CGFloat) -> CGFloat { + let p1: CGFloat = 0.1 + let p2: CGFloat = 0.3 + if progress <= p1 { + return 1.0 + } + if progress >= p2 { + return 0.0 + } + return 1.0 - (progress - p1)/(p2-p1) + } + + private func waveHorRadius(forProgress progress: CGFloat) -> CGFloat { + if progress <= 0 { + return initialHorRadius + } + if progress >= 1 { + return 0 + } + let p1: CGFloat = 0.4 + if progress <= p1 { + return initialHorRadius + progress/p1*(maxHorRadius - initialHorRadius) + } + let t: CGFloat = (progress - p1)/(1.0 - p1) + let A: CGFloat = maxHorRadius + let r: CGFloat = 40 + let m: CGFloat = 9.8 + let beta: CGFloat = r/(2*m) + let k: CGFloat = 50 + let omega0: CGFloat = k/m + let omega: CGFloat = pow(-pow(beta,2)+pow(omega0,2), 0.5) + + return A * exp(-beta * t) * cos( omega * t) + } + + private func waveHorRadiusBack(forProgress progress: CGFloat) -> CGFloat { + if progress <= 0 { + return initialHorRadius + } + if progress >= 1 { + return 0 + } + let p1: CGFloat = 0.4 + if progress <= p1 { + return initialHorRadius + progress/p1*initialHorRadius + } + let t: CGFloat = (progress - p1)/(1.0 - p1) + let A: CGFloat = 2 * initialHorRadius + let r: CGFloat = 40 + let m: CGFloat = 9.8 + let beta: CGFloat = r/(2*m) + let k: CGFloat = 50 + let omega0: CGFloat = k/m + let omega: CGFloat = pow(-pow(beta,2)+pow(omega0,2), 0.5) + + return A * exp(-beta * t) * cos( omega * t) + } + + private func waveVertRadius(forProgress progress: CGFloat) -> CGFloat { + let p1: CGFloat = 0.4 + if progress <= 0 { + return initialVertRadius + } + if progress >= p1 { + return maxVertRadius + } + return initialVertRadius + (maxVertRadius - initialVertRadius) * progress/p1 + } + + private func sideWidth(forProgress progress: CGFloat) -> CGFloat { + let p1: CGFloat = 0.2 + let p2: CGFloat = 0.8 + if progress <= p1 { + return initialSideWidth + } + if progress >= p2 { + return view.bounds.width + } + return initialSideWidth + (view.bounds.width - initialSideWidth) * (progress - p1)/(p2 - p1) + } +} diff --git a/liquid-swipe/Classes/WaveLayer.swift b/liquid-swipe/Classes/WaveLayer.swift new file mode 100644 index 0000000..b9ae4bb --- /dev/null +++ b/liquid-swipe/Classes/WaveLayer.swift @@ -0,0 +1,102 @@ +// +// WaveLayer.swift +// liquid-swipe +// +// Created by Anton Skopin on 04/01/2019. +// Copyright © 2019 cuberto. All rights reserved. +// + +import UIKit + +internal class WaveLayer: CAShapeLayer { + var waveCenterY: CGFloat + var waveHorRadius: CGFloat + var waveVertRadius: CGFloat + var sideWidth: CGFloat + init(waveCenterY: CGFloat, waveHorRadius: CGFloat, waveVertRadius: CGFloat, sideWidth: CGFloat) { + self.waveCenterY = waveCenterY + self.waveHorRadius = waveHorRadius + self.waveVertRadius = waveVertRadius + self.sideWidth = sideWidth + super.init() + } + + func updatePath() { + let rect = bounds + let path = CGMutablePath() + let maskWidth = rect.width - sideWidth + path.move(to: CGPoint(x: maskWidth - sideWidth, y: 0)) + path.addLine(to: CGPoint(x: 0, y: 0)) + path.addLine(to: CGPoint(x: 0, y: rect.height)) + path.addLine(to: CGPoint(x: maskWidth, y: rect.height)) + let curveStartY = waveCenterY + waveVertRadius + + path.addLine(to: CGPoint(x: maskWidth, y: curveStartY)) + + path.addCurve(to: CGPoint(x: maskWidth - waveHorRadius * 0.1561501458, + y: curveStartY - waveVertRadius * 0.3322374268), + control1: CGPoint(x: maskWidth, + y: curveStartY - waveVertRadius * 0.1346194756), + control2: CGPoint(x: maskWidth - waveHorRadius * 0.05341339583, + y: curveStartY - waveVertRadius * 0.2412779634)) + path.addCurve(to: CGPoint(x: maskWidth - waveHorRadius * 0.5012484792, + y: curveStartY - waveVertRadius * 0.5350576951), + control1: CGPoint(x: maskWidth - waveHorRadius * 0.2361659167, + y: curveStartY - waveVertRadius * 0.4030805244), + control2: CGPoint(x: maskWidth - waveHorRadius * 0.3305285625, + y: curveStartY - waveVertRadius * 0.4561193293)) + path.addCurve(to: CGPoint(x: maskWidth - waveHorRadius * 0.574934875, + y: curveStartY - waveVertRadius * 0.5689655122), + control1: CGPoint(x: maskWidth - waveHorRadius * 0.515878125, + y: curveStartY - waveVertRadius * 0.5418222317), + control2: CGPoint(x: maskWidth - waveHorRadius * 0.5664134792, + y: curveStartY - waveVertRadius * 0.5650349878)) + path.addCurve(to: CGPoint(x: maskWidth - waveHorRadius * 0.8774032292, + y: curveStartY - waveVertRadius * 0.7399037439), + control1: CGPoint(x: maskWidth - waveHorRadius * 0.7283715208, + y: curveStartY - waveVertRadius * 0.6397387195), + control2: CGPoint(x: maskWidth - waveHorRadius * 0.8086618958, + y: curveStartY - waveVertRadius * 0.6833456585)) + path.addCurve(to: CGPoint(x: maskWidth - waveHorRadius, y: curveStartY - waveVertRadius), + control1: CGPoint(x: maskWidth - waveHorRadius * 0.9653464583, + y: curveStartY - waveVertRadius * 0.8122605122), + control2: CGPoint(x: maskWidth - waveHorRadius, + y: curveStartY - waveVertRadius * 0.8936183659)) + path.addCurve(to: CGPoint(x: maskWidth - waveHorRadius * 0.8608411667, + y: curveStartY - waveVertRadius * 1.270484439), + control1: CGPoint(x: maskWidth - waveHorRadius, + y: curveStartY - waveVertRadius * 1.100142878), + control2: CGPoint(x: maskWidth - waveHorRadius * 0.9595746667, + y: curveStartY - waveVertRadius * 1.1887991951)) + path.addCurve(to: CGPoint(x: maskWidth - waveHorRadius * 0.5291125625, + y: curveStartY - waveVertRadius * 1.4665102805), + control1: CGPoint(x: maskWidth - waveHorRadius * 0.7852123333, + y: curveStartY - waveVertRadius * 1.3330544756), + control2: CGPoint(x: maskWidth - waveHorRadius * 0.703382125, + y: curveStartY - waveVertRadius * 1.3795848049)) + path.addCurve(to: CGPoint(x: maskWidth - waveHorRadius * 0.5015305417, + y: curveStartY - waveVertRadius * 1.4802616098), + control1: CGPoint(x: maskWidth - waveHorRadius * 0.5241858333, + y: curveStartY - waveVertRadius * 1.4689677195), + control2: CGPoint(x: maskWidth - waveHorRadius * 0.505739125, + y: curveStartY - waveVertRadius * 1.4781625854)) + path.addCurve(to: CGPoint(x: maskWidth - waveHorRadius * 0.1541165417, + y: curveStartY - waveVertRadius * 1.687403), + control1: CGPoint(x: maskWidth - waveHorRadius * 0.3187486042, + y: curveStartY - waveVertRadius * 1.5714239024), + control2: CGPoint(x: maskWidth - waveHorRadius * 0.2332057083, + y: curveStartY - waveVertRadius * 1.6204116463)) + path.addCurve(to: CGPoint(x: maskWidth, y: curveStartY - waveVertRadius * 2), + control1: CGPoint(x: maskWidth - waveHorRadius * 0.0509933125, + y: curveStartY - waveVertRadius * 1.774752061), + control2: CGPoint(x: maskWidth, y: curveStartY - waveVertRadius * 1.8709256829)) + + path.addLine(to: CGPoint(x: maskWidth, y: 0)) + path.closeSubpath() + self.path = path + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +}