-
Notifications
You must be signed in to change notification settings - Fork 1
/
AppListView.txt
38 lines (35 loc) · 1.21 KB
/
AppListView.txt
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
import SwiftUI
struct AppListView: View {
@ObservedObject var viewModel: FileManagerViewModel
var body: some View {
List(viewModel.installedApps) { app in
HStack {
if let appIcon = app.appIcon {
Image(uiImage: appIcon)
.resizable()
.frame(width: 40, height: 40)
.clipShape(RoundedRectangle(cornerRadius: 8))
} else {
Image(systemName: "app.fill")
.resizable()
.frame(width: 40, height: 40)
.clipShape(RoundedRectangle(cornerRadius: 8))
}
VStack(alignment: .leading) {
Text(app.appName)
.font(.headline)
Text(app.bundleIdentifier)
.font(.subheadline)
.foregroundColor(.gray)
}
}
}
.navigationTitle("Installed Apps")
}
}
struct AppListView_Previews: PreviewProvider {
static var previews: some View {
let viewModel = FileManagerViewModel()
AppListView(viewModel: viewModel)
}
}