Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

[Kuring] 캠퍼스 맵을 추가 #10

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
918d1c5
[추가] 실시간 검색에서 키보드 엔터 입력시 검색으로 로직을 변경하였습니다.
lgvv Jun 7, 2022
944def2
[추가] KuringLite를 위한 AppStorageManager를 추가합니다.
lgvv Jun 8, 2022
dbe6f73
[추가] 최근 검색어 UI를 구성합니다.
lgvv Jun 8, 2022
258b961
[추가] 텍스트를 클릭하여 검색하는 로직을 추가
lgvv Jun 8, 2022
577f0e2
[추가] SearchView를 environmentObject로 변경하여 SearchEngine()을 주입
lgvv Jun 8, 2022
8a7586d
[추가] 최근 검색어 선택시, TextFiled에도 text 반영
lgvv Jun 8, 2022
80cd4e5
[추가] OrderedCollections을 spm으로 추가합니다. Kuring과 동일한 버전을 지원합니다.
lgvv Jun 8, 2022
d509285
[추가] 최근 검색어 중복을 막는 로직을 구현하였습니다.
lgvv Jun 8, 2022
764bcba
[추가] 최근 검색어 클릭시, 가장 앞 부분에 위치하게끔 로직을 수정하였습니다.
lgvv Jun 8, 2022
de94436
[추가] 최근 검색어 삭제 로직을 구현하였습니다.
lgvv Jun 8, 2022
8c36144
[수정] searchView의 padding값을 수정합니다.
lgvv Jun 8, 2022
b504056
[이슈] AppStorage를 통해 저장후, 다시 앱을 실행할 때 키워드가 나타나지 않는 이슈
lgvv Jun 8, 2022
0db044d
[기록] git permission 확인을 위한 커밋입니다.
lgvv Jun 8, 2022
1d76cdd
[수정] 불필요한 주석을 삭제하였습니다. (lgvv로 fork한 커밋 기록입니다.)
lgvv Jun 8, 2022
7792a55
[이슈] 싱글톤을 제거했음에도 shared 코드가 그대로 빌드대는 현상
lgvv Jun 8, 2022
effe055
[추가] StringSet 파일을 추가하였습니다.
lgvv Jun 8, 2022
dfb0c83
[추가] AppStorageManger에서 싱글톤을 제거하고 코드를 수정하였습니다.
lgvv Jun 8, 2022
5c01fcd
[이슈] 최근 검색어에서 데이터는 지워지나, 뷰가 업데이트 되지 않는 현상을 발견하였습니다.
lgvv Jun 8, 2022
4ce7d7b
[추가] SearchEngine에 remove 메소드를 추가합니다.
lgvv Jun 8, 2022
430f549
[추가] 삭제 버튼 클릭시 최근 검색한 텍스트가 삭제되며, UI가 업데이트 됩니다.
lgvv Jun 8, 2022
b0fbb52
[추가] PR리뷰 - 코드 리뷰 사항을 반영하여 코드를 개편하고 기능을 완성하였습니다.
lgvv Jun 13, 2022
463cb80
[수정] 불필요한 파일을 삭제합니다.
lgvv Jun 13, 2022
5bf852f
[수정] orderedCollections - 사용하지 않는 모듈을 삭제합니다.
lgvv Jun 13, 2022
a9335c9
[추가] 사용된 스위프트 패키지 추가
lgvv Aug 23, 2022
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
Prev Previous commit
Next Next commit
[추가] AppStorageManger에서 싱글톤을 제거하고 코드를 수정하였습니다.
  • Loading branch information
lgvv committed Jun 8, 2022
commit dfb0c832971306544a5f6488c8b2f13c3fa4002a
8 changes: 4 additions & 4 deletions KuringLite.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
A9F83779284C93A60045FDBD /* SwiftPackageRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9F83778284C93A60045FDBD /* SwiftPackageRow.swift */; };
A9F83783284C96880045FDBD /* FeedbackState.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9F83781284C96880045FDBD /* FeedbackState.swift */; };
B11BA8872850742300C82836 /* AppStorageManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = B11BA8862850742300C82836 /* AppStorageManager.swift */; };
B11BA88A285074A900C82836 /* StringSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = B11BA889285074A900C82836 /* StringSet.swift */; };
B11BA88D285085BD00C82836 /* Collections in Frameworks */ = {isa = PBXBuildFile; productRef = B11BA88C285085BD00C82836 /* Collections */; };
B11BA88F285085BD00C82836 /* DequeModule in Frameworks */ = {isa = PBXBuildFile; productRef = B11BA88E285085BD00C82836 /* DequeModule */; };
B11BA891285085BD00C82836 /* OrderedCollections in Frameworks */ = {isa = PBXBuildFile; productRef = B11BA890285085BD00C82836 /* OrderedCollections */; };
B11BA893285113F300C82836 /* StringSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = B11BA892285113F300C82836 /* StringSet.swift */; };
B1C641CB284F518500473184 /* SearchedRecentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1C641CA284F518500473184 /* SearchedRecentView.swift */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -77,7 +77,7 @@
A9F83778284C93A60045FDBD /* SwiftPackageRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftPackageRow.swift; sourceTree = "<group>"; };
A9F83781284C96880045FDBD /* FeedbackState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FeedbackState.swift; sourceTree = "<group>"; };
B11BA8862850742300C82836 /* AppStorageManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppStorageManager.swift; sourceTree = "<group>"; };
B11BA889285074A900C82836 /* StringSet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringSet.swift; sourceTree = "<group>"; };
B11BA892285113F300C82836 /* StringSet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringSet.swift; sourceTree = "<group>"; };
B1C641CA284F518500473184 /* SearchedRecentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchedRecentView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -265,7 +265,7 @@
A983BAF5284BCC8300B96FF1 /* Commons */ = {
isa = PBXGroup;
children = (
B11BA889285074A900C82836 /* StringSet.swift */,
B11BA892285113F300C82836 /* StringSet.swift */,
A983BAEE284BCB9B00B96FF1 /* LottieView.swift */,
A983BAF3284BCC7700B96FF1 /* lottieLoading.json */,
);
Expand Down Expand Up @@ -400,7 +400,7 @@
B11BA8872850742300C82836 /* AppStorageManager.swift in Sources */,
A983BAED284BCB1F00B96FF1 /* NoticeTypeColumn.swift in Sources */,
A95125AD284CF94F0072EB8E /* KuringLite.docc in Sources */,
B11BA88A285074A900C82836 /* StringSet.swift in Sources */,
B11BA893285113F300C82836 /* StringSet.swift in Sources */,
A983BAC4284BB08F00B96FF1 /* ContentView.swift in Sources */,
A983BAE9284BC9CF00B96FF1 /* NoticeRow.swift in Sources */,
A9F83773284C8B730045FDBD /* SearchedResultList.swift in Sources */,
Expand Down
1 change: 0 additions & 1 deletion KuringLite/KuringLiteApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ struct KuringLiteApp: App {
var body: some Scene {
WindowGroup {
ContentView()
// .environmentObject(AppStorageManager())
.accentColor(ColorSet.Label.primary.color)
}
}
Expand Down
2 changes: 1 addition & 1 deletion KuringLite/Manager/AppStorageManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import SwiftUI

class AppStorageManager {
class AppStorageManager: ObservableObject {
@AppStorage(StringSet.recentSearch)
var recentSearch: [String] = UserDefaults.standard.array(forKey: StringSet.recentSearch) as? [String] ?? []
}
6 changes: 3 additions & 3 deletions KuringLite/Search/DataModel/SearchEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ import OrderedCollections

/// 쿠링의 검색 관련 데이터를 관리하는 검색엔진 모델
class SearchEngine: ObservableObject {
@Published var recentText: [String] = AppStorageManager().recentSearch
@Published var appStorageManager = AppStorageManager()

@Published var inputText: String = ""
@Published var searchText: String = "" {
didSet {
recentText.append(searchText)
Logger.debug("AppStorage: \(recentText)", action: nil)
appStorageManager.recentSearch.append(searchText)
Logger.debug("AppStorage: \(appStorageManager.recentSearch)", action: nil)
}
}

Expand Down
5 changes: 2 additions & 3 deletions KuringLite/Search/View/SearchView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import KuringCommons
struct SearchView: View {
@EnvironmentObject var engine: SearchEngine


var body: some View {
VStack {
HStack {
Expand All @@ -46,7 +45,7 @@ struct SearchView: View {

TextField("", text: $engine.inputText, onCommit: {
Logger.debug("🐻 키보드 엔터 입력이 들어왔어요")
engine.recentText.removeAll { $0 == engine.inputText }
engine.appStorageManager.recentSearch.removeAll { $0 == engine.inputText }
engine.searchText = engine.inputText

})
Expand All @@ -60,7 +59,7 @@ struct SearchView: View {
.padding([.horizontal, .top], 16)
.padding(.bottom, 10)

if !engine.recentText.isEmpty {
if !engine.appStorageManager.recentSearch.isEmpty {
SearchedRecentList()
.padding(.bottom, 10)
}
Expand Down
6 changes: 3 additions & 3 deletions KuringLite/Search/View/SearchedRecentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct SearchedRecentList: View {
var body: some View {
ScrollView(.horizontal, showsIndicators: false) {
HStack {
ForEach(engine.recentText.reversed(), id: \.self) { text in
ForEach(engine.appStorageManager.recentSearch.reversed(), id: \.self) { text in

HStack(spacing: 5) {
Text("\(text)")
Expand All @@ -26,7 +26,7 @@ struct SearchedRecentList: View {
}

Button {
engine.recentText.removeAll { String($0) == text }
engine.appStorageManager.recentSearch.removeAll { String($0) == text }
} label: {
Image(systemName: "xmark")
.foregroundColor(ColorSet.secondaryGray.color)
Expand All @@ -46,7 +46,7 @@ struct SearchedRecentList: View {
}

private func search(_ text: String) {
engine.recentText.removeAll { String($0) == text }
engine.appStorageManager.recentSearch.removeAll { String($0) == text }

engine.searchText = text
engine.inputText = text
Expand Down