From e1b0ec599d0af7c33a60d6b55438690ecf133404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=92=E1=85=A9=E1=86=BC=E1=84=89=E1=85=A5=E1=86=A8?= =?UTF-8?q?=E1=84=92=E1=85=A7=E1=86=AB?= Date: Tue, 12 Aug 2025 10:40:04 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat.=20=ED=8C=80=20=EC=86=8C=EA=B0=9C=20?= =?UTF-8?q?=EB=AA=A8=EB=8D=B8=20=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Core/Data/Item.swift | 18 -------- .../Sources/Core/Data/TeamMember.swift | 44 +++++++++++++++++++ .../IntroduceMain/View/ContentView.swift | 19 +------- 3 files changed, 46 insertions(+), 35 deletions(-) delete mode 100644 TeamIntroduce/TeamIntroduce/Sources/Core/Data/Item.swift create mode 100644 TeamIntroduce/TeamIntroduce/Sources/Core/Data/TeamMember.swift diff --git a/TeamIntroduce/TeamIntroduce/Sources/Core/Data/Item.swift b/TeamIntroduce/TeamIntroduce/Sources/Core/Data/Item.swift deleted file mode 100644 index 2d45203..0000000 --- a/TeamIntroduce/TeamIntroduce/Sources/Core/Data/Item.swift +++ /dev/null @@ -1,18 +0,0 @@ -// -// Item.swift -// TeamIntroduce -// -// Created by Wonji Suh on 8/11/25. -// - -import Foundation -import SwiftData - -@Model -final class Item { - var timestamp: Date - - init(timestamp: Date) { - self.timestamp = timestamp - } -} diff --git a/TeamIntroduce/TeamIntroduce/Sources/Core/Data/TeamMember.swift b/TeamIntroduce/TeamIntroduce/Sources/Core/Data/TeamMember.swift new file mode 100644 index 0000000..4c146c5 --- /dev/null +++ b/TeamIntroduce/TeamIntroduce/Sources/Core/Data/TeamMember.swift @@ -0,0 +1,44 @@ +// +// TeamMember.swift +// TeamIntroduce +// +// Created by ν™μ„ν˜„ on 8/12/25. +// + +import Foundation +import SwiftData + +@Model +final class TeamMember: Identifiable { + var id: UUID + var name: String + var imageName: String + var role: String + var mbti: String + var introduction: String + var strengths: [String] + var blogLink: String + var collaborationStyle: [String] + + init( + id: UUID = UUID(), + name: String, + imageName: String, + role: String, + mbti: String, + introduction: String, + strengths: [String], + blogLink: String, + collaborationStyle: [String] + ) { + self.id = id + self.name = name + self.imageName = imageName + self.role = role + self.mbti = mbti + self.introduction = introduction + self.strengths = strengths + self.blogLink = blogLink + self.collaborationStyle = collaborationStyle + } +} diff --git a/TeamIntroduce/TeamIntroduce/Sources/Presnetaion/IntroduceMain/View/ContentView.swift b/TeamIntroduce/TeamIntroduce/Sources/Presnetaion/IntroduceMain/View/ContentView.swift index 6b8e037..34e0a8b 100644 --- a/TeamIntroduce/TeamIntroduce/Sources/Presnetaion/IntroduceMain/View/ContentView.swift +++ b/TeamIntroduce/TeamIntroduce/Sources/Presnetaion/IntroduceMain/View/ContentView.swift @@ -10,7 +10,7 @@ import SwiftData struct ContentView: View { @Environment(\.modelContext) private var modelContext - @Query private var items: [Item] + @Query private var items: [TeamMember] @EnvironmentObject private var coordinator: IntroduceCoordinator @@ -22,24 +22,9 @@ struct ContentView: View { } } } - - private func addItem() { - withAnimation { - let newItem = Item(timestamp: Date()) - modelContext.insert(newItem) - } - } - - private func deleteItems(offsets: IndexSet) { - withAnimation { - for index in offsets { - modelContext.delete(items[index]) - } - } - } } #Preview { ContentView() - .modelContainer(for: Item.self, inMemory: true) + .modelContainer(for: TeamMember.self, inMemory: true) } From 618b5c7c9f9851db3df87b00e91fa455987c6dda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=92=E1=85=A9=E1=86=BC=E1=84=89=E1=85=A5=E1=86=A8?= =?UTF-8?q?=E1=84=92=E1=85=A7=E1=86=AB?= Date: Tue, 12 Aug 2025 11:18:19 +0900 Subject: [PATCH 2/3] =?UTF-8?q?feat.=20=ED=8C=80=EC=9B=90=20=EC=86=8C?= =?UTF-8?q?=EA=B0=9C=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?=EB=B0=8F=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=ED=99=95=EC=9D=B8=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Application/TeamIntroduceApp.swift | 82 +++++++++++++++++++ .../Sources/Core/Data/TeamMember.swift | 5 +- .../View/IntorduceCoordinatorView.swift | 2 +- .../IntroduceMain/View/ContentView.swift | 10 +-- 4 files changed, 90 insertions(+), 9 deletions(-) diff --git a/TeamIntroduce/TeamIntroduce/Sources/Application/TeamIntroduceApp.swift b/TeamIntroduce/TeamIntroduce/Sources/Application/TeamIntroduceApp.swift index 0adc934..292bf5c 100644 --- a/TeamIntroduce/TeamIntroduce/Sources/Application/TeamIntroduceApp.swift +++ b/TeamIntroduce/TeamIntroduce/Sources/Application/TeamIntroduceApp.swift @@ -13,6 +13,88 @@ struct TeamIntroduceApp: App { var body: some Scene { WindowGroup { RootView() + .modelContainer(for: TeamMember.self) { result in + // 🎯 초기 데이터 μ„€μ • + switch result { + case .success(let container): + setupInitialData(container: container) + case .failure(let error): + print("❌ SwiftData μ»¨ν…Œμ΄λ„ˆ 생성 μ‹€νŒ¨: \(error)") + } + } } } + + // MARK: - 초기 데이터 μ„€μ • + private func setupInitialData(container: ModelContainer) { + let context = container.mainContext + + // πŸ” κΈ°μ‘΄ 데이터 확인 + let descriptor = FetchDescriptor() + let existingCount = (try? context.fetch(descriptor).count) ?? 0 + + print("πŸ“Š κΈ°μ‘΄ νŒ€μ› 데이터 개수: \(existingCount)") + + // 데이터가 μ—†μœΌλ©΄ μƒ˜ν”Œ 데이터 μΆ”κ°€ + if existingCount == 0 { + print("🎯 초기 νŒ€μ› 데이터 생성 쀑...") + + let members = createMembers() + + for member in members { + context.insert(member) + print("βœ… νŒ€μ› μΆ”κ°€: \(member.name) (ID: \(member.id))") + } + + do { + try context.save() + print("πŸ’Ύ 초기 데이터 μ €μž₯ μ™„λ£Œ!") + + // μ €μž₯ ν›„ λ‹€μ‹œ 확인 + let savedCount = (try? context.fetch(descriptor).count) ?? 0 + print("πŸ“Š μ €μž₯된 νŒ€μ› 데이터 개수: \(savedCount)") + } catch { + print("❌ 데이터 μ €μž₯ μ‹€νŒ¨: \(error)") + } + } else { + print("ℹ️ κΈ°μ‘΄ 데이터가 μžˆμ–΄μ„œ μ΄ˆκΈ°ν™”λ₯Ό κ±΄λ„ˆλœλ‹ˆλ‹€.") + } + } + + // MARK: - μƒ˜ν”Œ 데이터 생성 + private func createMembers() -> [TeamMember] { + return [ + TeamMember( + name: "김민희", + imageName: "person.crop.circle", + role: "iOS Developer", + mbti: "ESTP", + introduction: "μΊ ν”„ ν›„ 되고 싢은 λ‚˜μ˜ λͺ¨μŠ΅ ν˜Ήμ€ 미래의 λ‚˜μ˜ λͺ¨μŠ΅μ„ ν•œλ§ˆλ””λ‘œ μ μ–΄λ³΄μ„Έμš”! μƒμƒν•˜κ²Œ 꿈꾸면 μ΄λ£¨μ–΄μ§„λ‹΅λ‹ˆλ‹€!", + strengths: ["UIKit", "Core Data", "Auto Layout", "Unit Testing"], + blogLink: "https://0minnie0.tistory.com/", + collaborationStyle: ["μ„Έμ‹¬ν•œ κ²€ν† ", "λ¬Έμ„œν™” μ€‘μ‹œ", "체계적 정리", "ν’ˆμ§ˆ 관리"], + isLeader: true + ), + TeamMember( + name: "μ„œμ›μ§€", + imageName: "person.crop.circle.fill", + role: "iOS Developer", + mbti: "INTP", + introduction: "μ’€ 큰 기업에 μž…μ‚¬λ₯Ό ν•˜κ³  λ‹€μ–‘ν•œ ν”„λ‘œμ νŠΈλ₯΄ ν•˜κ³  μ‹ΆμŠ΅λ‹ˆλ‹€", + strengths: ["Swift", "RxSwift", "Clean Architecture", "Firebase Integration"], + blogLink: "https://velog.io/@suhwj/posts", + collaborationStyle: ["창의적 λ¬Έμ œν•΄κ²°", "μ‚¬μš©μž 쀑심 사고", "논리적 뢄석", "기술 연ꡬ"] + ), + TeamMember( + name: "ν™μ„ν˜„", + imageName: "person.circle.fill", + role: "iOS Developer", + mbti: "ENFJ", + introduction: "μ•ˆλ…•ν•˜μ„Έμš”! 열정적인 iOS κ°œλ°œμžμž…λ‹ˆλ‹€.", + strengths: ["SwiftUI", "Combine", "Swift Concurrency", "MVVM Architecture"], + blogLink: "https://blog.example.com/hong", + collaborationStyle: ["적극적 μ†Œν†΅", "μ½”λ“œ 리뷰", "νŒ€ 리딩", "지식 곡유"] + ) + ] + } } diff --git a/TeamIntroduce/TeamIntroduce/Sources/Core/Data/TeamMember.swift b/TeamIntroduce/TeamIntroduce/Sources/Core/Data/TeamMember.swift index 4c146c5..861322e 100644 --- a/TeamIntroduce/TeamIntroduce/Sources/Core/Data/TeamMember.swift +++ b/TeamIntroduce/TeamIntroduce/Sources/Core/Data/TeamMember.swift @@ -19,6 +19,7 @@ final class TeamMember: Identifiable { var strengths: [String] var blogLink: String var collaborationStyle: [String] + var isLeader: Bool init( id: UUID = UUID(), @@ -29,7 +30,8 @@ final class TeamMember: Identifiable { introduction: String, strengths: [String], blogLink: String, - collaborationStyle: [String] + collaborationStyle: [String], + isLeader: Bool = false ) { self.id = id self.name = name @@ -40,5 +42,6 @@ final class TeamMember: Identifiable { self.strengths = strengths self.blogLink = blogLink self.collaborationStyle = collaborationStyle + self.isLeader = isLeader } } diff --git a/TeamIntroduce/TeamIntroduce/Sources/Presnetaion/IntroduceMain/Coordinator/View/IntorduceCoordinatorView.swift b/TeamIntroduce/TeamIntroduce/Sources/Presnetaion/IntroduceMain/Coordinator/View/IntorduceCoordinatorView.swift index d7d94b9..94ee7b9 100644 --- a/TeamIntroduce/TeamIntroduce/Sources/Presnetaion/IntroduceMain/Coordinator/View/IntorduceCoordinatorView.swift +++ b/TeamIntroduce/TeamIntroduce/Sources/Presnetaion/IntroduceMain/Coordinator/View/IntorduceCoordinatorView.swift @@ -12,7 +12,7 @@ struct IntorduceCoordinatorView : View { @EnvironmentObject private var coordinator: IntroduceCoordinator var sharedModelContainer: ModelContainer = { let schema = Schema([ - Item.self, + TeamMember.self, ]) let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false) diff --git a/TeamIntroduce/TeamIntroduce/Sources/Presnetaion/IntroduceMain/View/ContentView.swift b/TeamIntroduce/TeamIntroduce/Sources/Presnetaion/IntroduceMain/View/ContentView.swift index 34e0a8b..8296eb7 100644 --- a/TeamIntroduce/TeamIntroduce/Sources/Presnetaion/IntroduceMain/View/ContentView.swift +++ b/TeamIntroduce/TeamIntroduce/Sources/Presnetaion/IntroduceMain/View/ContentView.swift @@ -10,16 +10,12 @@ import SwiftData struct ContentView: View { @Environment(\.modelContext) private var modelContext - @Query private var items: [TeamMember] + @Query private var teamMembers: [TeamMember] @EnvironmentObject private var coordinator: IntroduceCoordinator - var body: some View { - VStack { - Text("main") - .onTapGesture { - coordinator.send(.present(.teamAgreement)) - } + List(teamMembers, id: \.id) { member in + Text(member.name) } } } From d58c4b299b88b4be375263bc05918892e1400391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=92=E1=85=A9=E1=86=BC=E1=84=89=E1=85=A5=E1=86=A8?= =?UTF-8?q?=E1=84=92=E1=85=A7=E1=86=AB?= Date: Tue, 12 Aug 2025 12:20:59 +0900 Subject: [PATCH 3/3] =?UTF-8?q?chor.=20=ED=83=80=EC=9E=85=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Application/TeamIntroduceApp.swift | 6 +++--- .../TeamIntroduce/Sources/Core/Data/TeamMember.swift | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/TeamIntroduce/TeamIntroduce/Sources/Application/TeamIntroduceApp.swift b/TeamIntroduce/TeamIntroduce/Sources/Application/TeamIntroduceApp.swift index 292bf5c..beafba8 100644 --- a/TeamIntroduce/TeamIntroduce/Sources/Application/TeamIntroduceApp.swift +++ b/TeamIntroduce/TeamIntroduce/Sources/Application/TeamIntroduceApp.swift @@ -72,7 +72,7 @@ struct TeamIntroduceApp: App { introduction: "μΊ ν”„ ν›„ 되고 싢은 λ‚˜μ˜ λͺ¨μŠ΅ ν˜Ήμ€ 미래의 λ‚˜μ˜ λͺ¨μŠ΅μ„ ν•œλ§ˆλ””λ‘œ μ μ–΄λ³΄μ„Έμš”! μƒμƒν•˜κ²Œ 꿈꾸면 μ΄λ£¨μ–΄μ§„λ‹΅λ‹ˆλ‹€!", strengths: ["UIKit", "Core Data", "Auto Layout", "Unit Testing"], blogLink: "https://0minnie0.tistory.com/", - collaborationStyle: ["μ„Έμ‹¬ν•œ κ²€ν† ", "λ¬Έμ„œν™” μ€‘μ‹œ", "체계적 정리", "ν’ˆμ§ˆ 관리"], + collaborationStyle: "μ„Έμ‹¬ν•œ κ²€ν† , λ¬Έμ„œν™” μ€‘μ‹œ, 체계적 정리, ν’ˆμ§ˆ 관리", isLeader: true ), TeamMember( @@ -83,7 +83,7 @@ struct TeamIntroduceApp: App { introduction: "μ’€ 큰 기업에 μž…μ‚¬λ₯Ό ν•˜κ³  λ‹€μ–‘ν•œ ν”„λ‘œμ νŠΈλ₯΄ ν•˜κ³  μ‹ΆμŠ΅λ‹ˆλ‹€", strengths: ["Swift", "RxSwift", "Clean Architecture", "Firebase Integration"], blogLink: "https://velog.io/@suhwj/posts", - collaborationStyle: ["창의적 λ¬Έμ œν•΄κ²°", "μ‚¬μš©μž 쀑심 사고", "논리적 뢄석", "기술 연ꡬ"] + collaborationStyle: "창의적 λ¬Έμ œν•΄κ²°, μ‚¬μš©μž 쀑심 사고, 논리적 뢄석, 기술 연ꡬ" ), TeamMember( name: "ν™μ„ν˜„", @@ -93,7 +93,7 @@ struct TeamIntroduceApp: App { introduction: "μ•ˆλ…•ν•˜μ„Έμš”! 열정적인 iOS κ°œλ°œμžμž…λ‹ˆλ‹€.", strengths: ["SwiftUI", "Combine", "Swift Concurrency", "MVVM Architecture"], blogLink: "https://blog.example.com/hong", - collaborationStyle: ["적극적 μ†Œν†΅", "μ½”λ“œ 리뷰", "νŒ€ 리딩", "지식 곡유"] + collaborationStyle: "적극적 μ†Œν†΅, μ½”λ“œ 리뷰, νŒ€ 리딩, 지식 곡유" ) ] } diff --git a/TeamIntroduce/TeamIntroduce/Sources/Core/Data/TeamMember.swift b/TeamIntroduce/TeamIntroduce/Sources/Core/Data/TeamMember.swift index 861322e..19f516c 100644 --- a/TeamIntroduce/TeamIntroduce/Sources/Core/Data/TeamMember.swift +++ b/TeamIntroduce/TeamIntroduce/Sources/Core/Data/TeamMember.swift @@ -18,7 +18,7 @@ final class TeamMember: Identifiable { var introduction: String var strengths: [String] var blogLink: String - var collaborationStyle: [String] + var collaborationStyle: String var isLeader: Bool init( @@ -30,7 +30,7 @@ final class TeamMember: Identifiable { introduction: String, strengths: [String], blogLink: String, - collaborationStyle: [String], + collaborationStyle: String, isLeader: Bool = false ) { self.id = id