0

Here is how my widget looks like:

enter image description here

and this is how it looks in code:

struct WidgetTimerEntryView : View {
    var entry: WidgetTimerEntry
    var backgroundColor: Color {
        return Color(Options.shared.currentMode.underlayBackgroundColor)
    }
    var body: some View {
        VStack(alignment: .center, spacing: 5) {
            Image(Options.shared.timerIsPaused ? "icon-play" : "icon-paused")
                .scaledToFit()
                .frame(width: 30.0, height: 30.0)
                .cornerRadius(15)
                .clipped()
        }
        .padding(.all, 10)
        .background(backgroundColor)
    }
}

Now I need the following things:

  1. Why my corner radius doesn't work?
  2. How to attach the tap event to Image without opening parent application?
  3. How to update my View?
halfer
  • 19,824
  • 17
  • 99
  • 186
Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
  • 1
    Regarding #1 - see [How to get the size of the corner radius of widget in SwiftUI?](https://stackoverflow.com/q/65654868/8697793) – pawello2222 Jan 23 '21 at 13:22
  • 1
    Regarding #2 / #3 - you can't. Similar issue: [How to prevent iOS 14 Widget opening app and react to callback](https://stackoverflow.com/q/65115917/8697793) – pawello2222 Jan 23 '21 at 13:23
  • @Bartłomiej Semańczyk Since Widget are not mini-apps. Custom user interactions are not allowed in Widget( Only deep linking with Link() ). Think like its something which project content from app being at home screen. – YodagamaHeshan Feb 02 '21 at 10:02
  • Reading #4 https://stackoverflow.com/questions/65556274/ios-add-button-to-widget-extension/66006151#66006151 – YodagamaHeshan Feb 02 '21 at 10:03

0 Answers0