title: How to wrap a horizontal UIScrollView so it works for SwiftUI
body: <p>I'm new to SwiftUI, I need to use a horizontal UIScrollView in an SwiftUI app, but I can't manage to get it to render the views properly when I tried to wrap it. The views I put inside just disappear. Is there a way to fix a wrapped UIScrollView to Horizontal scroll only?</p>
  
  <p>Here is my attempt.</p>
  
  <pre><code>struct CustomScrollView&lt;Content&gt;: UIViewRepresentable where Content : View {
      let content: () -&gt; Content
  
      init(proxy: ListScrollingProxy, @ViewBuilder content: @escaping () -&gt; Content) {
          self.content = content
  
      }
  
      func makeUIView(context: Context) -&gt; UIView {
           let hosting = UIHostingController(rootView: content())
                 let width = UIScreen.main.bounds.width
                 let size = hosting.view.sizeThatFits(CGSize(width: width, height: CGFloat.greatestFiniteMagnitude))
                 hosting.view.frame = CGRect(x: 0, y: 0, width: width, height: size.height)
                 let scrollview = UIScrollView()
  
  
                  scrollview.showsVerticalScrollIndicator = false
                  scrollview.showsHorizontalScrollIndicator = false
  
                 scrollview.addSubview(hosting.view)
                 scrollview.contentSize = CGSize(width: width, height: size.height)
  
                 return scrollview
      }
  
      func updateUIView(_ uiView: UIView, context: Context) {
  
         }
  }
  </code></pre>
  
  <p>Any help will be appreciated.</p>