about summary refs log tree commit diff
path: root/modules/expo-bluesky-translate/ios/TranslateView.swift
diff options
context:
space:
mode:
Diffstat (limited to 'modules/expo-bluesky-translate/ios/TranslateView.swift')
-rw-r--r--modules/expo-bluesky-translate/ios/TranslateView.swift31
1 files changed, 31 insertions, 0 deletions
diff --git a/modules/expo-bluesky-translate/ios/TranslateView.swift b/modules/expo-bluesky-translate/ios/TranslateView.swift
new file mode 100644
index 000000000..e2886dc84
--- /dev/null
+++ b/modules/expo-bluesky-translate/ios/TranslateView.swift
@@ -0,0 +1,31 @@
+import SwiftUI
+// conditionally import the Translation module
+#if canImport(Translation)
+import Translation
+#endif
+
+struct TranslateView: View {
+  @ObservedObject var state = TranslateViewState.shared
+
+  var body: some View {
+    if #available(iOS 17.4, *) {
+      VStack {
+        UIViewRepresentableWrapper(view: UIView(frame: .zero))
+      }
+      .translationPresentation(
+        isPresented: $state.isPresented,
+        text: state.text
+      )
+    }
+  }
+}
+
+struct UIViewRepresentableWrapper: UIViewRepresentable {
+  let view: UIView
+
+  func makeUIView(context: Context) -> UIView {
+    return view
+  }
+
+  func updateUIView(_ uiView: UIView, context: Context) {}
+}