diff --git a/.gitignore b/.gitignore index cd6753f..94870ad 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ build/* xcuserdata profile *.moved-aside +Carthage diff --git a/Info-framework.plist b/Info-framework.plist new file mode 100644 index 0000000..384d8fb --- /dev/null +++ b/Info-framework.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + com.nghialv.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/MaterialKit.xcodeproj/project.pbxproj b/MaterialKit.xcodeproj/project.pbxproj new file mode 100644 index 0000000..430cf1d --- /dev/null +++ b/MaterialKit.xcodeproj/project.pbxproj @@ -0,0 +1,317 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 8956360E1ACF928D00CA60E9 /* MKButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 895636071ACF928D00CA60E9 /* MKButton.swift */; }; + 8956360F1ACF928D00CA60E9 /* MKColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 895636081ACF928D00CA60E9 /* MKColor.swift */; }; + 895636101ACF928D00CA60E9 /* MKImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 895636091ACF928D00CA60E9 /* MKImageView.swift */; }; + 895636111ACF928D00CA60E9 /* MKLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8956360A1ACF928D00CA60E9 /* MKLabel.swift */; }; + 895636121ACF928D00CA60E9 /* MKLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8956360B1ACF928D00CA60E9 /* MKLayer.swift */; }; + 895636131ACF928D00CA60E9 /* MKTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8956360C1ACF928D00CA60E9 /* MKTableViewCell.swift */; }; + 895636141ACF928D00CA60E9 /* MKTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8956360D1ACF928D00CA60E9 /* MKTextField.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 895635EB1ACF91F900CA60E9 /* MaterialKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MaterialKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 895635EF1ACF91F900CA60E9 /* Info-framework.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Info-framework.plist"; path = "../Info-framework.plist"; sourceTree = ""; }; + 895636071ACF928D00CA60E9 /* MKButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MKButton.swift; path = Source/MKButton.swift; sourceTree = SOURCE_ROOT; }; + 895636081ACF928D00CA60E9 /* MKColor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MKColor.swift; path = Source/MKColor.swift; sourceTree = SOURCE_ROOT; }; + 895636091ACF928D00CA60E9 /* MKImageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MKImageView.swift; path = Source/MKImageView.swift; sourceTree = SOURCE_ROOT; }; + 8956360A1ACF928D00CA60E9 /* MKLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MKLabel.swift; path = Source/MKLabel.swift; sourceTree = SOURCE_ROOT; }; + 8956360B1ACF928D00CA60E9 /* MKLayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MKLayer.swift; path = Source/MKLayer.swift; sourceTree = SOURCE_ROOT; }; + 8956360C1ACF928D00CA60E9 /* MKTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MKTableViewCell.swift; path = Source/MKTableViewCell.swift; sourceTree = SOURCE_ROOT; }; + 8956360D1ACF928D00CA60E9 /* MKTextField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MKTextField.swift; path = Source/MKTextField.swift; sourceTree = SOURCE_ROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 895635E71ACF91F900CA60E9 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 895635E11ACF91F900CA60E9 = { + isa = PBXGroup; + children = ( + 895635ED1ACF91F900CA60E9 /* MaterialKit */, + 895635EC1ACF91F900CA60E9 /* Products */, + ); + sourceTree = ""; + }; + 895635EC1ACF91F900CA60E9 /* Products */ = { + isa = PBXGroup; + children = ( + 895635EB1ACF91F900CA60E9 /* MaterialKit.framework */, + ); + name = Products; + sourceTree = ""; + }; + 895635ED1ACF91F900CA60E9 /* MaterialKit */ = { + isa = PBXGroup; + children = ( + 895636071ACF928D00CA60E9 /* MKButton.swift */, + 895636081ACF928D00CA60E9 /* MKColor.swift */, + 895636091ACF928D00CA60E9 /* MKImageView.swift */, + 8956360A1ACF928D00CA60E9 /* MKLabel.swift */, + 8956360B1ACF928D00CA60E9 /* MKLayer.swift */, + 8956360C1ACF928D00CA60E9 /* MKTableViewCell.swift */, + 8956360D1ACF928D00CA60E9 /* MKTextField.swift */, + 895635EE1ACF91F900CA60E9 /* Supporting Files */, + ); + path = MaterialKit; + sourceTree = ""; + }; + 895635EE1ACF91F900CA60E9 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 895635EF1ACF91F900CA60E9 /* Info-framework.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 895635E81ACF91F900CA60E9 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 895635EA1ACF91F900CA60E9 /* MaterialKit */ = { + isa = PBXNativeTarget; + buildConfigurationList = 895636011ACF91F900CA60E9 /* Build configuration list for PBXNativeTarget "MaterialKit" */; + buildPhases = ( + 895635E61ACF91F900CA60E9 /* Sources */, + 895635E71ACF91F900CA60E9 /* Frameworks */, + 895635E81ACF91F900CA60E9 /* Headers */, + 895635E91ACF91F900CA60E9 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = MaterialKit; + productName = MaterialKit; + productReference = 895635EB1ACF91F900CA60E9 /* MaterialKit.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 895635E21ACF91F900CA60E9 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0630; + ORGANIZATIONNAME = nghialv; + TargetAttributes = { + 895635EA1ACF91F900CA60E9 = { + CreatedOnToolsVersion = 6.3; + }; + }; + }; + buildConfigurationList = 895635E51ACF91F900CA60E9 /* Build configuration list for PBXProject "MaterialKit" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 895635E11ACF91F900CA60E9; + productRefGroup = 895635EC1ACF91F900CA60E9 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 895635EA1ACF91F900CA60E9 /* MaterialKit */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 895635E91ACF91F900CA60E9 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 895635E61ACF91F900CA60E9 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 895636111ACF928D00CA60E9 /* MKLabel.swift in Sources */, + 895636121ACF928D00CA60E9 /* MKLayer.swift in Sources */, + 895636141ACF928D00CA60E9 /* MKTextField.swift in Sources */, + 8956360E1ACF928D00CA60E9 /* MKButton.swift in Sources */, + 8956360F1ACF928D00CA60E9 /* MKColor.swift in Sources */, + 895636101ACF928D00CA60E9 /* MKImageView.swift in Sources */, + 895636131ACF928D00CA60E9 /* MKTableViewCell.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 895635FF1ACF91F900CA60E9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + 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_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 895636001ACF91F900CA60E9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + 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 = 8.3; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 895636021ACF91F900CA60E9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "$(SRCROOT)/Info-framework.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 895636031ACF91F900CA60E9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "$(SRCROOT)/Info-framework.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 895635E51ACF91F900CA60E9 /* Build configuration list for PBXProject "MaterialKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 895635FF1ACF91F900CA60E9 /* Debug */, + 895636001ACF91F900CA60E9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 895636011ACF91F900CA60E9 /* Build configuration list for PBXNativeTarget "MaterialKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 895636021ACF91F900CA60E9 /* Debug */, + 895636031ACF91F900CA60E9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 895635E21ACF91F900CA60E9 /* Project object */; +} diff --git a/MaterialKit.xcodeproj/xcshareddata/xcschemes/MaterialKit.xcscheme b/MaterialKit.xcodeproj/xcshareddata/xcschemes/MaterialKit.xcscheme new file mode 100644 index 0000000..3ad8d75 --- /dev/null +++ b/MaterialKit.xcodeproj/xcshareddata/xcschemes/MaterialKit.xcscheme @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/MKImageView.swift b/Source/MKImageView.swift index 62e9287..2b3d8ff 100644 --- a/Source/MKImageView.swift +++ b/Source/MKImageView.swift @@ -62,6 +62,11 @@ public class MKImageView: UIImageView } private lazy var mkLayer: MKLayer = MKLayer(superLayer: self.layer) + public init() { + super.init(frame: CGRectZero) + setup() + } + required public init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) setup() diff --git a/Source/MKLabel.swift b/Source/MKLabel.swift index ac23f94..bbbc660 100644 --- a/Source/MKLabel.swift +++ b/Source/MKLabel.swift @@ -60,6 +60,11 @@ public class MKLabel: UILabel { } private lazy var mkLayer: MKLayer = MKLayer(superLayer: self.layer) + public init() { + super.init(frame: CGRectZero) + setup() + } + required public init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) setup() diff --git a/Source/MKTableViewCell.swift b/Source/MKTableViewCell.swift index 3407c43..a5787f2 100644 --- a/Source/MKTableViewCell.swift +++ b/Source/MKTableViewCell.swift @@ -37,7 +37,12 @@ public class MKTableViewCell : UITableViewCell { override public init(style: UITableViewCellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } - + + public init(frame: CGRect) { + super.init(style: .Default, reuseIdentifier: nil) + setupLayer() + } + required public init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) setupLayer()