commit a4e4611b2a7fd7b5900be6fa8697523e40113b79 Author: Shial Date: Tue May 30 23:32:37 2017 +1000 Add SWindow diff --git a/SWindow.xcodeproj/project.pbxproj b/SWindow.xcodeproj/project.pbxproj new file mode 100644 index 0000000..15e6caf --- /dev/null +++ b/SWindow.xcodeproj/project.pbxproj @@ -0,0 +1,429 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 62A735B41EDDA1CA008174F2 /* SWindow.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 62A735AA1EDDA1CA008174F2 /* SWindow.framework */; }; + 62A735B91EDDA1CA008174F2 /* SWindowTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62A735B81EDDA1CA008174F2 /* SWindowTests.swift */; }; + 62A735BB1EDDA1CA008174F2 /* SWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 62A735AD1EDDA1CA008174F2 /* SWindow.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 62A735C51EDDA231008174F2 /* SWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62A735C41EDDA231008174F2 /* SWindow.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 62A735B51EDDA1CA008174F2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 62A735A11EDDA1CA008174F2 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 62A735A91EDDA1CA008174F2; + remoteInfo = SWindow; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 62A735AA1EDDA1CA008174F2 /* SWindow.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SWindow.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 62A735AD1EDDA1CA008174F2 /* SWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SWindow.h; sourceTree = ""; }; + 62A735AE1EDDA1CA008174F2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 62A735B31EDDA1CA008174F2 /* SWindowTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SWindowTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 62A735B81EDDA1CA008174F2 /* SWindowTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SWindowTests.swift; sourceTree = ""; }; + 62A735BA1EDDA1CA008174F2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 62A735C41EDDA231008174F2 /* SWindow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SWindow.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 62A735A61EDDA1CA008174F2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 62A735B01EDDA1CA008174F2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 62A735B41EDDA1CA008174F2 /* SWindow.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 62A735A01EDDA1CA008174F2 = { + isa = PBXGroup; + children = ( + 62A735AC1EDDA1CA008174F2 /* SWindow */, + 62A735B71EDDA1CA008174F2 /* SWindowTests */, + 62A735AB1EDDA1CA008174F2 /* Products */, + ); + sourceTree = ""; + }; + 62A735AB1EDDA1CA008174F2 /* Products */ = { + isa = PBXGroup; + children = ( + 62A735AA1EDDA1CA008174F2 /* SWindow.framework */, + 62A735B31EDDA1CA008174F2 /* SWindowTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 62A735AC1EDDA1CA008174F2 /* SWindow */ = { + isa = PBXGroup; + children = ( + 62A735AD1EDDA1CA008174F2 /* SWindow.h */, + 62A735AE1EDDA1CA008174F2 /* Info.plist */, + 62A735C41EDDA231008174F2 /* SWindow.swift */, + ); + path = SWindow; + sourceTree = ""; + }; + 62A735B71EDDA1CA008174F2 /* SWindowTests */ = { + isa = PBXGroup; + children = ( + 62A735B81EDDA1CA008174F2 /* SWindowTests.swift */, + 62A735BA1EDDA1CA008174F2 /* Info.plist */, + ); + path = SWindowTests; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 62A735A71EDDA1CA008174F2 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 62A735BB1EDDA1CA008174F2 /* SWindow.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 62A735A91EDDA1CA008174F2 /* SWindow */ = { + isa = PBXNativeTarget; + buildConfigurationList = 62A735BE1EDDA1CA008174F2 /* Build configuration list for PBXNativeTarget "SWindow" */; + buildPhases = ( + 62A735A51EDDA1CA008174F2 /* Sources */, + 62A735A61EDDA1CA008174F2 /* Frameworks */, + 62A735A71EDDA1CA008174F2 /* Headers */, + 62A735A81EDDA1CA008174F2 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SWindow; + productName = SWindow; + productReference = 62A735AA1EDDA1CA008174F2 /* SWindow.framework */; + productType = "com.apple.product-type.framework"; + }; + 62A735B21EDDA1CA008174F2 /* SWindowTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 62A735C11EDDA1CA008174F2 /* Build configuration list for PBXNativeTarget "SWindowTests" */; + buildPhases = ( + 62A735AF1EDDA1CA008174F2 /* Sources */, + 62A735B01EDDA1CA008174F2 /* Frameworks */, + 62A735B11EDDA1CA008174F2 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 62A735B61EDDA1CA008174F2 /* PBXTargetDependency */, + ); + name = SWindowTests; + productName = SWindowTests; + productReference = 62A735B31EDDA1CA008174F2 /* SWindowTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 62A735A11EDDA1CA008174F2 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0830; + LastUpgradeCheck = 0830; + ORGANIZATIONNAME = Shial; + TargetAttributes = { + 62A735A91EDDA1CA008174F2 = { + CreatedOnToolsVersion = 8.3.2; + DevelopmentTeam = 7Z5C7X6723; + LastSwiftMigration = 0830; + ProvisioningStyle = Automatic; + }; + 62A735B21EDDA1CA008174F2 = { + CreatedOnToolsVersion = 8.3.2; + DevelopmentTeam = 7Z5C7X6723; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 62A735A41EDDA1CA008174F2 /* Build configuration list for PBXProject "SWindow" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 62A735A01EDDA1CA008174F2; + productRefGroup = 62A735AB1EDDA1CA008174F2 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 62A735A91EDDA1CA008174F2 /* SWindow */, + 62A735B21EDDA1CA008174F2 /* SWindowTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 62A735A81EDDA1CA008174F2 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 62A735B11EDDA1CA008174F2 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 62A735A51EDDA1CA008174F2 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 62A735C51EDDA231008174F2 /* SWindow.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 62A735AF1EDDA1CA008174F2 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 62A735B91EDDA1CA008174F2 /* SWindowTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 62A735B61EDDA1CA008174F2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 62A735A91EDDA1CA008174F2 /* SWindow */; + targetProxy = 62A735B51EDDA1CA008174F2 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 62A735BC1EDDA1CA008174F2 /* 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++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_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.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 62A735BD1EDDA1CA008174F2 /* 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++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.3; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 62A735BF1EDDA1CA008174F2 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 7Z5C7X6723; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = SWindow/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.shial.swindow.ios.SWindow; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + 62A735C01EDDA1CA008174F2 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 7Z5C7X6723; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = SWindow/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.shial.swindow.ios.SWindow; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; + }; + name = Release; + }; + 62A735C21EDDA1CA008174F2 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + DEVELOPMENT_TEAM = 7Z5C7X6723; + INFOPLIST_FILE = SWindowTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.shial.swindow.ios.SWindowTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + 62A735C31EDDA1CA008174F2 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + DEVELOPMENT_TEAM = 7Z5C7X6723; + INFOPLIST_FILE = SWindowTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.shial.swindow.ios.SWindowTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 62A735A41EDDA1CA008174F2 /* Build configuration list for PBXProject "SWindow" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 62A735BC1EDDA1CA008174F2 /* Debug */, + 62A735BD1EDDA1CA008174F2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 62A735BE1EDDA1CA008174F2 /* Build configuration list for PBXNativeTarget "SWindow" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 62A735BF1EDDA1CA008174F2 /* Debug */, + 62A735C01EDDA1CA008174F2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; + 62A735C11EDDA1CA008174F2 /* Build configuration list for PBXNativeTarget "SWindowTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 62A735C21EDDA1CA008174F2 /* Debug */, + 62A735C31EDDA1CA008174F2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = 62A735A11EDDA1CA008174F2 /* Project object */; +} diff --git a/SWindow.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/SWindow.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..6e7d5a9 --- /dev/null +++ b/SWindow.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/SWindow.xcodeproj/project.xcworkspace/xcuserdata/shial.xcuserdatad/UserInterfaceState.xcuserstate b/SWindow.xcodeproj/project.xcworkspace/xcuserdata/shial.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..1fe4408 Binary files /dev/null and b/SWindow.xcodeproj/project.xcworkspace/xcuserdata/shial.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/SWindow.xcodeproj/xcuserdata/shial.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/SWindow.xcodeproj/xcuserdata/shial.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..fe2b454 --- /dev/null +++ b/SWindow.xcodeproj/xcuserdata/shial.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/SWindow.xcodeproj/xcuserdata/shial.xcuserdatad/xcschemes/SWindow.xcscheme b/SWindow.xcodeproj/xcuserdata/shial.xcuserdatad/xcschemes/SWindow.xcscheme new file mode 100644 index 0000000..a533ed9 --- /dev/null +++ b/SWindow.xcodeproj/xcuserdata/shial.xcuserdatad/xcschemes/SWindow.xcscheme @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SWindow.xcodeproj/xcuserdata/shial.xcuserdatad/xcschemes/xcschememanagement.plist b/SWindow.xcodeproj/xcuserdata/shial.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..869eeff --- /dev/null +++ b/SWindow.xcodeproj/xcuserdata/shial.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + SWindow.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 62A735A91EDDA1CA008174F2 + + primary + + + 62A735B21EDDA1CA008174F2 + + primary + + + + + diff --git a/SWindow/Info.plist b/SWindow/Info.plist new file mode 100644 index 0000000..fbe1e6b --- /dev/null +++ b/SWindow/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/SWindow/SWindow.h b/SWindow/SWindow.h new file mode 100644 index 0000000..18dfee2 --- /dev/null +++ b/SWindow/SWindow.h @@ -0,0 +1,19 @@ +// +// SWindow.h +// SWindow +// +// Created by Shial on 30/5/17. +// Copyright © 2017 Shial. All rights reserved. +// + +#import + +//! Project version number for SWindow. +FOUNDATION_EXPORT double SWindowVersionNumber; + +//! Project version string for SWindow. +FOUNDATION_EXPORT const unsigned char SWindowVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/SWindow/SWindow.swift b/SWindow/SWindow.swift new file mode 100644 index 0000000..c6b1f98 --- /dev/null +++ b/SWindow/SWindow.swift @@ -0,0 +1,155 @@ +// +// SWindow.swift +// SWindow +// +// Created by Shial on 30/5/17. +// Copyright © 2017 Shial. All rights reserved. +// + +import UIKit + +public typealias SModalPriority = Float + +extension SModalPriority { + public static var Low: SModalPriority = 250 + public static var Required: SModalPriority = 500 + public static var High: SModalPriority = 750 +} + +public enum SModalStatus { + case presented + case waitingInStack + case none +} + +public class SModal { + static let modalWindow: UIWindow = { + let window = UIWindow(frame: UIScreen.main.bounds) + window.backgroundColor = .clear + window.windowLevel = windowLevel + window.isHidden = true + return window + }() + + static var stack: [SModalPresentation] = [] + + static var windowLevel: UIWindowLevel { + return UIWindowLevelAlert - 1 + } + + static var animationDuration: TimeInterval { + return 0.2 + } +} + +public protocol SModalStack { + var stack: [SModalPresentation] { get } + var modalStatus: SModalStatus { get } + var canDismiss: Bool { get } + var priority: SModalPriority { get } +} + +public protocol SModalPresentation: class, SModalStack { + func sPresent(animated: Bool, completion: (() -> Void)?) + func sWithdraw(animated: Bool, completion: (() -> Void)?) +} + +extension SModalPresentation { + public var modalStatus: SModalStatus { + if SModal.modalWindow.rootViewController === self { + return .presented + } + if SModal.stack.contains(where: { $0 === self }) { + return .waitingInStack + } + return .none + } + + public var canDismiss: Bool { + return false + } + + public var stack: [SModalPresentation] { + return SModal.stack + } + + public var priority: SModalPriority { + return .Required + } +} + +extension SModalPresentation where Self: UIViewController { + func sReplace(with controller: T, animated: Bool, completion: (() -> Void)?) where T: SModalPresentation { + if animated { + SModal.modalWindow.isHidden = false + UIView.animate(withDuration: SModal.animationDuration, animations: { + SModal.modalWindow.rootViewController = controller + SModal.modalWindow.makeKey() + SModal.modalWindow.alpha = 1 + }, completion: { completed in + completion?() + }) + } else { + SModal.modalWindow.rootViewController = controller + SModal.modalWindow.makeKey() + SModal.modalWindow.isHidden = false + completion?() + } + + } + + func sPresent(animated: Bool, completion: (() -> Void)?) { + guard let currentPresented = SModal.modalWindow.rootViewController else { + SModal.modalWindow.rootViewController = self + SModal.modalWindow.makeKey() + if animated { + SModal.modalWindow.alpha = 0 + SModal.modalWindow.isHidden = false + UIView.animate(withDuration: SModal.animationDuration, animations: { + SModal.modalWindow.alpha = 1 + }, completion: { completed in + completion?() + }) + } else { + SModal.modalWindow.isHidden = false + completion?() + } + return + } + if let sModalController = currentPresented as? Self, sModalController.canDismiss == true { + sModalController.sReplace(with: self, animated: animated, completion: completion) + } else { + SModal.stack.append(self) + } + } + + func sWithdraw(animated: Bool, completion: (() -> Void)?) { + if SModal.modalWindow.rootViewController === self { + if animated { + SModal.modalWindow.alpha = 1 + UIView.animate(withDuration: SModal.animationDuration, animations: { + SModal.modalWindow.alpha = 0 + }, completion: { completed in + SModal.modalWindow.isHidden = true + completion?() + }) + } else { + SModal.modalWindow.isHidden = true + completion?() + } + SModal.modalWindow.rootViewController = nil + SModal.modalWindow.resignKey() + } else if SModal.stack.contains(where: { $0 === self }) { + SModal.stack = SModal.stack.filter() { !($0 === self) } + } + DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + SModal.animationDuration) { + if let controller = SModal.stack.sorted(by: {$0.priority > $1.priority}).first { + SModal.stack.removeFirst() + controller.sPresent(animated: true, completion: nil) + } + } + } +} + + + diff --git a/SWindowTests/Info.plist b/SWindowTests/Info.plist new file mode 100644 index 0000000..6c6c23c --- /dev/null +++ b/SWindowTests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/SWindowTests/SWindowTests.swift b/SWindowTests/SWindowTests.swift new file mode 100644 index 0000000..666b1b0 --- /dev/null +++ b/SWindowTests/SWindowTests.swift @@ -0,0 +1,36 @@ +// +// SWindowTests.swift +// SWindowTests +// +// Created by Shial on 30/5/17. +// Copyright © 2017 Shial. All rights reserved. +// + +import XCTest +@testable import SWindow + +class SWindowTests: XCTestCase { + + override func setUp() { + super.setUp() + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testExample() { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testPerformanceExample() { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +}