diff --git a/PokemonPhoneBook/.DS_Store b/PokemonPhoneBook/.DS_Store new file mode 100644 index 0000000..db0373b Binary files /dev/null and b/PokemonPhoneBook/.DS_Store differ diff --git a/PokemonPhoneBook/PokemonPhoneBook.xcodeproj/project.pbxproj b/PokemonPhoneBook/PokemonPhoneBook.xcodeproj/project.pbxproj new file mode 100644 index 0000000..691ebd8 --- /dev/null +++ b/PokemonPhoneBook/PokemonPhoneBook.xcodeproj/project.pbxproj @@ -0,0 +1,366 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXBuildFile section */ + F9AD7DAF2D06DA2F00356354 /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = F9AD7DAE2D06DA2F00356354 /* SnapKit */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + F90996F52D03098F00A92B66 /* PokemonPhoneBook.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PokemonPhoneBook.app; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ + F9DCB1412D0705960054FFA3 /* Exceptions for "PokemonPhoneBook" folder in "PokemonPhoneBook" target */ = { + isa = PBXFileSystemSynchronizedBuildFileExceptionSet; + membershipExceptions = ( + Info.plist, + ); + target = F90996F42D03098F00A92B66 /* PokemonPhoneBook */; + }; +/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + F90996F72D03098F00A92B66 /* PokemonPhoneBook */ = { + isa = PBXFileSystemSynchronizedRootGroup; + exceptions = ( + F9DCB1412D0705960054FFA3 /* Exceptions for "PokemonPhoneBook" folder in "PokemonPhoneBook" target */, + ); + path = PokemonPhoneBook; + sourceTree = ""; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + F90996F22D03098F00A92B66 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + F9AD7DAF2D06DA2F00356354 /* SnapKit in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + F90996EC2D03098F00A92B66 = { + isa = PBXGroup; + children = ( + F90996F72D03098F00A92B66 /* PokemonPhoneBook */, + F90996F62D03098F00A92B66 /* Products */, + ); + sourceTree = ""; + }; + F90996F62D03098F00A92B66 /* Products */ = { + isa = PBXGroup; + children = ( + F90996F52D03098F00A92B66 /* PokemonPhoneBook.app */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + F90996F42D03098F00A92B66 /* PokemonPhoneBook */ = { + isa = PBXNativeTarget; + buildConfigurationList = F909970B2D03099100A92B66 /* Build configuration list for PBXNativeTarget "PokemonPhoneBook" */; + buildPhases = ( + F90996F12D03098F00A92B66 /* Sources */, + F90996F22D03098F00A92B66 /* Frameworks */, + F90996F32D03098F00A92B66 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + F90996F72D03098F00A92B66 /* PokemonPhoneBook */, + ); + name = PokemonPhoneBook; + packageProductDependencies = ( + F9AD7DAE2D06DA2F00356354 /* SnapKit */, + ); + productName = PokemonPhoneBook; + productReference = F90996F52D03098F00A92B66 /* PokemonPhoneBook.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + F90996ED2D03098F00A92B66 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1600; + LastUpgradeCheck = 1600; + TargetAttributes = { + F90996F42D03098F00A92B66 = { + CreatedOnToolsVersion = 16.0; + }; + }; + }; + buildConfigurationList = F90996F02D03098F00A92B66 /* Build configuration list for PBXProject "PokemonPhoneBook" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = F90996EC2D03098F00A92B66; + minimizedProjectReferenceProxies = 1; + packageReferences = ( + F9AD7DAD2D06DA2F00356354 /* XCRemoteSwiftPackageReference "SnapKit" */, + ); + preferredProjectObjectVersion = 77; + productRefGroup = F90996F62D03098F00A92B66 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + F90996F42D03098F00A92B66 /* PokemonPhoneBook */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + F90996F32D03098F00A92B66 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + F90996F12D03098F00A92B66 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + F909970C2D03099100A92B66 /* 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 = KP2ZL84Y7U; + 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 = com.jeongmu.PokemonPhoneBook; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + F909970D2D03099100A92B66 /* 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 = KP2ZL84Y7U; + 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 = com.jeongmu.PokemonPhoneBook; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + F909970E2D03099100A92B66 /* 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.0; + 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; + }; + F909970F2D03099100A92B66 /* 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.0; + 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; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + F90996F02D03098F00A92B66 /* Build configuration list for PBXProject "PokemonPhoneBook" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F909970E2D03099100A92B66 /* Debug */, + F909970F2D03099100A92B66 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + F909970B2D03099100A92B66 /* Build configuration list for PBXNativeTarget "PokemonPhoneBook" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F909970C2D03099100A92B66 /* Debug */, + F909970D2D03099100A92B66 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + F9AD7DAD2D06DA2F00356354 /* XCRemoteSwiftPackageReference "SnapKit" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/SnapKit/SnapKit.git"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 5.7.1; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + F9AD7DAE2D06DA2F00356354 /* SnapKit */ = { + isa = XCSwiftPackageProductDependency; + package = F9AD7DAD2D06DA2F00356354 /* XCRemoteSwiftPackageReference "SnapKit" */; + productName = SnapKit; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = F90996ED2D03098F00A92B66 /* Project object */; +} diff --git a/PokemonPhoneBook/PokemonPhoneBook.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/PokemonPhoneBook/PokemonPhoneBook.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/PokemonPhoneBook/PokemonPhoneBook.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/PokemonPhoneBook/PokemonPhoneBook.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/PokemonPhoneBook/PokemonPhoneBook.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..3f64b3c --- /dev/null +++ b/PokemonPhoneBook/PokemonPhoneBook.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,15 @@ +{ + "originHash" : "dd27728c8848101841bd8d45243ef43144e233aa3767c82656934b73447347b8", + "pins" : [ + { + "identity" : "snapkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/SnapKit/SnapKit.git", + "state" : { + "revision" : "2842e6e84e82eb9a8dac0100ca90d9444b0307f4", + "version" : "5.7.1" + } + } + ], + "version" : 3 +} diff --git a/PokemonPhoneBook/PokemonPhoneBook.xcodeproj/project.xcworkspace/xcuserdata/mooya.xcuserdatad/UserInterfaceState.xcuserstate b/PokemonPhoneBook/PokemonPhoneBook.xcodeproj/project.xcworkspace/xcuserdata/mooya.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..3c64cf3 Binary files /dev/null and b/PokemonPhoneBook/PokemonPhoneBook.xcodeproj/project.xcworkspace/xcuserdata/mooya.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/PokemonPhoneBook/PokemonPhoneBook.xcodeproj/xcuserdata/mooya.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/PokemonPhoneBook/PokemonPhoneBook.xcodeproj/xcuserdata/mooya.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..2becf25 --- /dev/null +++ b/PokemonPhoneBook/PokemonPhoneBook.xcodeproj/xcuserdata/mooya.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,6 @@ + + + diff --git a/PokemonPhoneBook/PokemonPhoneBook.xcodeproj/xcuserdata/mooya.xcuserdatad/xcschemes/xcschememanagement.plist b/PokemonPhoneBook/PokemonPhoneBook.xcodeproj/xcuserdata/mooya.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..dc96333 --- /dev/null +++ b/PokemonPhoneBook/PokemonPhoneBook.xcodeproj/xcuserdata/mooya.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + PokemonPhoneBook.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/PokemonPhoneBook/PokemonPhoneBook/AppDelegate.swift b/PokemonPhoneBook/PokemonPhoneBook/AppDelegate.swift new file mode 100644 index 0000000..630e775 --- /dev/null +++ b/PokemonPhoneBook/PokemonPhoneBook/AppDelegate.swift @@ -0,0 +1,81 @@ +// +// AppDelegate.swift +// PokemonPhoneBook +// +// Created by YangJeongMu 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/PokemonPhoneBook/Assets.xcassets/AccentColor.colorset/Contents.json b/PokemonPhoneBook/PokemonPhoneBook/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/PokemonPhoneBook/PokemonPhoneBook/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/PokemonPhoneBook/PokemonPhoneBook/Assets.xcassets/AppIcon.appiconset/Contents.json b/PokemonPhoneBook/PokemonPhoneBook/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..2305880 --- /dev/null +++ b/PokemonPhoneBook/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/PokemonPhoneBook/Assets.xcassets/Contents.json b/PokemonPhoneBook/PokemonPhoneBook/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/PokemonPhoneBook/PokemonPhoneBook/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/PokemonPhoneBook/PokemonPhoneBook/Base.lproj/LaunchScreen.storyboard b/PokemonPhoneBook/PokemonPhoneBook/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..2e490f3 --- /dev/null +++ b/PokemonPhoneBook/PokemonPhoneBook/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PokemonPhoneBook/PokemonPhoneBook/Info.plist b/PokemonPhoneBook/PokemonPhoneBook/Info.plist new file mode 100644 index 0000000..0eb786d --- /dev/null +++ b/PokemonPhoneBook/PokemonPhoneBook/Info.plist @@ -0,0 +1,23 @@ + + + + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + + + + + + diff --git a/PokemonPhoneBook/PokemonPhoneBook/PhoneBookViewController.swift b/PokemonPhoneBook/PokemonPhoneBook/PhoneBookViewController.swift new file mode 100644 index 0000000..724d39e --- /dev/null +++ b/PokemonPhoneBook/PokemonPhoneBook/PhoneBookViewController.swift @@ -0,0 +1,125 @@ +// +// PhoneBookViewController.swift +// PokemonPhoneBook +// +// Created by YangJeongMu on 12/11/24. +// + +import UIKit +import SnapKit + +class PhoneBookViewController: UIViewController { + + + + + let randomProfileImage = UIImageView() + let randomImageButton = UIButton() + let namebar = UITextField() + let phoneNumberBar = UITextField() + + override func viewDidLoad() { + super.viewDidLoad() + configureUI() + + // 네비게이션 바 제목 + self.title = "연락처 추가" + + // 네비게이션 바 적용 버튼 + let applyButton = UIBarButtonItem(title: "적용", style: .plain, target: self, action: #selector(applyButtonClicked)) + self.navigationItem.rightBarButtonItem = applyButton + + // 버튼 액션 설정 + + } + + + + private func configureUI() { + view.backgroundColor = .white + + // 프로필 이미지 + randomProfileImage.layer.cornerRadius = 75 + randomProfileImage.layer.borderColor = UIColor.lightGray.cgColor + randomProfileImage.layer.borderWidth = 2 + randomProfileImage.clipsToBounds = true + + view.addSubview(randomProfileImage) + randomProfileImage.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide).offset(25) + make.centerX.equalToSuperview() + make.width.equalTo(150) + make.height.equalTo(150) + + + // 랜덤 이미지 생성 버튼 + randomImageButton.setTitle("랜덤 이미지 생성", for: .normal) + randomImageButton.setTitleColor(.systemGray, for: .normal) + + view.addSubview(randomImageButton) + randomImageButton.snp.makeConstraints{ make in + make.top.equalTo(randomProfileImage.snp.top).offset(160) + make.centerX.equalToSuperview() + make.width.equalTo(150) + make.height.equalTo(50) + } + // 이름 + namebar.layer.cornerRadius = 8 + namebar.layer.borderColor = UIColor.lightGray.cgColor + namebar.layer.borderWidth = 1 + namebar.clipsToBounds = true + + view.addSubview(namebar) + namebar.snp.makeConstraints{ make in + make.top.equalTo(randomImageButton.snp.top).offset(70) + make.centerX.equalToSuperview() + make.width.equalTo(350) + make.height.equalTo(50) + } + + // 전화번호 + phoneNumberBar.layer.cornerRadius = 8 + phoneNumberBar.layer.borderColor = UIColor.lightGray.cgColor + phoneNumberBar.layer.borderWidth = 1 + phoneNumberBar.clipsToBounds = true + + view.addSubview(phoneNumberBar) + phoneNumberBar.snp.makeConstraints { make in + make.top.equalTo(namebar.snp.top).offset(60) + make.centerX.equalToSuperview() + make.width.equalTo(350) + make.height.equalTo(50) + } + + + + + } + + + + } + + @objc + private func applyButtonClicked() { + self.navigationController?.pushViewController(PhoneBookViewController(), animated: true) + print("적용") + } + +} + + + + + +/* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destination. + // Pass the selected object to the new view controller. + } + */ + + diff --git a/PokemonPhoneBook/PokemonPhoneBook/PhoneTableViewCell.swift b/PokemonPhoneBook/PokemonPhoneBook/PhoneTableViewCell.swift new file mode 100644 index 0000000..87f7cab --- /dev/null +++ b/PokemonPhoneBook/PokemonPhoneBook/PhoneTableViewCell.swift @@ -0,0 +1,71 @@ +// +// PhoneTableViewCell.swift +// PokemonPhoneBook +// +// Created by YangJeongMu on 12/11/24. +// + +import UIKit + +class PhoneTableViewCell: UITableViewCell { + + + let profileImageView = UIImageView() + let nameLabel = UILabel() + let phoneLabel = UILabel() + + + + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + configureUI() + + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + + + } + + private func configureUI() { + self.contentView.addSubview(profileImageView) + self.contentView.addSubview(nameLabel) + self.contentView.addSubview(phoneLabel) + + nameLabel.text = "pokemom" + phoneLabel.text = "010-0000-0000" + phoneLabel.textAlignment = .right + profileImageView.layer.cornerRadius = 25 + profileImageView.layer.borderColor = UIColor.lightGray.cgColor + profileImageView.layer.borderWidth = 1 + + + profileImageView.snp.makeConstraints{ make in + make.leading.equalToSuperview().offset(16) + make.top.equalToSuperview().offset(16) + make.width.equalTo(50) + make.height.equalTo(50) + } + + nameLabel.snp.makeConstraints{ make in + make.leading.equalTo(profileImageView.snp.trailing).offset(16) + make.top.equalToSuperview().offset(16) + make.width.equalTo(100) + make.height.equalTo(50) + + } + + phoneLabel.snp.makeConstraints{ make in + + make.trailing.equalToSuperview().offset(-16) + make.top.equalToSuperview().offset(16) + make.width.equalTo(150) + make.height.equalTo(50) + } + + } + + + +} diff --git a/PokemonPhoneBook/PokemonPhoneBook/PokemonPhoneBook.xcdatamodeld/.xccurrentversion b/PokemonPhoneBook/PokemonPhoneBook/PokemonPhoneBook.xcdatamodeld/.xccurrentversion new file mode 100644 index 0000000..e1b76cc --- /dev/null +++ b/PokemonPhoneBook/PokemonPhoneBook/PokemonPhoneBook.xcdatamodeld/.xccurrentversion @@ -0,0 +1,8 @@ + + + + + _XCCurrentVersionName + PokemonPhoneBook.xcdatamodel + + diff --git a/PokemonPhoneBook/PokemonPhoneBook/PokemonPhoneBook.xcdatamodeld/PokemonPhoneBook.xcdatamodel/contents b/PokemonPhoneBook/PokemonPhoneBook/PokemonPhoneBook.xcdatamodeld/PokemonPhoneBook.xcdatamodel/contents new file mode 100644 index 0000000..50d2514 --- /dev/null +++ b/PokemonPhoneBook/PokemonPhoneBook/PokemonPhoneBook.xcdatamodeld/PokemonPhoneBook.xcdatamodel/contents @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/PokemonPhoneBook/PokemonPhoneBook/SceneDelegate.swift b/PokemonPhoneBook/PokemonPhoneBook/SceneDelegate.swift new file mode 100644 index 0000000..139aebb --- /dev/null +++ b/PokemonPhoneBook/PokemonPhoneBook/SceneDelegate.swift @@ -0,0 +1,58 @@ +// +// SceneDelegate.swift +// PokemonPhoneBook +// +// Created by YangJeongMu 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 } + + window = UIWindow(windowScene: windowScene) + window?.rootViewController = UINavigationController(rootViewController: ViewController()) + window?.makeKeyAndVisible() + + } + + 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/PokemonPhoneBook/ViewController.swift b/PokemonPhoneBook/PokemonPhoneBook/ViewController.swift new file mode 100644 index 0000000..59a82a9 --- /dev/null +++ b/PokemonPhoneBook/PokemonPhoneBook/ViewController.swift @@ -0,0 +1,103 @@ +// +// ViewController.swift +// PokemonPhoneBook +// +// Created by YangJeongMu on 12/9/24. +// + +import UIKit +import SnapKit + +class ViewController: UIViewController { + + // MARK: - UI Components + private let titleLabel: UILabel = { + let label = UILabel() + label.text = "친구 목록" + label.font = UIFont.boldSystemFont(ofSize: 24) + label.textAlignment = .center + label.textColor = .black + return label + }() + + private let addButton: UIButton = { + let button = UIButton(type: .system) + button.setTitle("추가", for: .normal) + button.titleLabel?.font = UIFont.systemFont(ofSize: 18) + return button + }() + + private let tableView: UITableView = { + let tableView = UITableView() + tableView.separatorStyle = .singleLine + tableView.rowHeight = 80 // 셀 높이 설정 + return tableView + }() + + + + + + + + // MARK: - Lifecycle + override func viewDidLoad() { + super.viewDidLoad() + setupUI() + + // 데이터 소스 연결 + tableView.register(PhoneTableViewCell.self, forCellReuseIdentifier: "PhoneTableViewCell") + tableView.dataSource = self + + addButton.addTarget(self, action: #selector(buttonClicked), for: .touchDown) + + + + } + + @objc + private func buttonClicked() { + self.navigationController?.pushViewController(PhoneBookViewController(), animated: true) + print("버튼 클릭") + } + + // MARK: - Setup UI + private func setupUI() { + view.backgroundColor = .white + + // Add Components + view.addSubview(titleLabel) + view.addSubview(addButton) + view.addSubview(tableView) // 테이블 뷰 추가 + + // Layout Using SnapKit + titleLabel.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide.snp.top).offset(16) + make.centerX.equalToSuperview() + } + + addButton.snp.makeConstraints { make in + make.centerY.equalTo(titleLabel) + make.trailing.equalToSuperview().inset(16) + } + + tableView.snp.makeConstraints { make in + make.top.equalTo(titleLabel.snp.bottom).offset(16) + make.leading.trailing.bottom.equalToSuperview() // 하단 제약 조건 추가 + } + } +} + +// MARK: - UITableViewDataSource +extension ViewController: UITableViewDataSource { + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return 3 + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "PhoneTableViewCell") as! + PhoneTableViewCell + + return cell + } +} diff --git a/README.md b/README.md index 9830bf8..6a70965 100644 --- a/README.md +++ b/README.md @@ -1 +1,113 @@ # PokemonPhoneBook + +**목표**: Xcode에서 UIKit 프레임워크를 이용해서 스토리보드 혹은 코드베이스로 포켓몬 전화번호부를 만듭니다. + +## 📝 협업 규칙 + +### Pull Request 작성 규칙 +1. **형식**: `[레벨] 작업 내용 - 팀원 이름` + - 예: `[Lv 1] 필수기능 구현 - sonny` + +2. **작업 세부 사항**: 구현한 주요 기능과 로직에 대한 요약을 작성합니다. + +3. **Github 커밋 컨벤션 가이드 (이모지 버전)** + + - 기본 커밋 타입 + - ✨ `feat` : 새로운 기능 추가 + - 🐝 `fix` : 버그 수정 + - 📝 `docs` : 문서 수정 + - 💄 `style` : 코드 포맷팅, 세미콜론 누락, 코드 변경이 없는 경우 + - ♻️ `refactor` : 코드 리팩토링 + - ✅ `test` : 테스트 코드, 리팩토링 테스트 코드 추가 + - 🎨 `chore` : 빌드 업무 수정, 패키지 매니저 수정 + + - 자주 사용되는 추가 타입 + - 🚀 `deploy` : 배포 + - ⚡️ `perf` : 성능 개선 + - 🔧 `config` : 설정 파일 수정 + - 📦 `build` : 빌드 관련 수정 + - 🔀 `merge` : 합병 + - ⏪️ `revert` : 되돌리기 + +### 레포지토리 설정 및 브랜치 관리 +1. **Fork로 가져오기**: 각 팀원은 레포지토리를 Fork하여 자신의 개인 레포지토리로 가져옵니다. +2. **브랜치 생성**: Fork한 개인 레포지토리에서 각자의 이름을 딴 브랜치를 생성합니다. +3. **Pull Request**: 각자의 브랜치에서 Pull Request를 생성해 코드 리뷰를 요청합니다. 모든 팀원이 Pull Request에 코멘트를 추가하여 피드백을 제공합니다. +4. **수정 및 Merge**: 피드백을 반영하여 수정한 후, 팀원들의 동의를 얻어 merge를 진행합니다. + +-> 풀 리퀘스트를 한 후 Merge하지 않은채 커밋-푸시를 하면 기존 풀 리퀘스트에 들어가기 때문에 그럴 경우 새로운 브랜치를 만듭니다. + +## 🌟 필수 구현 기능 (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)) + +--- +