feat: 新增图片预览功能与现代图片选择组件

- 在EditFeedView中集成ImagePreviewPager,支持全屏图片预览。
- 更新ModernImageSelectionGrid,添加图片点击事件以触发预览。
- 移除冗余的PhotosUI导入,优化代码结构。
This commit is contained in:
edwinQQQ
2025-07-22 18:20:21 +08:00
parent 2a02553015
commit fd6e44c6f9
2 changed files with 42 additions and 5 deletions

View File

@@ -0,0 +1,29 @@
import SwiftUI
struct ImagePreviewPager: View {
let images: [UIImage]
@Binding var currentIndex: Int
let onClose: () -> Void
var body: some View {
ZStack(alignment: .topTrailing) {
Color.black.ignoresSafeArea()
TabView(selection: $currentIndex) {
ForEach(images.indices, id: \Int.self) { idx in
Image(uiImage: images[idx])
.resizable()
.aspectRatio(contentMode: .fit)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.black)
.tag(idx)
}
}
.tabViewStyle(PageTabViewStyle(indexDisplayMode: .always))
Button(action: { onClose() }) {
Image(systemName: "xmark.circle.fill")
.font(.system(size: 32))
.foregroundColor(.white)
.padding(24)
}
}
}
}