Skip to content

Commit 31cd536

Browse files
bug fix and additional folder
1 parent 4b94a45 commit 31cd536

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

IconChanger/SettingView.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct APISettingView: View {
3939

4040
struct OtherFolderView: View {
4141
@State var add = false
42-
@State var folders = UserDefaults.standard.object(forKey: "addition") as? [URL] ?? [URL]()
42+
@State var folders = [URL]()
4343

4444
var body: some View {
4545
VStack {
@@ -60,6 +60,11 @@ struct OtherFolderView: View {
6060
.padding()
6161
}
6262
.padding()
63+
.onAppear {
64+
if let data = UserDefaults.standard.data(forKey: "addition"), let folders = try? JSONDecoder().decode([URL].self, from: data) {
65+
self.folders = folders
66+
}
67+
}
6368
.fileImporter(isPresented: $add, allowedContentTypes: [.folder]) { result in
6469
switch result{
6570
case .success(let url):

0 commit comments

Comments
 (0)