Post

Replies

Boosts

Views

Activity

Spacer() is spacing on Apple watch 3
My Apple watch app is showing very strange behavior on an Apple watch Series using swifui. App is made with Xcode 12.5 It works fine on Simulator series 5&6 and on my Watch 6 SE. Between the H9P3 there is an Spacer() The 3 numbers are distances to a certain GPS coordinate based on the devices GPS position. Ofcourse I tried googling, without results. Anyone got an idea what is going on? A video of the behaviour is here: https://youtu.be/K3ybhocCkEs My code: var body: some View{      VStack{        HStack{          Text("H")          Text("\(courseManager.currentHole)")            .foregroundColor(Color.green)            .digitalCrownRotation($crownValue, from: -9999, through: 9999, by: 1, sensitivity: .low, isContinuous: true, isHapticFeedbackEnabled: true)          Text(" P")          Text("\(courseManager.currentPar)")            .foregroundColor(Color.green)            .focusable(true)                    }.font(.title2)        Spacer()        HStack(){          //Distances          VStack(alignment: .leading, spacing: 0){                                   Text(String(courseManager.back))//courseManager.back              .font(.title)              .multilineTextAlignment(.leading)            Text(String(courseManager.middle))//courseManager.middle              .font(.title)              .multilineTextAlignment(.leading)            Text(String(courseManager.front))//courseManager.front              .font(.title)              .multilineTextAlignment(.leading)                          //hacky method so that the onreice of location works                      }          Spacer()                    VStack(alignment: .trailing, spacing: 0){            /*            NavigationLink("map", destination: MapView(courseManager: self.courseManager, locationManager: self.locationManager))            .padding([.trailing],0)            .frame(width:65, height: 50)            .font(.title3)            */            Button(courseManager.shotTrackingActive ? "\(String(courseManager.shotTrackingDistance))" : "Shot"){              print("shot button clicked")              courseManager.cachePosition()              self.confirmShotTracking = true            }            .padding([.trailing],0)            .frame(width:65, height: 50)            .font(.title3)                                              }        }      }      .alert(isPresented: $confirmShotTracking){        Alert.sideBySideButtons(          title: Text("Reset shot distance?"),          primaryButton: Alert.Button.default(            Text("Yes"),            action: {            courseManager.startTracking()          }),          secondaryButton: Alert.Button.cancel(Text("No")))                      }      .frame(        minWidth: 0,        idealWidth: 100,        maxWidth: /*@START_MENU_TOKEN@*/.infinity/*@END_MENU_TOKEN@*/,        minHeight: 0,        idealHeight: 100,        maxHeight: /*@START_MENU_TOKEN@*/.infinity/*@END_MENU_TOKEN@*/,        alignment: .topLeading      )                  //.navigationBarHidden(true)      .onReceive(locationManager.$location){ location in        if let location = location {          courseManager.update(location:location)        }              }      .onChange(of: crownValue, perform: { value in        let roundedValue = Int(value.rounded())        if(roundedValue == prevCrownValue) { return }                print(roundedValue)                if prevCrownValue > roundedValue { courseManager.changeHole(next: -1) }        if prevCrownValue < roundedValue { courseManager.changeHole(next: 1) }        self.prevCrownValue = roundedValue      })      .onAppear() {        //courseManager.getCourse(course_id:course_id)        workoutManager.startWorkout()      }      .gesture(DragGesture(minimumDistance: 0.0, coordinateSpace: .local)          .onEnded({ value in            if value.translation.width < -40 && abs(value.translation.height) < 30 {              courseManager.changeHole(next: 1)              print("swipe left")            }            else if value.translation.width > 40 && abs(value.translation.height) < 30 {              courseManager.changeHole(next: -1)              print("swipe left")            }                      })        )                     }
1
0
340
Sep ’21