From 28c70de731a9d31900384d70b511b904d8380531 Mon Sep 17 00:00:00 2001 From: taek0622 Date: Fri, 2 Jun 2023 17:29:50 +0900 Subject: [PATCH] Chore:wrench:: #32 Modify searching variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - isEditing이라는 별도의 변수 대신 searchQuery로 검색 중 여부 판단 --- Nav/View/MapView.swift | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Nav/View/MapView.swift b/Nav/View/MapView.swift index f5cbc40..cdf8a37 100644 --- a/Nav/View/MapView.swift +++ b/Nav/View/MapView.swift @@ -8,7 +8,6 @@ import MapKit import SwiftUI struct MapView: View { @ObservedObject var addressSearcher = AddressSearcher() - @State var isEditing = false // 서울 좌표 @State private var region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 37.5666791, longitude: 126.9782914), span: MKCoordinateSpan(latitudeDelta: 0.5, longitudeDelta: 0.5)) @@ -24,7 +23,7 @@ struct MapView: View { data in MapMarker(coordinate: data.coordinate) } - if isEditing { + if addressSearcher.searchQuery != "" { List(addressSearcher.completions) { completion in Button { addressSearcher.loadAddressCoordinate(completion) { coordinate in @@ -50,9 +49,6 @@ struct MapView: View { placement: .navigationBarDrawer, prompt: "검색" ) - .onChange(of: addressSearcher.searchQuery) { newValue in - isEditing = (newValue != "" ? true : false) - } } } }