swiftUI: Value of type ‘AVCapturePhoto’ has no member ‘livePhotoMovieFileURL’
Value of type ‘AVCapturePhoto’ has no member ‘livePhotoMovieFileURL’
SwiftUI FileDocument: Modify the default save panel
Is it possible to change the default save dialog that appears when creating a document based MacOS app in SwiftUI?
SwiftUI FileDocument: Modify the default save panel
Is it possible to change the default save dialog that appears when creating a document based MacOS app in SwiftUI?
How to fetch installed app usage data using Device Activity and Family Controls?
I’m trying to create a function in Swift that requests the authorization for the individual and fetch the screen time app usage data of all the installed apps inside iphone device for last 24 hours. I’ve added the necessary permissions and capabilities.
How to manage ViewModels used in multple SwiftUI Views with EnvironmentObject or @StateObject and @ObservedObject
I’m a little confused on when to use @StateObject
/@ObservedObject
and when to use @EnvironmentObject
. My confusing is for when the same ViewModel needs to be used in multiple views. For instance, the code below, I need to use SomeViewModel
in all four tab views. In fact, in my current app I’m injecting all my ViewModels to the @EnvironmentObjet as shown in Method 2 below, but I recenlty ran into an issue where some UI controls were not showing and realized that by removing the calls to the view models solves the issue so, I’m now wondering if @StateObject
/@ObservedObject
is the right choice but after thinking about it, the way I’m showing in Method 1, I’m creating multiple instances of the SomeViewModel
and got me wondering if I will end up running into different issues.
How to manage ViewModels used in multple SwiftUI Views with EnvironmentObject or @StateObject and @ObservedObject
I’m a little confused on when to use @StateObject
/@ObservedObject
and when to use @EnvironmentObject
. My confusing is for when the same ViewModel needs to be used in multiple views. For instance, the code below, I need to use SomeViewModel
in all four tab views. In fact, in my current app I’m injecting all my ViewModels to the @EnvironmentObjet as shown in Method 2 below, but I recenlty ran into an issue where some UI controls were not showing and realized that by removing the calls to the view models solves the issue so, I’m now wondering if @StateObject
/@ObservedObject
is the right choice but after thinking about it, the way I’m showing in Method 1, I’m creating multiple instances of the SomeViewModel
and got me wondering if I will end up running into different issues.
How to manage ViewModels used in multple SwiftUI Views with EnvironmentObject or @StateObject and @ObservedObject
I’m a little confused on when to use @StateObject
/@ObservedObject
and when to use @EnvironmentObject
. My confusing is for when the same ViewModel needs to be used in multiple views. For instance, the code below, I need to use SomeViewModel
in all four tab views. In fact, in my current app I’m injecting all my ViewModels to the @EnvironmentObjet as shown in Method 2 below, but I recenlty ran into an issue where some UI controls were not showing and realized that by removing the calls to the view models solves the issue so, I’m now wondering if @StateObject
/@ObservedObject
is the right choice but after thinking about it, the way I’m showing in Method 1, I’m creating multiple instances of the SomeViewModel
and got me wondering if I will end up running into different issues.
How to manage ViewModels used in multple SwiftUI Views with EnvironmentObject or @StateObject and @ObservedObject
I’m a little confused on when to use @StateObject
/@ObservedObject
and when to use @EnvironmentObject
. My confusing is for when the same ViewModel needs to be used in multiple views. For instance, the code below, I need to use SomeViewModel
in all four tab views. In fact, in my current app I’m injecting all my ViewModels to the @EnvironmentObjet as shown in Method 2 below, but I recenlty ran into an issue where some UI controls were not showing and realized that by removing the calls to the view models solves the issue so, I’m now wondering if @StateObject
/@ObservedObject
is the right choice but after thinking about it, the way I’m showing in Method 1, I’m creating multiple instances of the SomeViewModel
and got me wondering if I will end up running into different issues.
Upon loading a view, how do I set the value of a property based on the value of an @AppStorage property without triggering onChange?
I have a Toggle
component in my view that I want to set the value for when the view loads (based on the value of an @AppStorage
property). But I also have an onChange
method listening to the Toggle
property that I don’t want to trigger until after the view loads. I haven’t been able to get onChange to ignore that initial property set. I’ve tried using the onAppear
with flags, as well as using onInit()
and accessing UserDefaults
directly (which is always empy when onInit() fires). What am I doing wrong here?
Why does `GeometryReader` return a smaller size during window resize while the view visually retains its size?
I am using GeometryReader
in SwiftUI to track the frame of a Color.black
background. However, when I resize the window, the size retrieved from GeometryReader
(via geo.frame(in: .local)
) unexpectedly shrinks, even though the Color.black
background visually remains the correct size.