File tree Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ func loadImage(for entry: Entry) -> UIImage? {
14
14
15
15
struct LibraryView : View {
16
16
let library : Library
17
- let columns : [ GridItem ]
18
17
19
18
@State private var showTagManager : Bool = false
20
19
@@ -23,22 +22,19 @@ struct LibraryView: View {
23
22
24
23
init ( library: Library ) {
25
24
self . library = library
26
- if UIDevice . current. userInterfaceIdiom == . phone {
27
- self . columns = LibraryView . columnsPhone
28
- } else {
29
- self . columns = LibraryView . columnsPad
30
- }
31
25
}
32
26
33
27
var body : some View {
34
- ScrollView {
35
- LazyVGrid ( columns: columns) {
36
- ForEach ( library. safeGetEntries ( ) , id: \. path) { entry in
37
- GridRow {
38
- EntryMiniView ( entry: entry)
28
+ GeometryReader { geometry in
29
+ ScrollView {
30
+ LazyVGrid ( columns: geometry. size. width < 600 ? LibraryView . columnsPhone : LibraryView . columnsPad) {
31
+ ForEach ( library. safeGetEntries ( ) , id: \. path) { entry in
32
+ GridRow {
33
+ EntryMiniView ( entry: entry)
34
+ }
39
35
}
40
- }
41
- } . padding ( 16 )
36
+ } . padding ( 16 )
37
+ }
42
38
}
43
39
. toolbar {
44
40
ToolbarItem ( placement: . navigationBarTrailing) {
You can’t perform that action at this time.
0 commit comments