Post

Replies

Boosts

Views

Activity

Sleep Analysis inBed sample not recorded on Apple Watch in iOS 18
In this link, Apple states we can know when a user is in bed vs sleeping and compare their quality of sleep by it. Only, in iOS 18, Apple no longer reports inBed time samples for the Apple Watch. I get why they stopped doing this for the phone, but why the watch? Bug? My app was using the inBed times for this very purpose and now only works for Garmin and Oura who still report inBed times. https://developer.apple.com/documentation/healthkit/hkcategoryvaluesleepanalysis
2
2
341
Oct ’24
SwiftUI Transition Animation with LazyVGrid
Explanation I'm trying to animate the contents of a view off the screen while animating new contents in from the other side (see playground code and select "Next Question" while running the view). Most of the views behave as expected but the LazyVGrid leaves the screen with animation but doesn't enter the screen with the rest of the animation; instead, it immediately appears at the final location while the rest of the views animate in. In the final code, I also change the question text and the possible answers in the LazyVGrid. Playground Code import SwiftUI import PlaygroundSupport struct ContentView: View {          var body: some View {         VStack (alignment: .leading) {             Text("History Questionaire").font(.title).padding([.top, .leading]).foregroundColor(.white)             QuestionView()                 .transition(                     .asymmetric(                         insertion: .move(edge: .trailing),                         removal: .move(edge: .leading)                     )                 )         }         .background(Color(.lightGray))         .cornerRadius(8.0)         .padding()              } } struct QuestionView: View {          @State var questionViewID = 1          var body: some View {         VStack (alignment: .leading){             Text("Question").font(.title2).padding(.bottom)             VStack (alignment: .leading) {                 Text("Have you had a doctor appointment this year?").font(.body).foregroundColor(Color(.darkGray))                                  // Question: How do I get the items in the grid to animate in with the rest of the items in the VStack?                 LazyVGrid(columns: [GridItem(.adaptive(minimum: 150, maximum: 300))], alignment: .leading, content: {                     Text("Yes")                         .padding()                         .background(Color.white)                         .cornerRadius(4.0)                     Text("No")                         .padding()                         .background(Color.white)                         .cornerRadius(4.0)                 })             }             .padding(.bottom)                          HStack {                 Spacer()                 Button(action: {                     withAnimation(Animation.easeIn(duration: 2)) {                         questionViewID += 1                     }                                      }, label: {                     Text("Next Question")                         .font(.body)                         .fontWeight(.bold)                         .foregroundColor(.blue)                 })                                  Spacer()             }             .padding(.vertical)         }         .id(questionViewID)         .padding()     } } PlaygroundPage.current.setLiveView(ContentView())
0
1
2.3k
Mar ’21