Skip to content

Commit

Permalink
Merge pull request #51 from School-of-Company/50-PostDetail-Publishing
Browse files Browse the repository at this point in the history
🔀 :: [#50] 게시물 상세페이지 퍼블리싱
  • Loading branch information
Xixn2 authored Nov 11, 2024
2 parents 78054ce + dd8d035 commit bdf9ae5
Show file tree
Hide file tree
Showing 15 changed files with 370 additions and 47 deletions.
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

0 comments on commit bdf9ae5

Please sign in to comment.