blob: 97e311ce3b0d4414197c99dde9a73e18278e294c (
plain) (
blame)
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
|
import SwiftUI
struct PostView: View {
let post: MoebooruPost
var softLimit: CGFloat
var thumbnailMode: PostThumbnailMode = .preview
private var thumbnailURL: URL? {
switch thumbnailMode {
case .preview:
return post.previewURL
case .sample:
return post.sampleURL
case .file:
return post.fileURL
}
}
var body: some View {
VStack {
AsyncImage(url: thumbnailURL) { image in
image
.resizable()
.scaledToFit()
} placeholder: {
ProgressView()
}
.frame(width: softLimit, height: softLimit)
}
}
}
|