-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
LockScreenUnconfiguredView.swift
39 lines (35 loc) · 1.14 KB
/
LockScreenUnconfiguredView.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import SwiftUI
import WidgetKit
@available(iOS 16.0, *)
struct LockScreenUnconfiguredView: View {
@Environment(\.widgetFamily) var family: WidgetFamily
let viewModel: LockScreenUnconfiguredViewModel
var body: some View {
if family == .accessoryRectangular {
ZStack {
Text(viewModel.message)
.font(.system(size: 11))
.minimumScaleFactor(0.8)
.multilineTextAlignment(.center)
}
.removableWidgetBackground()
} else {
Text("Not implemented for widget family \(family.debugDescription)")
.removableWidgetBackground()
}
}
}
@available(iOS 16.0, *)
struct LockScreenUnconfiguredView_Previews: PreviewProvider {
static let viewModel = LockScreenUnconfiguredViewModel(
message: "Log in to Jetpack to see today's stats."
)
static var previews: some View {
LockScreenUnconfiguredView(
viewModel: LockScreenUnconfiguredView_Previews.viewModel
)
.previewContext(
WidgetPreviewContext(family: .accessoryRectangular)
)
}
}