7
7
8
8
import SwiftUI
9
9
import OpenAI
10
- import SafariServices
11
10
12
11
public struct ImageCreationView : View {
13
12
@ObservedObject var store : ImageStore
14
13
15
14
@State private var prompt : String = " "
16
15
@State private var n : Int = 1
17
16
@State private var size : String
18
- @State private var showSafari = false
19
17
20
18
private var sizes = [ " 256x256 " , " 512x512 " , " 1024x1024 " ]
21
19
@@ -61,14 +59,8 @@ public struct ImageCreationView: View {
61
59
ForEach ( $store. images, id: \. self) { image in
62
60
let urlString = image. wrappedValue. url
63
61
if let imageURL = URL ( string: urlString) , UIApplication . shared. canOpenURL ( imageURL) {
64
- Button {
65
- showSafari. toggle ( )
66
- } label: {
67
- Text ( urlString)
68
- . foregroundStyle ( . foreground)
69
- } . fullScreenCover ( isPresented: $showSafari, content: {
70
- SafariView ( url: imageURL)
71
- } )
62
+ LinkPreview ( previewURL: imageURL)
63
+ . aspectRatio ( contentMode: . fit)
72
64
} else {
73
65
Text ( urlString)
74
66
. foregroundStyle ( . secondary)
@@ -81,13 +73,3 @@ public struct ImageCreationView: View {
81
73
. navigationTitle ( " Create Image " )
82
74
}
83
75
}
84
-
85
- private struct SafariView : UIViewControllerRepresentable {
86
- var url : URL
87
-
88
- func makeUIViewController( context: UIViewControllerRepresentableContext < SafariView > ) -> SFSafariViewController {
89
- SFSafariViewController ( url: url)
90
- }
91
-
92
- func updateUIViewController( _ safariViewController: SFSafariViewController , context: UIViewControllerRepresentableContext < SafariView > ) { }
93
- }
0 commit comments