Skip to content

Commit

Permalink
[Add] #259 위젯 관련 plist 추가 및 Entry distance type 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
isakatty committed May 5, 2024
1 parent 767635d commit fa12486
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Projects/App/Widget/NearByStop/NearByStopEntry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import WidgetKit
struct NearByStopEntry: TimelineEntry {
let date: Date
let busStopName: String
let distance: Int
let distance: String
}

#if DEBUG
extension NearByStopEntry {
static let mock: Self = .init(
date: .now,
busStopName: "강남역 2호선",
distance: 20
distance: "20m"
)
}
#endif
19 changes: 10 additions & 9 deletions Projects/App/Widget/NearByStop/NearByStopProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct NearByStopProvider: TimelineProvider {
NearByStopEntry(
date: .now,
busStopName: "강남역 2호선",
distance: 60
distance: "60m"
)
}

Expand All @@ -41,7 +41,7 @@ struct NearByStopProvider: TimelineProvider {
NearByStopEntry(
date: .now,
busStopName: "강남역 2호선",
distance: 60
distance: "60m"
)
)
}
Expand All @@ -54,14 +54,15 @@ struct NearByStopProvider: TimelineProvider {

useCase.updateNearByStop()
.subscribe(onNext: { response, distance in
var entries: [NearByStopEntry] = []

entries.append(NearByStopEntry(
date: .now,
busStopName: response.busStopName,
distance: Int(distance) ?? 0
))

var entries: [NearByStopEntry] = [
NearByStopEntry(
date: .now,
busStopName: response.busStopName,
distance: distance
)
]

// 데이터 업데이트를 위한 타임라인 생성
let timeline = Timeline(
entries: entries,
Expand Down
2 changes: 1 addition & 1 deletion Projects/App/Widget/NearByStop/View/NearByStopView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct NearByStopView: View {
bottom: -3,
trailing: 0
))
Text("\(entry.distance)m")
Text("\(entry.distance)")
.foregroundStyle(
DesignSystemAsset.blueBus.swiftUIColor
)
Expand Down
Binary file added graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fa12486

Please sign in to comment.