Skip to content

Commit 3f900b5

Browse files
committed
[#234] NaverMap API 샘플 코드 설계
1 parent 3e44e83 commit 3f900b5

File tree

4 files changed

+49
-21
lines changed

4 files changed

+49
-21
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//
2+
// MapViewController.swift
3+
// EATSSU
4+
//
5+
// Created by JIWOONG CHOI on 1/28/25.
6+
//
7+
8+
import UIKit
9+
10+
import EATSSUDesign
11+
12+
import NMapsMap
13+
14+
final class MapViewController: BaseViewController, NMFMapViewTouchDelegate {
15+
private var mapView: NMFMapView!
16+
17+
override func viewDidLoad() {
18+
super.viewDidLoad()
19+
20+
mapView = NMFMapView(frame: view.frame)
21+
view.addSubview(mapView)
22+
23+
let marker = NMFMarker()
24+
marker.position = NMGLatLng(lat: 37.4964, lng: 126.9575)
25+
marker.mapView = mapView
26+
27+
mapView.touchDelegate = self
28+
}
29+
}
30+
31+
extension MapViewController {
32+
func mapView(_: NMFMapView, didTapMap latlng: NMGLatLng, point _: CGPoint) {
33+
#if DEBUG
34+
print("탭: \(latlng.lat), \(latlng.lng)")
35+
#endif
36+
37+
let marker = NMFMarker()
38+
marker.position = NMGLatLng(lat: latlng.lat, lng: latlng.lng)
39+
marker.mapView = mapView
40+
}
41+
42+
func mapView(_: NMFMapView, didLongTapMap latlng: NMGLatLng, point _: CGPoint) {
43+
#if DEBUG
44+
print("롱 탭: \(latlng.lat), \(latlng.lng)")
45+
#endif
46+
}
47+
}

EATSSU/App/Sources/Presentation/Maps/ViewController/MapsViewController.swift

-20
This file was deleted.

EATSSU/App/Sources/Presentation/TabBar/RootTabBarViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class RootTabBarViewController: UITabBarController {
2727

2828
// 기존 코드 유지
2929
let homeViewController = HomeViewController()
30-
let searchViewController = MapsViewController()
30+
let searchViewController = MapViewController()
3131
let mypageViewController = MyPageViewController(hasAccessToken: RealmService.shared.isAccessTokenPresent())
3232

3333
let homeNav = UINavigationController(rootViewController: homeViewController)

EATSSU/Project.swift

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ let appInfoPlist: InfoPlist = .extendingDefault(with: [
66
"KAKAO API KEY": "$(KAKAO_API_KEY)",
77
"NMFClientId": "$(NMAP_CLIENT_ID)",
88
"GADApplicationIdentifier": "$(GADApplicationIdentifier)",
9+
"NSLocationAlwaysUsageDescription": "사용자의 위치를 받습니다.",
910
"UILaunchStoryboardName": "LaunchScreen",
1011
"CFBundleURLTypes": [
1112
[

0 commit comments

Comments
 (0)