From 5e1e3faf093d19b1b2aafa41590fc4681b1e5f04 Mon Sep 17 00:00:00 2001 From: Doraemoe Date: Sat, 1 Jun 2024 22:43:27 +1000 Subject: [PATCH] rollback to sync load image (#218) --- LANreader/Page/PageImageV2.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/LANreader/Page/PageImageV2.swift b/LANreader/Page/PageImageV2.swift index 25bf0d6..553a3f4 100644 --- a/LANreader/Page/PageImageV2.swift +++ b/LANreader/Page/PageImageV2.swift @@ -229,12 +229,14 @@ struct PageImageV2: View { return store.path } }() - AsyncImage(url: contentPath) { image in - image + // if use UIImage(contentsOfFile:) directly, IOSurface creation failed warning may happen + // Same thing happens in ImageService + if let imageData = try? Data(contentsOf: contentPath!), let uiImage = UIImage(data: imageData) { + Image(uiImage: uiImage) .resizable() .aspectRatio(contentMode: .fit) .draggableAndZoomable(contentSize: geometrySize) - } placeholder: { + } else { Image(systemName: "rectangle.slash") .frame(height: geometrySize.height) }