Skip to content

Commit

Permalink
Chore:wrench:: #32 Modify searching variable
Browse files Browse the repository at this point in the history
- isEditing이라는 별도의 변수 대신 searchQuery로 검색 중 여부 판단
  • Loading branch information
taek0622 committed Jun 2, 2023
1 parent 02c1f3a commit 28c70de
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions Nav/View/MapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
Expand All @@ -50,9 +49,6 @@ struct MapView: View {
placement: .navigationBarDrawer,
prompt: "검색"
)
.onChange(of: addressSearcher.searchQuery) { newValue in
isEditing = (newValue != "" ? true : false)
}
}
}
}
Expand Down

0 comments on commit 28c70de

Please sign in to comment.