Merge pull request #6 from khoovirajsingh/master

Swift
This commit is contained in:
Emily Bache
2019-09-13 07:54:16 +02:00
committed by GitHub
15 changed files with 806 additions and 0 deletions

BIN
swift/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,479 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
104F7D7E23282F2900665957 /* Theatrical_Players_Refactoring_Kata.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 104F7D7423282F2900665957 /* Theatrical_Players_Refactoring_Kata.framework */; };
104F7D8323282F2900665957 /* StatementPrinterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 104F7D8223282F2900665957 /* StatementPrinterTests.swift */; };
104F7D8523282F2900665957 /* Theatrical_Players_Refactoring_Kata.h in Headers */ = {isa = PBXBuildFile; fileRef = 104F7D7723282F2900665957 /* Theatrical_Players_Refactoring_Kata.h */; settings = {ATTRIBUTES = (Public, ); }; };
104F7D8F2328305A00665957 /* Play.swift in Sources */ = {isa = PBXBuildFile; fileRef = 104F7D8E2328305A00665957 /* Play.swift */; };
104F7D91232830EF00665957 /* Performance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 104F7D90232830EF00665957 /* Performance.swift */; };
104F7D932328312700665957 /* Invoice.swift in Sources */ = {isa = PBXBuildFile; fileRef = 104F7D922328312600665957 /* Invoice.swift */; };
104F7D95232831E000665957 /* StatementPrinter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 104F7D94232831E000665957 /* StatementPrinter.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
104F7D7F23282F2900665957 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 104F7D6B23282F2900665957 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 104F7D7323282F2900665957;
remoteInfo = "Theatrical-Players-Refactoring-Kata";
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
104F7D7423282F2900665957 /* Theatrical_Players_Refactoring_Kata.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Theatrical_Players_Refactoring_Kata.framework; sourceTree = BUILT_PRODUCTS_DIR; };
104F7D7723282F2900665957 /* Theatrical_Players_Refactoring_Kata.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Theatrical_Players_Refactoring_Kata.h; sourceTree = "<group>"; };
104F7D7823282F2900665957 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
104F7D7D23282F2900665957 /* Theatrical-Players-Refactoring-KataTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Theatrical-Players-Refactoring-KataTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
104F7D8223282F2900665957 /* StatementPrinterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatementPrinterTests.swift; sourceTree = "<group>"; };
104F7D8423282F2900665957 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
104F7D8E2328305A00665957 /* Play.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Play.swift; sourceTree = "<group>"; };
104F7D90232830EF00665957 /* Performance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Performance.swift; sourceTree = "<group>"; };
104F7D922328312600665957 /* Invoice.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Invoice.swift; sourceTree = "<group>"; };
104F7D94232831E000665957 /* StatementPrinter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatementPrinter.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
104F7D7123282F2900665957 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
104F7D7A23282F2900665957 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
104F7D7E23282F2900665957 /* Theatrical_Players_Refactoring_Kata.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
104F7D6A23282F2900665957 = {
isa = PBXGroup;
children = (
104F7D7623282F2900665957 /* Theatrical-Players-Refactoring-Kata */,
104F7D8123282F2900665957 /* Theatrical-Players-Refactoring-KataTests */,
104F7D7523282F2900665957 /* Products */,
);
sourceTree = "<group>";
};
104F7D7523282F2900665957 /* Products */ = {
isa = PBXGroup;
children = (
104F7D7423282F2900665957 /* Theatrical_Players_Refactoring_Kata.framework */,
104F7D7D23282F2900665957 /* Theatrical-Players-Refactoring-KataTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
104F7D7623282F2900665957 /* Theatrical-Players-Refactoring-Kata */ = {
isa = PBXGroup;
children = (
104F7D7723282F2900665957 /* Theatrical_Players_Refactoring_Kata.h */,
104F7D7823282F2900665957 /* Info.plist */,
104F7D8E2328305A00665957 /* Play.swift */,
104F7D90232830EF00665957 /* Performance.swift */,
104F7D922328312600665957 /* Invoice.swift */,
104F7D94232831E000665957 /* StatementPrinter.swift */,
);
path = "Theatrical-Players-Refactoring-Kata";
sourceTree = "<group>";
};
104F7D8123282F2900665957 /* Theatrical-Players-Refactoring-KataTests */ = {
isa = PBXGroup;
children = (
104F7D8223282F2900665957 /* StatementPrinterTests.swift */,
104F7D8423282F2900665957 /* Info.plist */,
);
path = "Theatrical-Players-Refactoring-KataTests";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
104F7D6F23282F2900665957 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
104F7D8523282F2900665957 /* Theatrical_Players_Refactoring_Kata.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
104F7D7323282F2900665957 /* Theatrical-Players-Refactoring-Kata */ = {
isa = PBXNativeTarget;
buildConfigurationList = 104F7D8823282F2900665957 /* Build configuration list for PBXNativeTarget "Theatrical-Players-Refactoring-Kata" */;
buildPhases = (
104F7D6F23282F2900665957 /* Headers */,
104F7D7023282F2900665957 /* Sources */,
104F7D7123282F2900665957 /* Frameworks */,
104F7D7223282F2900665957 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "Theatrical-Players-Refactoring-Kata";
productName = "Theatrical-Players-Refactoring-Kata";
productReference = 104F7D7423282F2900665957 /* Theatrical_Players_Refactoring_Kata.framework */;
productType = "com.apple.product-type.framework";
};
104F7D7C23282F2900665957 /* Theatrical-Players-Refactoring-KataTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 104F7D8B23282F2900665957 /* Build configuration list for PBXNativeTarget "Theatrical-Players-Refactoring-KataTests" */;
buildPhases = (
104F7D7923282F2900665957 /* Sources */,
104F7D7A23282F2900665957 /* Frameworks */,
104F7D7B23282F2900665957 /* Resources */,
);
buildRules = (
);
dependencies = (
104F7D8023282F2900665957 /* PBXTargetDependency */,
);
name = "Theatrical-Players-Refactoring-KataTests";
productName = "Theatrical-Players-Refactoring-KataTests";
productReference = 104F7D7D23282F2900665957 /* Theatrical-Players-Refactoring-KataTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
104F7D6B23282F2900665957 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1030;
LastUpgradeCheck = 1030;
ORGANIZATIONNAME = kata;
TargetAttributes = {
104F7D7323282F2900665957 = {
CreatedOnToolsVersion = 10.3;
LastSwiftMigration = 1030;
};
104F7D7C23282F2900665957 = {
CreatedOnToolsVersion = 10.3;
};
};
};
buildConfigurationList = 104F7D6E23282F2900665957 /* Build configuration list for PBXProject "Theatrical-Players-Refactoring-Kata" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 104F7D6A23282F2900665957;
productRefGroup = 104F7D7523282F2900665957 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
104F7D7323282F2900665957 /* Theatrical-Players-Refactoring-Kata */,
104F7D7C23282F2900665957 /* Theatrical-Players-Refactoring-KataTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
104F7D7223282F2900665957 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
104F7D7B23282F2900665957 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
104F7D7023282F2900665957 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
104F7D91232830EF00665957 /* Performance.swift in Sources */,
104F7D932328312700665957 /* Invoice.swift in Sources */,
104F7D95232831E000665957 /* StatementPrinter.swift in Sources */,
104F7D8F2328305A00665957 /* Play.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
104F7D7923282F2900665957 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
104F7D8323282F2900665957 /* StatementPrinterTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
104F7D8023282F2900665957 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 104F7D7323282F2900665957 /* Theatrical-Players-Refactoring-Kata */;
targetProxy = 104F7D7F23282F2900665957 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
104F7D8623282F2900665957 /* 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 = "-";
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;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
104F7D8723282F2900665957 /* 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 = "-";
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;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
104F7D8923282F2900665957 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = "Theatrical-Players-Refactoring-Kata/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "kata.Theatrical-Players-Refactoring-Kata";
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
104F7D8A23282F2900665957 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = "Theatrical-Players-Refactoring-Kata/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "kata.Theatrical-Players-Refactoring-Kata";
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
};
name = Release;
};
104F7D8C23282F2900665957 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = "Theatrical-Players-Refactoring-KataTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "kata.Theatrical-Players-Refactoring-KataTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
104F7D8D23282F2900665957 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = "Theatrical-Players-Refactoring-KataTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "kata.Theatrical-Players-Refactoring-KataTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
104F7D6E23282F2900665957 /* Build configuration list for PBXProject "Theatrical-Players-Refactoring-Kata" */ = {
isa = XCConfigurationList;
buildConfigurations = (
104F7D8623282F2900665957 /* Debug */,
104F7D8723282F2900665957 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
104F7D8823282F2900665957 /* Build configuration list for PBXNativeTarget "Theatrical-Players-Refactoring-Kata" */ = {
isa = XCConfigurationList;
buildConfigurations = (
104F7D8923282F2900665957 /* Debug */,
104F7D8A23282F2900665957 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
104F7D8B23282F2900665957 /* Build configuration list for PBXNativeTarget "Theatrical-Players-Refactoring-KataTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
104F7D8C23282F2900665957 /* Debug */,
104F7D8D23282F2900665957 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 104F7D6B23282F2900665957 /* Project object */;
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:Theatrical-Players-Refactoring-Kata.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,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1030"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "104F7D7323282F2900665957"
BuildableName = "Theatrical_Players_Refactoring_Kata.framework"
BlueprintName = "Theatrical-Players-Refactoring-Kata"
ReferencedContainer = "container:Theatrical-Players-Refactoring-Kata.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "104F7D7C23282F2900665957"
BuildableName = "Theatrical-Players-Refactoring-KataTests.xctest"
BlueprintName = "Theatrical-Players-Refactoring-KataTests"
ReferencedContainer = "container:Theatrical-Players-Refactoring-Kata.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "104F7D7323282F2900665957"
BuildableName = "Theatrical_Players_Refactoring_Kata.framework"
BlueprintName = "Theatrical-Players-Refactoring-Kata"
ReferencedContainer = "container:Theatrical-Players-Refactoring-Kata.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "104F7D7323282F2900665957"
BuildableName = "Theatrical_Players_Refactoring_Kata.framework"
BlueprintName = "Theatrical-Players-Refactoring-Kata"
ReferencedContainer = "container:Theatrical-Players-Refactoring-Kata.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "104F7D7323282F2900665957"
BuildableName = "Theatrical_Players_Refactoring_Kata.framework"
BlueprintName = "Theatrical-Players-Refactoring-Kata"
ReferencedContainer = "container:Theatrical-Players-Refactoring-Kata.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -0,0 +1,27 @@
<?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>SchemeUserState</key>
<dict>
<key>Theatrical-Players-Refactoring-Kata.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>104F7D7323282F2900665957</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>104F7D7C23282F2900665957</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,24 @@
<?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>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2019 kata. All rights reserved.</string>
</dict>
</plist>

View File

@@ -0,0 +1,4 @@
struct Invoice {
let customer: String
let performances: [Performance]
}

View File

@@ -0,0 +1,4 @@
struct Performance {
let playID: String
let audience: Int
}

View File

@@ -0,0 +1,3 @@
struct Play {
let name, type: String
}

View File

@@ -0,0 +1,54 @@
class StatementPrinter {
func print(_ invoice: Invoice, _ plays: Dictionary<String, Play>) throws -> String {
var totalAmount = 0
var volumeCredits = 0
var result = "Statement for \(invoice.customer)\n"
let frmt = NumberFormatter()
frmt.numberStyle = .currency
frmt.locale = Locale(identifier: "en_US")
for performance in invoice.performances {
var thisAmount = 0
guard let play = plays[performance.playID] else {
throw UnknownTypeError.unknownTypeError("unknown play")
}
switch (play.type) {
case "tragedy" :
thisAmount = 40000
if (performance.audience > 30) {
thisAmount += 1000 * (performance.audience - 30)
}
case "comedy" :
thisAmount = 30000
if (performance.audience > 20) {
thisAmount += 10000 + 500 * (performance.audience - 20)
}
thisAmount += 300 * performance.audience
default : throw UnknownTypeError.unknownTypeError("unknown type: \(play.type)")
}
// add volume credits
volumeCredits += max(performance.audience - 30, 0)
// add extra credit for every ten comedy attendees
if ("comedy" == play.type) {
volumeCredits += Int(round(Double(performance.audience / 5)))
}
// print line for this order
result += " \(play.name): \(frmt.string(for: NSNumber(value: Double((thisAmount / 100))))!) (\(performance.audience) seats)\n"
totalAmount += thisAmount
}
result += "Amount owed is \(frmt.string(for: NSNumber(value: Double(totalAmount / 100)))!)\n"
result += "You earned \(volumeCredits) credits\n"
return result
}
}
enum UnknownTypeError: Error {
case unknownTypeError(String)
}

View File

@@ -0,0 +1,19 @@
//
// Theatrical_Players_Refactoring_Kata.h
// Theatrical-Players-Refactoring-Kata
//
// Created by Khoovi Seewoonauth on 10/09/2019.
// Copyright © 2019 kata. All rights reserved.
//
#import <Cocoa/Cocoa.h>
//! Project version number for Theatrical_Players_Refactoring_Kata.
FOUNDATION_EXPORT double Theatrical_Players_Refactoring_KataVersionNumber;
//! Project version string for Theatrical_Players_Refactoring_Kata.
FOUNDATION_EXPORT const unsigned char Theatrical_Players_Refactoring_KataVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <Theatrical_Players_Refactoring_Kata/PublicHeader.h>

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

@@ -0,0 +1,55 @@
import XCTest
@testable import Theatrical_Players_Refactoring_Kata
class StatementPrinterTests: XCTestCase {
func test_exampleStatement() throws {
let expected = """
Statement for BigCo
Hamlet: $650.00 (55 seats)
As You Like It: $580.00 (35 seats)
Othello: $500.00 (40 seats)
Amount owed is $1,730.00
You earned 47 credits
"""
let plays = [
"hamlet": Play(name: "Hamlet", type: "tragedy"),
"as-like": Play(name: "As You Like It", type: "comedy"),
"othello": Play(name: "Othello", type: "tragedy")
]
let invoice = Invoice(
customer: "BigCo", performances: [
Performance(playID: "hamlet", audience: 55),
Performance(playID: "as-like", audience: 35),
Performance(playID: "othello", audience: 40)
]
)
let statementPrinter = StatementPrinter()
let result = try statementPrinter.print(invoice, plays)
XCTAssertEqual(result, expected)
}
func test_statementWithNewPlayTypes() {
let plays = [
"henry-v": Play(name: "Henry V", type: "history"),
"as-like": Play(name: "As You Like It", type: "pastoral")
]
let invoice = Invoice(
customer: "BigCo", performances: [
Performance(playID: "henry-v", audience: 53),
Performance(playID: "as-like", audience: 55)
]
)
let statementPrinter = StatementPrinter()
XCTAssertThrowsError(try statementPrinter.print(invoice, plays))
}
}