-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFilePermissionView.swift
44 lines (37 loc) · 1.3 KB
/
FilePermissionView.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// FilePermissionView.swift
//
// Created by Speedyfriend67 on 30.06.24
//
// FilePermissionView.swift
//
// Created by Speedyfriend67 on 30.06.24
//
import SwiftUI
struct FilePermissionView: View {
@ObservedObject var viewModel: FileManagerViewModel
let fileURL: URL
var body: some View {
let metadata = viewModel.getFileMetadata(at: fileURL)
return List {
Section(header: Text("File Metadata")) {
Text("Name: \(metadata.name)")
Text("Size: \(metadata.size)")
Text("Creation Date: \(metadata.creationDate)")
Text("Modification Date: \(metadata.modificationDate)")
}
Section(header: Text("File Permissions")) {
ForEach(FilePermission.allCases, id: \.self) { permission in
HStack {
Text(permission.rawValue)
Spacer()
Image(systemName: viewModel.isPermissionGranted(for: fileURL, permission: permission) ? "checkmark.square" : "square")
.onTapGesture {
viewModel.toggleFilePermission(at: fileURL, permission: permission)
}
}
}
}
}
}
}