yaps/YAPS/YAPS/Struct/YapsFileCell.swift

44 lines
1.2 KiB
Swift

//
// YapsFileCell.swift
// YAPS
//
// Created by Gerrit Linnemann on 08.08.20.
// Copyright © 2020 Adawim UG (haftungsbeschränkt). All rights reserved.
//
import Foundation
import SwiftUI
struct YapsFileCell: View {
@State var focused: Bool
@State var yapsFile : YapsFile
var body: some View {
Group {
HStack {
// Icon
FinderHelper.shared.getImageByFiletype(file: yapsFile.file).resizable().frame(width: 20, height: 25)
VStack(alignment: .leading) {
// Dateiname
Text("\(yapsFile.name)")
.foregroundColor(self.focused ? .blue : .primary)
.multilineTextAlignment(.leading)
.lineLimit(1)
.aspectRatio(contentMode: .fill)
// Details
Text(
MiscHelper.shared.dateFormatDefault(inDate: FinderHelper.shared.getFileAttributes(yapsFile: yapsFile)[FileAttributeKey.creationDate] as! Date)
)
.font(.footnote)
.foregroundColor(.secondary)
.multilineTextAlignment(.leading)
.lineLimit(1)
.aspectRatio(contentMode: .fill)
}
}
}
}
}