Add example project

This commit is contained in:
Simon 2018-12-26 14:20:00 +08:00
parent 6c35880c03
commit 1cff1e82d5
14 changed files with 892 additions and 10 deletions

View File

@ -20,10 +20,10 @@ before_install:
script:
- set -o pipefail
- 'if [ $POD_LINT == "YES" ]; then pod lib lint; fi'
# - >-
# if [ $BUILD_EXAMPLE == "YES" ]; then xcodebuild clean build -project
# Examples/TableViewExample/TableViewExample.xcodeproj -scheme
# TableViewExample -sdk "$SDK" -destination "$DESTINATION"; fi
- >-
if [ $BUILD_EXAMPLE == "YES" ]; then xcodebuild clean build -project
Examples/ImagesExample/ImagesExample.xcodeproj -scheme
TableViewExample -sdk "$SDK" -destination "$DESTINATION"; fi
- >-
if [ $RUN_TESTS == "YES" ]; then xcodebuild clean test -project
"$PROJECT" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION"

View File

@ -0,0 +1,528 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
F4EC51C421D33B6900DED569 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4EC51C321D33B6900DED569 /* AppDelegate.swift */; };
F4EC51C621D33B6900DED569 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4EC51C521D33B6900DED569 /* ViewController.swift */; };
F4EC51C921D33B6900DED569 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F4EC51C721D33B6900DED569 /* Main.storyboard */; };
F4EC51CB21D33B6B00DED569 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F4EC51CA21D33B6B00DED569 /* Assets.xcassets */; };
F4EC51CE21D33B6B00DED569 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F4EC51CC21D33B6B00DED569 /* LaunchScreen.storyboard */; };
F4EC51D921D33B6B00DED569 /* ImagesExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4EC51D821D33B6B00DED569 /* ImagesExampleTests.swift */; };
F4EC51F021D33C1800DED569 /* PlaceholderKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F4EC51E921D33B7D00DED569 /* PlaceholderKit.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
F4EC51D521D33B6B00DED569 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = F4EC51B821D33B6900DED569 /* Project object */;
proxyType = 1;
remoteGlobalIDString = F4EC51BF21D33B6900DED569;
remoteInfo = ImagesExample;
};
F4EC51E821D33B7D00DED569 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = F4EC51E321D33B7D00DED569 /* PlaceholderKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F444B67021C104460042E6F2;
remoteInfo = PlaceholderKit;
};
F4EC51EA21D33B7D00DED569 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = F4EC51E321D33B7D00DED569 /* PlaceholderKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F444B67921C104460042E6F2;
remoteInfo = PlaceholderKitTests;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
F4EC51C021D33B6900DED569 /* ImagesExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ImagesExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
F4EC51C321D33B6900DED569 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
F4EC51C521D33B6900DED569 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
F4EC51C821D33B6900DED569 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
F4EC51CA21D33B6B00DED569 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
F4EC51CD21D33B6B00DED569 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
F4EC51CF21D33B6B00DED569 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
F4EC51D421D33B6B00DED569 /* ImagesExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ImagesExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
F4EC51D821D33B6B00DED569 /* ImagesExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImagesExampleTests.swift; sourceTree = "<group>"; };
F4EC51DA21D33B6B00DED569 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
F4EC51E321D33B7D00DED569 /* PlaceholderKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PlaceholderKit.xcodeproj; path = ../../PlaceholderKit.xcodeproj; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
F4EC51BD21D33B6900DED569 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
F4EC51F021D33C1800DED569 /* PlaceholderKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
F4EC51D121D33B6B00DED569 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
F4EC51B721D33B6900DED569 = {
isa = PBXGroup;
children = (
F4EC51E321D33B7D00DED569 /* PlaceholderKit.xcodeproj */,
F4EC51C221D33B6900DED569 /* ImagesExample */,
F4EC51D721D33B6B00DED569 /* ImagesExampleTests */,
F4EC51C121D33B6900DED569 /* Products */,
F4EC51ED21D33C1800DED569 /* Frameworks */,
);
sourceTree = "<group>";
};
F4EC51C121D33B6900DED569 /* Products */ = {
isa = PBXGroup;
children = (
F4EC51C021D33B6900DED569 /* ImagesExample.app */,
F4EC51D421D33B6B00DED569 /* ImagesExampleTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
F4EC51C221D33B6900DED569 /* ImagesExample */ = {
isa = PBXGroup;
children = (
F4EC51C321D33B6900DED569 /* AppDelegate.swift */,
F4EC51C521D33B6900DED569 /* ViewController.swift */,
F4EC51C721D33B6900DED569 /* Main.storyboard */,
F4EC51CA21D33B6B00DED569 /* Assets.xcassets */,
F4EC51CC21D33B6B00DED569 /* LaunchScreen.storyboard */,
F4EC51CF21D33B6B00DED569 /* Info.plist */,
);
path = ImagesExample;
sourceTree = "<group>";
};
F4EC51D721D33B6B00DED569 /* ImagesExampleTests */ = {
isa = PBXGroup;
children = (
F4EC51D821D33B6B00DED569 /* ImagesExampleTests.swift */,
F4EC51DA21D33B6B00DED569 /* Info.plist */,
);
path = ImagesExampleTests;
sourceTree = "<group>";
};
F4EC51E421D33B7D00DED569 /* Products */ = {
isa = PBXGroup;
children = (
F4EC51E921D33B7D00DED569 /* PlaceholderKit.framework */,
F4EC51EB21D33B7D00DED569 /* PlaceholderKitTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
F4EC51ED21D33C1800DED569 /* Frameworks */ = {
isa = PBXGroup;
children = (
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
F4EC51BF21D33B6900DED569 /* ImagesExample */ = {
isa = PBXNativeTarget;
buildConfigurationList = F4EC51DD21D33B6B00DED569 /* Build configuration list for PBXNativeTarget "ImagesExample" */;
buildPhases = (
F4EC51BC21D33B6900DED569 /* Sources */,
F4EC51BD21D33B6900DED569 /* Frameworks */,
F4EC51BE21D33B6900DED569 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = ImagesExample;
productName = ImagesExample;
productReference = F4EC51C021D33B6900DED569 /* ImagesExample.app */;
productType = "com.apple.product-type.application";
};
F4EC51D321D33B6B00DED569 /* ImagesExampleTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = F4EC51E021D33B6B00DED569 /* Build configuration list for PBXNativeTarget "ImagesExampleTests" */;
buildPhases = (
F4EC51D021D33B6B00DED569 /* Sources */,
F4EC51D121D33B6B00DED569 /* Frameworks */,
F4EC51D221D33B6B00DED569 /* Resources */,
);
buildRules = (
);
dependencies = (
F4EC51D621D33B6B00DED569 /* PBXTargetDependency */,
);
name = ImagesExampleTests;
productName = ImagesExampleTests;
productReference = F4EC51D421D33B6B00DED569 /* ImagesExampleTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
F4EC51B821D33B6900DED569 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1010;
LastUpgradeCheck = 1010;
ORGANIZATIONNAME = "Shao Ping Lee";
TargetAttributes = {
F4EC51BF21D33B6900DED569 = {
CreatedOnToolsVersion = 10.1;
};
F4EC51D321D33B6B00DED569 = {
CreatedOnToolsVersion = 10.1;
TestTargetID = F4EC51BF21D33B6900DED569;
};
};
};
buildConfigurationList = F4EC51BB21D33B6900DED569 /* Build configuration list for PBXProject "ImagesExample" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = F4EC51B721D33B6900DED569;
productRefGroup = F4EC51C121D33B6900DED569 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = F4EC51E421D33B7D00DED569 /* Products */;
ProjectRef = F4EC51E321D33B7D00DED569 /* PlaceholderKit.xcodeproj */;
},
);
projectRoot = "";
targets = (
F4EC51BF21D33B6900DED569 /* ImagesExample */,
F4EC51D321D33B6B00DED569 /* ImagesExampleTests */,
);
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
F4EC51E921D33B7D00DED569 /* PlaceholderKit.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = PlaceholderKit.framework;
remoteRef = F4EC51E821D33B7D00DED569 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
F4EC51EB21D33B7D00DED569 /* PlaceholderKitTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = PlaceholderKitTests.xctest;
remoteRef = F4EC51EA21D33B7D00DED569 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
F4EC51BE21D33B6900DED569 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F4EC51CE21D33B6B00DED569 /* LaunchScreen.storyboard in Resources */,
F4EC51CB21D33B6B00DED569 /* Assets.xcassets in Resources */,
F4EC51C921D33B6900DED569 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
F4EC51D221D33B6B00DED569 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
F4EC51BC21D33B6900DED569 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F4EC51C621D33B6900DED569 /* ViewController.swift in Sources */,
F4EC51C421D33B6900DED569 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
F4EC51D021D33B6B00DED569 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F4EC51D921D33B6B00DED569 /* ImagesExampleTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
F4EC51D621D33B6B00DED569 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = F4EC51BF21D33B6900DED569 /* ImagesExample */;
targetProxy = F4EC51D521D33B6B00DED569 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
F4EC51C721D33B6900DED569 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
F4EC51C821D33B6900DED569 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
F4EC51CC21D33B6B00DED569 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
F4EC51CD21D33B6B00DED569 /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
F4EC51DB21D33B6B00DED569 /* 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 = 12.1;
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";
};
name = Debug;
};
F4EC51DC21D33B6B00DED569 /* 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 = 12.1;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
F4EC51DE21D33B6B00DED569 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = T3LQ95726F;
INFOPLIST_FILE = ImagesExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.shaopinglee.ImagesExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
F4EC51DF21D33B6B00DED569 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = T3LQ95726F;
INFOPLIST_FILE = ImagesExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.shaopinglee.ImagesExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
F4EC51E121D33B6B00DED569 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = T3LQ95726F;
INFOPLIST_FILE = ImagesExampleTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.shaopinglee.ImagesExampleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ImagesExample.app/ImagesExample";
};
name = Debug;
};
F4EC51E221D33B6B00DED569 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = T3LQ95726F;
INFOPLIST_FILE = ImagesExampleTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.shaopinglee.ImagesExampleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ImagesExample.app/ImagesExample";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
F4EC51BB21D33B6900DED569 /* Build configuration list for PBXProject "ImagesExample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F4EC51DB21D33B6B00DED569 /* Debug */,
F4EC51DC21D33B6B00DED569 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
F4EC51DD21D33B6B00DED569 /* Build configuration list for PBXNativeTarget "ImagesExample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F4EC51DE21D33B6B00DED569 /* Debug */,
F4EC51DF21D33B6B00DED569 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
F4EC51E021D33B6B00DED569 /* Build configuration list for PBXNativeTarget "ImagesExampleTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F4EC51E121D33B6B00DED569 /* Debug */,
F4EC51E221D33B6B00DED569 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = F4EC51B821D33B6900DED569 /* Project object */;
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:ImagesExample.xcodeproj">
</FileRef>
</Workspace>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,46 @@
//
// AppDelegate.swift
// ImagesExample
//
// Created by Simon Lee on 12/26/18.
// Copyright © 2018 Shao Ping Lee. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and 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.
}
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:.
}
}

View File

@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View File

@ -0,0 +1,25 @@
//
// ViewController.swift
// ImagesExample
//
// Created by Simon Lee on 12/26/18.
// Copyright © 2018 Shao Ping Lee. All rights reserved.
//
import UIKit
import PlaceholderKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let settings = PlaceholderSettings(size: CGSize(width: 320, height: 640),
background: .solidColor(UIColor.red),
showDimensionAsText: true,
convertDimensionToAspectRatio: false)
let factory = PlaceholderFactory(settings: settings)
let image = factory.createPlaceholder()
print(image)
}
}

View File

@ -0,0 +1,34 @@
//
// ImagesExampleTests.swift
// ImagesExampleTests
//
// Created by Simon Lee on 12/26/18.
// Copyright © 2018 Shao Ping Lee. All rights reserved.
//
import XCTest
@testable import ImagesExample
class ImagesExampleTests: XCTestCase {
override func 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.
}
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.
}
}
}

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@ -8,18 +8,18 @@
#if os(OSX)
import AppKit
typealias Color = NSColor
typealias Image = NSImage
public typealias Color = NSColor
public typealias Image = NSImage
#else
import UIKit
typealias Color = UIColor
typealias Image = UIImage
public typealias Color = UIColor
public typealias Image = UIImage
#endif
public struct PlaceholderFactory {
let settings: PlaceholderSettings
func createPlaceholder() -> Image? {
public func createPlaceholder() -> Image? {
switch settings.background {
case .solidColor(let color):
return Image.createPlaceholder(withColor: color, size: settings.size)
@ -27,6 +27,10 @@ public struct PlaceholderFactory {
return nil
}
}
public init(settings: PlaceholderSettings) {
self.settings = settings
}
}
public struct PlaceholderSettings {
@ -34,9 +38,19 @@ public struct PlaceholderSettings {
let background: PlaceholderBackground
let showDimensionAsText: Bool
let convertDimensionToAspectRatio: Bool
public init(size: CGSize,
background: PlaceholderBackground,
showDimensionAsText: Bool,
convertDimensionToAspectRatio: Bool) {
self.size = size
self.background = background
self.showDimensionAsText = showDimensionAsText
self.convertDimensionToAspectRatio = convertDimensionToAspectRatio
}
}
enum PlaceholderBackground {
public enum PlaceholderBackground {
case solidColor(Color)
case image(Image)
}