about summary refs log tree commit diff
path: root/modules/expo-bluesky-translate/ios/TranslateView.swift
blob: e2886dc844787efd2dd6c9be46503e0c1c663f34 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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) {}
}