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

[FEAT] 이색체험, 제주맛집 카카오맵 연결 구현 #423

Merged
merged 1 commit into from
Feb 25, 2025
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
53 changes: 53 additions & 0 deletions NanaLand/NanaLand.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@
6D6D308F2C61FAAF00002F77 /* review_restaurant.json in Resources */ = {isa = PBXBuildFile; fileRef = 6D6D308C2C61FAAF00002F77 /* review_restaurant.json */; };
6D6D30902C61FAAF00002F77 /* report_complete.json in Resources */ = {isa = PBXBuildFile; fileRef = 6D6D308D2C61FAAF00002F77 /* report_complete.json */; };
6D6D30912C61FAAF00002F77 /* review_experience.json in Resources */ = {isa = PBXBuildFile; fileRef = 6D6D308E2C61FAAF00002F77 /* review_experience.json */; };
6D711E312D6C83DF001B3DE4 /* KakaoMapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D711E302D6C83DF001B3DE4 /* KakaoMapView.swift */; };
6D711E342D6C8E98001B3DE4 /* KakaoMapController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D711E332D6C8E98001B3DE4 /* KakaoMapController.swift */; };
6D711E372D6C8EC7001B3DE4 /* KakaoMapsSDK-SPM in Frameworks */ = {isa = PBXBuildFile; productRef = 6D711E362D6C8EC7001B3DE4 /* KakaoMapsSDK-SPM */; };
6D711E3A2D6C9C0F001B3DE4 /* AddressEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D711E392D6C9C0F001B3DE4 /* AddressEndPoint.swift */; };
6D711E3C2D6C9C1B001B3DE4 /* AddressService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D711E3B2D6C9C1B001B3DE4 /* AddressService.swift */; };
6D722C062D2F6E8C006ACD8D /* NoResultFilterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D722C052D2F6E8C006ACD8D /* NoResultFilterView.swift */; };
6D76022F2CEA587B00C49EDC /* loading.json in Resources */ = {isa = PBXBuildFile; fileRef = 6D76022E2CEA587B00C49EDC /* loading.json */; };
6D7756752C8F4E190085D747 /* SearchReviewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D7756742C8F4E190085D747 /* SearchReviewView.swift */; };
Expand Down Expand Up @@ -190,6 +195,7 @@
6DCFB19E2D191F7B00A622EB /* UserInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DCFB19D2D191F7B00A622EB /* UserInfoModel.swift */; };
6DD11F422C51545C00363B08 /* TypeTestProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DD11F412C51545C00363B08 /* TypeTestProfileView.swift */; };
6DD11F442C5161E500363B08 /* ReviewArticleItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DD11F432C5161E500363B08 /* ReviewArticleItemView.swift */; };
6DF06DAF2D6D987F00465584 /* KakaoGecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DF06DAE2D6D987F00465584 /* KakaoGecoder.swift */; };
6DF18F082C6E25130021ED5B /* TestLoading.json in Resources */ = {isa = PBXBuildFile; fileRef = 6DF18F072C6E25120021ED5B /* TestLoading.json */; };
6DFF08EE2D3BFBB80052A4E3 /* LottieWithTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DFF08ED2D3BFBB80052A4E3 /* LottieWithTextView.swift */; };
9C6A9C3E2BCC1BAE000413AD /* Fonts+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C6A9C3D2BCC1BAE000413AD /* Fonts+.swift */; };
Expand Down Expand Up @@ -497,6 +503,10 @@
6D6D308C2C61FAAF00002F77 /* review_restaurant.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = review_restaurant.json; sourceTree = "<group>"; };
6D6D308D2C61FAAF00002F77 /* report_complete.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = report_complete.json; sourceTree = "<group>"; };
6D6D308E2C61FAAF00002F77 /* review_experience.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = review_experience.json; sourceTree = "<group>"; };
6D711E302D6C83DF001B3DE4 /* KakaoMapView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KakaoMapView.swift; sourceTree = "<group>"; };
6D711E332D6C8E98001B3DE4 /* KakaoMapController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KakaoMapController.swift; sourceTree = "<group>"; };
6D711E392D6C9C0F001B3DE4 /* AddressEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddressEndPoint.swift; sourceTree = "<group>"; };
6D711E3B2D6C9C1B001B3DE4 /* AddressService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddressService.swift; sourceTree = "<group>"; };
6D722C052D2F6E8C006ACD8D /* NoResultFilterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoResultFilterView.swift; sourceTree = "<group>"; };
6D76022E2CEA587B00C49EDC /* loading.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = loading.json; sourceTree = "<group>"; };
6D7756742C8F4E190085D747 /* SearchReviewView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchReviewView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -528,6 +538,7 @@
6DCFB19D2D191F7B00A622EB /* UserInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserInfoModel.swift; sourceTree = "<group>"; };
6DD11F412C51545C00363B08 /* TypeTestProfileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypeTestProfileView.swift; sourceTree = "<group>"; };
6DD11F432C5161E500363B08 /* ReviewArticleItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewArticleItemView.swift; sourceTree = "<group>"; };
6DF06DAE2D6D987F00465584 /* KakaoGecoder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KakaoGecoder.swift; sourceTree = "<group>"; };
6DF18F072C6E25120021ED5B /* TestLoading.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = TestLoading.json; sourceTree = "<group>"; };
6DFF08ED2D3BFBB80052A4E3 /* LottieWithTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LottieWithTextView.swift; sourceTree = "<group>"; };
9C6A9C3D2BCC1BAE000413AD /* Fonts+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Fonts+.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -664,6 +675,7 @@
BF85F6602CD3617A0020BDBF /* FirebaseAuth in Frameworks */,
2C80ECEA2BDAA551002F38A7 /* SwiftUICalendar in Frameworks */,
2C219B532C16FE53001F4C28 /* FirebaseRemoteConfig in Frameworks */,
6D711E372D6C8EC7001B3DE4 /* KakaoMapsSDK-SPM in Frameworks */,
BFB73BB72C05BA6A00A9A10E /* SDWebImageSwiftUI in Frameworks */,
BF85F65E2CD3614F0020BDBF /* FirebaseFirestore in Frameworks */,
2C3C75AF2BCA3C5000312F26 /* Alamofire in Frameworks */,
Expand Down Expand Up @@ -828,6 +840,7 @@
2C3C75C02BCA540200312F26 /* Networks */ = {
isa = PBXGroup;
children = (
6D711E382D6C9BFD001B3DE4 /* Address */,
BF8EF0672D07D77600A722BB /* File */,
6D799D452D1D3737003954C1 /* PreSignedUpload */,
BFC7AF282C7EDBB800432ECC /* Notification */,
Expand Down Expand Up @@ -901,6 +914,7 @@
BF0D58962C60DAE20042D6BC /* ExpandableText.swift */,
6D722C052D2F6E8C006ACD8D /* NoResultFilterView.swift */,
6D224A822D5F016F001EB871 /* PhotoModalView.swift */,
6D711E322D6C8E8C001B3DE4 /* KakaoMap */,
);
path = Component;
sourceTree = "<group>";
Expand Down Expand Up @@ -1268,6 +1282,25 @@
path = TypeTest;
sourceTree = "<group>";
};
6D711E322D6C8E8C001B3DE4 /* KakaoMap */ = {
isa = PBXGroup;
children = (
6D711E302D6C83DF001B3DE4 /* KakaoMapView.swift */,
6D711E332D6C8E98001B3DE4 /* KakaoMapController.swift */,
6DF06DAE2D6D987F00465584 /* KakaoGecoder.swift */,
);
path = KakaoMap;
sourceTree = "<group>";
};
6D711E382D6C9BFD001B3DE4 /* Address */ = {
isa = PBXGroup;
children = (
6D711E392D6C9C0F001B3DE4 /* AddressEndPoint.swift */,
6D711E3B2D6C9C1B001B3DE4 /* AddressService.swift */,
);
path = Address;
sourceTree = "<group>";
};
6D799D452D1D3737003954C1 /* PreSignedUpload */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1671,6 +1704,7 @@
BF8F85BF2C7B7BC60066432C /* FirebaseMessaging */,
BF85F65D2CD3614F0020BDBF /* FirebaseFirestore */,
BF85F65F2CD3617A0020BDBF /* FirebaseAuth */,
6D711E362D6C8EC7001B3DE4 /* KakaoMapsSDK-SPM */,
);
productName = NanaLand;
productReference = 2C3C75802BCA3ADA00312F26 /* NanaLand.app */;
Expand Down Expand Up @@ -1761,6 +1795,7 @@
2C219B4F2C16FE53001F4C28 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */,
6D0E90D62C54659900F8D686 /* XCRemoteSwiftPackageReference "MasonryStack" */,
BF0D58982C61D81F0042D6BC /* XCRemoteSwiftPackageReference "CustomAlert" */,
6D711E352D6C8EC7001B3DE4 /* XCRemoteSwiftPackageReference "KakaoMapsSDK-SPM" */,
);
productRefGroup = 2C3C75812BCA3ADA00312F26 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -1848,6 +1883,7 @@
2C9CF4DC2BFE0EA800A346E8 /* ReportInfoResultView.swift in Sources */,
BF3021EE2BDF8E9300CB3966 /* ShopDetailService.swift in Sources */,
BF06B36E2C4AADAE000E43ED /* ExperienceDetailModel.swift in Sources */,
6DF06DAF2D6D987F00465584 /* KakaoGecoder.swift in Sources */,
BF1510D82C4502F700BC2DE6 /* ExperienceMainModel.swift in Sources */,
2C2D3D552C038A54002A38AA /* LocalizedKey.swift in Sources */,
BF22B8032C460F7D0059B380 /* ExperienceService.swift in Sources */,
Expand All @@ -1868,6 +1904,7 @@
BF17B5FE2C5B261B0045B6E3 /* UserProfileMainView.swift in Sources */,
BF06B36A2C4AAD91000E43ED /* ExperienceDetailView.swift in Sources */,
BF7F7F622BE613400000F08A /* NatureService.swift in Sources */,
6D711E3A2D6C9C0F001B3DE4 /* AddressEndPoint.swift in Sources */,
2C80ECBA2BCFCCB7002F38A7 /* NetworkManager.swift in Sources */,
2C80ECD12BD4AEDE002F38A7 /* NanaNavigationBar.swift in Sources */,
BF80FDA32BFB2BEF00C5DA2D /* ProfileUpdateModel.swift in Sources */,
Expand Down Expand Up @@ -1976,6 +2013,7 @@
BFF8E9E92C045B830081C0A6 /* LanguageView.swift in Sources */,
BF138BCA2CEEFCD10013F1C0 /* HotModel.swift in Sources */,
2C2749832C09833500ECBA71 /* String+.swift in Sources */,
6D711E312D6C83DF001B3DE4 /* KakaoMapView.swift in Sources */,
6D9EDADE2C5B52DA003A8DE5 /* NoticeService.swift in Sources */,
6D130D002C788D61005FCD99 /* NewNanaPickDetailService.swift in Sources */,
2C40DB9A2BE64973007A3768 /* NanaHome.swift in Sources */,
Expand All @@ -1991,10 +2029,12 @@
BFABD3512BE7634100C3F3A6 /* FestivalModel.swift in Sources */,
BF9834182BCE700B00A5C289 /* FestivalMainView.swift in Sources */,
2C5425002BF72C3500B16439 /* TripType.swift in Sources */,
6D711E3C2D6C9C1B001B3DE4 /* AddressService.swift in Sources */,
2C3C75D12BCAAFF300312F26 /* FavoriteMainView.swift in Sources */,
BF4F6C6C2BD5560A009F070F /* NaNaPickDetailViewModel.swift in Sources */,
2C80ECAD2BCF6201002F38A7 /* SearchService.swift in Sources */,
2C9CF4E42BFEE59200A346E8 /* ArticleDetailViewType.swift in Sources */,
6D711E342D6C8E98001B3DE4 /* KakaoMapController.swift in Sources */,
6D48AA0C2C75C65E00E16429 /* NewNanaPickMainModel.swift in Sources */,
2C80ECF02BDBE44C002F38A7 /* RoundedCorners.swift in Sources */,
BFABD34F2BE75F4600C3F3A6 /* FestivalEndPoint.swift in Sources */,
Expand Down Expand Up @@ -2548,6 +2588,14 @@
minimumVersion = 0.1.0;
};
};
6D711E352D6C8EC7001B3DE4 /* XCRemoteSwiftPackageReference "KakaoMapsSDK-SPM" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/kakao-mapsSDK/KakaoMapsSDK-SPM.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 2.12.5;
};
};
BF0D58982C61D81F0042D6BC /* XCRemoteSwiftPackageReference "CustomAlert" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/divadretlaw/CustomAlert.git";
Expand Down Expand Up @@ -2627,6 +2675,11 @@
package = 6D0E90D62C54659900F8D686 /* XCRemoteSwiftPackageReference "MasonryStack" */;
productName = MasonryStack;
};
6D711E362D6C8EC7001B3DE4 /* KakaoMapsSDK-SPM */ = {
isa = XCSwiftPackageProductDependency;
package = 6D711E352D6C8EC7001B3DE4 /* XCRemoteSwiftPackageReference "KakaoMapsSDK-SPM" */;
productName = "KakaoMapsSDK-SPM";
};
BF0D58992C61D81F0042D6BC /* CustomAlert */ = {
isa = XCSwiftPackageProductDependency;
package = BF0D58982C61D81F0042D6BC /* XCRemoteSwiftPackageReference "CustomAlert" */;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "39719f64a2d469eae2495c6d8a7d0f328606b43784795304ad68ef674551f9b2",
"originHash" : "e94927db15150af0f88b444f033b8e35bdb98f0458761ee054ba429120737938",
"pins" : [
{
"identity" : "abseil-cpp-binary",
Expand Down Expand Up @@ -163,6 +163,15 @@
"version" : "2.23.0"
}
},
{
"identity" : "kakaomapssdk-spm",
"kind" : "remoteSourceControl",
"location" : "https://github.com/kakao-mapsSDK/KakaoMapsSDK-SPM.git",
"state" : {
"revision" : "d44bc7365bee88f66964a14168a42910ac092d38",
"version" : "2.12.5"
}
},
{
"identity" : "kingfisher",
"kind" : "remoteSourceControl",
Expand Down
6 changes: 6 additions & 0 deletions NanaLand/NanaLand/App/NanaLandApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import SwiftUI
import KakaoMapsSDK
import KakaoSDKCommon
import KakaoSDKAuth
import GoogleSignIn
Expand Down Expand Up @@ -57,6 +58,11 @@ class AppDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCenterDele
let gcmMessageIDKey = "gcm.message_id"

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {

// kakao sdk 최기화
SDKInitializer.InitSDK(appKey: Secrets.kakaoLoginNativeAppKey)


// 파이어 베이스 설정
FirebaseApp.configure()
// 앱 실행시 유저에게 알림 허용 권한을 받음
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "icAdressArrow.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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "icCopy.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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "logoPin.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.
70 changes: 70 additions & 0 deletions NanaLand/NanaLand/Common/Component/KakaoMap/KakaoGecoder.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//
// KakaoGecoder.swift
// NanaLand
//
// Created by wodnd on 2/25/25.
//

import Foundation
import SwiftUI

struct KakaoGeocoder {
static let apiKey = "63ebadd5e9c63cbaeca239d78b3ad4f4" // 🔴 여기에 본인의 Kakao REST API 키 입력

static func convertAddressToCoordinates(address: String, completion: @escaping (Double?, Double?) -> Void) {
let encodedAddress = address.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? ""
let urlString = "https://dapi.kakao.com/v2/local/search/address.json?query=\(encodedAddress)"

guard let url = URL(string: urlString) else {
print("❌ URL 생성 실패")
completion(nil, nil)
return
}

var request = URLRequest(url: url)
request.setValue("KakaoAK \(apiKey)", forHTTPHeaderField: "Authorization") // 🔴 API 키 추가

let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let error = error {
print("❌ 네트워크 요청 실패: \(error.localizedDescription)")
completion(nil, nil)
return
}

guard let data = data else {
print("❌ 데이터 없음")
completion(nil, nil)
return
}

do {
let decodedResponse = try JSONDecoder().decode(KakaoAddressResponse.self, from: data)

if let firstAddress = decodedResponse.documents.first {
let latitude = Double(firstAddress.y) ?? 0.0
let longitude = Double(firstAddress.x) ?? 0.0
print("✅ 변환된 좌표: \(latitude), \(longitude)")
completion(latitude, longitude)
} else {
print("❌ 주소 검색 결과 없음")
completion(nil, nil)
}
} catch {
print("❌ JSON 파싱 오류: \(error.localizedDescription)")
completion(nil, nil)
}
}

task.resume()
}
}

// 🔹 API 응답 모델
struct KakaoAddressResponse: Codable {
let documents: [KakaoAddress]
}

struct KakaoAddress: Codable {
let x: String // 경도
let y: String // 위도
}
Loading