diff --git a/swift/.DS_Store b/swift/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/swift/.DS_Store differ diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/project.pbxproj b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/project.pbxproj new file mode 100644 index 0000000..8fcaa14 --- /dev/null +++ b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/project.pbxproj @@ -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 = ""; }; + 104F7D7823282F2900665957 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 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 = ""; }; + 104F7D8423282F2900665957 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 104F7D8E2328305A00665957 /* Play.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Play.swift; sourceTree = ""; }; + 104F7D90232830EF00665957 /* Performance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Performance.swift; sourceTree = ""; }; + 104F7D922328312600665957 /* Invoice.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Invoice.swift; sourceTree = ""; }; + 104F7D94232831E000665957 /* StatementPrinter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatementPrinter.swift; sourceTree = ""; }; +/* 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 = ""; + }; + 104F7D7523282F2900665957 /* Products */ = { + isa = PBXGroup; + children = ( + 104F7D7423282F2900665957 /* Theatrical_Players_Refactoring_Kata.framework */, + 104F7D7D23282F2900665957 /* Theatrical-Players-Refactoring-KataTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 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 = ""; + }; + 104F7D8123282F2900665957 /* Theatrical-Players-Refactoring-KataTests */ = { + isa = PBXGroup; + children = ( + 104F7D8223282F2900665957 /* StatementPrinterTests.swift */, + 104F7D8423282F2900665957 /* Info.plist */, + ); + path = "Theatrical-Players-Refactoring-KataTests"; + sourceTree = ""; + }; +/* 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 */; +} diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..e904b1d --- /dev/null +++ b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/project.xcworkspace/xcuserdata/khoovis.xcuserdatad/UserInterfaceState.xcuserstate b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/project.xcworkspace/xcuserdata/khoovis.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..5295f3d Binary files /dev/null and b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/project.xcworkspace/xcuserdata/khoovis.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/xcshareddata/xcschemes/Theatrical-Players-Refactoring-Kata.xcscheme b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/xcshareddata/xcschemes/Theatrical-Players-Refactoring-Kata.xcscheme new file mode 100644 index 0000000..04f4b28 --- /dev/null +++ b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/xcshareddata/xcschemes/Theatrical-Players-Refactoring-Kata.xcscheme @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/xcuserdata/khoovis.xcuserdatad/xcschemes/xcschememanagement.plist b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/xcuserdata/khoovis.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..e4fa6d0 --- /dev/null +++ b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/xcuserdata/khoovis.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + Theatrical-Players-Refactoring-Kata.xcscheme_^#shared#^_ + + orderHint + 0 + + + SuppressBuildableAutocreation + + 104F7D7323282F2900665957 + + primary + + + 104F7D7C23282F2900665957 + + primary + + + + + diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Info.plist b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Info.plist new file mode 100644 index 0000000..1e1ee91 --- /dev/null +++ b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSHumanReadableCopyright + Copyright © 2019 kata. All rights reserved. + + diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Invoice.swift b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Invoice.swift new file mode 100644 index 0000000..807e0bf --- /dev/null +++ b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Invoice.swift @@ -0,0 +1,4 @@ +struct Invoice { + let customer: String + let performances: [Performance] +} diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Performance.swift b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Performance.swift new file mode 100644 index 0000000..2cc88ae --- /dev/null +++ b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Performance.swift @@ -0,0 +1,4 @@ +struct Performance { + let playID: String + let audience: Int +} diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Play.swift b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Play.swift new file mode 100644 index 0000000..977e865 --- /dev/null +++ b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Play.swift @@ -0,0 +1,3 @@ +struct Play { + let name, type: String +} diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/StatementPrinter.swift b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/StatementPrinter.swift new file mode 100644 index 0000000..c5781ec --- /dev/null +++ b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/StatementPrinter.swift @@ -0,0 +1,54 @@ +class StatementPrinter { + func print(_ invoice: Invoice, _ plays: Dictionary) 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) +} diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Theatrical_Players_Refactoring_Kata.h b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Theatrical_Players_Refactoring_Kata.h new file mode 100644 index 0000000..ed024b5 --- /dev/null +++ b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Theatrical_Players_Refactoring_Kata.h @@ -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 + +//! 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 + + diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-KataTests/Info.plist b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-KataTests/Info.plist new file mode 100644 index 0000000..6c40a6c --- /dev/null +++ b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-KataTests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-KataTests/StatementPrinterTests.swift b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-KataTests/StatementPrinterTests.swift new file mode 100644 index 0000000..b80d78c --- /dev/null +++ b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-KataTests/StatementPrinterTests.swift @@ -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)) + } +} +