Skip to content
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,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x00",
"green" : "0xAA",
"red" : "0x00"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x00",
"green" : "0xAA",
"red" : "0x00"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x00",
"green" : "0x00",
"red" : "0xFF"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x00",
"green" : "0x00",
"red" : "0xFF"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x00",
"green" : "0xA5",
"red" : "0xFF"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x00",
"green" : "0xA5",
"red" : "0xFF"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
8 changes: 0 additions & 8 deletions ComfortableMove/ComfortableMove/Core/Manager/APIManager.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ class BusArrivalService {
let items = result.msgBody.itemList ?? []
Logger.log(message: "🚌 [API] Retrieved \(items.count) bus routes")

// 혼잡도 디버깅
for item in items {
Logger.log(message: "🚌 [API] Route: \(item.rtNm), congestion1: \(item.congestion1 ?? "nil"), congestion: \(item.congestion.rawValue)")
}

return items
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,41 @@ struct MsgBody: Codable {
let itemList: [BusArrivalItem]?
}

// MARK: - 버스 혼잡도
enum BusCongestion: String {
case empty = "여유"
case normal = "보통"
case crowded = "혼잡"
case unknown = ""

var color: Color {
switch self {
case .empty:
return Color("Comfort")
case .normal:
return Color("Normal")
case .crowded:
return Color("Crowded")
case .unknown:
return Color.gray
}
}

static func from(code: String?) -> BusCongestion {
guard let code = code else { return .unknown }
switch code {
case "0", "3":
return .empty
case "4":
return .normal
case "5", "6":
return .crowded
default:
return .unknown
}
}
}

// MARK: - 버스 도착 정보 아이템
struct BusArrivalItem: Codable {
let rtNm: String // 노선명 (예: "721")
Expand All @@ -132,9 +167,15 @@ struct BusArrivalItem: Codable {
let routeType: String // 노선유형 (3:간선, 4:지선 등)
let isFullFlag1: String? // 만차 여부 (0:만차아님, 1:만차)
let isLast1: String? // 막차 여부 (0:막차아님, 1:막차)
let congestion1: String? // 첫번째 버스 혼잡도 (3:여유, 4:보통, 5:혼잡)

// 버스 번호로부터 계산된 노선 유형
var busType: BusRouteType {
return BusRouteType.from(busNumber: rtNm)
}

// 혼잡도
var congestion: BusCongestion {
return BusCongestion.from(code: congestion1)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,18 @@ struct HomeView: View {
}
}

if let arrivalMsg = arrivalInfo.arrmsg1 {
Text(arrivalMsg)
.moveFont(.caption)
.foregroundColor(.gray)
HStack(spacing: 4) {
if let arrivalMsg = arrivalInfo.arrmsg1 {
Text(arrivalMsg)
.moveFont(.caption)
.foregroundColor(.gray)
}

if arrivalInfo.congestion != .unknown {
Text(arrivalInfo.congestion.rawValue)
.moveFont(.caption)
.foregroundColor(arrivalInfo.congestion.color)
}
}

if let direction = arrivalInfo.adirection {
Expand Down