diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj new file mode 100644 index 0000000..5f1c466 --- /dev/null +++ b/Example/Example.xcodeproj/project.pbxproj @@ -0,0 +1,447 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 33E2B6CF0D9BD11D8C027DE6 /* Pods_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB925B38880FB296AF5D219F /* Pods_Example.framework */; }; + CD10F0DA211582580077CAFF /* header.gif in Resources */ = {isa = PBXBuildFile; fileRef = CD10F0D9211582580077CAFF /* header.gif */; }; + CD95D26F22E732CE007559A3 /* TestA.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD95D26E22E732CE007559A3 /* TestA.swift */; }; + CDA4E03C20D3935B00CD2A0C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDA4E03B20D3935B00CD2A0C /* AppDelegate.swift */; }; + CDA4E03E20D3935B00CD2A0C /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDA4E03D20D3935B00CD2A0C /* ViewController.swift */; }; + CDA4E04120D3935B00CD2A0C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CDA4E03F20D3935B00CD2A0C /* Main.storyboard */; }; + CDA4E04320D3935C00CD2A0C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CDA4E04220D3935C00CD2A0C /* Assets.xcassets */; }; + CDA4E04620D3935C00CD2A0C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CDA4E04420D3935C00CD2A0C /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + AB925B38880FB296AF5D219F /* Pods_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + BA1A6035F1B9A658B3BB225C /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = ""; }; + CA1298266BE89D7950DE99F2 /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig"; sourceTree = ""; }; + CD10F0D9211582580077CAFF /* header.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = header.gif; sourceTree = ""; }; + CD59584620E36DA8000F6427 /* Example-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Example-Bridging-Header.h"; sourceTree = ""; }; + CD95D26E22E732CE007559A3 /* TestA.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestA.swift; sourceTree = ""; }; + CDA4E03820D3935B00CD2A0C /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; + CDA4E03B20D3935B00CD2A0C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + CDA4E03D20D3935B00CD2A0C /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + CDA4E04020D3935B00CD2A0C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + CDA4E04220D3935C00CD2A0C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + CDA4E04520D3935C00CD2A0C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + CDA4E04720D3935C00CD2A0C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + CDA4E03520D3935B00CD2A0C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 33E2B6CF0D9BD11D8C027DE6 /* Pods_Example.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 139E7589A813C8747459CA4F /* Frameworks */ = { + isa = PBXGroup; + children = ( + AB925B38880FB296AF5D219F /* Pods_Example.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 6C5AB15780B2383CC5603A95 /* Pods */ = { + isa = PBXGroup; + children = ( + CA1298266BE89D7950DE99F2 /* Pods-Example.debug.xcconfig */, + BA1A6035F1B9A658B3BB225C /* Pods-Example.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + CDA4E02F20D3935B00CD2A0C = { + isa = PBXGroup; + children = ( + CDA4E03A20D3935B00CD2A0C /* Example */, + CDA4E03920D3935B00CD2A0C /* Products */, + 6C5AB15780B2383CC5603A95 /* Pods */, + 139E7589A813C8747459CA4F /* Frameworks */, + ); + sourceTree = ""; + }; + CDA4E03920D3935B00CD2A0C /* Products */ = { + isa = PBXGroup; + children = ( + CDA4E03820D3935B00CD2A0C /* Example.app */, + ); + name = Products; + sourceTree = ""; + }; + CDA4E03A20D3935B00CD2A0C /* Example */ = { + isa = PBXGroup; + children = ( + CDA4E03B20D3935B00CD2A0C /* AppDelegate.swift */, + CDA4E03D20D3935B00CD2A0C /* ViewController.swift */, + CD95D26E22E732CE007559A3 /* TestA.swift */, + CDA4E03F20D3935B00CD2A0C /* Main.storyboard */, + CDA4E04220D3935C00CD2A0C /* Assets.xcassets */, + CD10F0D9211582580077CAFF /* header.gif */, + CDA4E04420D3935C00CD2A0C /* LaunchScreen.storyboard */, + CDA4E04720D3935C00CD2A0C /* Info.plist */, + CD59584620E36DA8000F6427 /* Example-Bridging-Header.h */, + ); + path = Example; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + CDA4E03720D3935B00CD2A0C /* Example */ = { + isa = PBXNativeTarget; + buildConfigurationList = CDA4E04A20D3935C00CD2A0C /* Build configuration list for PBXNativeTarget "Example" */; + buildPhases = ( + 0FD6F25B57F7283E6523E731 /* [CP] Check Pods Manifest.lock */, + CDA4E03420D3935B00CD2A0C /* Sources */, + CDA4E03520D3935B00CD2A0C /* Frameworks */, + CDA4E03620D3935B00CD2A0C /* Resources */, + FE957B34A041E54F84E4F88C /* [CP] Embed Pods Frameworks */, + 7224810F9340C39F39EB06D1 /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Example; + productName = Example; + productReference = CDA4E03820D3935B00CD2A0C /* Example.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + CDA4E03020D3935B00CD2A0C /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0930; + LastUpgradeCheck = 0930; + ORGANIZATIONNAME = "Titan Studio"; + TargetAttributes = { + CDA4E03720D3935B00CD2A0C = { + CreatedOnToolsVersion = 9.3; + LastSwiftMigration = 1010; + }; + }; + }; + buildConfigurationList = CDA4E03320D3935B00CD2A0C /* Build configuration list for PBXProject "Example" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = CDA4E02F20D3935B00CD2A0C; + productRefGroup = CDA4E03920D3935B00CD2A0C /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + CDA4E03720D3935B00CD2A0C /* Example */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + CDA4E03620D3935B00CD2A0C /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CDA4E04620D3935C00CD2A0C /* LaunchScreen.storyboard in Resources */, + CDA4E04320D3935C00CD2A0C /* Assets.xcassets in Resources */, + CDA4E04120D3935B00CD2A0C /* Main.storyboard in Resources */, + CD10F0DA211582580077CAFF /* header.gif in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 0FD6F25B57F7283E6523E731 /* [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-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; + }; + 7224810F9340C39F39EB06D1 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + FE957B34A041E54F84E4F88C /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/ProHUD/ProHUD.framework", + "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ProHUD.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SnapKit.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + CDA4E03420D3935B00CD2A0C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CDA4E03E20D3935B00CD2A0C /* ViewController.swift in Sources */, + CDA4E03C20D3935B00CD2A0C /* AppDelegate.swift in Sources */, + CD95D26F22E732CE007559A3 /* TestA.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + CDA4E03F20D3935B00CD2A0C /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + CDA4E04020D3935B00CD2A0C /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + CDA4E04420D3935C00CD2A0C /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + CDA4E04520D3935C00CD2A0C /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + CDA4E04820D3935C00CD2A0C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + 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_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; + CODE_SIGN_IDENTITY = "iPhone Developer"; + 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; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + CDA4E04920D3935C00CD2A0C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + 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_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; + CODE_SIGN_IDENTITY = "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 = 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; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + CDA4E04B20D3935C00CD2A0C /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = CA1298266BE89D7950DE99F2 /* Pods-Example.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 34W5TB5KD2; + INFOPLIST_FILE = Example/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 2.0; + PRODUCT_BUNDLE_IDENTIFIER = com.xaoxuu.ProHUDExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = "b32d51a3-c20b-408f-aebf-11d2ea3811cd"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OBJC_BRIDGING_HEADER = "Example/Example-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Debug; + }; + CDA4E04C20D3935C00CD2A0C /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = BA1A6035F1B9A658B3BB225C /* Pods-Example.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = 34W5TB5KD2; + INFOPLIST_FILE = Example/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 2.0; + PRODUCT_BUNDLE_IDENTIFIER = com.xaoxuu.ProHUDExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = "b32d51a3-c20b-408f-aebf-11d2ea3811cd"; + PROVISIONING_PROFILE_SPECIFIER = "com.xaoxuu.*"; + SWIFT_OBJC_BRIDGING_HEADER = "Example/Example-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + CDA4E03320D3935B00CD2A0C /* Build configuration list for PBXProject "Example" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CDA4E04820D3935C00CD2A0C /* Debug */, + CDA4E04920D3935C00CD2A0C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + CDA4E04A20D3935C00CD2A0C /* Build configuration list for PBXNativeTarget "Example" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CDA4E04B20D3935C00CD2A0C /* Debug */, + CDA4E04C20D3935C00CD2A0C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = CDA4E03020D3935B00CD2A0C /* Project object */; +} diff --git a/Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..6d2a51b --- /dev/null +++ b/Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Example/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Example/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme b/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme new file mode 100644 index 0000000..f8b0624 --- /dev/null +++ b/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/Example.xcworkspace/contents.xcworkspacedata b/Example/Example.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..a37cf19 --- /dev/null +++ b/Example/Example.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/Example/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Example/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Example/Example/AppDelegate.swift b/Example/Example/AppDelegate.swift new file mode 100644 index 0000000..ad6aca4 --- /dev/null +++ b/Example/Example/AppDelegate.swift @@ -0,0 +1,68 @@ +// +// AppDelegate.swift +// Example +// +// Created by xaoxuu on 2018/6/15. +// Copyright © 2018 Titan Studio. All rights reserved. +// + +import UIKit +import ProHUD + +let hud = ProHUD.shared + +@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. + + + + hud.config(alert: { (a) in +// a.tintColor = .green +// a.loadSubviews { (aa) in +// +// } +// a.padding = 12 +// a.margin = 4 +// a.loadSubviews { (aa) in +// +// } + }) + hud.config(toast: { (a) in + + }) + 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 invalidate graphics rendering callbacks. 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. + NotificationCenter.default.post(name: NSNotification.Name.init("applicationDidEnterBackground"), object: nil) + + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // Called as part of the transition from the background to the active 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/Example/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..5c76c07 --- /dev/null +++ b/Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,116 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-Notification@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-Notification@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-Small@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-Small@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-Small-40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-Small-40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-Notification.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-Notification@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-Small.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-Small@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-Small-40.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-Small-40@2x.png", + "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.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "icon.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png new file mode 100644 index 0000000..493f5fb Binary files /dev/null and b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png differ diff --git a/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png new file mode 100644 index 0000000..064aafc Binary files /dev/null and b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png differ diff --git a/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-76.png b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-76.png new file mode 100644 index 0000000..e569aad Binary files /dev/null and b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-76.png differ diff --git a/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png new file mode 100644 index 0000000..3a88100 Binary files /dev/null and b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png differ diff --git a/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-83.5@2x.png b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-83.5@2x.png new file mode 100644 index 0000000..f6e7611 Binary files /dev/null and b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-83.5@2x.png differ diff --git a/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Notification.png b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Notification.png new file mode 100644 index 0000000..c531100 Binary files /dev/null and b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Notification.png differ diff --git a/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Notification@2x.png b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Notification@2x.png new file mode 100644 index 0000000..7de6b04 Binary files /dev/null and b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Notification@2x.png differ diff --git a/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Notification@3x.png b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Notification@3x.png new file mode 100644 index 0000000..e1b2bb3 Binary files /dev/null and b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Notification@3x.png differ diff --git a/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Small-40.png b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Small-40.png new file mode 100644 index 0000000..7de6b04 Binary files /dev/null and b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Small-40.png differ diff --git a/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@2x.png b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@2x.png new file mode 100644 index 0000000..42e69ae Binary files /dev/null and b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@2x.png differ diff --git a/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@3x.png b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@3x.png new file mode 100644 index 0000000..493f5fb Binary files /dev/null and b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@3x.png differ diff --git a/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Small.png b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Small.png new file mode 100644 index 0000000..e71e984 Binary files /dev/null and b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Small.png differ diff --git a/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png new file mode 100644 index 0000000..951c861 Binary files /dev/null and b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png differ diff --git a/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png new file mode 100644 index 0000000..a6a24e2 Binary files /dev/null and b/Example/Example/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png differ diff --git a/Example/Example/Assets.xcassets/AppIcon.appiconset/icon.png b/Example/Example/Assets.xcassets/AppIcon.appiconset/icon.png new file mode 100644 index 0000000..08b0b19 Binary files /dev/null and b/Example/Example/Assets.xcassets/AppIcon.appiconset/icon.png differ diff --git a/Example/Example/Assets.xcassets/Contents.json b/Example/Example/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/Example/Example/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/Example/Assets.xcassets/alert-circle.imageset/Contents.json b/Example/Example/Assets.xcassets/alert-circle.imageset/Contents.json new file mode 100644 index 0000000..78cde9e --- /dev/null +++ b/Example/Example/Assets.xcassets/alert-circle.imageset/Contents.json @@ -0,0 +1,25 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "alert-circle.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "alert-circle (1).png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + }, + "properties" : { + "template-rendering-intent" : "template" + } +} \ No newline at end of file diff --git a/Example/Example/Assets.xcassets/alert-circle.imageset/alert-circle (1).png b/Example/Example/Assets.xcassets/alert-circle.imageset/alert-circle (1).png new file mode 100644 index 0000000..0088b5f Binary files /dev/null and b/Example/Example/Assets.xcassets/alert-circle.imageset/alert-circle (1).png differ diff --git a/Example/Example/Assets.xcassets/alert-circle.imageset/alert-circle.png b/Example/Example/Assets.xcassets/alert-circle.imageset/alert-circle.png new file mode 100644 index 0000000..edd5e44 Binary files /dev/null and b/Example/Example/Assets.xcassets/alert-circle.imageset/alert-circle.png differ diff --git a/Example/Example/Assets.xcassets/bg.imageset/Contents.json b/Example/Example/Assets.xcassets/bg.imageset/Contents.json new file mode 100644 index 0000000..2076d77 --- /dev/null +++ b/Example/Example/Assets.xcassets/bg.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "IMG_0564.PNG", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/Example/Assets.xcassets/bg.imageset/IMG_0564.PNG b/Example/Example/Assets.xcassets/bg.imageset/IMG_0564.PNG new file mode 100644 index 0000000..930a677 Binary files /dev/null and b/Example/Example/Assets.xcassets/bg.imageset/IMG_0564.PNG differ diff --git a/Example/Example/Assets.xcassets/firewatch.imageset/Contents.json b/Example/Example/Assets.xcassets/firewatch.imageset/Contents.json new file mode 100644 index 0000000..4e3ecf0 --- /dev/null +++ b/Example/Example/Assets.xcassets/firewatch.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "firewatch_5k@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "firewatch_5k@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/Example/Assets.xcassets/firewatch.imageset/firewatch_5k@2x.png b/Example/Example/Assets.xcassets/firewatch.imageset/firewatch_5k@2x.png new file mode 100644 index 0000000..d200718 Binary files /dev/null and b/Example/Example/Assets.xcassets/firewatch.imageset/firewatch_5k@2x.png differ diff --git a/Example/Example/Assets.xcassets/firewatch.imageset/firewatch_5k@3x.png b/Example/Example/Assets.xcassets/firewatch.imageset/firewatch_5k@3x.png new file mode 100644 index 0000000..1632cdb Binary files /dev/null and b/Example/Example/Assets.xcassets/firewatch.imageset/firewatch_5k@3x.png differ diff --git a/Example/Example/Assets.xcassets/header_center.imageset/Contents.json b/Example/Example/Assets.xcassets/header_center.imageset/Contents.json new file mode 100644 index 0000000..028aba0 --- /dev/null +++ b/Example/Example/Assets.xcassets/header_center.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "header_center@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "header_center@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/Example/Assets.xcassets/header_center.imageset/header_center@2x.png b/Example/Example/Assets.xcassets/header_center.imageset/header_center@2x.png new file mode 100644 index 0000000..e56bf3e Binary files /dev/null and b/Example/Example/Assets.xcassets/header_center.imageset/header_center@2x.png differ diff --git a/Example/Example/Assets.xcassets/header_center.imageset/header_center@3x.png b/Example/Example/Assets.xcassets/header_center.imageset/header_center@3x.png new file mode 100644 index 0000000..f550546 Binary files /dev/null and b/Example/Example/Assets.xcassets/header_center.imageset/header_center@3x.png differ diff --git a/Example/Example/Assets.xcassets/icon_download.imageset/Contents.json b/Example/Example/Assets.xcassets/icon_download.imageset/Contents.json new file mode 100644 index 0000000..289614e --- /dev/null +++ b/Example/Example/Assets.xcassets/icon_download.imageset/Contents.json @@ -0,0 +1,25 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "cloud download (2).png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "cloud download (3).png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + }, + "properties" : { + "template-rendering-intent" : "template" + } +} \ No newline at end of file diff --git a/Example/Example/Assets.xcassets/icon_download.imageset/cloud download (2).png b/Example/Example/Assets.xcassets/icon_download.imageset/cloud download (2).png new file mode 100644 index 0000000..5a1a4ca Binary files /dev/null and b/Example/Example/Assets.xcassets/icon_download.imageset/cloud download (2).png differ diff --git a/Example/Example/Assets.xcassets/icon_download.imageset/cloud download (3).png b/Example/Example/Assets.xcassets/icon_download.imageset/cloud download (3).png new file mode 100644 index 0000000..436ce95 Binary files /dev/null and b/Example/Example/Assets.xcassets/icon_download.imageset/cloud download (3).png differ diff --git a/Example/Example/Base.lproj/LaunchScreen.storyboard b/Example/Example/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f83f6fd --- /dev/null +++ b/Example/Example/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/Example/Base.lproj/Main.storyboard b/Example/Example/Base.lproj/Main.storyboard new file mode 100644 index 0000000..5fb5f29 --- /dev/null +++ b/Example/Example/Base.lproj/Main.storyboard @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/Example/Example-Bridging-Header.h b/Example/Example/Example-Bridging-Header.h new file mode 100644 index 0000000..f84fb54 --- /dev/null +++ b/Example/Example/Example-Bridging-Header.h @@ -0,0 +1,5 @@ +// +// Use this file to import your target's public headers that you would like to expose to Swift. +// + + diff --git a/Example/Example/Info.plist b/Example/Example/Info.plist new file mode 100644 index 0000000..ff0a7ed --- /dev/null +++ b/Example/Example/Info.plist @@ -0,0 +1,54 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + ProHUD + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(MARKETING_VERSION) + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UIRequiresFullScreen + + UIStatusBarHidden + + UIStatusBarStyle + UIStatusBarStyleDefault + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + UIInterfaceOrientationPortraitUpsideDown + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Example/Example/TestA.swift b/Example/Example/TestA.swift new file mode 100644 index 0000000..f159b82 --- /dev/null +++ b/Example/Example/TestA.swift @@ -0,0 +1,49 @@ +// +// TestA.swift +// ProHUDExample +// +// Created by xaoxuu on 2019/7/23. +// Copyright © 2019 Titan Studio. All rights reserved. +// + +import UIKit + +public class TestA: NSObject { + + class func test1() { + print(self, "test1") + } + class func test2() { + print(self, "test2") + } + +} + + +open class TestB: NSObject { + + + class func test1() { + print(self, "test1") + } + open class func test2() { + print(self, "test2") + } + + +} + +class TestAA: TestA { + + override class func test2() { + print(self, "test2", "override") + } + +} + +class TestBB: TestB { + + override class func test2() { + print(self, "test2", "override") + } +} diff --git a/Example/Example/ViewController.swift b/Example/Example/ViewController.swift new file mode 100644 index 0000000..03bd703 --- /dev/null +++ b/Example/Example/ViewController.swift @@ -0,0 +1,49 @@ +// +// ViewController.swift +// Example +// +// Created by xaoxuu on 2018/6/15. +// Copyright © 2018 Titan Studio. All rights reserved. +// + +import UIKit +import ProHUD + +class ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view. + + + } + + + override func touchesBegan(_ touches: Set, with event: UIEvent?) { + + let a = ProHUD.show(alert: .delete, title: "确认删除", message: "此操作不可撤销") + + a.addAction(style: .destructive, title: "删除") { [weak a] in + a?.updateContent(scene: .success, title: "操作成功", message: "恭喜,您已经成功删除了xxx") + a?.updateAction(index: 0, style: .default, title: "好的", action: { + a?.remove() + }).removeAction(index: 1) +// a?.updateContent(scene: .success, title: "操作成功").removeAction(index: -1).timeout(2) + }.addAction(style: .cancel, title: "取消", action: nil).didDisappear { + debugPrint("didDisappear") + } + +// ProHUD.show(alert: .delete, title: "克里斯蒂娜删除", message: "克里斯蒂娜疯狂拉升的反馈老实交代分开就撒开了击快乐圣诞").addAction(style: .destructive, title: "删除") { +// +// }.addAction(style: .cancel, title: "取消", action: nil).didDisappear { +// debugPrint("didDisappear") +// } + + DispatchQueue.main.asyncAfter(deadline: .now()+1) { + + + } + } + +} + diff --git a/Example/Example/header.gif b/Example/Example/header.gif new file mode 100644 index 0000000..e62e8b1 Binary files /dev/null and b/Example/Example/header.gif differ diff --git a/Example/Podfile b/Example/Podfile new file mode 100644 index 0000000..0d39940 --- /dev/null +++ b/Example/Podfile @@ -0,0 +1,15 @@ +platform :ios, '10.0' +use_frameworks! + +target 'Example' do + + pod 'ProHUD', :path => '..' + + pod 'SnapKit', '4.2.0' + +end + + + +#pod install --verbose --no-repo-update #安装命令 +#pod update --verbose --no-repo-update #更新命令 diff --git a/Example/Podfile.lock b/Example/Podfile.lock new file mode 100644 index 0000000..e09b10a --- /dev/null +++ b/Example/Podfile.lock @@ -0,0 +1,20 @@ +PODS: + - ProHUD (1.0): + - SnapKit (= 4.2.0) + - SnapKit (4.2.0) + +DEPENDENCIES: + - ProHUD (from `..`) + - SnapKit (= 4.2.0) + +EXTERNAL SOURCES: + ProHUD: + :path: .. + +SPEC CHECKSUMS: + ProHUD: df9d30311cda37d3cd6db6606415733d26b94144 + SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a + +PODFILE CHECKSUM: 346966e04c944658b93fb1a6052bfb61ddb271be + +COCOAPODS: 1.3.1 diff --git a/ProHUD.podspec b/ProHUD.podspec new file mode 100755 index 0000000..2d41cb9 --- /dev/null +++ b/ProHUD.podspec @@ -0,0 +1,19 @@ +Pod::Spec.new do |s| + s.name = 'ProHUD' + s.version = "1.0" + s.license = 'MIT' + s.summary = '可完全定制化的HUD,包含顶部区域的Toast,中央区域的Alert和底部区域的ActionSheet。' + s.homepage = "http://xaoxuu.com" + s.authors = { 'xaoxuu' => 'xaoxuu@gmail.com' } + s.source = { :git => "https://github.com/xaoxuu/ProHUD.git", :tag => "#{s.version}", :submodules => false} + + s.ios.deployment_target = '9.0' + + s.source_files = 'ProHUD/**/*.swift' + s.resource_bundles = { 'ProHUD' => ['ProHUD/*.{xcassets,strings,xml,storyboard,xib,xcdatamodeld,gif,lproj}'] } + s.requires_arc = true + + s.dependency 'SnapKit', '4.2.0' + # s.dependency 'Inspire' + +end diff --git a/ProHUD.xcodeproj/project.pbxproj b/ProHUD.xcodeproj/project.pbxproj new file mode 100644 index 0000000..011e03f --- /dev/null +++ b/ProHUD.xcodeproj/project.pbxproj @@ -0,0 +1,438 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + CD16490B22EF09AB0077988C /* AlertModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD16490A22EF09AB0077988C /* AlertModel.swift */; }; + CD16490D22EF09B40077988C /* AlertConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD16490C22EF09B40077988C /* AlertConfig.swift */; }; + CD16490F22EF09D50077988C /* AlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD16490E22EF09D50077988C /* AlertView.swift */; }; + CD16491222EF0D900077988C /* HUDView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD16491122EF0D900077988C /* HUDView.swift */; }; + CD16491422EF12220077988C /* ProHUD.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CD16491322EF12220077988C /* ProHUD.xcassets */; }; + CD67039022E7F7B60072C96A /* HUDForToast.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD67038F22E7F7B60072C96A /* HUDForToast.swift */; }; + CD67039222E7F7BC0072C96A /* HUDForGuard.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD67039122E7F7BC0072C96A /* HUDForGuard.swift */; }; + CD6CD86C22F1858F00F4FD4A /* ToastModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD6CD86B22F1858F00F4FD4A /* ToastModel.swift */; }; + CD6CD86E22F185A000F4FD4A /* ToastView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD6CD86D22F185A000F4FD4A /* ToastView.swift */; }; + CD6CD87022F185A700F4FD4A /* ToastController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD6CD86F22F185A700F4FD4A /* ToastController.swift */; }; + CD6CD87222F185AF00F4FD4A /* ToastConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD6CD87122F185AF00F4FD4A /* ToastConfig.swift */; }; + CD6CD87522F185C200F4FD4A /* GuardController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD6CD87422F185C200F4FD4A /* GuardController.swift */; }; + CD6CD87722F185C900F4FD4A /* GuardModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD6CD87622F185C900F4FD4A /* GuardModel.swift */; }; + CD6CD87922F185D000F4FD4A /* GuardConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD6CD87822F185D000F4FD4A /* GuardConfig.swift */; }; + CD6CD87B22F185D600F4FD4A /* GuardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD6CD87A22F185D600F4FD4A /* GuardView.swift */; }; + CD95D22122E72C4C007559A3 /* ProHUD.h in Headers */ = {isa = PBXBuildFile; fileRef = CD95D21F22E72C4C007559A3 /* ProHUD.h */; settings = {ATTRIBUTES = (Public, ); }; }; + CD95D26922E72DA1007559A3 /* AlertController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD95D26822E72DA1007559A3 /* AlertController.swift */; }; + CD95D26B22E72DB3007559A3 /* ProHUD.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD95D26A22E72DB3007559A3 /* ProHUD.swift */; }; + CDB6A07B22EEF06500AF6CF0 /* HUDController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDB6A07A22EEF06500AF6CF0 /* HUDController.swift */; }; + CDB6A07D22EEF19D00AF6CF0 /* HUDConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDB6A07C22EEF19D00AF6CF0 /* HUDConfig.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + CD16490A22EF09AB0077988C /* AlertModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertModel.swift; sourceTree = ""; }; + CD16490C22EF09B40077988C /* AlertConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertConfig.swift; sourceTree = ""; }; + CD16490E22EF09D50077988C /* AlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertView.swift; sourceTree = ""; }; + CD16491122EF0D900077988C /* HUDView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HUDView.swift; sourceTree = ""; }; + CD16491322EF12220077988C /* ProHUD.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = ProHUD.xcassets; sourceTree = ""; }; + CD67038F22E7F7B60072C96A /* HUDForToast.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HUDForToast.swift; sourceTree = ""; }; + CD67039122E7F7BC0072C96A /* HUDForGuard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HUDForGuard.swift; sourceTree = ""; }; + CD6CD86B22F1858F00F4FD4A /* ToastModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToastModel.swift; sourceTree = ""; }; + CD6CD86D22F185A000F4FD4A /* ToastView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToastView.swift; sourceTree = ""; }; + CD6CD86F22F185A700F4FD4A /* ToastController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToastController.swift; sourceTree = ""; }; + CD6CD87122F185AF00F4FD4A /* ToastConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToastConfig.swift; sourceTree = ""; }; + CD6CD87422F185C200F4FD4A /* GuardController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GuardController.swift; sourceTree = ""; }; + CD6CD87622F185C900F4FD4A /* GuardModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GuardModel.swift; sourceTree = ""; }; + CD6CD87822F185D000F4FD4A /* GuardConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GuardConfig.swift; sourceTree = ""; }; + CD6CD87A22F185D600F4FD4A /* GuardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GuardView.swift; sourceTree = ""; }; + CD95D21C22E72C4C007559A3 /* ProHUD.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ProHUD.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + CD95D21F22E72C4C007559A3 /* ProHUD.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ProHUD.h; sourceTree = ""; }; + CD95D22022E72C4C007559A3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + CD95D26722E72D68007559A3 /* ProHUD.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; path = ProHUD.podspec; sourceTree = ""; }; + CD95D26822E72DA1007559A3 /* AlertController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertController.swift; sourceTree = ""; }; + CD95D26A22E72DB3007559A3 /* ProHUD.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProHUD.swift; sourceTree = ""; }; + CDB6A07A22EEF06500AF6CF0 /* HUDController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HUDController.swift; sourceTree = ""; }; + CDB6A07C22EEF19D00AF6CF0 /* HUDConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HUDConfig.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + CD95D21922E72C4C007559A3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + CD16491022EF0A4B0077988C /* Alert */ = { + isa = PBXGroup; + children = ( + CD95D26822E72DA1007559A3 /* AlertController.swift */, + CD16490A22EF09AB0077988C /* AlertModel.swift */, + CD16490C22EF09B40077988C /* AlertConfig.swift */, + CD16490E22EF09D50077988C /* AlertView.swift */, + ); + path = Alert; + sourceTree = ""; + }; + CD6CD87322F185B400F4FD4A /* Toast */ = { + isa = PBXGroup; + children = ( + CD6CD86B22F1858F00F4FD4A /* ToastModel.swift */, + CD6CD86D22F185A000F4FD4A /* ToastView.swift */, + CD6CD86F22F185A700F4FD4A /* ToastController.swift */, + CD6CD87122F185AF00F4FD4A /* ToastConfig.swift */, + ); + path = Toast; + sourceTree = ""; + }; + CD6CD87C22F185DA00F4FD4A /* Guard */ = { + isa = PBXGroup; + children = ( + CD6CD87422F185C200F4FD4A /* GuardController.swift */, + CD6CD87622F185C900F4FD4A /* GuardModel.swift */, + CD6CD87822F185D000F4FD4A /* GuardConfig.swift */, + CD6CD87A22F185D600F4FD4A /* GuardView.swift */, + ); + path = Guard; + sourceTree = ""; + }; + CD95D21222E72C4C007559A3 = { + isa = PBXGroup; + children = ( + CD95D26722E72D68007559A3 /* ProHUD.podspec */, + CD95D21E22E72C4C007559A3 /* ProHUD */, + CD95D21D22E72C4C007559A3 /* Products */, + ); + sourceTree = ""; + }; + CD95D21D22E72C4C007559A3 /* Products */ = { + isa = PBXGroup; + children = ( + CD95D21C22E72C4C007559A3 /* ProHUD.framework */, + ); + name = Products; + sourceTree = ""; + }; + CD95D21E22E72C4C007559A3 /* ProHUD */ = { + isa = PBXGroup; + children = ( + CD95D21F22E72C4C007559A3 /* ProHUD.h */, + CD16491322EF12220077988C /* ProHUD.xcassets */, + CD95D26A22E72DB3007559A3 /* ProHUD.swift */, + CD67038F22E7F7B60072C96A /* HUDForToast.swift */, + CD67039122E7F7BC0072C96A /* HUDForGuard.swift */, + CDB6A07C22EEF19D00AF6CF0 /* HUDConfig.swift */, + CDB6A07A22EEF06500AF6CF0 /* HUDController.swift */, + CD16491122EF0D900077988C /* HUDView.swift */, + CD6CD87322F185B400F4FD4A /* Toast */, + CD16491022EF0A4B0077988C /* Alert */, + CD6CD87C22F185DA00F4FD4A /* Guard */, + CD95D22022E72C4C007559A3 /* Info.plist */, + ); + path = ProHUD; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + CD95D21722E72C4C007559A3 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + CD95D22122E72C4C007559A3 /* ProHUD.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + CD95D21B22E72C4C007559A3 /* ProHUD */ = { + isa = PBXNativeTarget; + buildConfigurationList = CD95D22422E72C4C007559A3 /* Build configuration list for PBXNativeTarget "ProHUD" */; + buildPhases = ( + CD95D21722E72C4C007559A3 /* Headers */, + CD95D21822E72C4C007559A3 /* Sources */, + CD95D21922E72C4C007559A3 /* Frameworks */, + CD95D21A22E72C4C007559A3 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ProHUD; + productName = ProHUD; + productReference = CD95D21C22E72C4C007559A3 /* ProHUD.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + CD95D21322E72C4C007559A3 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1100; + ORGANIZATIONNAME = "Titan Studio"; + TargetAttributes = { + CD95D21B22E72C4C007559A3 = { + CreatedOnToolsVersion = 11.0; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = CD95D21622E72C4C007559A3 /* Build configuration list for PBXProject "ProHUD" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = CD95D21222E72C4C007559A3; + productRefGroup = CD95D21D22E72C4C007559A3 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + CD95D21B22E72C4C007559A3 /* ProHUD */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + CD95D21A22E72C4C007559A3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CD16491422EF12220077988C /* ProHUD.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + CD95D21822E72C4C007559A3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CD6CD87B22F185D600F4FD4A /* GuardView.swift in Sources */, + CD95D26922E72DA1007559A3 /* AlertController.swift in Sources */, + CD6CD87922F185D000F4FD4A /* GuardConfig.swift in Sources */, + CD67039222E7F7BC0072C96A /* HUDForGuard.swift in Sources */, + CDB6A07D22EEF19D00AF6CF0 /* HUDConfig.swift in Sources */, + CD16490F22EF09D50077988C /* AlertView.swift in Sources */, + CD6CD86E22F185A000F4FD4A /* ToastView.swift in Sources */, + CD6CD87222F185AF00F4FD4A /* ToastConfig.swift in Sources */, + CD67039022E7F7B60072C96A /* HUDForToast.swift in Sources */, + CD6CD87522F185C200F4FD4A /* GuardController.swift in Sources */, + CD6CD87022F185A700F4FD4A /* ToastController.swift in Sources */, + CD95D26B22E72DB3007559A3 /* ProHUD.swift in Sources */, + CD16490D22EF09B40077988C /* AlertConfig.swift in Sources */, + CD6CD86C22F1858F00F4FD4A /* ToastModel.swift in Sources */, + CD16490B22EF09AB0077988C /* AlertModel.swift in Sources */, + CD16491222EF0D900077988C /* HUDView.swift in Sources */, + CDB6A07B22EEF06500AF6CF0 /* HUDController.swift in Sources */, + CD6CD87722F185C900F4FD4A /* GuardModel.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + CD95D22222E72C4C007559A3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + 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_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; + CURRENT_PROJECT_VERSION = 1; + 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; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + CD95D22322E72C4C007559A3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + 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_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; + CURRENT_PROJECT_VERSION = 1; + 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; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + CD95D22522E72C4C007559A3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 34W5TB5KD2; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = ProHUD/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.xaoxuu.ProHUD; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + CD95D22622E72C4C007559A3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 34W5TB5KD2; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = ProHUD/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.xaoxuu.ProHUD; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + CD95D21622E72C4C007559A3 /* Build configuration list for PBXProject "ProHUD" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CD95D22222E72C4C007559A3 /* Debug */, + CD95D22322E72C4C007559A3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + CD95D22422E72C4C007559A3 /* Build configuration list for PBXNativeTarget "ProHUD" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CD95D22522E72C4C007559A3 /* Debug */, + CD95D22622E72C4C007559A3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = CD95D21322E72C4C007559A3 /* Project object */; +} diff --git a/ProHUD.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ProHUD.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..e7d8885 --- /dev/null +++ b/ProHUD.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ProHUD.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ProHUD.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ProHUD.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ProHUD/Alert/AlertConfig.swift b/ProHUD/Alert/AlertConfig.swift new file mode 100644 index 0000000..1ad306c --- /dev/null +++ b/ProHUD/Alert/AlertConfig.swift @@ -0,0 +1,227 @@ +// +// AlertConfig.swift +// ProHUD +// +// Created by xaoxuu on 2019/7/29. +// Copyright © 2019 Titan Studio. All rights reserved. +// + +import UIKit +import SnapKit + +public extension ProHUD.Configuration { + struct Alert { + /// 最大宽度(用于优化横屏或者iPad显示) + public var maxWidth = CGFloat(400) + /// 大标题字体 + public var largeTitleFont = UIFont.boldSystemFont(ofSize: 22) + /// 标题字体 + public var titleFont = UIFont.boldSystemFont(ofSize: 18) + /// 正文字体 + public var bodyFont = UIFont.systemFont(ofSize: 17) + /// 按钮字体 + public var buttonFont = UIFont.boldSystemFont(ofSize: 18) + /// 标题最多行数(0代表不限制) + public var titleMaxLines = Int(0) + /// 正文最多行数(0代表不限制) + public var bodyMaxLines = Int(0) + /// 圆角半径 + public var cornerRadius = CGFloat(16) + + public var margin = CGFloat(8) + + public var padding = CGFloat(16) + + public var iconSize = CGSize(width: 48, height: 48) + + public var tintColor = UIColor.init(red: 3/255, green: 169/255, blue: 244/255, alpha: 1) + /// 多少秒后显示强制退出的按钮【终止/隐藏】 + public var forceQuitTimeout = TimeInterval(2) + + /// 加载视图 + lazy var loadSubviews: (ProHUD.Alert) -> Void = { + return { (vc) in + debugPrint(vc, "loadSubviews") + vc.view.addSubview(vc.contentView) + vc.contentView.contentView.addSubview(vc.contentStack) + + let config = hud.config.alert + vc.contentStack.spacing = config.margin + config.padding + + vc.contentView.layer.masksToBounds = true + vc.contentView.layer.cornerRadius = config.cornerRadius + + vc.contentView.snp.makeConstraints { (mk) in + mk.center.equalToSuperview() + mk.width.lessThanOrEqualTo(CGFloat.minimum(UIScreen.main.bounds.width * 0.68, config.maxWidth)) + } + vc.contentStack.snp.makeConstraints { (mk) in + mk.centerX.equalToSuperview() + mk.top.equalToSuperview().offset(config.padding) + mk.bottom.equalToSuperview().offset(-config.padding) + mk.leading.equalToSuperview().offset(config.padding) + mk.trailing.equalToSuperview().offset(-config.padding) + } + + } + }() + + /// 更新视图 + lazy var updateFrame: (ProHUD.Alert) -> Void = { + return { (vc) in + debugPrint(vc, "updateFrame") + let config = hud.config.alert + let isFirstLayout: Bool + // 图标和文字至少有一个,如果都没有添加到视图中,说明是第一次layout + if vc.textStack.superview == nil && vc.imageView?.superview == nil { + isFirstLayout = true + } else { + isFirstLayout = false + } + let imgStr: String + switch vc.vm.scene { + case .success: + imgStr = "ProHUDSuccess" + case .warning: + imgStr = "ProHUDWarning" + case .error: + imgStr = "ProHUDError" + case .loading: + imgStr = "ProHUDLoading" + case .confirm: + imgStr = "ProHUDMessage" + case .delete: + imgStr = "ProHUDTrash" + default: + imgStr = "ProHUDMessage" + } + let img = vc.vm.icon ?? ProHUD.image(named: imgStr) + if let imgv = vc.imageView { + imgv.image = img + } else { + let icon = UIImageView(image: img) + vc.contentStack.addArrangedSubview(icon) + icon.snp.makeConstraints { (mk) in + mk.top.greaterThanOrEqualTo(vc.contentView).offset(config.padding*2.5) + mk.bottom.lessThanOrEqualTo(vc.contentView).offset(-config.padding*2.5) + mk.leading.greaterThanOrEqualTo(vc.contentView).offset(config.padding*4) + mk.trailing.lessThanOrEqualTo(vc.contentView).offset(-config.padding*4) + } + vc.imageView = icon + } + + // text + if vc.vm.title?.count ?? 0 > 0 || vc.vm.message?.count ?? 0 > 0 { + vc.contentStack.addArrangedSubview(vc.textStack) + vc.textStack.snp.makeConstraints { (mk) in + mk.top.greaterThanOrEqualTo(vc.contentView).offset(config.padding*1.5) + mk.bottom.lessThanOrEqualTo(vc.contentView).offset(-config.padding*1.5) + mk.leading.greaterThanOrEqualTo(vc.contentView).offset(config.padding*2) + mk.trailing.lessThanOrEqualTo(vc.contentView).offset(-config.padding*2) + } + if vc.vm.title?.count ?? 0 > 0 { + if let lb = vc.titleLabel { + lb.text = vc.vm.title + } else { + let title = UILabel() + title.textAlignment = .center + title.numberOfLines = config.titleMaxLines + title.textColor = UIColor.init(white: 0.2, alpha: 1) + title.text = vc.vm.title + vc.textStack.addArrangedSubview(title) + vc.titleLabel = title + } + if vc.vm.message?.count ?? 0 > 0 { + // 有message + vc.titleLabel?.font = config.largeTitleFont + } else { + // 没有message + vc.titleLabel?.font = config.titleFont + } + } else { + vc.titleLabel?.removeFromSuperview() + } + if vc.vm.message?.count ?? 0 > 0 { + if let lb = vc.messageLabel { + lb.text = vc.vm.message + } else { + let body = UILabel() + body.textAlignment = .center + body.font = config.bodyFont + body.numberOfLines = config.bodyMaxLines + body.textColor = UIColor.darkGray + body.text = vc.vm.message + vc.textStack.addArrangedSubview(body) + vc.messageLabel = body + } + if vc.vm.title?.count ?? 0 > 0 { + // 有title + vc.messageLabel?.font = config.bodyFont + } else { + // 没有title + vc.messageLabel?.font = config.titleFont + } + } else { + vc.messageLabel?.removeFromSuperview() + } + } else { + vc.textStack.removeFromSuperview() + } + if vc.actionStack.superview != nil { + vc.contentStack.addArrangedSubview(vc.actionStack) + // 适配横竖屏和iPad + if isPortrait == false { + vc.actionStack.axis = .horizontal + vc.actionStack.alignment = .fill + vc.actionStack.distribution = .fillEqually + } + vc.actionStack.snp.makeConstraints { (mk) in + mk.width.greaterThanOrEqualTo(200) + mk.leading.trailing.equalToSuperview() + } + } + if isFirstLayout { + vc.view.layoutIfNeeded() + vc.imageView?.transform = .init(scaleX: 0.75, y: 0.75) + } else { + + } + + UIView.animateFastEaseOut(delay: 0, animations: { + vc.imageView?.transform = .identity + vc.view.layoutIfNeeded() + }) { (done) in + } + } + }() + + /// 加载强制按钮 + lazy var showNavButtons: (ProHUD.Alert) -> Void = { + return { (vc) in + debugPrint(vc, "showNavButtons") + let btn = UIButton.hideButton() + vc.view.addSubview(btn) + btn.snp.makeConstraints { (mk) in + mk.leading.top.equalTo(vc.contentView).offset(hud.config.alert.margin/2) + } + vc.addTouchUpAction(for: btn) { [weak vc] in + debugPrint("点击了隐藏") + vc?.remove() + } + } + }() + + /// 加载视图 + /// - Parameter callback: 回调代码 + public mutating func loadSubviews(_ callback: @escaping (ProHUD.Alert) -> Void) { + loadSubviews = callback + } + + /// 更新视图 + /// - Parameter callback: 回调代码 + public mutating func updateFrame(_ callback: @escaping (ProHUD.Alert) -> Void) { + updateFrame = callback + } + + } +} diff --git a/ProHUD/Alert/AlertController.swift b/ProHUD/Alert/AlertController.swift new file mode 100644 index 0000000..0f91509 --- /dev/null +++ b/ProHUD/Alert/AlertController.swift @@ -0,0 +1,368 @@ +// +// Alert.swift +// ProHUD +// +// Created by xaoxuu on 2019/7/23. +// Copyright © 2019 Titan Studio. All rights reserved. +// + +import UIKit +import SnapKit + +public extension ProHUD { + class Alert: HUDController { + + /// 内容容器 + public var contentView = BlurView() + + /// 正文(包括icon、textStack、actionStack) + internal var contentStack: StackContainer = { + let stack = StackContainer() + return stack + }() + + /// 文本区域 + internal var textStack: StackContainer = { + let stack = StackContainer() + return stack + }() + internal var imageView: UIImageView? + internal var titleLabel: UILabel? + internal var messageLabel: UILabel? + /// 操作区域 + internal var actionStack: StackContainer = { + let stack = StackContainer() + stack.alignment = .fill + return stack + }() + + /// 视图模型 + public var vm = ViewModel() + + /// 显示顶部按钮(最小化) + internal var showNavButtonsBlock: DispatchWorkItem? + + // MARK: 生命周期 + + /// 实例化 + /// - Parameter scene: 场景 + /// - Parameter title: 标题 + /// - Parameter message: 内容 + /// - Parameter icon: 图标 + public convenience init(scene: Scene = .default, title: String? = nil, message: String? = nil, icon: UIImage? = nil) { + self.init() + view.tintColor = hud.config.alert.tintColor + vm.scene = scene + vm.title = title + vm.message = message + vm.icon = icon + switch scene { + case .loading: + timeout = nil + default: + timeout = 2 + } + + willLayout() + + } + + public override func viewDidDisappear(_ animated: Bool) { + super.viewDidDisappear(animated) + disappearCallback?() + } + + + /// 移除 + public func remove() { + let window = hud.getAlertWindow(self) + hud.removeItemFromArray(alert: self) + animateOut { (done) in + self.view.removeFromSuperview() + self.removeFromParent() + } + // hide window + let count = hud.alerts.count + if count == 0 && hud.alertWindow != nil { + UIView.animateFastEaseOut(delay: 0, animations: { + self.view.transform = .init(scaleX: 1.02, y: 1.02) + window.backgroundColor = window.backgroundColor?.withAlphaComponent(0) + }) { (done) in + hud.alertWindow = nil + } + } + } + + + // MARK: 设置函数 + + /// 设置超时时间 + /// - Parameter timeout: 超时时间 + @discardableResult public func timeout(_ timeout: TimeInterval?) -> Alert { + self.timeout = timeout + willLayout() + return self + } + + /// 添加按钮 + /// - Parameter style: 样式 + /// - Parameter text: 标题 + /// - Parameter action: 事件 + @discardableResult public func addAction(style: UIAlertAction.Style, title: String?, action: (() -> Void)?) -> Alert { + return addAction(custom: UIButton.actionButton(style: style, title: title), action: action) + } + + /// 添加按钮 + /// - Parameter button: 按钮 + /// - Parameter action: 事件 + @discardableResult public func addAction(custom button: UIButton , action: (() -> Void)?) -> Alert { + timeout = nil + if actionStack.superview == nil { + contentStack.addArrangedSubview(actionStack) + } + actionStack.addArrangedSubview(button) + addTouchUpAction(for: button) { [weak self] in + action?() + if button.tag == UIAlertAction.Style.cancel.rawValue { + self?.remove() + } + } + return self + } + + /// 消失事件 + /// - Parameter callback: 事件回调 + @discardableResult public func didDisappear(_ callback: (() -> Void)?) -> Alert { + disappearCallback = callback + return self + } + + /// 更新标题 + /// - Parameter title: 标题 + @discardableResult public func updateContent(scene: Scene, title: String? = nil, message: String? = nil, icon: UIImage? = nil) -> Alert { + vm.title = title + vm.message = message + vm.scene = scene + vm.icon = icon + hud.config.alert.updateFrame(self) + return self + } + + + /// 更新按钮 + /// - Parameter index: 索引 + /// - Parameter style: 样式 + /// - Parameter title: 标题 + /// - Parameter action: 事件 + @discardableResult public func updateAction(index: Int, style: UIAlertAction.Style, title: String?, action: (() -> Void)?) -> Alert { + return updateAction(index: index, button: { (btn) in + btn.setTitle(title, for: .normal) + btn.update(style: style) + btn.layoutIfNeeded() + }, action: action) + } + + + @discardableResult public func updateAction(index: Int, button: (UIButton) -> Void, action: (() -> Void)? = nil) -> Alert { + if index < self.actionStack.arrangedSubviews.count, let btn = self.actionStack.arrangedSubviews[index] as? UIButton { + button(btn) + if let ac = action { + addTouchUpAction(for: btn, action: ac) + } + } + UIView.animateFastEaseOut(delay: 0, animations: { + self.view.layoutIfNeeded() + }) { (done) in + } + return self + } + + @discardableResult public func removeAction(index: Int) -> Alert { + if index < 0 { + for view in self.actionStack.arrangedSubviews { + if let btn = view as? UIButton { + btn.removeFromSuperview() + } + } + } else if index < self.actionStack.arrangedSubviews.count, let btn = self.actionStack.arrangedSubviews[index] as? UIButton { + btn.removeFromSuperview() + } + UIView.animateFastEaseOut(delay: 0, animations: { + self.view.layoutIfNeeded() + }) { (done) in + } + return self + } + + + + } + +} + +fileprivate extension ProHUD.Alert { + func willLayout() { + willLayout?.cancel() + willLayout = DispatchWorkItem(block: { [weak self] in + if let a = self { + // 布局 + hud.config.alert.loadSubviews(a) + hud.config.alert.updateFrame(a) + // 超时 + a.timeoutBlock?.cancel() + if let t = a.timeout, t > 0 { + a.timeoutBlock = DispatchWorkItem(block: { [weak self] in + self?.remove() + }) + DispatchQueue.main.asyncAfter(deadline: .now()+t, execute: a.timeoutBlock!) + } else { + a.timeoutBlock = nil + } + // 顶部按钮 + if hud.config.alert.forceQuitTimeout > 0 && self?.actionStack.superview == nil { + a.showNavButtonsBlock?.cancel() + a.showNavButtonsBlock = DispatchWorkItem(block: { [weak self] in + if let s = self { + hud.config.alert.showNavButtons(s) + } + }) + DispatchQueue.main.asyncAfter(deadline: .now()+hud.config.alert.forceQuitTimeout, execute: a.showNavButtonsBlock!) + } + } + }) + DispatchQueue.main.asyncAfter(deadline: .now()+0.001, execute: willLayout!) + } + + +} + + +// MARK: - AlertHUD public func + +public extension ProHUD { + + @discardableResult + func show(_ alert: Alert) -> Alert { + let window = getAlertWindow(alert) + window.makeKeyAndVisible() + window.resignKey() + window.addSubview(alert.view) + UIView.animateFastEaseOut(delay: 0, animations: { + window.backgroundColor = window.backgroundColor?.withAlphaComponent(0.6) + }) + alert.view.transform = .init(scaleX: 1.2, y: 1.2) + alert.view.alpha = 0 + UIView.animateFastEaseOut(delay: 0, animations: { + alert.view.transform = .identity + alert.view.alpha = 1 + }) + alerts.append(alert) + updateAlertsScale() + // setup timeout + if let _ = alert.timeout, alert.timeoutBlock == nil { + alert.timeout(alert.timeout) + } + return alert + } + + @discardableResult + func show(alert: Alert.Scene, title: String? = nil, message: String? = nil, icon: UIImage? = nil) -> Alert { + return show(Alert(scene: alert, title: title, message: message, icon: icon)) + } + + func alerts(identifier: String?) -> [Alert] { + var aa = [Alert]() + for a in alerts { + if a.identifier == identifier { + aa.append(a) + } + } + return aa + } + + func remove(alert: Alert) { + for a in alerts { + if a == alert { + a.remove() + } + } + } + + func remove(alert identifier: String?) { + for a in alerts { + if a.identifier == identifier { + a.remove() + } + } + } +} + + +// MARK: AlertHUD public class func + +public extension ProHUD { + + @discardableResult + class func show(alert: Alert.Scene, title: String? = nil, message: String? = nil, icon: UIImage? = nil) -> Alert { + return shared.show(alert: alert, title: title, message: message, icon: icon) + } + + class func alert(identifier: String?) -> [Alert] { + return shared.alerts(identifier: identifier) + } + + class func remove(alert: Alert) { + shared.remove(alert: alert) + } + + class func remove(alert identifier: String?) { + shared.remove(alert: identifier) + } + +} + +// MARK: AlertHUD private func + +fileprivate extension ProHUD { + + func updateAlertsScale() { + for (i, a) in alerts.reversed().enumerated() { + let scale = CGFloat(pow(0.7, CGFloat(i))) + UIView.animate(withDuration: 2, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 0.5, options: [.allowUserInteraction, .curveEaseInOut], animations: { + let y = -50 * CGFloat(i) * CGFloat(pow(0.8, CGFloat(i))) + a.view.transform = CGAffineTransform.init(translationX: 0, y: y).scaledBy(x: scale, y: scale) + }) { (done) in + + } + } + } + + func getAlertWindow(_ vc: UIViewController) -> UIWindow { + if let w = alertWindow { + return w + } + let w = UIWindow() + alertWindow = w + w.backgroundColor = UIColor.init(red: 0, green: 0, blue: 0, alpha: 0) + // 比原生alert层级低一点 + w.windowLevel = UIWindow.Level.alert - 1 + return w + } + + func removeItemFromArray(alert: Alert) { + if alerts.count > 1 { + for (i, a) in alerts.enumerated() { + if a == alert { + alerts.remove(at: i) + } + } + updateAlertsScale() + } else if alerts.count == 1 { + alerts.removeAll() + } else { + debugPrint("漏洞:已经没有alert了") + } + } + +} + diff --git a/ProHUD/Alert/AlertModel.swift b/ProHUD/Alert/AlertModel.swift new file mode 100644 index 0000000..496ce99 --- /dev/null +++ b/ProHUD/Alert/AlertModel.swift @@ -0,0 +1,81 @@ +// +// AlertModel.swift +// ProHUD +// +// Created by xaoxuu on 2019/7/29. +// Copyright © 2019 Titan Studio. All rights reserved. +// + +import UIKit + +public extension ProHUD.Alert { + enum Scene { + /// 默认场景 + case `default` + + /// 加载中场景 + case loading + + /// 确认场景 + case confirm + + /// 删除场景 + case delete + + /// 成功场景 + case success + + /// 警告场景 + case warning + + /// 错误场景 + case error + + public var backgroundColor: UIColor { + switch self { + case .success: + return UIColor.green + case .warning: + return UIColor.yellow + case .error: + return UIColor.red + default: + return .clear + } + } + + public var tintColor: UIColor { + switch self { + case .success, .error: + return .white + default: + return UIColor.darkGray + } + } + } + + struct ViewModel { + + /// 使用场景 + public var scene = Scene.default + + /// 标题 + public var title: String? + + /// 正文 + public var message: String? + + /// 图标 + public var icon: UIImage? + + public init(title: String? = nil, message: String? = nil, icon: UIImage? = nil) { + self.title = title + self.message = message + self.icon = icon + } + + + } + +} + diff --git a/ProHUD/Alert/AlertView.swift b/ProHUD/Alert/AlertView.swift new file mode 100644 index 0000000..0051364 --- /dev/null +++ b/ProHUD/Alert/AlertView.swift @@ -0,0 +1,63 @@ +// +// AlertView.swift +// ProHUD +// +// Created by xaoxuu on 2019/7/29. +// Copyright © 2019 Titan Studio. All rights reserved. +// + +import UIKit + +public extension ProHUD.Alert { + + +} + +extension UIButton { + class func hideButton() -> UIButton { + let btn = UIButton(type: .custom) + btn.contentEdgeInsets = .init(top: 8, left: 8, bottom: 8, right: 8) + btn.setImage(ProHUD.image(named: "ProHUDMinimize"), for: .normal) + btn.layer.shadowOpacity = 0.15 + btn.layer.shadowOffset = .init(width: 0, height: 1.2) + btn.layer.shadowRadius = 1.2 + btn.alpha = 0 + btn.transform = .init(scaleX: 0.5, y: 0.5) + UIView.animateFastEaseOut(delay: 0, animations: { + btn.alpha = 1 + btn.transform = .identity + }) { (done) in + } + return btn + } + class func actionButton(style: UIAlertAction.Style, title: String?) -> UIButton { + let btn = UIButton(type: .system) + btn.setTitle(title, for: .normal) + btn.layer.cornerRadius = hud.config.alert.cornerRadius / 2 + btn.titleLabel?.font = hud.config.alert.buttonFont + btn.update(style: style) + return btn + } + + func update(style: UIAlertAction.Style) { + let pd = hud.config.alert.padding/2 + if style != .cancel { + backgroundColor = .init(white: 0, alpha: 0.04) + contentEdgeInsets = .init(top: pd*1.5, left: pd*1.5, bottom: pd*1.5, right: pd*1.5) + } else { + contentEdgeInsets = .init(top: pd*0.5, left: pd*1.5, bottom: pd*0.5, right: pd*1.5) + } + switch style { + case .default: + setTitleColor(tintColor, for: .normal) + case .destructive: + setTitleColor(.init(red: 244/255, green: 67/255, blue: 54/255, alpha: 1), for: .normal) + case .cancel: + setTitleColor(.darkGray, for: .normal) + @unknown default: + break + } + tag = style.rawValue + } + +} diff --git a/ProHUD/Guard/GuardConfig.swift b/ProHUD/Guard/GuardConfig.swift new file mode 100644 index 0000000..d454649 --- /dev/null +++ b/ProHUD/Guard/GuardConfig.swift @@ -0,0 +1,60 @@ +// +// GuardConfig.swift +// ProHUD +// +// Created by xaoxuu on 2019/7/31. +// Copyright © 2019 Titan Studio. All rights reserved. +// + +import SnapKit + +public extension ProHUD.Configuration { + struct Guard { + /// 最大宽度(用于优化横屏或者iPad显示) + public var maxWidth = CGFloat(500) + /// 标题字体 + public var titleFont = UIFont.boldSystemFont(ofSize: 18) + /// 正文字体 + public var bodyFont = UIFont.systemFont(ofSize: 16) + /// 标题最多行数(0代表不限制) + public var titleMaxLines = Int(0) + /// 正文最多行数(0代表不限制) + public var bodyMaxLines = Int(0) + /// 圆角半径 + public var cornerRadius = CGFloat(16) + + public var margin = CGFloat(8) + + public var padding = CGFloat(16) + + public var iconSize = CGSize(width: 48, height: 48) + + /// 加载视图 + lazy var loadSubviews: (ProHUD.Alert) -> Void = { + return { (vc) in + debugPrint(vc, "loadSubviews") + + } + }() + + /// 更新视图 + lazy var updateFrame: (ProHUD.Alert) -> Void = { + return { (vc) in + debugPrint(vc, "updateFrame") + } + }() + + /// 加载视图 + /// - Parameter callback: 回调代码 + public mutating func loadSubviews(_ callback: @escaping (ProHUD.Alert) -> Void) { + loadSubviews = callback + } + + /// 更新视图 + /// - Parameter callback: 回调代码 + public mutating func updateFrame(_ callback: @escaping (ProHUD.Alert) -> Void) { + updateFrame = callback + } + + } +} diff --git a/ProHUD/Guard/GuardController.swift b/ProHUD/Guard/GuardController.swift new file mode 100644 index 0000000..c35b70c --- /dev/null +++ b/ProHUD/Guard/GuardController.swift @@ -0,0 +1,9 @@ +// +// GuardController.swift +// ProHUD +// +// Created by xaoxuu on 2019/7/31. +// Copyright © 2019 Titan Studio. All rights reserved. +// + +import Foundation diff --git a/ProHUD/Guard/GuardModel.swift b/ProHUD/Guard/GuardModel.swift new file mode 100644 index 0000000..dc0b4c6 --- /dev/null +++ b/ProHUD/Guard/GuardModel.swift @@ -0,0 +1,9 @@ +// +// GuardModel.swift +// ProHUD +// +// Created by xaoxuu on 2019/7/31. +// Copyright © 2019 Titan Studio. All rights reserved. +// + +import Foundation diff --git a/ProHUD/Guard/GuardView.swift b/ProHUD/Guard/GuardView.swift new file mode 100644 index 0000000..9242f66 --- /dev/null +++ b/ProHUD/Guard/GuardView.swift @@ -0,0 +1,9 @@ +// +// GuardView.swift +// ProHUD +// +// Created by xaoxuu on 2019/7/31. +// Copyright © 2019 Titan Studio. All rights reserved. +// + +import Foundation diff --git a/ProHUD/HUDConfig.swift b/ProHUD/HUDConfig.swift new file mode 100644 index 0000000..fa1a850 --- /dev/null +++ b/ProHUD/HUDConfig.swift @@ -0,0 +1,38 @@ +// +// HUDConfig.swift +// ProHUD +// +// Created by xaoxuu on 2019/7/29. +// Copyright © 2019 Titan Studio. All rights reserved. +// + +import UIKit + +public extension ProHUD { + struct Configuration { + + internal var toast = Toast() + internal var alert = Alert() + internal var `guard` = Guard() + + /// Toast的配置 + /// - Parameter callback: 回调 + public mutating func toast(_ callback: @escaping (inout Toast) -> Void) { + callback(&toast) + } + + /// Alert的配置 + /// - Parameter callback: 回调 + public mutating func alert(_ callback: @escaping (inout Alert) -> Void) { + callback(&alert) + } + + /// Guard的配置 + /// - Parameter callback: 回调 + public mutating func `guard`(_ callback: @escaping (inout Guard) -> Void) { + callback(&`guard`) + } + + } +} + diff --git a/ProHUD/HUDController.swift b/ProHUD/HUDController.swift new file mode 100644 index 0000000..94d867f --- /dev/null +++ b/ProHUD/HUDController.swift @@ -0,0 +1,70 @@ +// +// HUDController.swift +// ProHUD +// +// Created by xaoxuu on 2019/7/29. +// Copyright © 2019 Titan Studio. All rights reserved. +// + +import UIKit + +public class HUDController: UIViewController { + + public var identifier = String(Date().timeIntervalSince1970) + + internal var willLayout: DispatchWorkItem? + + /// 超时(自动消失)时间 + internal var timeout: TimeInterval? + + internal var timeoutBlock: DispatchWorkItem? + + /// 消失回调 + internal var disappearCallback: (() -> Void)? + internal var buttonEvents = [UIButton:() -> Void]() + + init() { + super.init(nibName: nil, bundle: nil) + print(self, "init") + } + + required public init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + deinit { + debugPrint(self, "deinit") + } + + + override public func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + + +} + +internal extension HUDController { + + func animateOut(completion: ((Bool) -> Void)? = nil) { + UIView.animateFastEaseOut(delay: 0, animations: { + self.view.alpha = 0 + }) { (done) in + completion?(done) + } + } + + func addTouchUpAction(for button: UIButton, action: @escaping () -> Void) { + button.addTarget(self, action: #selector(didTappedButton(_:)), for: .touchUpInside) + buttonEvents[button] = action + } + + @objc func didTappedButton(_ sender: UIButton) { + if let ac = buttonEvents[sender] { + ac() + } + } + +} diff --git a/ProHUD/HUDForGuard.swift b/ProHUD/HUDForGuard.swift new file mode 100644 index 0000000..8e2c53a --- /dev/null +++ b/ProHUD/HUDForGuard.swift @@ -0,0 +1,73 @@ +// +// Guard.swift +// ProHUD +// +// Created by xaoxuu on 2019/7/24. +// Copyright © 2019 Titan Studio. All rights reserved. +// + +import UIKit + +//public extension ProHUD { +// class Guard: Element { +// +// public class View: UIView { +// public var stack = UIStackView() +// +// public class Button: UIButton { +// +// } +// } +// +// +// public convenience init(title: String? = nil, message: String? = nil) { +// self.init() +// vm.title = title +// vm.message = message +// } +// +// public override func viewDidDisappear(_ animated: Bool) { +// vm.disappearCallback?() +// } +// +// } +// +// +// @discardableResult +// func show(_ guard: Guard) -> Guard { +// return `guard` +// } +// +// @discardableResult +// func showGuard(title: String? = nil, message: String? = nil) -> Guard { +// return ProHUD.shared.show(Guard(title: title, message: message)) +// } +// +// @discardableResult +// class func showGuard(title: String? = nil, message: String? = nil) -> Guard { +// return shared.showGuard(title: title, message: message) +// } +// +//} +// +//public extension ProHUD.Guard { +// +// @discardableResult +// func addAction(style: UIAlertAction.Style, title: String?, didTapped: ((View.Button) -> Void)?) -> ProHUD.Guard { +// +// return self +// } +// +// @discardableResult +// func addAction(custom: (View.Button) -> Void, didTapped: ((View.Button) -> Void)?) -> ProHUD.Guard { +// +// return self +// } +// +// @discardableResult +// func didDisappear(_ callback: (() -> Void)?) -> ProHUD.Guard { +// vm.disappearCallback = callback +// return self +// } +// +//} diff --git a/ProHUD/HUDForToast.swift b/ProHUD/HUDForToast.swift new file mode 100644 index 0000000..f02edc9 --- /dev/null +++ b/ProHUD/HUDForToast.swift @@ -0,0 +1,61 @@ +// +// Toast.swift +// ProHUD +// +// Created by xaoxuu on 2019/7/24. +// Copyright © 2019 Titan Studio. All rights reserved. +// + +import UIKit + + +//public extension ProHUD { +// class Toast: HUDController { +// +// public class View: UIView { +// public var stack = UIStackView() +// +// public class Button: UIButton { +// +// } +// } +// +// public convenience init(scene: HUDScene = .default, title: String?, message: String?, icon: UIImage?) { +// self.init() +// vm.scene = scene +// vm.title = title +// vm.message = message +// vm.icon = icon +// switch scene { +// case .loading: +// vm.timeout = nil +// default: +// vm.timeout = 2 +// } +// } +// +// /// 设置超时时间 +// /// - Parameter timeout: 超时时间 +// public func timeout(_ timeout: TimeInterval?) -> Toast { +// vm.timeout = timeout +// return self +// } +// +// } +// +// @discardableResult +// func show(_ toast: Toast) -> Toast { +// return toast +// } +// +// @discardableResult +// func showToast(scene: HUDScene = .default, title: String?, message: String?, icon: UIImage? = nil) -> Toast { +// return ProHUD.shared.show(Toast(scene: scene, title: title, message: message, icon: icon)) +// } +// +// @discardableResult +// class func showAlert(scene: HUDScene = .default, title: String?, message: String?, icon: UIImage? = nil) -> Toast { +// return shared.showToast(scene: scene, title: title, message: message, icon: icon) +// } +// +//} diff --git a/ProHUD/HUDView.swift b/ProHUD/HUDView.swift new file mode 100644 index 0000000..963fd75 --- /dev/null +++ b/ProHUD/HUDView.swift @@ -0,0 +1,62 @@ +// +// HUDView.swift +// ProHUD +// +// Created by xaoxuu on 2019/7/29. +// Copyright © 2019 Titan Studio. All rights reserved. +// + +import UIKit + +public extension ProHUD { + + class StackContainer: UIStackView { + + + public override init(frame: CGRect) { + super.init(frame: frame) + spacing = hud.config.alert.margin + distribution = .fill + alignment = .center + axis = .vertical + + } + + required init(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + } + + class BlurView: UIVisualEffectView { + + + init() { + super.init(effect: UIBlurEffect(style: .light)) + backgroundColor = UIColor.init(white: 1, alpha: 0.66) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + } + + +} + +internal extension UIView { + + class func animateEaseOut(duration: TimeInterval = 1, delay: TimeInterval = 0, animations: @escaping () -> Void, completion: ((Bool) -> Void)? = nil) { + animate(withDuration: duration, delay: delay, usingSpringWithDamping: 1, initialSpringVelocity: 1, options: [.allowUserInteraction, .curveEaseOut], animations: animations, completion: completion) + } + + class func animateFastEaseOut(delay: TimeInterval = 0, animations: @escaping () -> Void, completion: ((Bool) -> Void)? = nil) { + animateEaseOut(duration: 0.5, delay: delay, animations: animations, completion: completion) + } + + class func animateSlowEaseOut(delay: TimeInterval = 0, animations: @escaping () -> Void, completion: ((Bool) -> Void)? = nil) { + animateEaseOut(duration: 2, delay: delay, animations: animations, completion: completion) + } + +} diff --git a/ProHUD/Info.plist b/ProHUD/Info.plist new file mode 100644 index 0000000..9bcb244 --- /dev/null +++ b/ProHUD/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + + diff --git a/ProHUD/ProHUD.h b/ProHUD/ProHUD.h new file mode 100644 index 0000000..57853f8 --- /dev/null +++ b/ProHUD/ProHUD.h @@ -0,0 +1,19 @@ +// +// ProHUD.h +// ProHUD +// +// Created by xaoxuu on 2019/7/23. +// Copyright © 2019 Titan Studio. All rights reserved. +// + +#import + +//! Project version number for ProHUD. +FOUNDATION_EXPORT double ProHUDVersionNumber; + +//! Project version string for ProHUD. +FOUNDATION_EXPORT const unsigned char ProHUDVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/ProHUD/ProHUD.swift b/ProHUD/ProHUD.swift new file mode 100644 index 0000000..50320fc --- /dev/null +++ b/ProHUD/ProHUD.swift @@ -0,0 +1,73 @@ +// +// ProHUD.swift +// ProHUD +// +// Created by xaoxuu on 2019/7/23. +// Copyright © 2019 Titan Studio. All rights reserved. +// + +import UIKit + +internal let hud = ProHUD.shared + +public class ProHUD: NSObject { + + public static let shared = ProHUD() + + internal var config = Configuration() + + public var elements = [String]() + +// public var toasts = [Toast]() + public var alerts = [Alert]() + + internal var alertWindow: UIWindow? + + deinit { + debugPrint(self, "deinit") + } + + + +} + +public extension ProHUD { + + func config(toast: (inout Configuration.Toast) -> Void) { + toast(&config.toast) + } + func config(alert: (inout Configuration.Alert) -> Void) { + alert(&config.alert) + } + func config(guard: (inout Configuration.Guard) -> Void) { + `guard`(&config.guard) + } + +} + + +internal extension ProHUD { + + class var bundle: Bundle { + var b = Bundle.init(for: ProHUD.self) + let p = b.path(forResource: "ProHUD", ofType: "bundle") + if let bb = Bundle.init(path: p ?? "") { + b = bb + } + return b + } + + class func image(named: String) -> UIImage? { + return UIImage.init(named: named, in: bundle, compatibleWith: nil) + } + + +} + +internal var isPortrait: Bool { + if UIScreen.main.bounds.width < 500 { + return true + } else { + return false + } +} diff --git a/ProHUD/ProHUD.xcassets/Contents.json b/ProHUD/ProHUD.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/ProHUD/ProHUD.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ProHUD/ProHUD.xcassets/ProHUDError.imageset/Contents.json b/ProHUD/ProHUD.xcassets/ProHUDError.imageset/Contents.json new file mode 100644 index 0000000..48c2c50 --- /dev/null +++ b/ProHUD/ProHUD.xcassets/ProHUDError.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ProHUDError@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "ProHUDError@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ProHUD/ProHUD.xcassets/ProHUDError.imageset/ProHUDError@2x.png b/ProHUD/ProHUD.xcassets/ProHUDError.imageset/ProHUDError@2x.png new file mode 100644 index 0000000..62e1a32 Binary files /dev/null and b/ProHUD/ProHUD.xcassets/ProHUDError.imageset/ProHUDError@2x.png differ diff --git a/ProHUD/ProHUD.xcassets/ProHUDError.imageset/ProHUDError@3x.png b/ProHUD/ProHUD.xcassets/ProHUDError.imageset/ProHUDError@3x.png new file mode 100644 index 0000000..5076022 Binary files /dev/null and b/ProHUD/ProHUD.xcassets/ProHUDError.imageset/ProHUDError@3x.png differ diff --git a/ProHUD/ProHUD.xcassets/ProHUDLoading.imageset/Contents.json b/ProHUD/ProHUD.xcassets/ProHUDLoading.imageset/Contents.json new file mode 100644 index 0000000..eba4d3a --- /dev/null +++ b/ProHUD/ProHUD.xcassets/ProHUDLoading.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ProHUDLoading@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "ProHUDLoading@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ProHUD/ProHUD.xcassets/ProHUDLoading.imageset/ProHUDLoading@2x.png b/ProHUD/ProHUD.xcassets/ProHUDLoading.imageset/ProHUDLoading@2x.png new file mode 100644 index 0000000..6357f41 Binary files /dev/null and b/ProHUD/ProHUD.xcassets/ProHUDLoading.imageset/ProHUDLoading@2x.png differ diff --git a/ProHUD/ProHUD.xcassets/ProHUDLoading.imageset/ProHUDLoading@3x.png b/ProHUD/ProHUD.xcassets/ProHUDLoading.imageset/ProHUDLoading@3x.png new file mode 100644 index 0000000..94d26bd Binary files /dev/null and b/ProHUD/ProHUD.xcassets/ProHUDLoading.imageset/ProHUDLoading@3x.png differ diff --git a/ProHUD/ProHUD.xcassets/ProHUDMessage.imageset/Contents.json b/ProHUD/ProHUD.xcassets/ProHUDMessage.imageset/Contents.json new file mode 100644 index 0000000..d050e76 --- /dev/null +++ b/ProHUD/ProHUD.xcassets/ProHUDMessage.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ProHUDMessage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "ProHUDMessage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ProHUD/ProHUD.xcassets/ProHUDMessage.imageset/ProHUDMessage@2x.png b/ProHUD/ProHUD.xcassets/ProHUDMessage.imageset/ProHUDMessage@2x.png new file mode 100644 index 0000000..9b5aa6a Binary files /dev/null and b/ProHUD/ProHUD.xcassets/ProHUDMessage.imageset/ProHUDMessage@2x.png differ diff --git a/ProHUD/ProHUD.xcassets/ProHUDMessage.imageset/ProHUDMessage@3x.png b/ProHUD/ProHUD.xcassets/ProHUDMessage.imageset/ProHUDMessage@3x.png new file mode 100644 index 0000000..a7322dd Binary files /dev/null and b/ProHUD/ProHUD.xcassets/ProHUDMessage.imageset/ProHUDMessage@3x.png differ diff --git a/ProHUD/ProHUD.xcassets/ProHUDMinimize.imageset/Contents.json b/ProHUD/ProHUD.xcassets/ProHUDMinimize.imageset/Contents.json new file mode 100644 index 0000000..0430a35 --- /dev/null +++ b/ProHUD/ProHUD.xcassets/ProHUDMinimize.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ProHUDMinimize@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "ProHUDMinimize@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ProHUD/ProHUD.xcassets/ProHUDMinimize.imageset/ProHUDMinimize@2x.png b/ProHUD/ProHUD.xcassets/ProHUDMinimize.imageset/ProHUDMinimize@2x.png new file mode 100644 index 0000000..4ee0a98 Binary files /dev/null and b/ProHUD/ProHUD.xcassets/ProHUDMinimize.imageset/ProHUDMinimize@2x.png differ diff --git a/ProHUD/ProHUD.xcassets/ProHUDMinimize.imageset/ProHUDMinimize@3x.png b/ProHUD/ProHUD.xcassets/ProHUDMinimize.imageset/ProHUDMinimize@3x.png new file mode 100644 index 0000000..0086dda Binary files /dev/null and b/ProHUD/ProHUD.xcassets/ProHUDMinimize.imageset/ProHUDMinimize@3x.png differ diff --git a/ProHUD/ProHUD.xcassets/ProHUDSuccess.imageset/Contents.json b/ProHUD/ProHUD.xcassets/ProHUDSuccess.imageset/Contents.json new file mode 100644 index 0000000..bff012c --- /dev/null +++ b/ProHUD/ProHUD.xcassets/ProHUDSuccess.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ProHUDSuccess@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "ProHUDSuccess@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ProHUD/ProHUD.xcassets/ProHUDSuccess.imageset/ProHUDSuccess@2x.png b/ProHUD/ProHUD.xcassets/ProHUDSuccess.imageset/ProHUDSuccess@2x.png new file mode 100644 index 0000000..91a86c6 Binary files /dev/null and b/ProHUD/ProHUD.xcassets/ProHUDSuccess.imageset/ProHUDSuccess@2x.png differ diff --git a/ProHUD/ProHUD.xcassets/ProHUDSuccess.imageset/ProHUDSuccess@3x.png b/ProHUD/ProHUD.xcassets/ProHUDSuccess.imageset/ProHUDSuccess@3x.png new file mode 100644 index 0000000..3b637da Binary files /dev/null and b/ProHUD/ProHUD.xcassets/ProHUDSuccess.imageset/ProHUDSuccess@3x.png differ diff --git a/ProHUD/ProHUD.xcassets/ProHUDTrash.imageset/Contents.json b/ProHUD/ProHUD.xcassets/ProHUDTrash.imageset/Contents.json new file mode 100644 index 0000000..f6faed5 --- /dev/null +++ b/ProHUD/ProHUD.xcassets/ProHUDTrash.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ProHUDTrash@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "ProHUDTrash@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ProHUD/ProHUD.xcassets/ProHUDTrash.imageset/ProHUDTrash@2x.png b/ProHUD/ProHUD.xcassets/ProHUDTrash.imageset/ProHUDTrash@2x.png new file mode 100644 index 0000000..d136622 Binary files /dev/null and b/ProHUD/ProHUD.xcassets/ProHUDTrash.imageset/ProHUDTrash@2x.png differ diff --git a/ProHUD/ProHUD.xcassets/ProHUDTrash.imageset/ProHUDTrash@3x.png b/ProHUD/ProHUD.xcassets/ProHUDTrash.imageset/ProHUDTrash@3x.png new file mode 100644 index 0000000..d3f1cce Binary files /dev/null and b/ProHUD/ProHUD.xcassets/ProHUDTrash.imageset/ProHUDTrash@3x.png differ diff --git a/ProHUD/ProHUD.xcassets/ProHUDWarning.imageset/Contents.json b/ProHUD/ProHUD.xcassets/ProHUDWarning.imageset/Contents.json new file mode 100644 index 0000000..31d0029 --- /dev/null +++ b/ProHUD/ProHUD.xcassets/ProHUDWarning.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ProHUDWarning@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "ProHUDWarning@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ProHUD/ProHUD.xcassets/ProHUDWarning.imageset/ProHUDWarning@2x.png b/ProHUD/ProHUD.xcassets/ProHUDWarning.imageset/ProHUDWarning@2x.png new file mode 100644 index 0000000..9d63015 Binary files /dev/null and b/ProHUD/ProHUD.xcassets/ProHUDWarning.imageset/ProHUDWarning@2x.png differ diff --git a/ProHUD/ProHUD.xcassets/ProHUDWarning.imageset/ProHUDWarning@3x.png b/ProHUD/ProHUD.xcassets/ProHUDWarning.imageset/ProHUDWarning@3x.png new file mode 100644 index 0000000..036ebde Binary files /dev/null and b/ProHUD/ProHUD.xcassets/ProHUDWarning.imageset/ProHUDWarning@3x.png differ diff --git a/ProHUD/Toast/ToastConfig.swift b/ProHUD/Toast/ToastConfig.swift new file mode 100644 index 0000000..b128343 --- /dev/null +++ b/ProHUD/Toast/ToastConfig.swift @@ -0,0 +1,61 @@ +// +// ToastConfig.swift +// ProHUD +// +// Created by xaoxuu on 2019/7/31. +// Copyright © 2019 Titan Studio. All rights reserved. +// + +import SnapKit + +public extension ProHUD.Configuration { + struct Toast { + /// 最大宽度(用于优化横屏或者iPad显示) + public var maxWidth = CGFloat(500) + /// 标题字体 + public var titleFont = UIFont.boldSystemFont(ofSize: 18) + /// 正文字体 + public var bodyFont = UIFont.systemFont(ofSize: 16) + /// 标题最多行数(0代表不限制) + public var titleMaxLines = Int(0) + /// 正文最多行数(0代表不限制) + public var bodyMaxLines = Int(0) + /// 圆角半径 + public var cornerRadius = CGFloat(16) + + public var margin = CGFloat(8) + + public var padding = CGFloat(16) + + public var iconSize = CGSize(width: 48, height: 48) + + /// 加载视图 + lazy var loadSubviews: (ProHUD.Alert) -> Void = { + return { (vc) in + debugPrint(vc, "loadSubviews") + + } + }() + + /// 更新视图 + lazy var updateFrame: (ProHUD.Alert) -> Void = { + return { (vc) in + debugPrint(vc, "updateFrame") + } + }() + + /// 加载视图 + /// - Parameter callback: 回调代码 + public mutating func loadSubviews(_ callback: @escaping (ProHUD.Alert) -> Void) { + loadSubviews = callback + } + + /// 更新视图 + /// - Parameter callback: 回调代码 + public mutating func updateFrame(_ callback: @escaping (ProHUD.Alert) -> Void) { + updateFrame = callback + } + + } +} + diff --git a/ProHUD/Toast/ToastController.swift b/ProHUD/Toast/ToastController.swift new file mode 100644 index 0000000..85ed164 --- /dev/null +++ b/ProHUD/Toast/ToastController.swift @@ -0,0 +1,9 @@ +// +// ToastController.swift +// ProHUD +// +// Created by xaoxuu on 2019/7/31. +// Copyright © 2019 Titan Studio. All rights reserved. +// + +import Foundation diff --git a/ProHUD/Toast/ToastModel.swift b/ProHUD/Toast/ToastModel.swift new file mode 100644 index 0000000..eab4d69 --- /dev/null +++ b/ProHUD/Toast/ToastModel.swift @@ -0,0 +1,9 @@ +// +// ToastModel.swift +// ProHUD +// +// Created by xaoxuu on 2019/7/31. +// Copyright © 2019 Titan Studio. All rights reserved. +// + +import Foundation diff --git a/ProHUD/Toast/ToastView.swift b/ProHUD/Toast/ToastView.swift new file mode 100644 index 0000000..39a4593 --- /dev/null +++ b/ProHUD/Toast/ToastView.swift @@ -0,0 +1,9 @@ +// +// ToastView.swift +// ProHUD +// +// Created by xaoxuu on 2019/7/31. +// Copyright © 2019 Titan Studio. All rights reserved. +// + +import Foundation