Skip to content

Commit

Permalink
feat: QRCodeWidget 구현 (TeamNADA#364)
Browse files Browse the repository at this point in the history
- 정적인 선택목록을 사용하기 때문에 StaticConfiguration 을 사용.
- image 로 UI 구현.
- 위젯 선택시 동작이 예정되어 있기 때문에 widgetURL 사용.
- QRCodeWidget 을 설명하는 내용 작성.
  • Loading branch information
hyun99999 committed Feb 6, 2023
1 parent eee4a5c commit cf8f8d6
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Widgets/WidgetsBundle/QRCodeWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,22 @@ struct QRCodeProvider: TimelineProvider {
struct QRCodeEntry: TimelineEntry {
let date: Date
}

struct QRCodeEntryView: View {
var entry: QRCodeProvider.Entry
@Environment(\.widgetFamily) var widgetFamily

var body: some View {
switch widgetFamily {
default:
Image("widgetQr")
.resizable()
.scaledToFill()
.widgetURL(URL(string: "openQRCodeWidget"))
}
}
}

struct QRCodeWidget: Widget {
let kind: String = "QRCodeWidget"

Expand All @@ -44,6 +60,9 @@ struct QRCodeWidget: Widget {
provider: QRCodeProvider()) { entry in
QRCodeEntryView(entry: entry)
}
.configurationDisplayName("QR Code 위젯")
.description("QR Code 를 인식할 수 있도록 카메라로 빠르게 접근합니다.")
}
}

struct QRCodeWidget_Previews: PreviewProvider {
Expand Down

0 comments on commit cf8f8d6

Please sign in to comment.