diff --git a/Combine-Study/Combine-Study.xcodeproj/project.pbxproj b/Combine-Study/Combine-Study.xcodeproj/project.pbxproj new file mode 100644 index 0000000..31fc8a1 --- /dev/null +++ b/Combine-Study/Combine-Study.xcodeproj/project.pbxproj @@ -0,0 +1,383 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXBuildFile section */ + 338985FC2EF14F4600909A38 /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = 338985FB2EF14F4600909A38 /* SnapKit */; }; + 338985FF2EF14F5100909A38 /* Then in Frameworks */ = {isa = PBXBuildFile; productRef = 338985FE2EF14F5100909A38 /* Then */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 338985292EF1497E00909A38 /* Combine-Study.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Combine-Study.app"; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ + 3389853B2EF1498100909A38 /* Exceptions for "Combine-Study" folder in "Combine-Study" target */ = { + isa = PBXFileSystemSynchronizedBuildFileExceptionSet; + membershipExceptions = ( + Info.plist, + ); + target = 338985282EF1497E00909A38 /* Combine-Study */; + }; +/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + 3389852B2EF1497E00909A38 /* Combine-Study */ = { + isa = PBXFileSystemSynchronizedRootGroup; + exceptions = ( + 3389853B2EF1498100909A38 /* Exceptions for "Combine-Study" folder in "Combine-Study" target */, + ); + path = "Combine-Study"; + sourceTree = ""; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + 338985262EF1497E00909A38 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 338985FC2EF14F4600909A38 /* SnapKit in Frameworks */, + 338985FF2EF14F5100909A38 /* Then in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 338985202EF1497E00909A38 = { + isa = PBXGroup; + children = ( + 3389852B2EF1497E00909A38 /* Combine-Study */, + 3389852A2EF1497E00909A38 /* Products */, + ); + sourceTree = ""; + }; + 3389852A2EF1497E00909A38 /* Products */ = { + isa = PBXGroup; + children = ( + 338985292EF1497E00909A38 /* Combine-Study.app */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 338985282EF1497E00909A38 /* Combine-Study */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3389853C2EF1498100909A38 /* Build configuration list for PBXNativeTarget "Combine-Study" */; + buildPhases = ( + 338985252EF1497E00909A38 /* Sources */, + 338985262EF1497E00909A38 /* Frameworks */, + 338985272EF1497E00909A38 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + 3389852B2EF1497E00909A38 /* Combine-Study */, + ); + name = "Combine-Study"; + packageProductDependencies = ( + 338985FB2EF14F4600909A38 /* SnapKit */, + 338985FE2EF14F5100909A38 /* Then */, + ); + productName = "Combine-Study"; + productReference = 338985292EF1497E00909A38 /* Combine-Study.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 338985212EF1497E00909A38 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1640; + LastUpgradeCheck = 1640; + TargetAttributes = { + 338985282EF1497E00909A38 = { + CreatedOnToolsVersion = 16.4; + }; + }; + }; + buildConfigurationList = 338985242EF1497E00909A38 /* Build configuration list for PBXProject "Combine-Study" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 338985202EF1497E00909A38; + minimizedProjectReferenceProxies = 1; + packageReferences = ( + 338985FA2EF14F4600909A38 /* XCRemoteSwiftPackageReference "SnapKit" */, + 338985FD2EF14F5100909A38 /* XCRemoteSwiftPackageReference "Then" */, + ); + preferredProjectObjectVersion = 77; + productRefGroup = 3389852A2EF1497E00909A38 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 338985282EF1497E00909A38 /* Combine-Study */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 338985272EF1497E00909A38 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 338985252EF1497E00909A38 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 3389853D2EF1498100909A38 /* 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 = P64LJZB7SK; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Combine-Study/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 = "yeonnies.Combine-Study"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 3389853E2EF1498100909A38 /* 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 = P64LJZB7SK; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Combine-Study/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 = "yeonnies.Combine-Study"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 3389853F2EF1498100909A38 /* 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.5; + 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; + }; + 338985402EF1498100909A38 /* 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.5; + 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 */ + 338985242EF1497E00909A38 /* Build configuration list for PBXProject "Combine-Study" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3389853F2EF1498100909A38 /* Debug */, + 338985402EF1498100909A38 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3389853C2EF1498100909A38 /* Build configuration list for PBXNativeTarget "Combine-Study" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3389853D2EF1498100909A38 /* Debug */, + 3389853E2EF1498100909A38 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + 338985FA2EF14F4600909A38 /* XCRemoteSwiftPackageReference "SnapKit" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/SnapKit/SnapKit.git"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 5.7.1; + }; + }; + 338985FD2EF14F5100909A38 /* XCRemoteSwiftPackageReference "Then" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/devxoul/Then"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 3.0.0; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 338985FB2EF14F4600909A38 /* SnapKit */ = { + isa = XCSwiftPackageProductDependency; + package = 338985FA2EF14F4600909A38 /* XCRemoteSwiftPackageReference "SnapKit" */; + productName = SnapKit; + }; + 338985FE2EF14F5100909A38 /* Then */ = { + isa = XCSwiftPackageProductDependency; + package = 338985FD2EF14F5100909A38 /* XCRemoteSwiftPackageReference "Then" */; + productName = Then; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = 338985212EF1497E00909A38 /* Project object */; +} diff --git a/Combine-Study/Combine-Study.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Combine-Study/Combine-Study.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Combine-Study/Combine-Study.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Combine-Study/Combine-Study.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Combine-Study/Combine-Study.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..da17c27 --- /dev/null +++ b/Combine-Study/Combine-Study.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,24 @@ +{ + "originHash" : "dc78d9f78c6dffeef10c87cabc223dde5b29ad30f0c1897eba28f817c2359a8a", + "pins" : [ + { + "identity" : "snapkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/SnapKit/SnapKit.git", + "state" : { + "revision" : "2842e6e84e82eb9a8dac0100ca90d9444b0307f4", + "version" : "5.7.1" + } + }, + { + "identity" : "then", + "kind" : "remoteSourceControl", + "location" : "https://github.com/devxoul/Then", + "state" : { + "revision" : "d41ef523faef0f911369f79c0b96815d9dbb6d7a", + "version" : "3.0.0" + } + } + ], + "version" : 3 +} diff --git a/Combine-Study/Combine-Study/Application/AppDelegate.swift b/Combine-Study/Combine-Study/Application/AppDelegate.swift new file mode 100644 index 0000000..3f21172 --- /dev/null +++ b/Combine-Study/Combine-Study/Application/AppDelegate.swift @@ -0,0 +1,36 @@ +// +// AppDelegate.swift +// Combine-Study +// +// Created by 김나연 on 12/16/25. +// + +import UIKit + +@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. + } + + +} + diff --git a/Combine-Study/Combine-Study/Application/Base.lproj/LaunchScreen.storyboard b/Combine-Study/Combine-Study/Application/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/Combine-Study/Combine-Study/Application/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Combine-Study/Combine-Study/Application/SceneDelegate.swift b/Combine-Study/Combine-Study/Application/SceneDelegate.swift new file mode 100644 index 0000000..dc08853 --- /dev/null +++ b/Combine-Study/Combine-Study/Application/SceneDelegate.swift @@ -0,0 +1,60 @@ +// +// SceneDelegate.swift +// Combine-Study +// +// Created by 김나연 on 12/16/25. +// + +import UIKit + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + // 1. + guard let windowScene = (scene as? UIWindowScene) else { return } + // 2. + let window = UIWindow(windowScene: windowScene) + // 3. + let vc = UINavigationController(rootViewController: MovieAPIViewController()) + // 4. + window.rootViewController = vc + // 5. + self.window = window + // 6. + 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. + } + + +} + diff --git a/Combine-Study/Combine-Study/Global/Extension/UITableViewCell+.swift b/Combine-Study/Combine-Study/Global/Extension/UITableViewCell+.swift new file mode 100644 index 0000000..58d3baa --- /dev/null +++ b/Combine-Study/Combine-Study/Global/Extension/UITableViewCell+.swift @@ -0,0 +1,14 @@ +// +// UITableViewCell+.swift +// sopt-37th-Assignment +// +// Created by 김나연 on 11/14/25. +// + +import UIKit + +extension UITableViewCell { + static var identifier : String { + return String(describing: self) + } +} diff --git a/Combine-Study/Combine-Study/Global/Extension/UIView+.swift b/Combine-Study/Combine-Study/Global/Extension/UIView+.swift new file mode 100644 index 0000000..0e3c6f6 --- /dev/null +++ b/Combine-Study/Combine-Study/Global/Extension/UIView+.swift @@ -0,0 +1,14 @@ +// +// UIView+.swift +// sopt-37th-Assignment +// +// Created by 김나연 on 10/29/25. +// + +import UIKit + +public extension UIView { + func addSubviews(_ views: UIView...) { + views.forEach { self.addSubview($0) } + } +} diff --git a/Combine-Study/Combine-Study/Global/Resource/Assets.xcassets/AccentColor.colorset/Contents.json b/Combine-Study/Combine-Study/Global/Resource/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/Combine-Study/Combine-Study/Global/Resource/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Combine-Study/Combine-Study/Global/Resource/Assets.xcassets/AppIcon.appiconset/Contents.json b/Combine-Study/Combine-Study/Global/Resource/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..2305880 --- /dev/null +++ b/Combine-Study/Combine-Study/Global/Resource/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/Combine-Study/Combine-Study/Global/Resource/Assets.xcassets/Contents.json b/Combine-Study/Combine-Study/Global/Resource/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Combine-Study/Combine-Study/Global/Resource/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Combine-Study/Combine-Study/Global/Resource/Font/Pretendard-Regular.otf b/Combine-Study/Combine-Study/Global/Resource/Font/Pretendard-Regular.otf new file mode 100644 index 0000000..08bf4cf Binary files /dev/null and b/Combine-Study/Combine-Study/Global/Resource/Font/Pretendard-Regular.otf differ diff --git a/Combine-Study/Combine-Study/Global/Resource/Font/Pretendard-Thin.otf b/Combine-Study/Combine-Study/Global/Resource/Font/Pretendard-Thin.otf new file mode 100644 index 0000000..77e792d Binary files /dev/null and b/Combine-Study/Combine-Study/Global/Resource/Font/Pretendard-Thin.otf differ diff --git a/Combine-Study/Combine-Study/Info.plist b/Combine-Study/Combine-Study/Info.plist new file mode 100644 index 0000000..10749e3 --- /dev/null +++ b/Combine-Study/Combine-Study/Info.plist @@ -0,0 +1,28 @@ + + + + + UIAppFonts + + Pretendard-Regular.otf + Pretendard-Thin.otf + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + + + + + + diff --git a/Combine-Study/Combine-Study/Network/DTO/MovieResponseDTO.swift b/Combine-Study/Combine-Study/Network/DTO/MovieResponseDTO.swift new file mode 100644 index 0000000..dde6092 --- /dev/null +++ b/Combine-Study/Combine-Study/Network/DTO/MovieResponseDTO.swift @@ -0,0 +1,22 @@ +// +// MovieResponseDTO.swift +// Combine-Study +// +// Created by 김나연 on 12/16/25. +// + +struct MovieResponseDTO: Codable { + let boxOfficeResult: BoxOfficeResult +} + +struct BoxOfficeResult: Codable { + let dailyBoxOfficeList: [DailyBoxOffice] +} + +struct DailyBoxOffice: Codable { + let rank: String + let movieNm: String + let openDt: String + let audiCnt: String + let audiAcc: String +} diff --git a/Combine-Study/Combine-Study/Network/Error/NetworkError.swift b/Combine-Study/Combine-Study/Network/Error/NetworkError.swift new file mode 100644 index 0000000..a3163fc --- /dev/null +++ b/Combine-Study/Combine-Study/Network/Error/NetworkError.swift @@ -0,0 +1,29 @@ +// +// NetworkError.swift +// Combine-Study +// +// Created by 김나연 on 12/16/25. +// + +enum NetworkError: Int, Error, CustomStringConvertible { + var description: String { self.errorDescription } + case requestEncodingError + case responseDecodingError + case responseError + case unknownError + case loginFailed = 400 + case internalServerError = 500 + case notFoundError = 404 + + var errorDescription: String { + switch self { + case .loginFailed: return "로그인에 실패하였습니다." + case .requestEncodingError: return "REQUEST_ENCODING_ERROR" + case .responseError: return "RESPONSE_ERROR" + case .responseDecodingError: return "RESPONSE_DECODING_ERROR" + case .unknownError: return "UNKNOWN_ERROR" + case .internalServerError: return "500:INTERNAL_SERVER_ERROR" + case .notFoundError: return "404:NOT_FOUND_ERROR" + } + } +} diff --git a/Combine-Study/Combine-Study/Network/Service/MovieService.swift b/Combine-Study/Combine-Study/Network/Service/MovieService.swift new file mode 100644 index 0000000..7418bf1 --- /dev/null +++ b/Combine-Study/Combine-Study/Network/Service/MovieService.swift @@ -0,0 +1,53 @@ +// +// MovieService.swift +// Combine-Study +// +// Created by 김나연 on 12/16/25. +// + +import Foundation + +final class MovieService { + static let shared = MovieService() + private init() {} + + func makeRequest() -> URLRequest? { + let formatter = DateFormatter() + formatter.dateFormat = "yyyyMMdd" + var urlString = "https://www.kobis.or.kr/kobisopenapi/webservice/rest/boxoffice/searchDailyBoxOfficeList.json?key=c06cf35df72346791f337ce75080763e&" + + if let yesterday = Calendar.current.date(byAdding: .day, value: -1, to: Date()) { + let yesterdayString = formatter.string(from: yesterday) + if let encoded = yesterdayString.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) { + urlString += "targetDt=\(encoded)" + } + } + + guard let url = URL(string: urlString) else {return nil} + + var request = URLRequest(url: url) + request.httpMethod = "GET" + request.setValue("application/json", forHTTPHeaderField: "Content-Type") + return request + } + + func fetchMovieRankList() async throws -> [MovieModel] { + guard let request = makeRequest() else { + throw NetworkError.requestEncodingError + } + + let (data, response) = try await URLSession.shared.data(for: request) + + guard let httpResponse = response as? HTTPURLResponse, + (200...299).contains(httpResponse.statusCode) else { + throw NetworkError.responseError + } + do { + let decoded = try JSONDecoder().decode(MovieResponseDTO.self, from: data) + return decoded.boxOfficeResult.dailyBoxOfficeList.map { MovieModel(from: $0) } + } catch { + print("디코딩 실패:", error) + throw NetworkError.responseDecodingError + } + } +} diff --git a/Combine-Study/Combine-Study/Presentation/Cell/MovieAPITableViewCell.swift b/Combine-Study/Combine-Study/Presentation/Cell/MovieAPITableViewCell.swift new file mode 100644 index 0000000..f925f8d --- /dev/null +++ b/Combine-Study/Combine-Study/Presentation/Cell/MovieAPITableViewCell.swift @@ -0,0 +1,90 @@ +// +// MovieAPITableViewCell.swift +// Combine-Study +// +// Created by 김나연 on 12/16/25. +// + +import UIKit +import SnapKit +import Then + +class MovieAPITableViewCell: UITableViewCell { + + // MARK: - Property + private let rankLabel = UILabel().then{ + $0.textColor = .white + $0.font = .italicSystemFont(ofSize: 96) + } + + private let nameLabel = UILabel().then{ + $0.textColor = .white + $0.font = UIFont(name: "Pretendard-Thin", size: 40) + } + + private let dateLabel = UILabel().then{ + $0.textColor = .white + $0.font = UIFont(name: "Pretendard-Regular", size: 14) + } + + private let todayAudienceLabel = UILabel().then{ + $0.textColor = .gray + $0.font = UIFont(name: "Pretendard-Regular", size: 12) + } + + private let allAudienceLabel = UILabel().then{ + $0.textColor = .gray + $0.font = UIFont(name: "Pretendard-Regular", size: 12) + } + + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + contentView.backgroundColor = .black + setLayout() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + private func setLayout() { + [rankLabel, nameLabel, dateLabel, todayAudienceLabel, allAudienceLabel].forEach { + contentView.addSubview($0) + } + + rankLabel.snp.makeConstraints { + $0.leading.equalToSuperview().inset(12) + $0.centerY.equalToSuperview() + } + nameLabel.snp.makeConstraints { + $0.leading.equalTo(rankLabel.snp.trailing).offset(10) + $0.top.equalToSuperview().inset(25) + } + + dateLabel.snp.makeConstraints { + $0.leading.equalTo(nameLabel.snp.leading) + $0.bottom.equalToSuperview().inset(22) + } + + todayAudienceLabel.snp.makeConstraints { + $0.trailing.equalToSuperview().inset(12) + $0.bottom.equalTo(allAudienceLabel.snp.top).offset(-2) + } + + allAudienceLabel.snp.makeConstraints { + $0.trailing.equalToSuperview().inset(12) + $0.bottom.equalToSuperview().inset(22) + } + } +} + +extension MovieAPITableViewCell { + func dataBind(_ data: MovieModel) { + rankLabel.text = data.rank + nameLabel.text = data.movieNm + dateLabel.text = "개봉일: \(data.openDt)" + todayAudienceLabel.text = "오늘 관객수: \(data.audiCnt)명" + allAudienceLabel.text = "누적 관객수: \(data.audiAcc)명" + } +} diff --git a/Combine-Study/Combine-Study/Presentation/Model/MovieModel.swift b/Combine-Study/Combine-Study/Presentation/Model/MovieModel.swift new file mode 100644 index 0000000..1bb7d50 --- /dev/null +++ b/Combine-Study/Combine-Study/Presentation/Model/MovieModel.swift @@ -0,0 +1,26 @@ +// +// MovieData.swift +// Combine-Study +// +// Created by 김나연 on 12/16/25. +// + +import Foundation + +struct MovieModel: Codable { + let rank: String + let movieNm: String + let openDt: String + let audiCnt: String + let audiAcc: String +} + +extension MovieModel { + init(from daily: DailyBoxOffice) { + self.rank = daily.rank + self.movieNm = daily.movieNm + self.openDt = daily.openDt + self.audiCnt = daily.audiCnt + self.audiAcc = daily.audiAcc + } +} diff --git a/Combine-Study/Combine-Study/Presentation/View/MovieAPIView.swift b/Combine-Study/Combine-Study/Presentation/View/MovieAPIView.swift new file mode 100644 index 0000000..f614d28 --- /dev/null +++ b/Combine-Study/Combine-Study/Presentation/View/MovieAPIView.swift @@ -0,0 +1,65 @@ +// +// MovieAPIView.swift +// Combine-Study +// +// Created by 김나연 on 12/16/25. +// + +import UIKit + +import SnapKit +import Then + +final class MovieAPIView: UIView { + + // MARK: - Property + + let tableView = UITableView(frame: .zero, style: .plain) + + let loadingIndicator = UIActivityIndicatorView(style: .large) + + + // MARK: - Init + + override init(frame: CGRect) { + super.init(frame: frame) + setUI() + setLayout() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + + // MARK: - SetUI + + private func setUI() { + tableView.do { + $0.register(MovieAPITableViewCell.self, forCellReuseIdentifier: MovieAPITableViewCell.identifier) + $0.backgroundColor = .clear + $0.rowHeight = 120 + } + + loadingIndicator.do { + $0.color = .white + $0.hidesWhenStopped = true + } + + backgroundColor = .black + addSubviews(tableView, loadingIndicator) + } + + + // MARK: - SetLayout + + private func setLayout(){ + tableView.snp.makeConstraints{ + $0.edges.equalToSuperview() + } + + loadingIndicator.snp.makeConstraints { + $0.center.equalToSuperview() + } + } +} diff --git a/Combine-Study/Combine-Study/Presentation/ViewController/MovieAPIViewController.swift b/Combine-Study/Combine-Study/Presentation/ViewController/MovieAPIViewController.swift new file mode 100644 index 0000000..c585ed2 --- /dev/null +++ b/Combine-Study/Combine-Study/Presentation/ViewController/MovieAPIViewController.swift @@ -0,0 +1,119 @@ +// +// MovieAPIViewController.swift +// Combine-Study +// +// Created by 김나연 on 12/16/25. +// + +import UIKit + +import Combine +import SnapKit +import Then + +class MovieAPIViewController: UIViewController { + + // MARK: - Property + + private let movieView = MovieAPIView() + private let viewModel = MoviewAPIViewModel() + private var cancellables = Set() + + private var movies: [MovieModel] = [] + + private let viewWillAppearSubject = PassthroughSubject() + + + // MARK: - LifeCycle + + override func loadView() { + view = movieView + } + + override func viewDidLoad() { + super.viewDidLoad() + view.self.backgroundColor = .black + setDelegate() + setBind() + } + + override func viewWillAppear(_ animated: Bool) { + viewWillAppearSubject.send(()) + } + + + // MARK: - Set Delegate + + private func setDelegate() { + movieView.tableView.delegate = self + movieView.tableView.dataSource = self + } + + + // MARK: - Set Bind + + private func setBind(){ + let input = MoviewAPIViewModel.Input (viewWillAppear: viewWillAppearSubject.eraseToAnyPublisher()) + + let output = viewModel.transform(input: input) + + output.movies + .receive(on: DispatchQueue.main) + .sink { [weak self] movies in + self?.movies = movies + self?.movieView.tableView.reloadData() + } + .store(in: &cancellables) + + output.isLoading + .receive(on: DispatchQueue.main) + .sink { isLoading in + if isLoading { + self.movieView.loadingIndicator.startAnimating() + self.movieView.tableView.alpha = 0.5 + } else { + self.movieView.loadingIndicator.stopAnimating() + self.movieView.tableView.alpha = 1 + } + } + .store(in: &cancellables) + + output.error + .receive(on: DispatchQueue.main) + .compactMap { $0 } + .sink { [weak self] error in + self?.showErrorAlert(message: error) + } + .store(in: &cancellables) + } + + private func showErrorAlert(message: String) { + let alert = UIAlertController(title: "에러", message: message, preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "확인", style: .default)) + present(alert, animated: true) + } +} + + +// MARK: - TableView Delegate + +extension MovieAPIViewController: UITableViewDelegate { + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + return 120 + } +} + + +// MARK: - TableView DataSource + +extension MovieAPIViewController: UITableViewDataSource { + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return movies.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + guard let cell = tableView.dequeueReusableCell(withIdentifier: MovieAPITableViewCell.identifier, for: indexPath) as? MovieAPITableViewCell else { return UITableViewCell() } + cell.dataBind(movies[indexPath.row]) + return cell + } +} diff --git a/Combine-Study/Combine-Study/Presentation/ViewModel/MoviewAPIViewModel.swift b/Combine-Study/Combine-Study/Presentation/ViewModel/MoviewAPIViewModel.swift new file mode 100644 index 0000000..9b6ae42 --- /dev/null +++ b/Combine-Study/Combine-Study/Presentation/ViewModel/MoviewAPIViewModel.swift @@ -0,0 +1,62 @@ +// +// MoviewAPIViewModel.swift +// Combine-Study +// +// Created by 김나연 on 12/16/25. +// + +import UIKit + +import Combine + +protocol ViewModelProtocol { + associatedtype Input + associatedtype Output + + func transform(input: Input) -> Output +} + +final class MoviewAPIViewModel: ViewModelProtocol { + struct Input { + let viewWillAppear: AnyPublisher + } + + struct Output { + let movies: AnyPublisher<[MovieModel], Never> + let isLoading: AnyPublisher + let error: AnyPublisher + } + + private var cancellables = Set() + + private let movieSubject = CurrentValueSubject<[MovieModel], Never>([]) + private let isLoadingSubject = CurrentValueSubject(false) + private let errorSubject = CurrentValueSubject(nil) + + func transform(input: Input) -> Output { + input.viewWillAppear + .sink { [weak self] _ in + self?.fetchMovies() + } + .store(in: &cancellables) + + return Output( + movies: movieSubject.eraseToAnyPublisher(), isLoading: isLoadingSubject.eraseToAnyPublisher(), error: errorSubject.eraseToAnyPublisher() + ) + } + + private func fetchMovies() { + isLoadingSubject.send(true) + + Task { + do { + let movies = try await MovieService.shared.fetchMovieRankList() + movieSubject.send(movies) + isLoadingSubject.send(false) + } catch { + errorSubject.send("데이터 로딩 실패: \(error.localizedDescription)") + isLoadingSubject.send(false) + } + } + } +}