-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Merge] #319 - 위경도로 식당 상세 지도 및 주소 띄우기
- Loading branch information
Showing
22 changed files
with
452 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
Hankkijogbo/Hankkijogbo/Network/NaverMap/DTO/Response/GetHankkiAddressResponseDTO.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// | ||
// GetHankkiAddressResponseDTO.swift | ||
// Hankkijogbo | ||
// | ||
// Created by 서은수 on 12/30/24. | ||
// | ||
|
||
import Foundation | ||
|
||
// MARK: - Naver Reverse Geocoding API Res | ||
|
||
struct ReverseGeocodingBaseDTO: Decodable { | ||
let code: Int | ||
let name: String | ||
let message: String | ||
} | ||
|
||
struct GetHankkiAddressResponseDTO: Decodable { | ||
let status: ReverseGeocodingBaseDTO | ||
let results: [GetHankkiAddressResult?] | ||
} | ||
|
||
struct GetHankkiAddressResult: Decodable { | ||
let region: Region? | ||
let land: Land? | ||
} | ||
|
||
struct Region: Decodable { | ||
let area1: Area1? | ||
let area2, area3, area4: Area? | ||
} | ||
|
||
struct Area1: Decodable { | ||
let name, alias: String? | ||
} | ||
|
||
struct Area: Decodable { | ||
let name: String? | ||
} | ||
|
||
struct Land: Decodable { | ||
let name: String? | ||
let number1, number2: String? | ||
} |
38 changes: 38 additions & 0 deletions
38
Hankkijogbo/Hankkijogbo/Network/NaverMap/NaverMapAPIService.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// NaverMapAPIService.swift | ||
// Hankkijogbo | ||
// | ||
// Created by 서은수 on 12/30/24. | ||
// | ||
|
||
import Foundation | ||
|
||
import Moya | ||
|
||
protocol NaverMapAPIServiceProtocol { | ||
func getHankkiAddress(latitude: Double, longitude: Double, completion: @escaping(NetworkResult<GetHankkiAddressResponseDTO>) -> Void) | ||
} | ||
|
||
final class NaverMapAPIService: BaseAPIService, NaverMapAPIServiceProtocol { | ||
|
||
private let provider = MoyaProvider<NaverMapTargetType>(plugins: [MoyaPlugin.shared]) | ||
|
||
func getHankkiAddress( | ||
latitude: Double, | ||
longitude: Double, | ||
completion: @escaping (NetworkResult<GetHankkiAddressResponseDTO>) -> Void) { | ||
provider.request(.getHankkiAddress(latitude: latitude, longitude: longitude)) { result in | ||
switch result { | ||
case .success(let response): | ||
let networkResult: NetworkResult<GetHankkiAddressResponseDTO> = self.fetchNetworkResult(statusCode: response.statusCode, data: response.data) | ||
print(networkResult) | ||
completion(networkResult) | ||
case .failure(let error): | ||
if let response = error.response { | ||
let networkResult: NetworkResult<GetHankkiAddressResponseDTO> = self.fetchNetworkResult(statusCode: response.statusCode, data: response.data) | ||
completion(networkResult) | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.