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

๐Ÿ”€ :: [#50] ๊ฒŒ์‹œ๋ฌผ ์ƒ์„ธํŽ˜์ด์ง€ ํผ๋ธ”๋ฆฌ์‹ฑ #51

Merged
merged 6 commits into from
Nov 11, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "PostTestImage.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"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" : [
{
"filename" : "grayleftbutton.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"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" : [
{
"filename" : "grayrightbutton.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"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" : [
{
"filename" : "แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2024-11-11 แ„‹แ…ฉแ„’แ…ฎ 4.14.24.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"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.
7 changes: 6 additions & 1 deletion Projects/App/Sources/Application/ExpoApp.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import SwiftUI
import KakaoMapsSDK

@main
struct ExpoApp: App {
var body: some Scene {
WindowGroup {
SigninView(viewModel: AuthViewModel())
PostDetailView()
.onAppear {
let appKey = Bundle.main.object(forInfoDictionaryKey: "KAKAO_NATIVE_APP_KEY") as? String ?? ""
SDKInitializer.InitSDK(appKey: appKey)
}
}
}
}
64 changes: 64 additions & 0 deletions Projects/App/Sources/DesignSystem/Button/ExpoOutLineButton.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//
// ExpoOutLineButton.swift
// Expo-iOS
//
// Created by ์„œ์ง€์™„ on 11/11/24.
// Copyright ยฉ 2024 SchoolofCompany. All rights reserved.
//


import SwiftUI

public struct ExpoOutLineButton: View {
var text: String
var horizontalPadding: CGFloat
var verticalPadding: CGFloat
var backColor: Color
var action: () -> Void

@State private var isPressed = false

public init(
text: String,
horizontalPadding: CGFloat = 16,
verticalPadding: CGFloat = 8,
backColor: Color,
action: @escaping () -> Void = {}
) {
self.text = text
self.horizontalPadding = horizontalPadding
self.verticalPadding = verticalPadding
self.backColor = backColor
self.action = action
}

public var body: some View {
Button(action: {
self.action()
}) {
Text(text)
.expoFont(.body2B)
.expoColor(ExpoColor.main)
.padding(.horizontal, horizontalPadding)
.padding(.vertical, verticalPadding)
.background(
RoundedRectangle(cornerRadius: 6)
.fill(backColor)
)
.overlay(
RoundedRectangle(cornerRadius: 6)
.stroke(ExpoColor.main.swiftUIColor, lineWidth: 1)
)
.scaleEffect(isPressed ? 0.9 : 1.0)
}
.buttonStyle(PlainButtonStyle())
.gesture(
DragGesture(minimumDistance: 0)
.onChanged { _ in self.isPressed = true }
.onEnded { _ in
self.isPressed = false
self.action()
}
)
}
}
50 changes: 15 additions & 35 deletions Projects/App/Sources/Extension/KakaoMapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct KakaoMapView: UIViewRepresentable {
if let location {
defaultPosition = MapPoint(longitude: location.locationX, latitude: location.locationY)
} else {
defaultPosition = MapPoint(longitude: 126.978365, latitude: 37.566691)
defaultPosition = MapPoint(longitude: 126.978365, latitude: 37.566691) // Default position: Seoul
}
let mapviewInfo = MapviewInfo(viewName: "mapview", viewInfoName: "map", defaultPosition: defaultPosition)

Expand All @@ -106,32 +106,9 @@ struct KakaoMapView: UIViewRepresentable {
}
view.viewRect = container?.bounds ?? .zero

createLabelLayer()
createPois()
}

func createLabelLayer() {
guard let controller else {
print("Controller is nil in createLabelLayer")
return
}

guard let view = controller.getView("mapview") as? KakaoMap else {
print("view is nil or not KakaoMap type in createLabelLayer")
return
}

let manager = view.getLabelManager()
let layerOption = LabelLayerOptions(
layerID: "PoiLayer",
competitionType: .none,
competitionUnit: .symbolFirst,
orderType: .rank,
zOrder: 0
)
let _ = manager.addLabelLayer(option: layerOption)
}

func createPois() {
print("createPois")
guard let view = controller?.getView("mapview") as? KakaoMap else {
Expand All @@ -140,27 +117,30 @@ struct KakaoMapView: UIViewRepresentable {
}
let manager = view.getLabelManager()
let layer = manager.getLabelLayer(layerID: "PoiLayer")
let poiOption = PoiOptions(styleID: "PerLevelStyle")
let poiOption = PoiOptions(styleID: "DefaultStyle")
poiOption.rank = 0

let poi1: Poi?
// ์ƒ์„ฑํ•  POI ๊ฐ์ฒด๋ฅผ ์—ฌ๊ธฐ์„œ ์ถ”๊ฐ€
var poi: Poi?
if let location {
poi1 = layer?.addPoi(
poi = layer?.addPoi(
option: poiOption,
at: MapPoint(longitude: location.locationX, latitude: location.locationY)
)
print("location on")
print("Location set")
} else {
poi1 = layer?.addPoi(option: poiOption, at: MapPoint(longitude: 126.978365, latitude: 37.566691))
print("default location")
poi = layer?.addPoi(
option: poiOption,
at: MapPoint(longitude: 126.978365, latitude: 37.566691)
)
print("Default location set")
}

guard let poi1 else {
if let poi {
poi.show()
} else {
print("Failed to create POI")
return
}

poi1.show()
}

func containerDidResized(_ size: CGSize) {
Expand All @@ -171,7 +151,7 @@ struct KakaoMapView: UIViewRepresentable {
mapView.viewRect = CGRect(origin: .zero, size: size)
if first {
let cameraUpdate = CameraUpdate.make(
target: MapPoint(longitude: 126.978365, latitude: 37.566691),
target: MapPoint(longitude: location?.locationX ?? 126.978365, latitude: location?.locationY ?? 37.566691),
mapView: mapView
)
mapView.moveCamera(cameraUpdate)
Expand Down
Loading
Loading