diff --git a/iOS-Assignment/iOS-Assignment.xcodeproj/project.pbxproj b/Week3/Week3.xcodeproj/project.pbxproj similarity index 51% rename from iOS-Assignment/iOS-Assignment.xcodeproj/project.pbxproj rename to Week3/Week3.xcodeproj/project.pbxproj index 4afbaa4..68df69c 100644 --- a/iOS-Assignment/iOS-Assignment.xcodeproj/project.pbxproj +++ b/Week3/Week3.xcodeproj/project.pbxproj @@ -7,111 +7,147 @@ objects = { /* Begin PBXBuildFile section */ - 2CE1B3572BBDB35000BA4855 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CE1B3562BBDB35000BA4855 /* AppDelegate.swift */; }; - 2CE1B3592BBDB35000BA4855 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CE1B3582BBDB35000BA4855 /* SceneDelegate.swift */; }; - 2CE1B35B2BBDB35000BA4855 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CE1B35A2BBDB35000BA4855 /* ViewController.swift */; }; - 2CE1B35E2BBDB35000BA4855 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2CE1B35C2BBDB35000BA4855 /* Main.storyboard */; }; - 2CE1B3602BBDB35100BA4855 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2CE1B35F2BBDB35100BA4855 /* Assets.xcassets */; }; - 2CE1B3632BBDB35100BA4855 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2CE1B3612BBDB35100BA4855 /* LaunchScreen.storyboard */; }; - 2CE1B36B2BBDB38800BA4855 /* Fonts in Resources */ = {isa = PBXBuildFile; fileRef = 2CE1B36A2BBDB38800BA4855 /* Fonts */; }; - 2CE1B36D2BBDB3BF00BA4855 /* WelcomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CE1B36C2BBDB3BF00BA4855 /* WelcomeViewController.swift */; }; - 2CE1B36F2BBDB3CF00BA4855 /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CE1B36E2BBDB3CF00BA4855 /* LoginViewController.swift */; }; + 2C64CAD72BD4B45F00A453C3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C64CAD62BD4B45F00A453C3 /* AppDelegate.swift */; }; + 2C64CAD92BD4B45F00A453C3 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C64CAD82BD4B45F00A453C3 /* SceneDelegate.swift */; }; + 2C64CADB2BD4B45F00A453C3 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C64CADA2BD4B45F00A453C3 /* ViewController.swift */; }; + 2C64CADE2BD4B45F00A453C3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2C64CADC2BD4B45F00A453C3 /* Main.storyboard */; }; + 2C64CAE02BD4B46000A453C3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2C64CADF2BD4B46000A453C3 /* Assets.xcassets */; }; + 2C64CAE32BD4B46000A453C3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2C64CAE12BD4B46000A453C3 /* LaunchScreen.storyboard */; }; + 2C64CAED2BD4B4CB00A453C3 /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C64CAEC2BD4B4CB00A453C3 /* LoginView.swift */; }; + 2C64CAEF2BD4B4DE00A453C3 /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C64CAEE2BD4B4DE00A453C3 /* LoginViewController.swift */; }; + 2C64CAF12BD4B51600A453C3 /* ItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C64CAF02BD4B51600A453C3 /* ItemModel.swift */; }; + 2C64CAF32BD4B52600A453C3 /* ItemCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C64CAF22BD4B52600A453C3 /* ItemCollectionViewCell.swift */; }; + 2C64CAF52BD4B53300A453C3 /* ItemViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C64CAF42BD4B53300A453C3 /* ItemViewController.swift */; }; + 2C64CAF72BD4B55A00A453C3 /* ChatModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C64CAF62BD4B55A00A453C3 /* ChatModel.swift */; }; + 2C64CAF92BD4B56A00A453C3 /* ChatTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C64CAF82BD4B56A00A453C3 /* ChatTableViewCell.swift */; }; + 2C64CAFB2BD4B57D00A453C3 /* ChatViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C64CAFA2BD4B57D00A453C3 /* ChatViewController.swift */; }; + 2C64CAFE2BD4B6F800A453C3 /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = 2C64CAFD2BD4B6F800A453C3 /* SnapKit */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 2CE1B3532BBDB35000BA4855 /* iOS-Assignment.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "iOS-Assignment.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - 2CE1B3562BBDB35000BA4855 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 2CE1B3582BBDB35000BA4855 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; - 2CE1B35A2BBDB35000BA4855 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; - 2CE1B35D2BBDB35000BA4855 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 2CE1B35F2BBDB35100BA4855 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 2CE1B3622BBDB35100BA4855 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 2CE1B3642BBDB35100BA4855 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 2CE1B36A2BBDB38800BA4855 /* Fonts */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Fonts; sourceTree = ""; }; - 2CE1B36C2BBDB3BF00BA4855 /* WelcomeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WelcomeViewController.swift; sourceTree = ""; }; - 2CE1B36E2BBDB3CF00BA4855 /* LoginViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = ""; }; + 2C64CAD32BD4B45F00A453C3 /* Week3.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Week3.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 2C64CAD62BD4B45F00A453C3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 2C64CAD82BD4B45F00A453C3 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 2C64CADA2BD4B45F00A453C3 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 2C64CADD2BD4B45F00A453C3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 2C64CADF2BD4B46000A453C3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 2C64CAE22BD4B46000A453C3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 2C64CAE42BD4B46000A453C3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 2C64CAEC2BD4B4CB00A453C3 /* LoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginView.swift; sourceTree = ""; }; + 2C64CAEE2BD4B4DE00A453C3 /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = ""; }; + 2C64CAF02BD4B51600A453C3 /* ItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemModel.swift; sourceTree = ""; }; + 2C64CAF22BD4B52600A453C3 /* ItemCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemCollectionViewCell.swift; sourceTree = ""; }; + 2C64CAF42BD4B53300A453C3 /* ItemViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemViewController.swift; sourceTree = ""; }; + 2C64CAF62BD4B55A00A453C3 /* ChatModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatModel.swift; sourceTree = ""; }; + 2C64CAF82BD4B56A00A453C3 /* ChatTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatTableViewCell.swift; sourceTree = ""; }; + 2C64CAFA2BD4B57D00A453C3 /* ChatViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatViewController.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 2CE1B3502BBDB35000BA4855 /* Frameworks */ = { + 2C64CAD02BD4B45F00A453C3 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 2C64CAFE2BD4B6F800A453C3 /* SnapKit in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 2CE1B34A2BBDB35000BA4855 = { + 2C64CACA2BD4B45F00A453C3 = { isa = PBXGroup; children = ( - 2CE1B36A2BBDB38800BA4855 /* Fonts */, - 2CE1B3552BBDB35000BA4855 /* iOS-Assignment */, - 2CE1B3542BBDB35000BA4855 /* Products */, + 2C64CAD52BD4B45F00A453C3 /* Week3 */, + 2C64CAD42BD4B45F00A453C3 /* Products */, ); sourceTree = ""; }; - 2CE1B3542BBDB35000BA4855 /* Products */ = { + 2C64CAD42BD4B45F00A453C3 /* Products */ = { isa = PBXGroup; children = ( - 2CE1B3532BBDB35000BA4855 /* iOS-Assignment.app */, + 2C64CAD32BD4B45F00A453C3 /* Week3.app */, ); name = Products; sourceTree = ""; }; - 2CE1B3552BBDB35000BA4855 /* iOS-Assignment */ = { + 2C64CAD52BD4B45F00A453C3 /* Week3 */ = { isa = PBXGroup; children = ( - 2CE1B3562BBDB35000BA4855 /* AppDelegate.swift */, - 2CE1B3582BBDB35000BA4855 /* SceneDelegate.swift */, - 2CE1B35A2BBDB35000BA4855 /* ViewController.swift */, - 2CE1B35C2BBDB35000BA4855 /* Main.storyboard */, - 2CE1B35F2BBDB35100BA4855 /* Assets.xcassets */, - 2CE1B3612BBDB35100BA4855 /* LaunchScreen.storyboard */, - 2CE1B3642BBDB35100BA4855 /* Info.plist */, - 2CE1B36C2BBDB3BF00BA4855 /* WelcomeViewController.swift */, - 2CE1B36E2BBDB3CF00BA4855 /* LoginViewController.swift */, + 2C64CAEB2BD4B4B200A453C3 /* ItemCollectionView */, + 2C64CAEA2BD4B4A800A453C3 /* ChatTableView */, + 2C64CAD62BD4B45F00A453C3 /* AppDelegate.swift */, + 2C64CAD82BD4B45F00A453C3 /* SceneDelegate.swift */, + 2C64CADA2BD4B45F00A453C3 /* ViewController.swift */, + 2C64CADC2BD4B45F00A453C3 /* Main.storyboard */, + 2C64CADF2BD4B46000A453C3 /* Assets.xcassets */, + 2C64CAE12BD4B46000A453C3 /* LaunchScreen.storyboard */, + 2C64CAE42BD4B46000A453C3 /* Info.plist */, + 2C64CAEC2BD4B4CB00A453C3 /* LoginView.swift */, + 2C64CAEE2BD4B4DE00A453C3 /* LoginViewController.swift */, ); - path = "iOS-Assignment"; + path = Week3; + sourceTree = ""; + }; + 2C64CAEA2BD4B4A800A453C3 /* ChatTableView */ = { + isa = PBXGroup; + children = ( + 2C64CAF62BD4B55A00A453C3 /* ChatModel.swift */, + 2C64CAF82BD4B56A00A453C3 /* ChatTableViewCell.swift */, + 2C64CAFA2BD4B57D00A453C3 /* ChatViewController.swift */, + ); + path = ChatTableView; + sourceTree = ""; + }; + 2C64CAEB2BD4B4B200A453C3 /* ItemCollectionView */ = { + isa = PBXGroup; + children = ( + 2C64CAF02BD4B51600A453C3 /* ItemModel.swift */, + 2C64CAF22BD4B52600A453C3 /* ItemCollectionViewCell.swift */, + 2C64CAF42BD4B53300A453C3 /* ItemViewController.swift */, + ); + path = ItemCollectionView; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 2CE1B3522BBDB35000BA4855 /* iOS-Assignment */ = { + 2C64CAD22BD4B45F00A453C3 /* Week3 */ = { isa = PBXNativeTarget; - buildConfigurationList = 2CE1B3672BBDB35100BA4855 /* Build configuration list for PBXNativeTarget "iOS-Assignment" */; + buildConfigurationList = 2C64CAE72BD4B46000A453C3 /* Build configuration list for PBXNativeTarget "Week3" */; buildPhases = ( - 2CE1B34F2BBDB35000BA4855 /* Sources */, - 2CE1B3502BBDB35000BA4855 /* Frameworks */, - 2CE1B3512BBDB35000BA4855 /* Resources */, + 2C64CACF2BD4B45F00A453C3 /* Sources */, + 2C64CAD02BD4B45F00A453C3 /* Frameworks */, + 2C64CAD12BD4B45F00A453C3 /* Resources */, ); buildRules = ( ); dependencies = ( ); - name = "iOS-Assignment"; - productName = "iOS-Assignment"; - productReference = 2CE1B3532BBDB35000BA4855 /* iOS-Assignment.app */; + name = Week3; + packageProductDependencies = ( + 2C64CAFD2BD4B6F800A453C3 /* SnapKit */, + ); + productName = Week3; + productReference = 2C64CAD32BD4B45F00A453C3 /* Week3.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ - 2CE1B34B2BBDB35000BA4855 /* Project object */ = { + 2C64CACB2BD4B45F00A453C3 /* Project object */ = { isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = 1; LastSwiftUpdateCheck = 1420; LastUpgradeCheck = 1420; TargetAttributes = { - 2CE1B3522BBDB35000BA4855 = { + 2C64CAD22BD4B45F00A453C3 = { CreatedOnToolsVersion = 14.2; }; }; }; - buildConfigurationList = 2CE1B34E2BBDB35000BA4855 /* Build configuration list for PBXProject "iOS-Assignment" */; + buildConfigurationList = 2C64CACE2BD4B45F00A453C3 /* Build configuration list for PBXProject "Week3" */; compatibilityVersion = "Xcode 14.0"; developmentRegion = en; hasScannedForEncodings = 0; @@ -119,58 +155,66 @@ en, Base, ); - mainGroup = 2CE1B34A2BBDB35000BA4855; - productRefGroup = 2CE1B3542BBDB35000BA4855 /* Products */; + mainGroup = 2C64CACA2BD4B45F00A453C3; + packageReferences = ( + 2C64CAFC2BD4B6F800A453C3 /* XCRemoteSwiftPackageReference "SnapKit" */, + ); + productRefGroup = 2C64CAD42BD4B45F00A453C3 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( - 2CE1B3522BBDB35000BA4855 /* iOS-Assignment */, + 2C64CAD22BD4B45F00A453C3 /* Week3 */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - 2CE1B3512BBDB35000BA4855 /* Resources */ = { + 2C64CAD12BD4B45F00A453C3 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 2CE1B3632BBDB35100BA4855 /* LaunchScreen.storyboard in Resources */, - 2CE1B3602BBDB35100BA4855 /* Assets.xcassets in Resources */, - 2CE1B35E2BBDB35000BA4855 /* Main.storyboard in Resources */, - 2CE1B36B2BBDB38800BA4855 /* Fonts in Resources */, + 2C64CAE32BD4B46000A453C3 /* LaunchScreen.storyboard in Resources */, + 2C64CAE02BD4B46000A453C3 /* Assets.xcassets in Resources */, + 2C64CADE2BD4B45F00A453C3 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - 2CE1B34F2BBDB35000BA4855 /* Sources */ = { + 2C64CACF2BD4B45F00A453C3 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 2CE1B35B2BBDB35000BA4855 /* ViewController.swift in Sources */, - 2CE1B36D2BBDB3BF00BA4855 /* WelcomeViewController.swift in Sources */, - 2CE1B3572BBDB35000BA4855 /* AppDelegate.swift in Sources */, - 2CE1B36F2BBDB3CF00BA4855 /* LoginViewController.swift in Sources */, - 2CE1B3592BBDB35000BA4855 /* SceneDelegate.swift in Sources */, + 2C64CAF12BD4B51600A453C3 /* ItemModel.swift in Sources */, + 2C64CAF52BD4B53300A453C3 /* ItemViewController.swift in Sources */, + 2C64CAFB2BD4B57D00A453C3 /* ChatViewController.swift in Sources */, + 2C64CADB2BD4B45F00A453C3 /* ViewController.swift in Sources */, + 2C64CAD72BD4B45F00A453C3 /* AppDelegate.swift in Sources */, + 2C64CAED2BD4B4CB00A453C3 /* LoginView.swift in Sources */, + 2C64CAEF2BD4B4DE00A453C3 /* LoginViewController.swift in Sources */, + 2C64CAD92BD4B45F00A453C3 /* SceneDelegate.swift in Sources */, + 2C64CAF92BD4B56A00A453C3 /* ChatTableViewCell.swift in Sources */, + 2C64CAF32BD4B52600A453C3 /* ItemCollectionViewCell.swift in Sources */, + 2C64CAF72BD4B55A00A453C3 /* ChatModel.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ - 2CE1B35C2BBDB35000BA4855 /* Main.storyboard */ = { + 2C64CADC2BD4B45F00A453C3 /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( - 2CE1B35D2BBDB35000BA4855 /* Base */, + 2C64CADD2BD4B45F00A453C3 /* Base */, ); name = Main.storyboard; sourceTree = ""; }; - 2CE1B3612BBDB35100BA4855 /* LaunchScreen.storyboard */ = { + 2C64CAE12BD4B46000A453C3 /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; children = ( - 2CE1B3622BBDB35100BA4855 /* Base */, + 2C64CAE22BD4B46000A453C3 /* Base */, ); name = LaunchScreen.storyboard; sourceTree = ""; @@ -178,7 +222,7 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ - 2CE1B3652BBDB35100BA4855 /* Debug */ = { + 2C64CAE52BD4B46000A453C3 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; @@ -238,7 +282,7 @@ }; name = Debug; }; - 2CE1B3662BBDB35100BA4855 /* Release */ = { + 2C64CAE62BD4B46000A453C3 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; @@ -292,7 +336,7 @@ }; name = Release; }; - 2CE1B3682BBDB35100BA4855 /* Debug */ = { + 2C64CAE82BD4B46000A453C3 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; @@ -301,7 +345,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = MQ4ZG67BX3; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = "iOS-Assignment/Info.plist"; + INFOPLIST_FILE = Week3/Info.plist; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; @@ -312,7 +356,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = "com.osy.iOS-Assignment"; + PRODUCT_BUNDLE_IDENTIFIER = com.osy.Week3; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; @@ -320,7 +364,7 @@ }; name = Debug; }; - 2CE1B3692BBDB35100BA4855 /* Release */ = { + 2C64CAE92BD4B46000A453C3 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; @@ -329,7 +373,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = MQ4ZG67BX3; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = "iOS-Assignment/Info.plist"; + INFOPLIST_FILE = Week3/Info.plist; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; @@ -340,7 +384,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = "com.osy.iOS-Assignment"; + PRODUCT_BUNDLE_IDENTIFIER = com.osy.Week3; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; @@ -351,25 +395,44 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 2CE1B34E2BBDB35000BA4855 /* Build configuration list for PBXProject "iOS-Assignment" */ = { + 2C64CACE2BD4B45F00A453C3 /* Build configuration list for PBXProject "Week3" */ = { isa = XCConfigurationList; buildConfigurations = ( - 2CE1B3652BBDB35100BA4855 /* Debug */, - 2CE1B3662BBDB35100BA4855 /* Release */, + 2C64CAE52BD4B46000A453C3 /* Debug */, + 2C64CAE62BD4B46000A453C3 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 2CE1B3672BBDB35100BA4855 /* Build configuration list for PBXNativeTarget "iOS-Assignment" */ = { + 2C64CAE72BD4B46000A453C3 /* Build configuration list for PBXNativeTarget "Week3" */ = { isa = XCConfigurationList; buildConfigurations = ( - 2CE1B3682BBDB35100BA4855 /* Debug */, - 2CE1B3692BBDB35100BA4855 /* Release */, + 2C64CAE82BD4B46000A453C3 /* Debug */, + 2C64CAE92BD4B46000A453C3 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + 2C64CAFC2BD4B6F800A453C3 /* XCRemoteSwiftPackageReference "SnapKit" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/SnapKit/SnapKit"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 5.0.0; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 2C64CAFD2BD4B6F800A453C3 /* SnapKit */ = { + isa = XCSwiftPackageProductDependency; + package = 2C64CAFC2BD4B6F800A453C3 /* XCRemoteSwiftPackageReference "SnapKit" */; + productName = SnapKit; + }; +/* End XCSwiftPackageProductDependency section */ }; - rootObject = 2CE1B34B2BBDB35000BA4855 /* Project object */; + rootObject = 2C64CACB2BD4B45F00A453C3 /* Project object */; } diff --git a/iOS-Assignment/iOS-Assignment.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Week3/Week3.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from iOS-Assignment/iOS-Assignment.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to Week3/Week3.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/iOS-Assignment/iOS-Assignment.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Week3/Week3.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from iOS-Assignment/iOS-Assignment.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to Week3/Week3.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Week3/Week3.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Week3/Week3.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..9cae081 --- /dev/null +++ b/Week3/Week3.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,14 @@ +{ + "pins" : [ + { + "identity" : "snapkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/SnapKit/SnapKit", + "state" : { + "revision" : "f222cbdf325885926566172f6f5f06af95473158", + "version" : "5.6.0" + } + } + ], + "version" : 2 +} diff --git a/Week3/Week3.xcodeproj/project.xcworkspace/xcuserdata/osy.xcuserdatad/UserInterfaceState.xcuserstate b/Week3/Week3.xcodeproj/project.xcworkspace/xcuserdata/osy.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..144a778 Binary files /dev/null and b/Week3/Week3.xcodeproj/project.xcworkspace/xcuserdata/osy.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Week3/Week3.xcodeproj/xcuserdata/osy.xcuserdatad/xcschemes/xcschememanagement.plist b/Week3/Week3.xcodeproj/xcuserdata/osy.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..6a5d767 --- /dev/null +++ b/Week3/Week3.xcodeproj/xcuserdata/osy.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,35 @@ + + + + + SchemeUserState + + SnapKitPlayground (Playground) 1.xcscheme + + isShown + + orderHint + 2 + + SnapKitPlayground (Playground) 2.xcscheme + + isShown + + orderHint + 3 + + SnapKitPlayground (Playground).xcscheme + + isShown + + orderHint + 1 + + Week3.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/iOS-Assignment/iOS-Assignment/AppDelegate.swift b/Week3/Week3/AppDelegate.swift similarity index 95% rename from iOS-Assignment/iOS-Assignment/AppDelegate.swift rename to Week3/Week3/AppDelegate.swift index 05778b9..478350c 100644 --- a/iOS-Assignment/iOS-Assignment/AppDelegate.swift +++ b/Week3/Week3/AppDelegate.swift @@ -1,8 +1,8 @@ // // AppDelegate.swift -// iOS-Assignment +// Week3 // -// Created by 오서영 on 2024/04/04. +// Created by 오서영 on 2024/04/21. // import UIKit diff --git a/iOS-Assignment/iOS-Assignment/Assets.xcassets/AccentColor.colorset/Contents.json b/Week3/Week3/Assets.xcassets/AccentColor.colorset/Contents.json similarity index 100% rename from iOS-Assignment/iOS-Assignment/Assets.xcassets/AccentColor.colorset/Contents.json rename to Week3/Week3/Assets.xcassets/AccentColor.colorset/Contents.json diff --git a/iOS-Assignment/iOS-Assignment/Assets.xcassets/AppIcon.appiconset/Contents.json b/Week3/Week3/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from iOS-Assignment/iOS-Assignment/Assets.xcassets/AppIcon.appiconset/Contents.json rename to Week3/Week3/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/iOS-Assignment/iOS-Assignment/Assets.xcassets/Contents.json b/Week3/Week3/Assets.xcassets/Contents.json similarity index 100% rename from iOS-Assignment/iOS-Assignment/Assets.xcassets/Contents.json rename to Week3/Week3/Assets.xcassets/Contents.json diff --git a/iOS-Assignment/iOS-Assignment/Base.lproj/LaunchScreen.storyboard b/Week3/Week3/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from iOS-Assignment/iOS-Assignment/Base.lproj/LaunchScreen.storyboard rename to Week3/Week3/Base.lproj/LaunchScreen.storyboard diff --git a/iOS-Assignment/iOS-Assignment/Base.lproj/Main.storyboard b/Week3/Week3/Base.lproj/Main.storyboard similarity index 100% rename from iOS-Assignment/iOS-Assignment/Base.lproj/Main.storyboard rename to Week3/Week3/Base.lproj/Main.storyboard diff --git a/Week3/Week3/ChatTableView/ChatModel.swift b/Week3/Week3/ChatTableView/ChatModel.swift new file mode 100644 index 0000000..87f3c85 --- /dev/null +++ b/Week3/Week3/ChatTableView/ChatModel.swift @@ -0,0 +1,35 @@ +// +// ChatModel.swift +// Week3 +// +// Created by 오서영 on 2024/04/21. +// + +import Foundation +import UIKit + +struct ChatModel { + let profileImg: UIImage? + let name: String + let place: String + let message: String + let itemImg: UIImage? +} + +extension ChatModel { + static func dummy() -> [ChatModel] { + return [ + ChatModel(profileImg: UIImage(named: "profile1"), name: "류희재", place: "성북구", message: "땡큐", itemImg: UIImage(named: "product1")), + ChatModel(profileImg: UIImage(named: "profile2"), name: "윤희슬", place: "여의도", message: "안녕", itemImg: UIImage(named: "product2")), + ChatModel(profileImg: UIImage(named: "profile3"), name: "김가현", place: "잠실", message: "아요", itemImg: UIImage(named: "product3")), + ChatModel(profileImg: UIImage(named: "profile4"), name: "김선우", place: "회기", message: "너무 좋아요", itemImg: UIImage(named: "product4")), + ChatModel(profileImg: UIImage(named: "profile5"), name: "김나연", place: "미국", message: "뿅", itemImg: UIImage(named: "product5")), + ChatModel(profileImg: UIImage(named: "profile1"), name: "김민서", place: "중국", message: "뿡", itemImg: UIImage(named: "product1")), + ChatModel(profileImg: UIImage(named: "profile2"), name: "김수연", place: "일본", message: "자기야 미안해 했자나", itemImg: UIImage(named: "product2")), + ChatModel(profileImg: UIImage(named: "profile3"), name: "한지석", place: "태국", message: "솝트 이딴거 안했어", itemImg: UIImage(named: "product3")), + ChatModel(profileImg: UIImage(named: "profile4"), name: "한정원", place: "명왕성", message: "진짜?", itemImg: UIImage(named: "product4")), + ChatModel(profileImg: UIImage(named: "profile5"), name: "이지훈", place: "안드로메다", message: "난이서~", itemImg: UIImage(named: "product5")) + ] + } +} + diff --git a/Week3/Week3/ChatTableView/ChatTableViewCell.swift b/Week3/Week3/ChatTableView/ChatTableViewCell.swift new file mode 100644 index 0000000..cf4d297 --- /dev/null +++ b/Week3/Week3/ChatTableView/ChatTableViewCell.swift @@ -0,0 +1,88 @@ +// +// ChatTableViewCell.swift +// Week3 +// +// Created by 오서영 on 2024/04/21. +// + +import UIKit + +final class ChatTableViewCell: UITableViewCell { + + static let identifier = "ChatTableViewCell" + + private let profileImageView = UIImageView() + + private let nameLabel: UILabel = { + let label = UILabel() + label.textColor = .black + label.textAlignment = .center + label.font = UIFont(name: "Pretendard-Bold", size: 15) + return label + }() + private let placeLabel: UILabel = { + let label = UILabel() + label.textColor = UIColor(red: 156, green: 156, blue: 156, alpha: 1) + label.textAlignment = .left + label.font = UIFont(name: "Pretendard-Bold", size: 12) + return label + }() + private let chatLabel: UILabel = { + let label = UILabel() + label.textColor = .black + label.textAlignment = .left + label.font = UIFont(name: "Pretendard-Bold", size: 14) + return label + }() + + private let itemImageView = UIImageView() + + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + + setLayout() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + private func setLayout() { + [profileImageView, nameLabel, placeLabel, chatLabel, itemImageView].forEach { + contentView.addSubview($0) + } + + profileImageView.snp.makeConstraints { + $0.leading.top.equalToSuperview().offset(16) + $0.size.equalTo(40) + } + nameLabel.snp.makeConstraints { + $0.leading.equalTo(profileImageView.snp.trailing).offset(16) + $0.top.equalToSuperview().offset(16.5) + } + + placeLabel.snp.makeConstraints { + $0.leading.equalTo(nameLabel.snp.trailing).offset(4) + $0.top.equalTo(nameLabel).offset(2) + } + chatLabel.snp.makeConstraints { + $0.top.equalTo(placeLabel.snp.bottom).offset(4) + $0.leading.equalTo(nameLabel) + } + itemImageView.snp.makeConstraints { + $0.trailing.bottom.equalToSuperview().inset(16) + $0.size.equalTo(40) + } + } +} + +extension ChatTableViewCell { + func dataBind(_ chatData: ChatModel) { + profileImageView.image = chatData.profileImg + nameLabel.text = chatData.name + placeLabel.text = chatData.place + chatLabel.text = chatData.message + itemImageView.image = chatData.itemImg + } +} diff --git a/Week3/Week3/ChatTableView/ChatViewController.swift b/Week3/Week3/ChatTableView/ChatViewController.swift new file mode 100644 index 0000000..2fef86e --- /dev/null +++ b/Week3/Week3/ChatTableView/ChatViewController.swift @@ -0,0 +1,60 @@ +// +// ChatViewController.swift +// Week3 +// +// Created by 오서영 on 2024/04/21. +// + +import Foundation +import UIKit +import SnapKit + +final class ChatViewController: UIViewController { + + private let chatList = ChatModel.dummy() + private let tableView = UITableView(frame: .zero, style: .plain) + + override func viewDidLoad() { + super.viewDidLoad() + + setLayout() + setDelegate() + register() + } + + private func setLayout() { + self.view.addSubview(tableView) + + tableView.snp.makeConstraints { $0.edges.equalToSuperview() } + } + + private func register() { + tableView.register( + ChatTableViewCell.self, + forCellReuseIdentifier: ChatTableViewCell.identifier + ) + } + + private func setDelegate() { + tableView.delegate = self + tableView.dataSource = self + } +} + +extension ChatViewController: UITableViewDelegate { + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + return 72 + } +} + +extension ChatViewController: UITableViewDataSource { + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return chatList.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + guard let cell = tableView.dequeueReusableCell(withIdentifier: ChatTableViewCell.identifier, for: indexPath) as? ChatTableViewCell else { return UITableViewCell() } + cell.dataBind(chatList[indexPath.row]) + return cell + } +} diff --git a/iOS-Assignment/iOS-Assignment/Info.plist b/Week3/Week3/Info.plist similarity index 57% rename from iOS-Assignment/iOS-Assignment/Info.plist rename to Week3/Week3/Info.plist index d558d1f..0eb786d 100644 --- a/iOS-Assignment/iOS-Assignment/Info.plist +++ b/Week3/Week3/Info.plist @@ -2,18 +2,6 @@ - UIAppFonts - - Pretended-Black.otf - Pretended-Bold.otf - Pretended-ExtraBold.otf - Pretended-ExtraLight.otf - Pretended-Light.otf - Pretended-Medium.otf - Pretended-Regular.otf - Pretended-SemiBold.otf - Pretended-Thin.otf - UIApplicationSceneManifest UIApplicationSupportsMultipleScenes @@ -27,8 +15,6 @@ Default Configuration UISceneDelegateClassName $(PRODUCT_MODULE_NAME).SceneDelegate - UISceneStoryboardFile - Main diff --git a/Week3/Week3/ItemCollectionView/ItemCollectionViewCell.swift b/Week3/Week3/ItemCollectionView/ItemCollectionViewCell.swift new file mode 100644 index 0000000..f2b545d --- /dev/null +++ b/Week3/Week3/ItemCollectionView/ItemCollectionViewCell.swift @@ -0,0 +1,115 @@ +// +// ItemCollectionViewCell.swift +// Week3 +// +// Created by 오서영 on 2024/04/21. +// + +import Foundation +import UIKit + +protocol ItemCollectoinViewCellDelegate: AnyObject { + func heartButtonDidTapEvent(state: Bool, row: Int) +} + +final class ItemCollectionViewCell: UICollectionViewCell { + + static let identifier = "ItemCollectionViewCell" + var itemRow: Int? + + weak var delegate: ItemCollectoinViewCellDelegate? + + private let itemImageView = UIImageView() + + private let nameLabel: UILabel = { + let label = UILabel() + label.textColor = .black + label.textAlignment = .center + label.font = UIFont(name: "Pretendard-Regular", size: 16) + return label + }() + + private let priceLabel: UILabel = { + let label = UILabel() + label.textColor = .orange + label.textAlignment = .left + label.font = UIFont(name: "Pretendard-Bold", size: 15) + return label + }() + + private lazy var heartButton: UIButton = { + let button = UIButton() + // Use system-provided heart image for the normal state + button.setImage(UIImage(systemName: "heart"), for: .normal) + // Use system-provided filled heart image for the selected state + button.setImage(UIImage(systemName: "heart.fill"), for: .selected) + button.addTarget(self, action: #selector(heartButtonDidTap), for: .touchUpInside) + return button + }() + + + override init(frame: CGRect) { + super.init(frame: frame) + + self.backgroundColor = .white + setLayout() + } + + override func prepareForReuse() { + super.prepareForReuse() + + self.heartButton.isSelected = false + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + private func setLayout() { + [itemImageView, nameLabel, priceLabel, heartButton].forEach { + contentView.addSubview($0) + } + + itemImageView.snp.makeConstraints { + $0.top.equalToSuperview() + $0.horizontalEdges.equalToSuperview().inset(9) + $0.bottom.equalToSuperview().inset(59) + } + + nameLabel.snp.makeConstraints { + $0.top.equalTo(itemImageView.snp.bottom).offset(2) + $0.leading.equalToSuperview().offset(9) + } + + priceLabel.snp.makeConstraints { + $0.top.equalTo(nameLabel.snp.bottom).offset(2) + $0.leading.equalToSuperview().offset(9) + } + + heartButton.snp.makeConstraints { + $0.trailing.bottom.equalTo(itemImageView).inset(8) + $0.size.equalTo(16) + } + } + + @objc func heartButtonDidTap() { + self.heartButton.isSelected.toggle() + if let itemRow { + self.delegate?.heartButtonDidTapEvent( + state: self.heartButton.isSelected, + row: itemRow + ) + } + } +} + +extension ItemCollectionViewCell { + func dataBind(_ itemData: ItemModel, itemRow: Int) { + itemImageView.image = itemData.itemImg + nameLabel.text = itemData.name + priceLabel.text = itemData.price + heartButton.isSelected = itemData.heartIsSelected + self.itemRow = itemRow + } +} diff --git a/Week3/Week3/ItemCollectionView/ItemModel.swift b/Week3/Week3/ItemCollectionView/ItemModel.swift new file mode 100644 index 0000000..9910115 --- /dev/null +++ b/Week3/Week3/ItemCollectionView/ItemModel.swift @@ -0,0 +1,35 @@ +// +// ItemModel.swift +// Week3 +// +// Created by 오서영 on 2024/04/21. +// + +import UIKit + +struct ItemModel { + let itemImg: UIImage? + let name: String + let price: String + var heartIsSelected: Bool +} + +extension ItemModel { + static func dummy() -> [ItemModel] { + return [ + ItemModel(itemImg: UIImage(named: "product1"), name: "류희재", price: "22,000원", heartIsSelected: false), + ItemModel(itemImg: UIImage(named: "product1"), name: "류희재", price: "22,000원", heartIsSelected: false), + ItemModel(itemImg: UIImage(named: "product1"), name: "류희재", price: "22,000원", heartIsSelected: false), + ItemModel(itemImg: UIImage(named: "product1"), name: "류희재", price: "22,000원", heartIsSelected: false), + ItemModel(itemImg: UIImage(named: "product1"), name: "류희재", price: "22,000원", heartIsSelected: false), + ItemModel(itemImg: UIImage(named: "product1"), name: "류희재", price: "22,000원", heartIsSelected: false), + ItemModel(itemImg: UIImage(named: "product1"), name: "류희재", price: "22,000원", heartIsSelected: false), + ItemModel(itemImg: UIImage(named: "product1"), name: "류희재", price: "22,000원", heartIsSelected: false), + ItemModel(itemImg: UIImage(named: "product1"), name: "류희재", price: "22,000원", heartIsSelected: false), + ItemModel(itemImg: UIImage(named: "product1"), name: "류희재", price: "22,000원", heartIsSelected: false), + ItemModel(itemImg: UIImage(named: "product1"), name: "류희재", price: "22,000원", heartIsSelected: false) + ] + } +} + + diff --git a/Week3/Week3/ItemCollectionView/ItemViewController.swift b/Week3/Week3/ItemCollectionView/ItemViewController.swift new file mode 100644 index 0000000..0c56b1d --- /dev/null +++ b/Week3/Week3/ItemCollectionView/ItemViewController.swift @@ -0,0 +1,109 @@ +// +// ItemViewController.swift +// Week3 +// +// Created by 오서영 on 2024/04/21. +// + +import Foundation +import UIKit +import SnapKit + +final class ItemViewController: UIViewController { + + final let carrotLineSpacing: CGFloat = 10 + final let carrotInterItemSpacing: CGFloat = 21 + final let cellHeight: CGFloat = 198 + final let carrotInset = UIEdgeInsets(top: 48, left: 20, bottom: 10, right: 20) + + private var itemData = ItemModel.dummy() { + didSet { + self.collectionView.reloadData() + } + } + + private func calculateCellHeight() -> CGFloat { + let count = CGFloat(itemData.count) + let heightCount = count / 2 + count.truncatingRemainder(dividingBy: 2) + return heightCount * cellHeight + (heightCount - 1) * carrotLineSpacing + carrotInset.top + carrotInset.bottom + } + + private let collectionView : UICollectionView = { + let layout = UICollectionViewFlowLayout() + + let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout) + return collectionView + }() + + override func viewDidLoad() { + super.viewDidLoad() + + self.view.backgroundColor = .white + + setLayout() + register() + setDelegate() + } + + private func setLayout() { + self.view.addSubview(collectionView) + + collectionView.snp.makeConstraints { + $0.top.leading.trailing.equalTo(self.view.safeAreaLayoutGuide) + $0.bottom.equalToSuperview() + $0.height.equalTo(calculateCellHeight()) + } + } + + private func register() { + collectionView.register( + ItemCollectionViewCell.self, + forCellWithReuseIdentifier: ItemCollectionViewCell.identifier + ) + } + + private func setDelegate() { + collectionView.delegate = self + collectionView.dataSource = self + } +} + +extension ItemViewController: UICollectionViewDelegateFlowLayout { + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + let screenWidth = UIScreen.main.bounds.width + let doubleCellWidth = screenWidth - carrotInset.left - carrotInset.right - carrotInterItemSpacing + return CGSize(width: doubleCellWidth / 2, height: 198) + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { + return carrotLineSpacing + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { + return carrotInterItemSpacing + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { + return carrotInset + } +} + +extension ItemViewController: UICollectionViewDataSource { + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return itemData.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: ItemCollectionViewCell.identifier, for: indexPath) as? ItemCollectionViewCell else { return UICollectionViewCell() } + cell.delegate = self + cell.dataBind(itemData[indexPath.item], itemRow: indexPath.item) + return cell + } +} + +extension ItemViewController: ItemCollectoinViewCellDelegate { + func heartButtonDidTapEvent(state: Bool, row: Int) { + itemData[row].heartIsSelected = state + } +} + diff --git a/Week3/Week3/LoginView.swift b/Week3/Week3/LoginView.swift new file mode 100644 index 0000000..e601865 --- /dev/null +++ b/Week3/Week3/LoginView.swift @@ -0,0 +1,90 @@ +// +// LoginView.swift +// Week3 +// +// Created by 오서영 on 2024/04/21. +// + +import Foundation +import UIKit +import SnapKit + +final class LoginView: UIView { + + override init(frame: CGRect) { + super.init(frame: frame) + backgroundColor = .white + setLayout() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + private func setLayout() { + [titleLabel, idTextField, passwordTextField, loginButton].forEach { + self.addSubview($0) + } + + titleLabel.snp.makeConstraints { + $0.centerX.equalToSuperview() + $0.top.equalToSuperview().offset(161) + $0.width.equalTo(236) + $0.height.equalTo(44) + } + + idTextField.snp.makeConstraints { + $0.top.equalTo(titleLabel.snp.bottom).offset(71) + $0.horizontalEdges.equalToSuperview().inset(20) + $0.height.equalTo(52) + } + + passwordTextField.snp.makeConstraints { + $0.top.equalTo(idTextField.snp.bottom).offset(7) + $0.horizontalEdges.equalTo(idTextField) + $0.height.equalTo(52) + } + + loginButton.snp.makeConstraints { + $0.top.equalTo(passwordTextField.snp.bottom).offset(35) + $0.horizontalEdges.equalTo(idTextField) + $0.height.equalTo(58) + } + } + + private let titleLabel: UILabel = { + let label = UILabel() + label.text = "동네라서 가능한 모든것\n당근에서 가까운 이웃과 함께해요." + label.textColor = .black + label.textAlignment = .center + label.numberOfLines = 2 + label.font = UIFont(name: "Pretendard-Bold", size: 18) + return label + }() + + private let idTextField: UITextField = { + let textField = UITextField() + textField.placeholder = "아이디를 입력해주세요" + textField.font = UIFont(name: "Pretendard-SemiBold", size: 14) + textField.backgroundColor = UIColor(red: 221/255, green: 222/255, blue: 227/255, alpha: 1) + return textField + }() + + private let passwordTextField: UITextField = { + let textField = UITextField() + textField.placeholder = "비밀번호를 입력해주세요" + textField.font = UIFont(name: "Pretendard-SemiBold", size: 14) + textField.backgroundColor = UIColor(red: 221/255, green: 222/255, blue: 227/255, alpha: 1) + return textField + }() + + lazy var loginButton: UIButton = { + let button = UIButton() + button.backgroundColor = UIColor(red: 255/255, green: 111/255, blue: 15/255, alpha: 1) + button.setTitle("로그인하기", for: .normal) + button.setTitleColor(.white, for: .normal) + button.titleLabel?.font = UIFont(name: "Pretendard-Bold", size: 18) + return button + }() +} diff --git a/Week3/Week3/LoginViewController.swift b/Week3/Week3/LoginViewController.swift new file mode 100644 index 0000000..bc0e6d7 --- /dev/null +++ b/Week3/Week3/LoginViewController.swift @@ -0,0 +1,18 @@ +// +// LoginViewController.swift +// Week3 +// +// Created by 오서영 on 2024/04/21. +// + +import Foundation +import UIKit + +final class LoginViewController_CustomView: UIViewController { + + private let rootView = LoginView() + + override func loadView() { + self.view = rootView + } +} diff --git a/Week3/Week3/SceneDelegate.swift b/Week3/Week3/SceneDelegate.swift new file mode 100644 index 0000000..6a2e8fe --- /dev/null +++ b/Week3/Week3/SceneDelegate.swift @@ -0,0 +1,52 @@ +// +// SceneDelegate.swift +// Week3 +// +// Created by 오서영 on 2024/04/21. +// + +import UIKit + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. + // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. + // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). + guard let _ = (scene as? UIWindowScene) else { return } + } + + 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/iOS-Assignment/iOS-Assignment/ViewController.swift b/Week3/Week3/ViewController.swift similarity index 79% rename from iOS-Assignment/iOS-Assignment/ViewController.swift rename to Week3/Week3/ViewController.swift index c9cdc76..417846a 100644 --- a/iOS-Assignment/iOS-Assignment/ViewController.swift +++ b/Week3/Week3/ViewController.swift @@ -1,8 +1,8 @@ // // ViewController.swift -// iOS-Assignment +// Week3 // -// Created by 오서영 on 2024/04/04. +// Created by 오서영 on 2024/04/21. // import UIKit diff --git a/iOS-Assignment/Fonts/Pretendard-Black.otf b/iOS-Assignment/Fonts/Pretendard-Black.otf deleted file mode 100644 index a0d849e..0000000 Binary files a/iOS-Assignment/Fonts/Pretendard-Black.otf and /dev/null differ diff --git a/iOS-Assignment/Fonts/Pretendard-Bold.otf b/iOS-Assignment/Fonts/Pretendard-Bold.otf deleted file mode 100644 index 8e5e30a..0000000 Binary files a/iOS-Assignment/Fonts/Pretendard-Bold.otf and /dev/null differ diff --git a/iOS-Assignment/Fonts/Pretendard-ExtraBold.otf b/iOS-Assignment/Fonts/Pretendard-ExtraBold.otf deleted file mode 100644 index 388f3ca..0000000 Binary files a/iOS-Assignment/Fonts/Pretendard-ExtraBold.otf and /dev/null differ diff --git a/iOS-Assignment/Fonts/Pretendard-ExtraLight.otf b/iOS-Assignment/Fonts/Pretendard-ExtraLight.otf deleted file mode 100644 index 40c8b69..0000000 Binary files a/iOS-Assignment/Fonts/Pretendard-ExtraLight.otf and /dev/null differ diff --git a/iOS-Assignment/Fonts/Pretendard-Light.otf b/iOS-Assignment/Fonts/Pretendard-Light.otf deleted file mode 100644 index 228679e..0000000 Binary files a/iOS-Assignment/Fonts/Pretendard-Light.otf and /dev/null differ diff --git a/iOS-Assignment/Fonts/Pretendard-Medium.otf b/iOS-Assignment/Fonts/Pretendard-Medium.otf deleted file mode 100644 index 0575069..0000000 Binary files a/iOS-Assignment/Fonts/Pretendard-Medium.otf and /dev/null differ diff --git a/iOS-Assignment/Fonts/Pretendard-Regular.otf b/iOS-Assignment/Fonts/Pretendard-Regular.otf deleted file mode 100644 index 08bf4cf..0000000 Binary files a/iOS-Assignment/Fonts/Pretendard-Regular.otf and /dev/null differ diff --git a/iOS-Assignment/Fonts/Pretendard-SemiBold.otf b/iOS-Assignment/Fonts/Pretendard-SemiBold.otf deleted file mode 100644 index e7e36ab..0000000 Binary files a/iOS-Assignment/Fonts/Pretendard-SemiBold.otf and /dev/null differ diff --git a/iOS-Assignment/Fonts/Pretendard-Thin.otf b/iOS-Assignment/Fonts/Pretendard-Thin.otf deleted file mode 100644 index 77e792d..0000000 Binary files a/iOS-Assignment/Fonts/Pretendard-Thin.otf and /dev/null differ diff --git a/iOS-Assignment/iOS-Assignment.xcodeproj/project.xcworkspace/xcuserdata/osy.xcuserdatad/UserInterfaceState.xcuserstate b/iOS-Assignment/iOS-Assignment.xcodeproj/project.xcworkspace/xcuserdata/osy.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 1a1eee8..0000000 Binary files a/iOS-Assignment/iOS-Assignment.xcodeproj/project.xcworkspace/xcuserdata/osy.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/iOS-Assignment/iOS-Assignment.xcodeproj/xcuserdata/osy.xcuserdatad/xcschemes/xcschememanagement.plist b/iOS-Assignment/iOS-Assignment.xcodeproj/xcuserdata/osy.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index bd9a9da..0000000 --- a/iOS-Assignment/iOS-Assignment.xcodeproj/xcuserdata/osy.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - SchemeUserState - - iOS-Assignment.xcscheme_^#shared#^_ - - orderHint - 0 - - - - diff --git a/iOS-Assignment/iOS-Assignment/Assets.xcassets/Image.imageset/Contents.json b/iOS-Assignment/iOS-Assignment/Assets.xcassets/Image.imageset/Contents.json deleted file mode 100644 index 55b7562..0000000 --- a/iOS-Assignment/iOS-Assignment/Assets.xcassets/Image.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "img.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "img 1.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "img 2.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/iOS-Assignment/iOS-Assignment/Assets.xcassets/Image.imageset/img 1.png b/iOS-Assignment/iOS-Assignment/Assets.xcassets/Image.imageset/img 1.png deleted file mode 100644 index fd7cf0b..0000000 Binary files a/iOS-Assignment/iOS-Assignment/Assets.xcassets/Image.imageset/img 1.png and /dev/null differ diff --git a/iOS-Assignment/iOS-Assignment/Assets.xcassets/Image.imageset/img 2.png b/iOS-Assignment/iOS-Assignment/Assets.xcassets/Image.imageset/img 2.png deleted file mode 100644 index fd7cf0b..0000000 Binary files a/iOS-Assignment/iOS-Assignment/Assets.xcassets/Image.imageset/img 2.png and /dev/null differ diff --git a/iOS-Assignment/iOS-Assignment/Assets.xcassets/Image.imageset/img.png b/iOS-Assignment/iOS-Assignment/Assets.xcassets/Image.imageset/img.png deleted file mode 100644 index fd7cf0b..0000000 Binary files a/iOS-Assignment/iOS-Assignment/Assets.xcassets/Image.imageset/img.png and /dev/null differ diff --git a/iOS-Assignment/iOS-Assignment/LoginViewController.swift b/iOS-Assignment/iOS-Assignment/LoginViewController.swift deleted file mode 100644 index 9419fcf..0000000 --- a/iOS-Assignment/iOS-Assignment/LoginViewController.swift +++ /dev/null @@ -1,126 +0,0 @@ -// -// LoginViewController.swift -// 34th-Sopt-Seminar -// -// Created by 오서영 on 2024/03/31. -// - -import Foundation -import UIKit - -final class LoginViewController: UIViewController { - - private let titleLabel: UILabel = { - let label = UILabel(frame: CGRect(x: 69, y: 161, width: 236, height: 44)) - label.text = "동네라서 가능한 모든것\n당근에서 가까운 이웃과 함께해요." - - // label.textColor = .black - label.textColor = .orange // 과제 1 - 1 - - label.textAlignment = .center - label.numberOfLines = 2 - label.font = UIFont(name: "Pretendard-Bold", size: 18) - return label - }() - - private let idTextField: UITextField = { - let textField = UITextField(frame: CGRect(x: 20, y: 276, width: 335, height: 52)) - textField.placeholder = "아이디를 입력해주세요" - textField.font = UIFont(name: "Pretendard-SemiBold", size: 14) - textField.backgroundColor = UIColor(red: 221/255, green: 222/255, blue: 227/255, alpha: 1) - return textField - }() - - private let passwordTextField: UITextField = { - let textField = UITextField(frame: CGRect(x: 20, y: 335, width: 335, height: 52)) - textField.placeholder = "비밀번호를 입력해주세요" - textField.font = UIFont(name: "Pretendard-SemiBold", size: 14) - textField.backgroundColor = UIColor(red: 221/255, green: 222/255, blue: 227/255, alpha: 1) - return textField - }() - - private lazy var loginButton: UIButton = { -// let button = UIButton(frame: CGRect(x: 21, y: 422, width: 332, height: 58)) - let button = UIButton(frame: CGRect(x: 21, y: 482, width: 332, height: 58)) - - button.backgroundColor = UIColor(red: 255/255, green: 111/255, blue: 15/255, alpha: 1) - button.setTitle("로그인하기", for: .normal) - button.setTitleColor(.white, for: .normal) - button.titleLabel?.font = UIFont(name: "Pretendard-Bold", size: 18) - button.addTarget(self, action: #selector(loginButtonDidTap), for: .touchUpInside) - return button - }() - - // 과제 1 - 2 - // UISwitch 인스턴스 생성 - private let autoLoginSwitch: UISwitch = { - let autoLoginSwitch = UISwitch() - autoLoginSwitch.frame = CGRect(x: 150, y: 400, width: 0, height: 0) // 위치 지정, 크기는 UISwitch의 기본 크기를 사용 - autoLoginSwitch.isOn = false // 기본 상태 설정 (자동 로그인 비활성화) - autoLoginSwitch.onTintColor = .orange // 활성화 상태의 색상 변경 - autoLoginSwitch.addTarget(self, action: #selector(autoLoginSwitchChanged), for: .valueChanged) // 스위치 상태 변경시 호출될 메서드 추가 - return autoLoginSwitch - }() - - - - private func presentToWelcomeVC() { - let welcomeViewController = WelcomeViewController() - welcomeViewController.modalPresentationStyle = .formSheet -// welcomeViewController.id = idTextField.text - welcomeViewController.setLabelText(id: idTextField.text) - self.present(welcomeViewController, animated: true) - } - - private func pushToWelcomeVC() { - let welcomeViewController = WelcomeViewController() -// welcomeViewController.id = idTextField.text - welcomeViewController.setLabelText(id: idTextField.text) -// self.navigationController?.pushViewController(welcomeViewController, animated: true) - - // 과제 1 - 1 - UIView.animate(withDuration: 0.3, animations: { - self.view.alpha = 0 - }) { [weak self] finished in - if finished { - self?.navigationController?.pushViewController(welcomeViewController, animated: false) - // 페이드 아웃 효과 후에는 뷰의 투명도를 원상태로 복구 - self?.view.alpha = 1 - } - } - } - - @objc - private func loginButtonDidTap() { -// presentToWelcomeVC() - pushToWelcomeVC() - } - - override func viewDidLoad() { - super.viewDidLoad() - - self.view.backgroundColor = .white - setLayout() - } - - private func setLayout() { - [titleLabel, idTextField, passwordTextField, loginButton].forEach { - self.view.addSubview($0) - - self.view.addSubview(autoLoginSwitch) - - } - } - - - // 스위치 상태 변경시 호출될 메서드 - @objc func autoLoginSwitchChanged(_ sender: UISwitch) { - if sender.isOn { - print("자동 로그인 활성화") - } else { - print("자동 로그인 비활성화") - } - } - -} - diff --git a/iOS-Assignment/iOS-Assignment/SceneDelegate.swift b/iOS-Assignment/iOS-Assignment/SceneDelegate.swift deleted file mode 100644 index 0b4a495..0000000 --- a/iOS-Assignment/iOS-Assignment/SceneDelegate.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// SceneDelegate.swift -// 34th-Sopt-Seminar -// -// Created by 오서영 on 2024/03/31. -// - -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. - self.window = UIWindow(windowScene: windowScene) - // 3. - let navigationController = UINavigationController(rootViewController: LoginViewController()) - self.window?.rootViewController = navigationController - // 4. - self.window?.makeKeyAndVisible() - } -} diff --git a/iOS-Assignment/iOS-Assignment/WelcomeViewController.swift b/iOS-Assignment/iOS-Assignment/WelcomeViewController.swift deleted file mode 100644 index b889ea8..0000000 --- a/iOS-Assignment/iOS-Assignment/WelcomeViewController.swift +++ /dev/null @@ -1,83 +0,0 @@ -// -// WelcomeViewController.swift -// 34th-Sopt-Seminar -// -// Created by 오서영 on 2024/03/31. -// - -import Foundation -import UIKit - -final class WelcomeViewController: UIViewController { - - private var id: String? - - private let logoImageView: UIImageView = { - let imageView = UIImageView(frame: CGRect(x: 112, y: 87, width: 150, height: 150)) - imageView.image = UIImage(named: "logo2") - return imageView - }() - - private let welcomeLabel: UILabel = { - let label = UILabel(frame: CGRect(x: 140, y: 295, width: 95, height: 60)) - label.text = "???님 \n반가워요!" - label.font = UIFont(name: "Pretendard-ExtraBold", size: 25) - label.textAlignment = .center - label.numberOfLines = 2 - return label - }() - - private var goHomeButton: UIButton = { - let button = UIButton(frame: CGRect(x: 20, y: 426, width: 335, height: 58)) - button.backgroundColor = UIColor(red: 255/255, green: 111/255, blue: 15/255, alpha: 1) - button.setTitle("메인으로", for: .normal) - button.setTitleColor(.white, for: .normal) - button.titleLabel?.font = UIFont(name: "Pretendard-Bold", size: 18) - return button - }() - - private lazy var backToLoginButton: UIButton = { - let button = UIButton(frame: CGRect(x: 20, y: 498, width: 335, height: 58)) - button.backgroundColor = UIColor(red: 221/255, green: 222/255, blue: 227/255, alpha: 1) - button.setTitle("다시 로그인", for: .normal) - button.setTitleColor(UIColor(red: 172/255, green: 176/255, blue: 185/255, alpha: 1), for: .normal) - button.titleLabel?.font = UIFont(name: "Pretendard-Bold", size: 18) - button.addTarget(self, action: #selector(backToLoginButtonDidTap), for: .touchUpInside) - return button - }() - - private func bindID() { - guard let idText = id else { return } - self.welcomeLabel.text = "\(idText)님 \n반가워요!" - } - - func setLabelText(id: String?) { - self.id = id - } - - override func viewDidLoad() { - super.viewDidLoad() - - self.view.backgroundColor = .white - setLayout() - - bindID() - } - - private func setLayout() { - [logoImageView, welcomeLabel, goHomeButton, backToLoginButton].forEach { - self.view.addSubview($0) - } - } - - @objc - private func backToLoginButtonDidTap() { - if self.navigationController == nil { - self.dismiss(animated: true) - } else { - self.navigationController?.popViewController(animated: true) - } - } - - -}