diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..a1a6972 Binary files /dev/null and b/.DS_Store differ diff --git a/PokemonPhoneBook.xcodeproj/project.pbxproj b/PokemonPhoneBook.xcodeproj/project.pbxproj new file mode 100644 index 0000000..e6a4d39 --- /dev/null +++ b/PokemonPhoneBook.xcodeproj/project.pbxproj @@ -0,0 +1,629 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXBuildFile section */ + 99F6F24D2D03148C002E7842 /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = 99F6F24C2D03148C002E7842 /* SnapKit */; }; + 99F6F2502D03149D002E7842 /* Alamofire in Frameworks */ = {isa = PBXBuildFile; productRef = 99F6F24F2D03149D002E7842 /* Alamofire */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 99F6F1E32D030AD7002E7842 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 99F6F1C12D030AD6002E7842 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 99F6F1C82D030AD6002E7842; + remoteInfo = PokemonPhoneBook; + }; + 99F6F1ED2D030AD7002E7842 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 99F6F1C12D030AD6002E7842 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 99F6F1C82D030AD6002E7842; + remoteInfo = PokemonPhoneBook; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 99F6F1C92D030AD6002E7842 /* PokemonPhoneBook.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PokemonPhoneBook.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 99F6F1E22D030AD7002E7842 /* PokemonPhoneBookTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PokemonPhoneBookTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 99F6F1EC2D030AD7002E7842 /* PokemonPhoneBookUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PokemonPhoneBookUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ + 99F6F2F42D097CF5002E7842 /* Exceptions for "PokemonPhoneBook" folder in "PokemonPhoneBook" target */ = { + isa = PBXFileSystemSynchronizedBuildFileExceptionSet; + membershipExceptions = ( + Info.plist, + Models/PokemonPhoneBook.xcdatamodeld, + ); + target = 99F6F1C82D030AD6002E7842 /* PokemonPhoneBook */; + }; +/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ + +/* Begin PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet section */ + 99F6F2FD2D097D05002E7842 /* Exceptions for "PokemonPhoneBook" folder in "Compile Sources" phase from "PokemonPhoneBook" target */ = { + isa = PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet; + buildPhase = 99F6F1C52D030AD6002E7842 /* Sources */; + membershipExceptions = ( + Models/PokemonPhoneBook.xcdatamodeld, + ); + }; +/* End PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + 99F6F1CB2D030AD6002E7842 /* PokemonPhoneBook */ = { + isa = PBXFileSystemSynchronizedRootGroup; + exceptions = ( + 99F6F2F42D097CF5002E7842 /* Exceptions for "PokemonPhoneBook" folder in "PokemonPhoneBook" target */, + 99F6F2FD2D097D05002E7842 /* Exceptions for "PokemonPhoneBook" folder in "Compile Sources" phase from "PokemonPhoneBook" target */, + ); + path = PokemonPhoneBook; + sourceTree = ""; + }; + 99F6F1E52D030AD7002E7842 /* PokemonPhoneBookTests */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = PokemonPhoneBookTests; + sourceTree = ""; + }; + 99F6F1EF2D030AD7002E7842 /* PokemonPhoneBookUITests */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = PokemonPhoneBookUITests; + sourceTree = ""; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + 99F6F1C62D030AD6002E7842 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 99F6F24D2D03148C002E7842 /* SnapKit in Frameworks */, + 99F6F2502D03149D002E7842 /* Alamofire in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 99F6F1DF2D030AD7002E7842 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 99F6F1E92D030AD7002E7842 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 99F6F1C02D030AD6002E7842 = { + isa = PBXGroup; + children = ( + 99F6F1CB2D030AD6002E7842 /* PokemonPhoneBook */, + 99F6F1E52D030AD7002E7842 /* PokemonPhoneBookTests */, + 99F6F1EF2D030AD7002E7842 /* PokemonPhoneBookUITests */, + 99F6F1CA2D030AD6002E7842 /* Products */, + ); + sourceTree = ""; + }; + 99F6F1CA2D030AD6002E7842 /* Products */ = { + isa = PBXGroup; + children = ( + 99F6F1C92D030AD6002E7842 /* PokemonPhoneBook.app */, + 99F6F1E22D030AD7002E7842 /* PokemonPhoneBookTests.xctest */, + 99F6F1EC2D030AD7002E7842 /* PokemonPhoneBookUITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 99F6F1C82D030AD6002E7842 /* PokemonPhoneBook */ = { + isa = PBXNativeTarget; + buildConfigurationList = 99F6F1F52D030AD7002E7842 /* Build configuration list for PBXNativeTarget "PokemonPhoneBook" */; + buildPhases = ( + 99F6F1C52D030AD6002E7842 /* Sources */, + 99F6F1C62D030AD6002E7842 /* Frameworks */, + 99F6F1C72D030AD6002E7842 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + 99F6F1CB2D030AD6002E7842 /* PokemonPhoneBook */, + ); + name = PokemonPhoneBook; + packageProductDependencies = ( + 99F6F24C2D03148C002E7842 /* SnapKit */, + 99F6F24F2D03149D002E7842 /* Alamofire */, + ); + productName = PokemonPhoneBook; + productReference = 99F6F1C92D030AD6002E7842 /* PokemonPhoneBook.app */; + productType = "com.apple.product-type.application"; + }; + 99F6F1E12D030AD7002E7842 /* PokemonPhoneBookTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 99F6F1FA2D030AD7002E7842 /* Build configuration list for PBXNativeTarget "PokemonPhoneBookTests" */; + buildPhases = ( + 99F6F1DE2D030AD7002E7842 /* Sources */, + 99F6F1DF2D030AD7002E7842 /* Frameworks */, + 99F6F1E02D030AD7002E7842 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 99F6F1E42D030AD7002E7842 /* PBXTargetDependency */, + ); + fileSystemSynchronizedGroups = ( + 99F6F1E52D030AD7002E7842 /* PokemonPhoneBookTests */, + ); + name = PokemonPhoneBookTests; + packageProductDependencies = ( + ); + productName = PokemonPhoneBookTests; + productReference = 99F6F1E22D030AD7002E7842 /* PokemonPhoneBookTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 99F6F1EB2D030AD7002E7842 /* PokemonPhoneBookUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 99F6F1FD2D030AD7002E7842 /* Build configuration list for PBXNativeTarget "PokemonPhoneBookUITests" */; + buildPhases = ( + 99F6F1E82D030AD7002E7842 /* Sources */, + 99F6F1E92D030AD7002E7842 /* Frameworks */, + 99F6F1EA2D030AD7002E7842 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 99F6F1EE2D030AD7002E7842 /* PBXTargetDependency */, + ); + fileSystemSynchronizedGroups = ( + 99F6F1EF2D030AD7002E7842 /* PokemonPhoneBookUITests */, + ); + name = PokemonPhoneBookUITests; + packageProductDependencies = ( + ); + productName = PokemonPhoneBookUITests; + productReference = 99F6F1EC2D030AD7002E7842 /* PokemonPhoneBookUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 99F6F1C12D030AD6002E7842 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1610; + LastUpgradeCheck = 1610; + TargetAttributes = { + 99F6F1C82D030AD6002E7842 = { + CreatedOnToolsVersion = 16.1; + }; + 99F6F1E12D030AD7002E7842 = { + CreatedOnToolsVersion = 16.1; + TestTargetID = 99F6F1C82D030AD6002E7842; + }; + 99F6F1EB2D030AD7002E7842 = { + CreatedOnToolsVersion = 16.1; + TestTargetID = 99F6F1C82D030AD6002E7842; + }; + }; + }; + buildConfigurationList = 99F6F1C42D030AD6002E7842 /* Build configuration list for PBXProject "PokemonPhoneBook" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 99F6F1C02D030AD6002E7842; + minimizedProjectReferenceProxies = 1; + packageReferences = ( + 99F6F24B2D03148C002E7842 /* XCRemoteSwiftPackageReference "SnapKit" */, + 99F6F24E2D03149D002E7842 /* XCRemoteSwiftPackageReference "Alamofire" */, + ); + preferredProjectObjectVersion = 77; + productRefGroup = 99F6F1CA2D030AD6002E7842 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 99F6F1C82D030AD6002E7842 /* PokemonPhoneBook */, + 99F6F1E12D030AD7002E7842 /* PokemonPhoneBookTests */, + 99F6F1EB2D030AD7002E7842 /* PokemonPhoneBookUITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 99F6F1C72D030AD6002E7842 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 99F6F1E02D030AD7002E7842 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 99F6F1EA2D030AD7002E7842 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 99F6F1C52D030AD6002E7842 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 99F6F1DE2D030AD7002E7842 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 99F6F1E82D030AD7002E7842 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 99F6F1E42D030AD7002E7842 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 99F6F1C82D030AD6002E7842 /* PokemonPhoneBook */; + targetProxy = 99F6F1E32D030AD7002E7842 /* PBXContainerItemProxy */; + }; + 99F6F1EE2D030AD7002E7842 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 99F6F1C82D030AD6002E7842 /* PokemonPhoneBook */; + targetProxy = 99F6F1ED2D030AD7002E7842 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 99F6F1F62D030AD7002E7842 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 63SB2B8YJ5; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = PokemonPhoneBook/Info.plist; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = HwangSeokBeom.PokemonPhoneBook; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 99F6F1F72D030AD7002E7842 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 63SB2B8YJ5; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = PokemonPhoneBook/Info.plist; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = HwangSeokBeom.PokemonPhoneBook; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 99F6F1F82D030AD7002E7842 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + 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_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + 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; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + 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 = 18.1; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 99F6F1F92D030AD7002E7842 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + 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_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + 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; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + 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 = 18.1; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 99F6F1FB2D030AD7002E7842 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 63SB2B8YJ5; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.1; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = HwangSeokBeom.PokemonPhoneBookTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PokemonPhoneBook.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/PokemonPhoneBook"; + }; + name = Debug; + }; + 99F6F1FC2D030AD7002E7842 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 63SB2B8YJ5; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.1; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = HwangSeokBeom.PokemonPhoneBookTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PokemonPhoneBook.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/PokemonPhoneBook"; + }; + name = Release; + }; + 99F6F1FE2D030AD7002E7842 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 63SB2B8YJ5; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = HwangSeokBeom.PokemonPhoneBookUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = PokemonPhoneBook; + }; + name = Debug; + }; + 99F6F1FF2D030AD7002E7842 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 63SB2B8YJ5; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = HwangSeokBeom.PokemonPhoneBookUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = PokemonPhoneBook; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 99F6F1C42D030AD6002E7842 /* Build configuration list for PBXProject "PokemonPhoneBook" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 99F6F1F82D030AD7002E7842 /* Debug */, + 99F6F1F92D030AD7002E7842 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 99F6F1F52D030AD7002E7842 /* Build configuration list for PBXNativeTarget "PokemonPhoneBook" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 99F6F1F62D030AD7002E7842 /* Debug */, + 99F6F1F72D030AD7002E7842 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 99F6F1FA2D030AD7002E7842 /* Build configuration list for PBXNativeTarget "PokemonPhoneBookTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 99F6F1FB2D030AD7002E7842 /* Debug */, + 99F6F1FC2D030AD7002E7842 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 99F6F1FD2D030AD7002E7842 /* Build configuration list for PBXNativeTarget "PokemonPhoneBookUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 99F6F1FE2D030AD7002E7842 /* Debug */, + 99F6F1FF2D030AD7002E7842 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + 99F6F24B2D03148C002E7842 /* XCRemoteSwiftPackageReference "SnapKit" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/SnapKit/SnapKit.git"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 5.7.1; + }; + }; + 99F6F24E2D03149D002E7842 /* XCRemoteSwiftPackageReference "Alamofire" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/Alamofire/Alamofire.git"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 5.10.2; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 99F6F24C2D03148C002E7842 /* SnapKit */ = { + isa = XCSwiftPackageProductDependency; + package = 99F6F24B2D03148C002E7842 /* XCRemoteSwiftPackageReference "SnapKit" */; + productName = SnapKit; + }; + 99F6F24F2D03149D002E7842 /* Alamofire */ = { + isa = XCSwiftPackageProductDependency; + package = 99F6F24E2D03149D002E7842 /* XCRemoteSwiftPackageReference "Alamofire" */; + productName = Alamofire; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = 99F6F1C12D030AD6002E7842 /* Project object */; +} diff --git a/PokemonPhoneBook.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/PokemonPhoneBook.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/PokemonPhoneBook.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/PokemonPhoneBook.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/PokemonPhoneBook.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..b9dab7e --- /dev/null +++ b/PokemonPhoneBook.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,24 @@ +{ + "originHash" : "4d1117f641c000c6545947e4d48e126cc17473ec53f643df82900a33ad4936b2", + "pins" : [ + { + "identity" : "alamofire", + "kind" : "remoteSourceControl", + "location" : "https://github.com/Alamofire/Alamofire.git", + "state" : { + "revision" : "513364f870f6bfc468f9d2ff0a95caccc10044c5", + "version" : "5.10.2" + } + }, + { + "identity" : "snapkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/SnapKit/SnapKit.git", + "state" : { + "revision" : "2842e6e84e82eb9a8dac0100ca90d9444b0307f4", + "version" : "5.7.1" + } + } + ], + "version" : 3 +} diff --git a/PokemonPhoneBook.xcodeproj/project.xcworkspace/xcuserdata/naeilbaeumkaempeu.xcuserdatad/UserInterfaceState.xcuserstate b/PokemonPhoneBook.xcodeproj/project.xcworkspace/xcuserdata/naeilbaeumkaempeu.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..a8a278f Binary files /dev/null and b/PokemonPhoneBook.xcodeproj/project.xcworkspace/xcuserdata/naeilbaeumkaempeu.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/PokemonPhoneBook.xcodeproj/xcuserdata/naeilbaeumkaempeu.xcuserdatad/xcschemes/xcschememanagement.plist b/PokemonPhoneBook.xcodeproj/xcuserdata/naeilbaeumkaempeu.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..dc96333 --- /dev/null +++ b/PokemonPhoneBook.xcodeproj/xcuserdata/naeilbaeumkaempeu.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + PokemonPhoneBook.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/PokemonPhoneBook/AppDelegate.swift b/PokemonPhoneBook/AppDelegate.swift new file mode 100644 index 0000000..2d7a853 --- /dev/null +++ b/PokemonPhoneBook/AppDelegate.swift @@ -0,0 +1,79 @@ +// +// AppDelegate.swift +// PokemonPhoneBook +// +// Created by 내일배움캠프 on 12/6/24. +// + +import UIKit +import CoreData + +@main +class AppDelegate: UIResponder, UIApplicationDelegate { + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + // MARK: UISceneSession Lifecycle + + func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { + // Called when a new scene session is being created. + // Use this method to select a configuration to create the new scene with. + return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) + } + + func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { + // Called when the user discards a scene session. + // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. + // Use this method to release any resources that were specific to the discarded scenes, as they will not return. + } + + // MARK: - Core Data stack + + lazy var persistentContainer: NSPersistentContainer = { + /* + The persistent container for the application. This implementation + creates and returns a container, having loaded the store for the + application to it. This property is optional since there are legitimate + error conditions that could cause the creation of the store to fail. + */ + let container = NSPersistentContainer(name: "PokemonPhoneBook") + container.loadPersistentStores(completionHandler: { (storeDescription, error) in + if let error = error as NSError? { + // Replace this implementation with code to handle the error appropriately. + // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. + + /* + Typical reasons for an error here include: + * The parent directory does not exist, cannot be created, or disallows writing. + * The persistent store is not accessible, due to permissions or data protection when the device is locked. + * The device is out of space. + * The store could not be migrated to the current model version. + Check the error message to determine what the actual problem was. + */ + fatalError("Unresolved error \(error), \(error.userInfo)") + } + }) + return container + }() + + // MARK: - Core Data Saving support + + func saveContext () { + let context = persistentContainer.viewContext + if context.hasChanges { + do { + try context.save() + } catch { + // Replace this implementation with code to handle the error appropriately. + // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. + let nserror = error as NSError + fatalError("Unresolved error \(nserror), \(nserror.userInfo)") + } + } + } + +} + diff --git a/PokemonPhoneBook/Assets.xcassets/AccentColor.colorset/Contents.json b/PokemonPhoneBook/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/PokemonPhoneBook/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/PokemonPhoneBook/Assets.xcassets/AppIcon.appiconset/Contents.json b/PokemonPhoneBook/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..2305880 --- /dev/null +++ b/PokemonPhoneBook/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,35 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "tinted" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/PokemonPhoneBook/Assets.xcassets/Contents.json b/PokemonPhoneBook/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/PokemonPhoneBook/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/PokemonPhoneBook/Base.lproj/LaunchScreen.storyboard b/PokemonPhoneBook/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/PokemonPhoneBook/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PokemonPhoneBook/Controllers/AddPhoneBookViewController.swift b/PokemonPhoneBook/Controllers/AddPhoneBookViewController.swift new file mode 100644 index 0000000..c53c2a7 --- /dev/null +++ b/PokemonPhoneBook/Controllers/AddPhoneBookViewController.swift @@ -0,0 +1,109 @@ +import UIKit +import CoreData +import Alamofire + +class AddPhoneBookViewController: UIViewController { + + private let addPhoneBookView = AddPhoneBookView() + + var phoneBook: NSManagedObject? + var isEditingMode: Bool = false + + override func loadView() { + view = addPhoneBookView + } + + override func viewDidLoad() { + super.viewDidLoad() + setupNavigationBar() + configureEditingMode() + addActions() + } + + private func setupNavigationBar() { + let addButton = UIBarButtonItem( + title: "적용", + style: .plain, + target: self, + action: #selector(addButtonTapped) + ) + + navigationItem.title = "연락처 추가" + navigationItem.rightBarButtonItem = addButton + } + + private func addActions() { + addPhoneBookView.createButton.addTarget(self, action: #selector(createButtonTapped), for: .touchUpInside) + } + + @objc private func createButtonTapped() { + let randomNumber = Int.random(in: 0...1000) + guard let url = URL(string: "https://pokeapi.co/api/v2/pokemon/\(randomNumber)") else { return } + + PokeAPIManager.shared.fetchPokemonData(url: url) { [weak self] (result: Result) in + guard let self = self else { return } + switch result { + case .success(let pokemon): + guard let imageUrl = URL(string: pokemon.sprites.frontDefault) else { return } + PokeAPIManager.shared.fetchImage(url: imageUrl) { imageResult in + switch imageResult { + case .success(let image): + DispatchQueue.main.async { + self.addPhoneBookView.updateImage(image) + } + case .failure(let error): + print("이미지 로드 실패: \(error.localizedDescription)") + } + } + case .failure(let error): + print("데이터 로드 실패: \(error)") + } + } + } + + @objc private func addButtonTapped() { + guard let formData = addPhoneBookView.getFormData() else { + showAlert(message: "이미지 생성과 이름, 전화번호를 모두 입력하세요.") + return + } + if isEditingMode { + updateData(name: formData.name, phoneNumber: formData.phoneNumber, image: formData.image!) + } else { + createData(name: formData.name, phoneNumber: formData.phoneNumber, image: formData.image!) + } + navigationController?.popViewController(animated: true) + } + + private func showAlert(message: String) { + let alert = UIAlertController(title: "알림", message: message, preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "확인", style: .default, handler: nil)) + present(alert, animated: true, completion: nil) + } + + private func createData(name: String, phoneNumber: String, image: UIImage) { + if CoreDataManager.shared.createPhoneBook(name: name, phoneNumber: phoneNumber, image: image) { + print("연락처 저장 성공") + } else { + print("연락처 저장 실패") + } + } + + private func updateData(name: String, phoneNumber: String, image: UIImage) { + guard let phoneBook = phoneBook else { return } + if CoreDataManager.shared.updatePhoneBook(phoneBook: phoneBook, name: name, phoneNumber: phoneNumber, image: image) { + print("연락처 업데이트 성공") + } else { + print("연락처 업데이트 실패") + } + } + + private func configureEditingMode() { + guard isEditingMode, let phoneBook = phoneBook else { return } + let phoneBook1 = PhoneBook( + name: phoneBook.value(forKey: PokemonPhoneBook.Key.name) as? String ?? "", + phoneNumber: phoneBook.value(forKey: PokemonPhoneBook.Key.phoneNumber) as? String ?? "", + image: (phoneBook.value(forKey: PokemonPhoneBook.Key.image) as? Data).flatMap { UIImage(data: $0) } + ) + addPhoneBookView.updateView(with: phoneBook1) + } +} diff --git a/PokemonPhoneBook/Controllers/PhoneBookViewController.swift b/PokemonPhoneBook/Controllers/PhoneBookViewController.swift new file mode 100644 index 0000000..200489b --- /dev/null +++ b/PokemonPhoneBook/Controllers/PhoneBookViewController.swift @@ -0,0 +1,111 @@ +import UIKit +import CoreData + +class PhoneBookViewController: UIViewController { + + private var phoneBookList: [NSManagedObject] = [] + private let phoneBookView = PhoneBookView() + + override func loadView() { + view = phoneBookView + } + + override func viewDidLoad() { + super.viewDidLoad() + configureTableView() + configureActions() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + self.navigationController?.setNavigationBarHidden(true, animated: animated) + fetchData() + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + self.navigationController?.setNavigationBarHidden(false, animated: animated) + } + + private func configureTableView() { + phoneBookView.tableView.delegate = self + phoneBookView.tableView.dataSource = self + phoneBookView.tableView.register(PhoneBookTableViewCell.self, forCellReuseIdentifier: PhoneBookTableViewCell.identifier) + } + + private func configureActions() { + phoneBookView.addButton.addTarget(self, action: #selector(addButtonTapped), for: .touchUpInside) + } + + @objc private func addButtonTapped() { + let addVC = AddPhoneBookViewController() + navigationController?.pushViewController(addVC, animated: true) + } + + private func fetchData() { + phoneBookList = CoreDataManager.shared.fetchPhoneBooks() + phoneBookView.tableView.reloadData() + } +} + +extension PhoneBookViewController: UITableViewDelegate, UITableViewDataSource { + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + return 80 + } + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return phoneBookList.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + guard let cell = tableView.dequeueReusableCell(withIdentifier: PhoneBookTableViewCell.identifier, for: indexPath) as? PhoneBookTableViewCell else { + return UITableViewCell() + } + let managedObject = phoneBookList[indexPath.row] + if let name = managedObject.value(forKey: PokemonPhoneBook.Key.name) as? String, + let phoneNumber = managedObject.value(forKey: PokemonPhoneBook.Key.phoneNumber) as? String, + let imageData = managedObject.value(forKey: PokemonPhoneBook.Key.image) as? Data, + let image = UIImage(data: imageData) { + let phoneBook = PhoneBook(name: name, phoneNumber: phoneNumber, image: image) + cell.configure(with: phoneBook) + } + return cell + } + + func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCell.EditingStyle { + return .delete + } + + func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) { + if editingStyle == .delete { + showDeleteConfirmationAlert(forRowAt: indexPath) + } + } + + private func showDeleteConfirmationAlert(forRowAt indexPath: IndexPath) { + let alert = UIAlertController(title: "삭제 확인", message: "정말로 삭제하시겠습니까?", preferredStyle: .alert) + let deleteAction = UIAlertAction(title: "삭제", style: .destructive) { [weak self] _ in + guard let self = self else { return } + let managedObject = self.phoneBookList[indexPath.row] + if CoreDataManager.shared.deletePhoneBook(phoneBook: managedObject) { + self.phoneBookList.remove(at: indexPath.row) + self.phoneBookView.tableView.deleteRows(at: [indexPath], with: .fade) + } else { + print("삭제 실패") + } + } + let cancelAction = UIAlertAction(title: "취소", style: .cancel, handler: nil) + alert.addAction(deleteAction) + alert.addAction(cancelAction) + present(alert, animated: true, completion: nil) + } + + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + tableView.deselectRow(at: indexPath, animated: true) + let phoneBook = phoneBookList[indexPath.row] + let addVC = AddPhoneBookViewController() + addVC.phoneBook = phoneBook + addVC.isEditingMode = true + navigationController?.pushViewController(addVC, animated: true) + } +} diff --git a/PokemonPhoneBook/Info.plist b/PokemonPhoneBook/Info.plist new file mode 100644 index 0000000..0eb786d --- /dev/null +++ b/PokemonPhoneBook/Info.plist @@ -0,0 +1,23 @@ + + + + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + + + + + + diff --git a/PokemonPhoneBook/Managers/CoreDataManger.swift b/PokemonPhoneBook/Managers/CoreDataManger.swift new file mode 100644 index 0000000..c2f2466 --- /dev/null +++ b/PokemonPhoneBook/Managers/CoreDataManger.swift @@ -0,0 +1,85 @@ +// +// CoreDataManger.swift +// PokemonPhoneBook +// +// Created by 내일배움캠프 on 12/11/24. +// + +import Foundation +import CoreData +import UIKit + +class CoreDataManager { + static let shared = CoreDataManager() + private let persistentContainer: NSPersistentContainer + + private init() { + persistentContainer = NSPersistentContainer(name: PokemonPhoneBook.className) + persistentContainer.loadPersistentStores { _, error in + if let error = error { + fatalError("Unable to load persistent stores: \(error)") + } + } + } + + var context: NSManagedObjectContext { + return persistentContainer.viewContext + } + + func createPhoneBook(name: String, phoneNumber: String, image: UIImage?) -> Bool { + let entity = NSEntityDescription.entity(forEntityName: PokemonPhoneBook.className, in: context) + let phoneBook = NSManagedObject(entity: entity!, insertInto: context) + phoneBook.setValue(name, forKey: PokemonPhoneBook.Key.name) + phoneBook.setValue(phoneNumber, forKey: PokemonPhoneBook.Key.phoneNumber) + + if let imageData = image?.pngData() { + phoneBook.setValue(imageData, forKey: PokemonPhoneBook.Key.image) + } + + do { + try context.save() + return true + } catch { + print("Failed to save phone book: \(error)") + return false + } + } + + func fetchPhoneBooks() -> [NSManagedObject] { + let fetchRequest = NSFetchRequest(entityName: PokemonPhoneBook.className) + let sortDescriptor = NSSortDescriptor(key: PokemonPhoneBook.Key.name, ascending: true) + fetchRequest.sortDescriptors = [sortDescriptor] + do { + return try context.fetch(fetchRequest) + } catch { + print("Failed to fetch phone books: \(error)") + return [] + } + } + + func updatePhoneBook(phoneBook: NSManagedObject, name: String, phoneNumber: String, image: UIImage?) -> Bool { + phoneBook.setValue(name, forKey: PokemonPhoneBook.Key.name) + phoneBook.setValue(phoneNumber, forKey: PokemonPhoneBook.Key.phoneNumber) + if let imageData = image?.pngData() { + phoneBook.setValue(imageData, forKey: PokemonPhoneBook.Key.image) + } + do { + try context.save() + return true + } catch { + print("Failed to update phone book: \(error)") + return false + } + } + + func deletePhoneBook(phoneBook: NSManagedObject) -> Bool { + context.delete(phoneBook) + do { + try context.save() + return true + } catch { + print("Failed to delete phone book: \(error)") + return false + } + } +} diff --git a/PokemonPhoneBook/Managers/PokeAPIManager.swift b/PokemonPhoneBook/Managers/PokeAPIManager.swift new file mode 100644 index 0000000..24fffb0 --- /dev/null +++ b/PokemonPhoneBook/Managers/PokeAPIManager.swift @@ -0,0 +1,36 @@ +// +// PokeAPIManager.swift +// PokemonPhoneBook +// +// Created by 내일배움캠프 on 12/11/24. +// + +import UIKit +import Alamofire + +class PokeAPIManager { + static let shared = PokeAPIManager() + + private init() {} + + func fetchPokemonData(url: URL, completion: @escaping (Result) -> Void) { + AF.request(url).responseDecodable(of: T.self) { response in + completion(response.result) + } + } + + func fetchImage(url: URL, completion: @escaping (Result) -> Void) { + AF.request(url).responseData { response in + switch response.result { + case .success(let data): + if let image = UIImage(data: data) { + completion(.success(image)) + } else { + completion(.failure(NSError(domain: "PokeAPIManager", code: -1, userInfo: [NSLocalizedDescriptionKey: "Invalid image data"]))) + } + case .failure(let error): + completion(.failure(error)) + } + } + } +} diff --git a/PokemonPhoneBook/Models/PhoneBook.swift b/PokemonPhoneBook/Models/PhoneBook.swift new file mode 100644 index 0000000..aee7604 --- /dev/null +++ b/PokemonPhoneBook/Models/PhoneBook.swift @@ -0,0 +1,16 @@ +// +// PhoneBook.swift +// PokemonPhoneBook +// +// Created by 내일배움캠프 on 12/6/24. +// + +import UIKit + +struct PhoneBook { + let name: String + let phoneNumber: String + let image: UIImage? +} + + diff --git a/PokemonPhoneBook/Models/Pokemon.swift b/PokemonPhoneBook/Models/Pokemon.swift new file mode 100644 index 0000000..84a1ae9 --- /dev/null +++ b/PokemonPhoneBook/Models/Pokemon.swift @@ -0,0 +1,25 @@ +// +// PokeImage.swift +// PokemonPhoneBook +// +// Created by 내일배움캠프 on 12/10/24. +// + +import Foundation + +struct PokeMon: Decodable { + let id: Int + let name: String + let height: Int + let weight: Int + let sprites: PokemonSprites +} + +struct PokemonSprites: Decodable { + let frontDefault: String + + enum CodingKeys: String, CodingKey { + case frontDefault = "front_default" + } +} + diff --git a/PokemonPhoneBook/Models/PokemonPhoneBook+CoreDataClass.swift b/PokemonPhoneBook/Models/PokemonPhoneBook+CoreDataClass.swift new file mode 100644 index 0000000..25f76b8 --- /dev/null +++ b/PokemonPhoneBook/Models/PokemonPhoneBook+CoreDataClass.swift @@ -0,0 +1,20 @@ +// +// PokemonPhoneBook+CoreDataClass.swift +// PokemonPhoneBook +// +// Created by 내일배움캠프 on 12/10/24. +// +// + +import Foundation +import CoreData + +@objc(PokemonPhoneBook) +public class PokemonPhoneBook: NSManagedObject { + public static let className = "PokemonPhoneBook" + public enum Key { + static let name = "name" + static let phoneNumber = "phoneNumber" + static let image = "image" + } +} diff --git a/PokemonPhoneBook/Models/PokemonPhoneBook+CoreDataProperties.swift b/PokemonPhoneBook/Models/PokemonPhoneBook+CoreDataProperties.swift new file mode 100644 index 0000000..efe498b --- /dev/null +++ b/PokemonPhoneBook/Models/PokemonPhoneBook+CoreDataProperties.swift @@ -0,0 +1,27 @@ +// +// PokemonPhoneBook+CoreDataProperties.swift +// PokemonPhoneBook +// +// Created by 내일배움캠프 on 12/10/24. +// +// + +import Foundation +import CoreData + + +extension PokemonPhoneBook { + + @nonobjc public class func fetchRequest() -> NSFetchRequest { + return NSFetchRequest(entityName: "PokemonPhoneBook") + } + + @NSManaged public var name: String? + @NSManaged public var phoneNumber: String? + @NSManaged public var image: Data? + +} + +extension PokemonPhoneBook : Identifiable { + +} diff --git a/PokemonPhoneBook/Models/PokemonPhoneBook.xcdatamodeld/.xccurrentversion b/PokemonPhoneBook/Models/PokemonPhoneBook.xcdatamodeld/.xccurrentversion new file mode 100644 index 0000000..e1b76cc --- /dev/null +++ b/PokemonPhoneBook/Models/PokemonPhoneBook.xcdatamodeld/.xccurrentversion @@ -0,0 +1,8 @@ + + + + + _XCCurrentVersionName + PokemonPhoneBook.xcdatamodel + + diff --git a/PokemonPhoneBook/Models/PokemonPhoneBook.xcdatamodeld/PokemonPhoneBook.xcdatamodel/contents b/PokemonPhoneBook/Models/PokemonPhoneBook.xcdatamodeld/PokemonPhoneBook.xcdatamodel/contents new file mode 100644 index 0000000..0960308 --- /dev/null +++ b/PokemonPhoneBook/Models/PokemonPhoneBook.xcdatamodeld/PokemonPhoneBook.xcdatamodel/contents @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/PokemonPhoneBook/SceneDelegate.swift b/PokemonPhoneBook/SceneDelegate.swift new file mode 100644 index 0000000..46d7dff --- /dev/null +++ b/PokemonPhoneBook/SceneDelegate.swift @@ -0,0 +1,57 @@ +// +// SceneDelegate.swift +// PokemonPhoneBook +// +// Created by 내일배움캠프 on 12/6/24. +// + +import UIKit + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + guard let windowScene = (scene as? UIWindowScene) else { return } + let window = UIWindow(windowScene: windowScene) + let navigationController = UINavigationController(rootViewController: PhoneBookViewController()) + window.rootViewController = navigationController + window.makeKeyAndVisible() + self.window = window + } + + func sceneDidDisconnect(_ scene: UIScene) { + // Called as the scene is being released by the system. + // This occurs shortly after the scene enters the background, or when its session is discarded. + // Release any resources associated with this scene that can be re-created the next time the scene connects. + // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). + } + + func sceneDidBecomeActive(_ scene: UIScene) { + // Called when the scene has moved from an inactive state to an active state. + // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. + } + + func sceneWillResignActive(_ scene: UIScene) { + // Called when the scene will move from an active state to an inactive state. + // This may occur due to temporary interruptions (ex. an incoming phone call). + } + + func sceneWillEnterForeground(_ scene: UIScene) { + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. + } + + func sceneDidEnterBackground(_ scene: UIScene) { + // Called as the scene transitions from the foreground to the background. + // Use this method to save data, release shared resources, and store enough scene-specific state information + // to restore the scene back to its current state. + + // Save changes in the application's managed object context when the application transitions to the background. + (UIApplication.shared.delegate as? AppDelegate)?.saveContext() + } + + +} + diff --git a/PokemonPhoneBook/Views/AddPhoneBookView.swift b/PokemonPhoneBook/Views/AddPhoneBookView.swift new file mode 100644 index 0000000..1a686d1 --- /dev/null +++ b/PokemonPhoneBook/Views/AddPhoneBookView.swift @@ -0,0 +1,105 @@ +// +// AddPhoneBookView.swift +// PokemonPhoneBook +// +// Created by 내일배움캠프 on 12/11/24. +// + +import UIKit +import SnapKit + +class AddPhoneBookView: UIView { + + let pokeImageView: UIImageView = { + let imageView = UIImageView() + imageView.clipsToBounds = true + imageView.contentMode = .scaleAspectFill + imageView.layer.borderColor = UIColor.gray.cgColor + imageView.layer.borderWidth = 2 + imageView.layer.cornerRadius = 100 + return imageView + }() + + let createButton: UIButton = { + let button = UIButton() + button.setTitle("랜덤 이미지 생성", for: .normal) + button.setTitleColor(.lightGray, for: .normal) + button.titleLabel?.font = .systemFont(ofSize: 20, weight: .light) + button.backgroundColor = .clear + return button + }() + + let nameTextField: UITextField = { + let textField = UITextField() + textField.placeholder = "이름을 입력하세요" + textField.borderStyle = .roundedRect + return textField + }() + + let phoneTextField: UITextField = { + let textField = UITextField() + textField.placeholder = "전화번호를 입력하세요" + textField.borderStyle = .roundedRect + textField.keyboardType = .phonePad + return textField + }() + + override init(frame: CGRect) { + super.init(frame: frame) + setupLayout() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + private func setupLayout() { + backgroundColor = .white + + [pokeImageView, createButton, nameTextField, phoneTextField].forEach { addSubview($0) } + + pokeImageView.snp.makeConstraints { make in + make.top.equalTo(safeAreaLayoutGuide).offset(20) + make.centerX.equalToSuperview() + make.height.equalTo(200) + make.width.equalTo(200) + } + + createButton.snp.makeConstraints { make in + make.top.equalTo(pokeImageView.snp.bottom).offset(20) + make.leading.equalToSuperview().offset(20) + make.trailing.equalToSuperview().offset(-20) + make.height.equalTo(50) + } + + nameTextField.snp.makeConstraints { make in + make.top.equalTo(createButton.snp.bottom).offset(20) + make.leading.equalToSuperview().offset(20) + make.trailing.equalToSuperview().offset(-20) + make.height.equalTo(50) + } + + phoneTextField.snp.makeConstraints { make in + make.top.equalTo(nameTextField.snp.bottom).offset(20) + make.leading.trailing.height.equalTo(nameTextField) + } + } + + func updateView(with phoneBook: PhoneBook) { + nameTextField.text = phoneBook.name + phoneTextField.text = phoneBook.phoneNumber + pokeImageView.image = phoneBook.image + } + + func getFormData() -> (name: String, phoneNumber: String, image: UIImage?)? { + guard let name = nameTextField.text, !name.isEmpty, + let phoneNumber = phoneTextField.text, !phoneNumber.isEmpty, + let image = pokeImageView.image else { return nil } + return (name, phoneNumber, image) + } + + func updateImage(_ image: UIImage?) { + pokeImageView.image = image + } + +} diff --git a/PokemonPhoneBook/Views/PhoneBookTableViewCell.swift b/PokemonPhoneBook/Views/PhoneBookTableViewCell.swift new file mode 100644 index 0000000..661da48 --- /dev/null +++ b/PokemonPhoneBook/Views/PhoneBookTableViewCell.swift @@ -0,0 +1,83 @@ +// +// Untitled.swift +// PokemonPhoneBook +// +// Created by 내일배움캠프 on 12/6/24. +// +import UIKit +import SnapKit + + +class PhoneBookTableViewCell: UITableViewCell { + static let identifier = "PhoneBookTableViewCell" + + private let pokeImageView: UIImageView = { + let imageView = UIImageView() + imageView.clipsToBounds = true + imageView.contentMode = .scaleAspectFill + imageView.layer.borderColor = UIColor.gray.cgColor + imageView.layer.borderWidth = 2 + imageView.layer.cornerRadius = 25 + return imageView + }() + + private let nameLabel: UILabel = { + let label = UILabel() + label.font = UIFont.systemFont(ofSize: 18, weight: .medium) + label.textColor = .black + return label + }() + + private let phoneNumberLabel: UILabel = { + let label = UILabel() + label.font = UIFont.systemFont(ofSize: 18, weight: .medium) + label.textColor = .black + return label + }() + + private lazy var labelsStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [nameLabel, phoneNumberLabel]) + stackView.axis = .horizontal + stackView.distribution = .fillEqually + stackView.spacing = 10 + stackView.alignment = .center + return stackView + }() + + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + setupViews() + setupLayout() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + private func setupViews() { + contentView.addSubview(pokeImageView) + contentView.addSubview(labelsStackView) + } + + private func setupLayout() { + pokeImageView.snp.makeConstraints { make in + make.width.height.equalTo(50) + make.leading.equalToSuperview().offset(15) + make.centerY.equalToSuperview() + } + + labelsStackView.snp.makeConstraints { make in + make.leading.equalTo(pokeImageView.snp.trailing).offset(20) + make.trailing.equalToSuperview().offset(-15) + make.centerY.equalToSuperview() + } + } + + func configure(with phoneBook: PhoneBook) { + nameLabel.text = phoneBook.name + phoneNumberLabel.text = phoneBook.phoneNumber + if let image = phoneBook.image { + pokeImageView.image = image + } + } +} diff --git a/PokemonPhoneBook/Views/PhoneBookView.swift b/PokemonPhoneBook/Views/PhoneBookView.swift new file mode 100644 index 0000000..99a0454 --- /dev/null +++ b/PokemonPhoneBook/Views/PhoneBookView.swift @@ -0,0 +1,79 @@ +// +// PhoneBookView.swift +// PokemonPhoneBook +// +// Created by 내일배움캠프 on 12/11/24. +// + +import UIKit +import SnapKit + +class PhoneBookView: UIView { + + let titleLabel: UILabel = { + let label = UILabel() + label.text = "친구 목록" + label.textColor = .black + label.font = .boldSystemFont(ofSize: 30) + label.textAlignment = .center + return label + }() + + let addButton: UIButton = { + let button = UIButton() + button.setTitle("추가", for: .normal) + button.setTitleColor(.lightGray, for: .normal) + button.titleLabel?.font = .boldSystemFont(ofSize: 20) + button.backgroundColor = .clear + return button + }() + + private let stackView: UIStackView = { + let stackView = UIStackView() + stackView.axis = .horizontal + stackView.alignment = .center + stackView.distribution = .fillEqually + stackView.spacing = 30 + return stackView + }() + + let tableView: UITableView = { + let tableView = UITableView() + tableView.backgroundColor = .white + return tableView + }() + + override init(frame: CGRect) { + super.init(frame: frame) + setupLayout() + } + + @available(*, unavailable, message: "이 뷰는 Storyboard를 지원하지 않습니다.") + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + private func setupLayout() { + self.backgroundColor = .white + [ + stackView, + tableView + ].forEach { addSubview($0) } + + stackView.addArrangedSubview(UIView()) + stackView.addArrangedSubview(titleLabel) + stackView.addArrangedSubview(addButton) + + stackView.snp.makeConstraints { make in + make.centerX.equalToSuperview() + make.leading.equalTo(5) + make.trailing.equalTo(-5) + make.top.equalTo(self.safeAreaLayoutGuide.snp.top).offset(20) + } + tableView.snp.makeConstraints { make in + make.top.equalTo(stackView.snp.bottom).offset(60) + make.left.right.equalToSuperview() + make.bottom.equalToSuperview() + } + } +} diff --git a/PokemonPhoneBookTests/PokemonPhoneBookTests.swift b/PokemonPhoneBookTests/PokemonPhoneBookTests.swift new file mode 100644 index 0000000..119e7bc --- /dev/null +++ b/PokemonPhoneBookTests/PokemonPhoneBookTests.swift @@ -0,0 +1,36 @@ +// +// PokemonPhoneBookTests.swift +// PokemonPhoneBookTests +// +// Created by 내일배움캠프 on 12/6/24. +// + +import XCTest +@testable import PokemonPhoneBook + +final class PokemonPhoneBookTests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + // Any test you write for XCTest can be annotated as throws and async. + // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. + // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. + } + + func testPerformanceExample() throws { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/PokemonPhoneBookUITests/PokemonPhoneBookUITests.swift b/PokemonPhoneBookUITests/PokemonPhoneBookUITests.swift new file mode 100644 index 0000000..de874bb --- /dev/null +++ b/PokemonPhoneBookUITests/PokemonPhoneBookUITests.swift @@ -0,0 +1,43 @@ +// +// PokemonPhoneBookUITests.swift +// PokemonPhoneBookUITests +// +// Created by 내일배움캠프 on 12/6/24. +// + +import XCTest + +final class PokemonPhoneBookUITests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + @MainActor + func testExample() throws { + // UI tests must launch the application that they test. + let app = XCUIApplication() + app.launch() + + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + @MainActor + func testLaunchPerformance() throws { + if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { + // This measures how long it takes to launch your application. + measure(metrics: [XCTApplicationLaunchMetric()]) { + XCUIApplication().launch() + } + } + } +} diff --git a/PokemonPhoneBookUITests/PokemonPhoneBookUITestsLaunchTests.swift b/PokemonPhoneBookUITests/PokemonPhoneBookUITestsLaunchTests.swift new file mode 100644 index 0000000..0d95447 --- /dev/null +++ b/PokemonPhoneBookUITests/PokemonPhoneBookUITestsLaunchTests.swift @@ -0,0 +1,33 @@ +// +// PokemonPhoneBookUITestsLaunchTests.swift +// PokemonPhoneBookUITests +// +// Created by 내일배움캠프 on 12/6/24. +// + +import XCTest + +final class PokemonPhoneBookUITestsLaunchTests: XCTestCase { + + override class var runsForEachTargetApplicationUIConfiguration: Bool { + true + } + + override func setUpWithError() throws { + continueAfterFailure = false + } + + @MainActor + func testLaunch() throws { + let app = XCUIApplication() + app.launch() + + // Insert steps here to perform after app launch but before taking a screenshot, + // such as logging into a test account or navigating somewhere in the app + + let attachment = XCTAttachment(screenshot: app.screenshot()) + attachment.name = "Launch Screen" + attachment.lifetime = .keepAlways + add(attachment) + } +} diff --git a/README.md b/README.md index 9830bf8..b1bb4c8 100644 --- a/README.md +++ b/README.md @@ -1 +1,77 @@ # PokemonPhoneBook + +**목표**: Xcode에서 UIKit 프레임워크를 이용해서 스토리보드 혹은 코드베이스로 포켓몬 전화번호부를 만듭니다. + +## 🌟 필수 구현 기능 (Levels 1-5) + +- **Level 1**: `UILabel`, `UITableView`, `UIButton` 등을 이용해 테이블 뷰 만들기 +- **Level 2**: `UIViewController`를 새로 추가하여 연락처 추가 화면을 구현하기(파일 이름: PhoneBookViewController.swift) +- **Level 3**: 상단 네비게이션 바 영역을 구현하기 (제목, 적용 버튼 등) +- **Level 4**: API를 연결하여 버튼을 눌렀을 때 랜덤한 이미지가 생성되도록 구현하기 +- **Level 5**: 적용 버튼을 누르면 연락처 데이터(이름/전화번호/프로필 이미지)를 디스크에 실제 저장하도록 구현하기 + +## 💪 도전 구현 기능 (Levels 6-8) + +- **Level 6**: 연락처를 추가한 후 메인화면의 연락처가 항상 이름 순으로 정렬되도록 구현하기 +- **Level 7**: 테이블뷰의 셀을 클릭했을 때 `PhoneBookViewController` 페이지로 이동되도록 구현하기 +- **Level 8**: 테이블뷰의 셀을 클릭해서 화면을 이동했을 때, 연락처 편집 페이지에서 실제로 기기 디스크 데이터에 Update가 일어나도록 구현하기 + +## 🔥 Challenge - 디테일 키우기 + +Level 1 ~ 8 까지 구현하고도 여유가 되시는 분들은 심화과정을 고민해보기 + +- 포켓몬의 덩치가 클 때, 이미지 영역을 벗어나는 경우가 있습니다. 이 때, 원 밖을 벗어나지 않도록 구현해 봅시다!! +- 연락처를 매우 많이 추가했을 경우(예: 20개 이상) 테이블 뷰 스크롤을 빠르게 내리면 이미지가 겹쳐 보이거나 텍스트가 제대로 노출되지 않는 문제가 있을 수 있습니다. + - 이 문제는 `prepareForReuse`의 개념을 사용하면 해결할 수 있습니다 + - 구현은 못하더라도 개념 공부를 추천드립니다. +- 어떻게 구현하냐에 따라 메인화면의 우상단의 `추가` 버튼이 잘 클릭되지 않는 함정에 빠질 수 있습니다. 이걸 해결해 주세요! +- 연락처 앱에는 또 어떤 예외 사항이 있을지 스스로 고민해보며 자신만의 챌린지를 만들어 주세요!! + +## 📜 구현 가이드 + +- 개발 프로세스 가이드 + - **`UIKit` 화면 구성 및 화면 전환** + - 화면구성: `UITableView`, `UILabel`, `UITextView`, `UIButton` 활용 + - 화면전환: `친구 목록 페이지` → `연락처 추가 페이지`로 이동 + + - **`URLSession` / `Alamofire` 복습** + - 네트워크 통신을 이용해서 서버에서 랜덤 포켓몬 이미지를 불러옵니다. + - 두 가지 방법으로 모두 개발해보면 좋은 연습이 됩니다. + - 포켓몬 API: [포켓몬 API 링크](https://pokeapi.co/) + + - **`ViewController 생명주기` 개념** + - 친구 목록 페이지에 진입할때마다 목록이 `이름순으로 정렬`되도록 합니다. + + - **`CoreData` / `UserDefaults` 활용** + - 연락처 데이터를 `기기 디스크에 저장`합니다. + - 두 가지 방법으로 모두 개발해보면 좋은 연습이 됩니다. + +- **포켓몬 JSON Response 형태** +```swift + // JSON Response 형태 + { + "id": 25, + "name": "pikachu", + "height": 4, + "weight": 60, + "sprites": { + "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/25.png" + } + } +``` + +--- + +## 🎯 목표 + +- **기한**: 12월 12일 (목) 낮 12시까지 제출 +- **제출물**: + - 개인과제 결과물 제출 (GitHub 링크) + - 트러블슈팅 TIL + - 과제를 소개하는 README + +## 🔗 과제 링크 + +- [Ch 3. 앱개발 숙련 주차 과제]([https://developer.apple.com/swift/](https://teamsparta.notion.site/Ch-3-1522dc3ef5148059b6c7f310f7b15966)) + +---