Post

Replies

Boosts

Views

Activity

Reply to WidgetKit background like the system battery widget
I ran into this problem too. If you set your padding at the top or bottom too small you see the white canvas of the widget show through. I use a view background of black for instance (using below .background attached to the greatest View). I also noticed that the Preview in Xcode and the actualy rendered widget in the Simulator are not exactly the same. One can see the corners show up in the Preview but in the simulator they are gone. I think probably the only way around this is to use a padding sufficient enough to overlap those 'gaps'. which is messy. and probably a reason why Apple has some 'design' recommendations including a padding of 15px. EDIT: I just found the way to do it. You need to include Spacer() in the VStack to stretch to max size of canvas and similarly for the HStack if you are having gaps. This solved it for me...
Dec ’20