Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
Binary file modified JLPTVoca/.DS_Store
Binary file not shown.
129 changes: 120 additions & 9 deletions JLPTVoca/JLPTVoca.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,40 @@
remoteGlobalIDString = 214FEB5F2E5E320300C87957;
remoteInfo = JLPTVoca;
};
216B03632E9811150086B1F0 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 214FEB582E5E320300C87957 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 214FEB5F2E5E320300C87957;
remoteInfo = JLPTVoca;
};
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
214FEB602E5E320300C87957 /* JLPTVoca.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JLPTVoca.app; sourceTree = BUILT_PRODUCTS_DIR; };
216132B32E71D3C300DE17B7 /* JLPTVocaUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JLPTVocaUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
216B035F2E9811150086B1F0 /* JLPTVocaTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JLPTVocaTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
218805562E7E60E000F5F235 /* Exceptions for "JLPTVoca" folder in "JLPTVoca" target */ = {
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
Info.plist,
);
target = 214FEB5F2E5E320300C87957 /* JLPTVoca */;
};
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */

/* Begin PBXFileSystemSynchronizedRootGroup section */
214FEB622E5E320300C87957 /* JLPTVoca */ = {
isa = PBXFileSystemSynchronizedRootGroup;
exceptions = (
218805562E7E60E000F5F235 /* Exceptions for "JLPTVoca" folder in "JLPTVoca" target */,
);
path = JLPTVoca;
sourceTree = "<group>";
};
216132B42E71D3C300DE17B7 /* JLPTVocaUITests */ = {
isa = PBXFileSystemSynchronizedRootGroup;
path = JLPTVocaUITests;
sourceTree = "<group>";
};
/* End PBXFileSystemSynchronizedRootGroup section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -49,14 +65,20 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
216B035C2E9811150086B1F0 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
214FEB572E5E320300C87957 = {
isa = PBXGroup;
children = (
214FEB622E5E320300C87957 /* JLPTVoca */,
216132B42E71D3C300DE17B7 /* JLPTVocaUITests */,
214FEB612E5E320300C87957 /* Products */,
);
sourceTree = "<group>";
Expand All @@ -66,6 +88,7 @@
children = (
214FEB602E5E320300C87957 /* JLPTVoca.app */,
216132B32E71D3C300DE17B7 /* JLPTVocaUITests.xctest */,
216B035F2E9811150086B1F0 /* JLPTVocaTests.xctest */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -108,16 +131,33 @@
dependencies = (
216132B82E71D3C300DE17B7 /* PBXTargetDependency */,
);
fileSystemSynchronizedGroups = (
216132B42E71D3C300DE17B7 /* JLPTVocaUITests */,
);
name = JLPTVocaUITests;
packageProductDependencies = (
);
productName = JLPTVocaUITests;
productReference = 216132B32E71D3C300DE17B7 /* JLPTVocaUITests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
216B035E2E9811150086B1F0 /* JLPTVocaTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 216B03652E9811150086B1F0 /* Build configuration list for PBXNativeTarget "JLPTVocaTests" */;
buildPhases = (
216B035B2E9811150086B1F0 /* Sources */,
216B035C2E9811150086B1F0 /* Frameworks */,
216B035D2E9811150086B1F0 /* Resources */,
);
buildRules = (
);
dependencies = (
216B03642E9811150086B1F0 /* PBXTargetDependency */,
);
name = JLPTVocaTests;
packageProductDependencies = (
);
productName = JLPTVocaTests;
productReference = 216B035F2E9811150086B1F0 /* JLPTVocaTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
Expand All @@ -135,6 +175,10 @@
CreatedOnToolsVersion = 16.4;
TestTargetID = 214FEB5F2E5E320300C87957;
};
216B035E2E9811150086B1F0 = {
CreatedOnToolsVersion = 16.4;
TestTargetID = 214FEB5F2E5E320300C87957;
};
};
};
buildConfigurationList = 214FEB5B2E5E320300C87957 /* Build configuration list for PBXProject "JLPTVoca" */;
Expand All @@ -153,6 +197,7 @@
targets = (
214FEB5F2E5E320300C87957 /* JLPTVoca */,
216132B22E71D3C300DE17B7 /* JLPTVocaUITests */,
216B035E2E9811150086B1F0 /* JLPTVocaTests */,
);
};
/* End PBXProject section */
Expand All @@ -172,6 +217,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
216B035D2E9811150086B1F0 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand All @@ -189,6 +241,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
216B035B2E9811150086B1F0 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
Expand All @@ -197,6 +256,11 @@
target = 214FEB5F2E5E320300C87957 /* JLPTVoca */;
targetProxy = 216132B72E71D3C300DE17B7 /* PBXContainerItemProxy */;
};
216B03642E9811150086B1F0 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 214FEB5F2E5E320300C87957 /* JLPTVoca */;
targetProxy = 216B03632E9811150086B1F0 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */

/* Begin XCBuildConfiguration section */
Expand Down Expand Up @@ -331,6 +395,7 @@
DEVELOPMENT_TEAM = 3HYFT54PK2;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = JLPTVoca/Info.plist;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
Expand Down Expand Up @@ -359,6 +424,7 @@
DEVELOPMENT_TEAM = 3HYFT54PK2;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = JLPTVoca/Info.plist;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
Expand Down Expand Up @@ -413,6 +479,42 @@
};
name = Release;
};
216B03662E9811150086B1F0 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 3HYFT54PK2;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.JLPTVocaTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JLPTVoca.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/JLPTVoca";
};
name = Debug;
};
216B03672E9811150086B1F0 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 3HYFT54PK2;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.JLPTVocaTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JLPTVoca.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/JLPTVoca";
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
Expand Down Expand Up @@ -443,6 +545,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
216B03652E9811150086B1F0 /* Build configuration list for PBXNativeTarget "JLPTVocaTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
216B03662E9811150086B1F0 /* Debug */,
216B03672E9811150086B1F0 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 214FEB582E5E320300C87957 /* Project object */;
Expand Down
34 changes: 13 additions & 21 deletions JLPTVoca/JLPTVoca/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,22 @@ import SwiftUI
import SwiftData

struct ContentView: View {
@Query private var words: [Word]
@Environment(\.modelContext) private var context
@State private var wordManager = WordManager()
@AppStorage("hasCompletedOnboarding") private var hasCompletedOnboarding: Bool = false
@AppStorage("isDataPreloaded") private var isDataPreloaded: Bool = false
@Environment(WordManager.self) private var wordManager

var body: some View {
TabView {
HomeView()
.tabItem {
Label("학습", systemImage: "house.fill")
}

SelectDictionaryView()
.tabItem {
Label("사전", systemImage: "book.fill")
}

SettingView()
.tabItem {
Label("설정", systemImage: "gearshape.fill")
}
Group {
if !hasCompletedOnboarding {
OnboardingView(hasCompletedOnboarding: $hasCompletedOnboarding)
} else if !isDataPreloaded {
ProgressView("단어 데이터를 준비 중입니다..")
} else {
MainTabView()
}
}
.environment(wordManager)
.onAppear() {
wordManager.setContext(context: context)
.onAppear {
wordManager.prepareInitialData()
}
}
}
19 changes: 11 additions & 8 deletions JLPTVoca/JLPTVoca/JLPTVocaApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@ import SwiftData

@main
struct JLPTVocaApp: App {
let sharedModelConatainer: ModelContainer
let wordManager: WordManager

init() {
let container = try! ModelContainer(for: Word.self, StudyState.self)
self.sharedModelConatainer = container
self.wordManager = WordManager(modelContainer: container)
}

var body: some Scene {
WindowGroup {
ContentView()
}
.modelContainer(for: Word.self, onSetup: { result in
switch result {
case .success(let container):
DataLoader.loadInitialData(context: container.mainContext)
case .failure(let error):
fatalError("\(error.localizedDescription)")
}
})
.modelContainer(sharedModelConatainer)
.environment(wordManager)
}
}
Loading