3,774 questions
0 votes
1 answer
120 views
LockedCameraCaptureExtension and Sharing User Preferences
I have the main app that saves preferences to UserDefaults.standard. So I have this one preference that the user is able to toggle - isRawOn UserDefaults.standard.set(self.isRawOn, forKey: "...
0 votes
2 answers
77 views
Unable to reset user default text within a set cell:
This is my code: class WeatherFeatures: UIViewController, UITextViewDelegate, WeatherManagerDelegate { let date1ForTableView = UserDefaults.standard let low1ForTableView = UserDefaults....
0 votes
1 answer
72 views
UserDefaults suites ("standard" and "custom") overlapping - the keys appear in both?
I'm currently working on a Swift project where I register default values to two different UserDefaults suites: the standard suite and a custom suite. However, I'm seeing an unexpected (potentially ...
0 votes
1 answer
241 views
Understanding the relationship between suiteName and App Groups
Background I'm developing a macOS applications that consists of a plugin and main application. I would like for both targets to be able to share the same settings. I want to manipulate my settings ...
0 votes
1 answer
158 views
API available to Swift that provides the Apple ID associated with the current macOS user?
Is there any API available to Swift that provides the name (which should be an email address, AFAIK) of the Apple ID associated with the current macOS user? The following command line seems to provide ...
1 vote
1 answer
142 views
Is it possible to throw an exception with subscript?
I have written code below in Swift 5.10 to store and retrieve Codable data from UserDefaults by giving key value in the subscript, but there is some compile time error: Expected '->' for subscript ...
0 votes
0 answers
86 views
Swift String Parser semicolon issues
i want to create an app that allows the user to edit user defaults which makes it free to silence the annoying update warnings but I have ran into an issue. The code should take a string and print a ...
0 votes
0 answers
171 views
Using Jamf to security write new configuration to managed application
I've learned that it's possible to inject new configuration to MDM managed application using MDM so that the managed app configuration changes that are pushed down from an MDM server appear in ...
0 votes
0 answers
63 views
How to update userdefaults in another viewController once it is saved in a different viewController without overwriting the first one
This is my User struct. struct User: Codable { let uid: String? let name: String? var profileImageUrl: String? var bookmarkedRecipes: [String]? // This could be an array of recipe IDs....
0 votes
1 answer
94 views
Can NSUserDefaults work across different code bases?
I am trying to share data between an objective c iOS appliation and a c# xamarin forms application using app groups. I am setting up the initial data in the objective c project and passing the data ...
0 votes
0 answers
72 views
How to bind @Published variable value to @propertyWrapper in SwiftUI
I want to make variable user @Published, but then i get error: 'nil' is not compatible with expected argument type 'Published<UserLoginOutput.Response.Data? import Foundation protocol ...
3 votes
2 answers
2k views
iOS 17 - UserDefaults getting cleared on relaunching the app
works good on iOS 16 and prior, but on iOS 17, User Defaults gets cleared. I don't use Data Protection Entitlement. I use app groups, and tried both UserDefaults.standard and UserDefaults(suiteName:&...
1 vote
1 answer
485 views
Overriding UserDefaults with XCUIApplication.launchArguments ignores all future updates to that key, so how do I test it?
I can successfully override the UserDefaults value by setting it with XCUIApplication.launchArguments. But based on this link and the behavior I've noticed, once I override the UserDefaults value all ...
0 votes
0 answers
78 views
UserDefault: Is there any solution to add Favorited Movies into UserDefault
the project is like this, i have a button of adding a movie into Favorited Movies page, and the user can delete the movie (.onDelete). but, the thing here is that whenever i delete the Movie from ...
0 votes
1 answer
145 views
Clear unused UserDefaults key values from app
I am currently working on app which has been there since last few years. In the app, there is some cache stored as UserDefaults whose keys have now been removed from the code. So i want to clear those ...