Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

124
Vistas
slider is move to the top when i use HStack

The slider is move to the top when i use HStack, VStack is work well, any ideas?

struct LockerSlider<V>: View where V : BinaryFloatingPoint, V.Stride : BinaryFloatingPoint {
var body: some View {
        GeometryReader { proxy in
            ZStack(alignment: .leading) {
                RoundedRectangle(cornerRadius: 15)
                    .frame(height: 30)
                
                RoundedRectangle(cornerRadius: 15)
                .frame(width:(proxy.size.width - 30) * ratio + 30,height: 30)
                Circle()
                    .frame(width: 50, height: 50)
                    .offset(x: (proxy.size.width - 30) * ratio)
                    .gesture(DragGesture(minimumDistance: 0)
                    .onChanged({ updateStatus(value: $0, proxy: proxy)
                    })
                                .onEnded { _ in startX = nil
                    
            }
            .frame(height: 30)
            .simultaneousGesture(DragGesture(minimumDistance: 0)
                                    .onChanged({ update(value: $0, proxy: proxy) }))
            .onAppear {
                ratio = min(1, max(0,CGFloat(value / bounds.upperBound)))
            }
        }
    }
}
HStack{
      Text("Custom Slider")
      LockerSlider(value: $number, in: 0...1050000, step: 0.02, length: 15,ball: 30, onEditingChanged: { _ in
      print("111")
                })
            }

when i use HStack,the slider is moving to the top areas,and i missing something?

enter image description here

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda