I am trying to add lock screen widget in existing app which is having .medium widget.
The problem is as soon as I add lock screen widget on device, home screen widget getting blank. Once I remove lock screen widget from device the home screen widget showing correctly.
Here is my code for the view
struct WidgetNewEntryView : View {
var myDataEntry: DataEntry
var isnigt = getnightmodeflag()
@Environment(\.widgetFamily) var widgetType
var body: some View {
if #available(iOSApplicationExtension 16.0, *) {
switch widgetType {
case .accessoryRectangular:
getMainViewForLockScreenWidgetWith(entry: myDataEntry)
case .systemMedium:
GeometryReader { geo in
VStack (alignment: .leading) {
VStack(alignment: .leading,spacing: 0) {
// My UI Stuff
}
.padding(0)
}
}
default:
Text("No Data Available")
}
}
else {
switch widgetType {
case .systemMedium:
GeometryReader { geo in
VStack (alignment: .leading) {
VStack(alignment: .leading,spacing: 0) {
// My UI Stuff
}
.padding(0)
}
}
default:
Text("No Data Available")
}
}
}
}
Am I doing something wrong? Let me know if any more explanation needed