I have a LockedCameraCapture extension working well, however there is one situation I cannot find a solution to. If the user has not yet provided camera access permission then the main app will be launched rather than the LockedCameraCapture extension. I cannot find a mechanism by which my main app can detect that this was the reason for the launch and thereby request permission.
When the button is pressed from the control center without permission the app is run and the CameraCaptureIntent is called so I can prompt the user from there. However, as best I can tell the CameraCaptureIntent is not called when launched from a locked Lock Screen, the app is simply opened.
My app has a variety of functions, most of which do not involve the camera so I cannot just always prompt the user for camera access on open. Is there any mechanism by which my main app can detect it was launched for this reason so it could ask for permission? Thank you!
Post
Replies
Boosts
Views
Activity
I am trying to implement a variable configuration for my WidgetBundle. For example, I would like to have a widget only available for certain customers. The general idea would be some like this like:
@main
struct Widgets: WidgetBundle {
@WidgetBundleBuilder
var body: some Widget {
if Membership.active? {
WidgetA()
WidgetB()
WidgetPremium()
} else {
WidgetA()
WidgetB()
}
}
}
I realize that this particular syntax is invalid, but I've tried all manner of Function builder syntaxes I could think of to make something like this work but haven't been able to get any to work for widgets. In SwiftUI we have the conditional function builders, but I can't quite discover if they don't exist here or I'm just missing them.
Is this type of configurability possible? Thank you!
I'm trying to mask a view displayed inside of the widget to a shape that matches the overall shape. This seems like a perfect place to use the new ContainerRelativeShape() API.
It seems to work fine if I use it in a .background call but doesn't seem to work if I use it as a .clipShape for my subviews. Here is a simplified example showing what I'm doing. This results in a blue rectangle, rather than a blue round rect as I was hoping for.
struct InsetView: View {
var body: some View {
VStack {
Text("Top")
Text("Bottom")
}
.frame(maxWidth:.infinity, maxHeight: .infinity)
.background(Color.blue)
.padding(10)
.clipShape(ContainerRelativeShape())
}
}
Is this expected behavior, a bug or am I just using this API incorrectly? Any pointers would be great appreciated.
I am unable to use the .background(ContainerRelativeShape().fill(Color.blue)) approach because the backgrounds of my content are dynamic and so cannot easily be shared across the entire VStack.
This is in iOS 14, Beta 1.