diff options
| author | Fuwn <[email protected]> | 2025-02-22 00:37:31 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-02-22 00:37:31 -0800 |
| commit | 86744226b1f423742fc9663300bd0e322807a1ee (patch) | |
| tree | 5455e957ca768fbbbaada05356340067a7dbcc21 /Sora/Other/AsyncImageWithPreview.swift | |
| parent | feat: Development commit (diff) | |
| download | sora-testing-86744226b1f423742fc9663300bd0e322807a1ee.tar.xz sora-testing-86744226b1f423742fc9663300bd0e322807a1ee.zip | |
feat: Development commit
Diffstat (limited to 'Sora/Other/AsyncImageWithPreview.swift')
| -rw-r--r-- | Sora/Other/AsyncImageWithPreview.swift | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/Sora/Other/AsyncImageWithPreview.swift b/Sora/Other/AsyncImageWithPreview.swift index c1a7188..2e29052 100644 --- a/Sora/Other/AsyncImageWithPreview.swift +++ b/Sora/Other/AsyncImageWithPreview.swift @@ -11,27 +11,6 @@ struct AsyncImageWithPreview<Placeholder: View>: View { @State private var currentOffset: CGSize = .zero @State private var finalOffset: CGSize = .zero - init( - url: URL?, - loadingStage: Binding<PostLoadingState>, - finalLoadingState: PostLoadingState = .loadingFile, - postURL: URL? = nil, - @ViewBuilder placeholder: @escaping () -> Placeholder = { - GeometryReader { geometry in - ProgressView() - .frame(width: geometry.size.width, height: geometry.size.height) - .position(x: geometry.size.width / 2, y: geometry.size.height / 2) - .padding() - } - } - ) { - self.url = url - _loadingState = loadingStage - self.finalLoadingState = finalLoadingState - self.postURL = postURL - self.placeholder = placeholder - } - var body: some View { GeometryReader { geometry in AsyncImage(url: url) { image in @@ -167,4 +146,25 @@ struct AsyncImageWithPreview<Placeholder: View>: View { } } } + + init( + url: URL?, + loadingStage: Binding<PostLoadingState>, + finalLoadingState: PostLoadingState = .loadingFile, + postURL: URL? = nil, + @ViewBuilder placeholder: @escaping () -> Placeholder = { + GeometryReader { geometry in + ProgressView() + .frame(width: geometry.size.width, height: geometry.size.height) + .position(x: geometry.size.width / 2, y: geometry.size.height / 2) + .padding() + } + } + ) { + self.url = url + _loadingState = loadingStage + self.finalLoadingState = finalLoadingState + self.postURL = postURL + self.placeholder = placeholder + } } |