Skip to content

Commit

Permalink
Feat:sparkles:: #32 Add searching list visible
Browse files Browse the repository at this point in the history
- 검색 중에만 리스트를 보여주는 기능 추가
  • Loading branch information
taek0622 committed Jun 2, 2023
1 parent ca97dfc commit e615a4e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Nav/View/MapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ struct MapView: View {
private var mockDatas: [MockDatum] = MockDatum.allData

@State var searchQueryString = ""
@State var isEdit = false

// 서울 좌표
@State private var region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 37.5666791, longitude: 126.9782914), span: MKCoordinateSpan(latitudeDelta: 0.5, longitudeDelta: 0.5))
Expand Down Expand Up @@ -112,6 +113,7 @@ struct MapView: View {
}
}
}
if isEdit {
List {
Text(searchQueryString)
}
Expand All @@ -123,6 +125,13 @@ struct MapView: View {
placement: .navigationBarDrawer,
prompt: "검색"
)
.onChange(of: searchQueryString) { newValue in
if newValue != "" {
isEdit = true
} else {
isEdit = false
}
}
}
}

Expand All @@ -131,4 +140,4 @@ struct MapView_Previews: PreviewProvider {
static var previews: some View {
MapView()
}
}
}}

0 comments on commit e615a4e

Please sign in to comment.