Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scene/#15 - 주변 흡연구역 Search 파일 생성 및 구현 #45

Merged
merged 4 commits into from
Feb 12, 2023
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
46 changes: 30 additions & 16 deletions Damso.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

22 changes: 1 addition & 21 deletions Damso/Data/Network/MarkersHTTPMethod.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,9 @@ class MarkersHTTPMethod{
switch response.result {
case .success(let value):
//print(value)

let marker = NMFMarker()
var pinInfoArr :Array<Pin> = []

for i in value.result {
//marker.position = NMGLatLng(lat: Double(value.result[15].la)!, lng: Double(value.result[15].lo)!)

//marker.position = NMGLatLng(lat: Double(i.la)!, lng: Double(i.lo)!)
pinInfoArr.append(Pin(facilityId: i.facilityId, la: i.la, lo: i.lo))
//print(Double(i.la)!)
//print(markerArr)

//print(Double(value.result[15].la)!)
//print(Double(value.result[15].lo)!)

}
completionHandler(pinInfoArr)



completionHandler(value.result)
case .failure(let error):
print(error.localizedDescription)

}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "ExactlyClosed 1x.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ExactlyClosed 2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ExactlyClosed 3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "AreaExactlyOpenImg 1x.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "AreaExactlyOpenImg 2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "AreaExactlyOpenImg 3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "OpenArea 1x.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Open 2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Open 3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "close 1x.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "close 2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "close 3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "ExactlyOpenArea 1x.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ExactlyOpenArea 2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ExactlyOpenArea 3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

6 changes: 3 additions & 3 deletions Damso/Presentation/Bookmark/BookmarkVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import UIKit
class BookmarkVC: BaseVC {

let bookmarkView = BookmarkView()
let bookmarkCell = BookmarkTableViewCell()
let TableViewCell = SmokingAreaTableViewCell()

override func loadView(){
view = bookmarkView
Expand All @@ -20,7 +20,7 @@ class BookmarkVC: BaseVC {
bookmarkView.tableView.delegate = self
bookmarkView.tableView.dataSource = self

bookmarkView.tableView.register(BookmarkTableViewCell.self, forCellReuseIdentifier: BookmarkTableViewCell.identifier)
bookmarkView.tableView.register(SmokingAreaTableViewCell.self, forCellReuseIdentifier: SmokingAreaTableViewCell.identifier)

}

Expand All @@ -40,7 +40,7 @@ extension BookmarkVC: UITableViewDelegate, UITableViewDataSource{
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = bookmarkView.tableView.dequeueReusableCell(withIdentifier:BookmarkTableViewCell.identifier, for: indexPath) as? BookmarkTableViewCell else{ return UITableViewCell() }
guard let cell = bookmarkView.tableView.dequeueReusableCell(withIdentifier:SmokingAreaTableViewCell.identifier, for: indexPath) as? SmokingAreaTableViewCell else{ return UITableViewCell() }
return cell
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ import UIKit
import SnapKit
import Then

class BookmarkTableViewCell: UITableViewCell {
class SmokingAreaTableViewCell: UITableViewCell {

static let identifier = "BookmarkTableViewCell"

//시설 사진
let areaImgView = UIImageView().then{
$0.backgroundColor = .systemBackgroundColor
$0.layer.cornerRadius = 3
$0.image = UIImage(named: "AreaExactlyOpenImg")
$0.contentMode = .scaleAspectFit
}

//흡연구역명 레이블
Expand Down
1 change: 0 additions & 1 deletion Damso/Presentation/Input/Location/ReportVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ extension ReportVC: CLLocationManagerDelegate, NMFMapViewTouchDelegate, NMFMapVi

GeocodingManager.geocodingManager.callReversedGeocoding(lon: "\(latlng.lng)", lat: "\(latlng.lat)", completionHandler: { addressString in
DispatchQueue.main.async {

self.reportView.locationLabel.text = addressString
}
})
Expand Down
17 changes: 17 additions & 0 deletions Damso/Presentation/Search/SearchTypeVC.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// SearchTypeVC.swift
// Damso
//
// Created by 문정호 on 2023/02/12.
//

import UIKit

class SearchTypeVC: BaseVC {
let searchTypeview = SearchTypeView()

override func loadView() {
view = self.searchTypeview
}

}
100 changes: 100 additions & 0 deletions Damso/Presentation/Search/SearchTypeView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
//
// SearchTypeView.swift
// Damso
//
// Created by 문정호 on 2023/02/12.
//

import UIKit
import Then
import SnapKit

class SearchTypeView: BaseView {
//MARK: - Properties
var imgConfiguration = UIButton.Configuration.plain()

let typeTitle = UILabel().then{ //시설 형태 라벨
$0.text = "시설형태"
$0.font = UIFont(name: "NotoSansKR-Bold", size: 16)
}

lazy var stackView = UIStackView().then{
$0.axis = .horizontal
$0.spacing = 10
$0.distribution = .fillEqually //똑같은 스페이스를 둠
$0.alignment = .fill //정렬 수직 방향은 무조건 채움
}

let exactlyOpenButton = UIButton(configuration: UIButton.Configuration.gray()).then{ //완전 개방형 버튼
$0.configuration?.image = UIImage(named: "AreaExactlyOpenImg")
$0.configuration?.imagePadding = 10
$0.configuration?.imagePlacement = .top
$0.layer.cornerRadius = 10
}
let openButton = UIButton(configuration: UIButton.Configuration.gray()).then{ //완전 개방형 버튼
$0.setImage(UIImage(named: "AreaOpenImg"), for: .normal)
$0.configuration?.imagePadding = 0
$0.configuration?.imagePlacement = .top
$0.layer.cornerRadius = 10
}
let closedButton = UIButton(configuration: UIButton.Configuration.gray()).then{ //완전 개방형 버튼
$0.setImage(UIImage(named: "AreaclosedImg"), for: .normal)
$0.configuration?.imagePadding = 0
$0.configuration?.imagePlacement = .top
$0.layer.cornerRadius = 10
}
let exactlyClosedButton = UIButton(configuration: UIButton.Configuration.gray()).then{ //완전 개방형 버튼
$0.configuration?.subtitle = "완전 폐쇄형"
$0.setImage(UIImage(named: "AreaExactlyClosedImg"), for: .normal)
$0.configuration?.imagePadding = 0
$0.configuration?.imagePlacement = .top
$0.layer.cornerRadius = 10
}

let searchButton = UIButton(configuration: UIButton.Configuration.filled()).then{
$0.configuration?.title = "검색"
$0.configuration?.cornerStyle = .capsule
$0.configuration?.baseBackgroundColor = .primaryColor
}

//MARK: - SetupUI
override func setupUI() {
self.addSubview(typeTitle)
self.stackView.addArrangedSubview(exactlyOpenButton)
self.stackView.addArrangedSubview(openButton)
self.stackView.addArrangedSubview(closedButton)
self.stackView.addArrangedSubview(exactlyClosedButton)
self.addSubview(stackView)
self.addSubview(searchButton)
setButtonUI()
}

//MARK: - SetConstraints
override func setConstraints() {
typeTitle.snp.makeConstraints{make in
make.leading.equalToSuperview().inset(16)
make.top.equalToSuperview().inset(58)
}
stackView.snp.makeConstraints{ make in
make.leading.trailing.equalToSuperview().inset(16)
make.top.equalTo(typeTitle.snp.bottom).offset(12)
make.height.equalTo(70)
}
searchButton.snp.makeConstraints{make in
make.top.equalTo(stackView.snp.bottom).offset(26)
make.trailing.leading.equalToSuperview().inset(109)
make.height.equalTo(44)
}
}

//MARK: - Helper
func setButtonUI(){ //버튼 UI를 세팅합니다.
var container = AttributeContainer()
container.font = UIFont(name: "NotoSansKR-Regular", size: 10)
container.foregroundColor = UIColor.darkGray
self.exactlyOpenButton.configuration?.attributedTitle = AttributedString("완전 개방형", attributes: container)
self.openButton.configuration?.attributedSubtitle = AttributedString("개방형", attributes: container)
self.closedButton.configuration?.attributedSubtitle = AttributedString("폐쇄형", attributes: container)
self.exactlyClosedButton.configuration?.attributedSubtitle = AttributedString("완전 폐쇄형", attributes: container)
}
}
65 changes: 65 additions & 0 deletions Damso/Presentation/Search/SearchVC.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
//
// SearchVC.swift
// Damso
//
// Created by 문정호 on 2023/02/11.
//

import UIKit

class SearchVC: BaseVC {
//MARK: - Properties
let searchView = SearchView()
let bookmarkCell = SmokingAreaTableViewCell()
let searchTypeVC = SearchTypeVC()



//MARK: - LoadView
override func loadView(){
view = searchView
}

//MARK: - Configure
override func configure(){
searchView.tableView.delegate = self
searchView.tableView.dataSource = self
searchView.searchButton.action = #selector(setSearchType)
searchView.searchButton.target = self
searchView.tableView.register(SmokingAreaTableViewCell.self, forCellReuseIdentifier: SmokingAreaTableViewCell.identifier)
}

//MARK: - SetNavigationBar
override func setNavigationBar() {
self.navigationItem.title = "주변 흡연구역" //네비게이션바 타이틀 설정
self.navigationItem.rightBarButtonItem = searchView.searchButton // 오른쪽에 검색 버튼
self.navigationController?.navigationBar.backgroundColor = .white //네비게이션 바 배경 색 설정
}

@objc func setSearchType(){
if let sheet = searchTypeVC.sheetPresentationController { //sheet를 띄우는 방식을 컨트롤하는 컨트롤러=
// customize
sheet.detents = [ //present하는 범위를 설정
.custom { _ in
return 270 //270만큼 올림
}]
sheet.largestUndimmedDetentIdentifier = .medium
sheet.preferredCornerRadius = 20 //cornerRadius를 줌
sheet.prefersGrabberVisible = true //상단의 바를 노출시킴
}
self.present(searchTypeVC, animated: true, completion: nil)
}
}


//MARK: - Extenstion
extension SearchVC: UITableViewDelegate, UITableViewDataSource{
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 5
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = searchView.tableView.dequeueReusableCell(withIdentifier:SmokingAreaTableViewCell.identifier, for: indexPath) as? SmokingAreaTableViewCell else{ return UITableViewCell() }
return cell
}
}
Loading