Skip to content

Commit d3aaa31

Browse files
authored
Merge pull request #36 from wmorgue/userdefaults
Translation for UserDefaults article
2 parents d4c6d85 + 4322c66 commit d3aaa31

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

.yaspellerrc.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"RoundedProgressViewStyle",
6060
"inGracePeriod",
6161
"AppStore",
62+
"AppGroup",
6263
"willAutoRenew",
6364
"autoRenewPreference",
6465
"expirationReason",
@@ -90,6 +91,7 @@
9091
"DnD",
9192
"LibraryContentProvider",
9293
"UserProfileLibrary",
94+
"UserDefaults",
9395
"titleEdgeInsets",
9496
"SparrowKit",
9597
"imageEdgeInsets",

en/meta/articles.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,17 @@
8989
],
9090
"updated_date": "11.02.2022",
9191
"added_date": "11.02.2022"
92+
},
93+
"how-to-delete-userdefaults-on-macos-catalyst" : {
94+
"title" : "How to clean up UserDefaults for Mac Catalyst",
95+
"description" : "How to remove data for Catalyst application including AppGroup, Realm and UserDefaults.",
96+
"category" : "development",
97+
"author" : "ivanvorobei",
98+
"keywords" : [
99+
"UserDefaults",
100+
"Catalyst"
101+
],
102+
"updated_date" : "14.02.2022",
103+
"added_date" : "14.02.2022"
92104
}
93105
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
To reset a macOS Catalyst application you need to know the name of the user folder, the application bundle, the AppGroup, and the suit for UserDefaults (if you use it). In the tutorial I will use the following examples:
2+
3+
User folder `ivanvorobei`, app bundle `by.ivanvorobei.apps.debts`, AppGroup identifier `group.by.ivanvorobei.apps.debts`.
4+
5+
Be careful to use the values from your application.
6+
7+
## Clean up UserDefaults
8+
9+
If you want to delete the default `UserDefaults` open a terminal and enter the command:
10+
11+
```swift
12+
// Delete `UserDefaults` completely
13+
defaults delete by.ivanvorobei.apps.debts
14+
15+
// Delete from `UserDefaults` by key
16+
defaults delete by.ivanvorobei.apps.debts key
17+
```
18+
19+
For custom domain use the following command:
20+
21+
```swift
22+
// Created like this
23+
// UserDefaults(suiteName: "Custom")
24+
defaults delete suit.name
25+
```
26+
27+
## AppGroup
28+
29+
If you use an `AppGroup` you need to delete the following folders:
30+
31+
```swift
32+
/Users/ivanvorobei/Library/Group Containers/group.by.ivanvorobei.apps.debts
33+
/Users/ivanvorobei/Library/Application Scripts/group.by.ivanvorobei.apps.debts
34+
```
35+
36+
If you store in the default path, it will be the following directory:
37+
38+
```swift
39+
/Users/ivanvorobei/Library/Containers/by.ivanvorobei.apps.debts
40+
```
41+
42+
## Realm mobile database
43+
44+
The `Realm` database files are stored as regular files. They are either in the AppGroup or in the default directory. By performing the steps above, the database will be deleted.
45+
46+
## Other directories
47+
48+
I found more folders, but I don't know what they are for. I will leave the paths here:
49+
50+
```swift
51+
/Users/ivanvorobei/Library/Application Scripts/group.by.ivanvorobei.apps.debts
52+
/Users/ivanvorobei/Library/Developer/Xcode/Products/by.ivanvorobei.apps.debts (macOS)
53+
```
54+
55+
If you know what they are for or know more folders, let me know - I'll update the tutorial.

0 commit comments

Comments
 (0)