Monday, January 29, 2024
HomeiOS Developmentios - SwiftUI HStack clipping subviews

ios – SwiftUI HStack clipping subviews


I’m attempting to implement a video scrubber/trimmer in SwiftUI. To do that, put picture thumbnails in an HStack as follows:

struct ThumbnailsView: View {
  @State personal var thumbImages:[ThumbImage] = []

   var physique: some View {
       ForEach(thumbImages, id: .time) { thumbImage in
           Picture(uiImage: thumbImage.picture)
              .border(Coloration.white, width: 5)
       }
       .padding(5)
    }
 }

 struct ThumbImage {
   var time: CMTime
   let picture: UIImage
 }

This could mainly enable to assemble sequence of photos within the scrubber/trimmer (like in Pictures app). Nonetheless, my requirement (which is totally different from habits in Pictures app) is that as person trims from both finish, the trimmer will get shortened and clips the leftmost(or rightmost relying on path of trim) thumbnail by respective quantity, in order that solely a fraction of the leftmost or rightmost thumbnail is proven because the person drags the tip of the trimmer. I may do it in UIKit however simply wish to perceive how this may be accomplished in SwiftUI.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments