Post

Replies

Boosts

Views

Activity

Reproduce the apple macos calendar scroll layout
I am trying to recreate the apple calendar in swiftui but I have issues creating scroll layout. So I want to have: When I scroll horizontally the hours on the side have to stay fixed but the header with the day number day String and the full day events have to scroll When I scroll vertically the hours on the side have to move but the header don't For the moment I have : HStack(alignment: .top, spacing:0) { // The hours on the side LateralHours(height: geometry.size.height * 24/10) . offset(y: -offset) ScrollViewReader { proxy in ScrollView (.horizontal, showsIndicators: false) { VStack { // The day number and the full day events Header(width: width) ScrollView { LazyHStack (spacing: 0) { ForEach($loadedDays, id: \.self) { day in // The day grid with the events DayContentView( cellHeight: geometry.size.height / 10, width: width, selectedEvent: $selectedEvent, day: day, store: $store, modifiedEvent: $modifiedEvent ) } } .frame(height: 24*geometry.size.height / 10) // This code block is used to track the position of the scrollview position .background( GeometryReader { Color.clear.preference(key: ScrollOffsetPreferenceKey.self, value: -$0.frame(in: .named("scroll")).origin.y) }) .onPreferenceChange(ScrollOffsetPreferenceKey.self) { value in offset = value } } .coordinateSpace(name: "scroll") } } .scrollTargetBehavior(.viewAligned) .defaultScrollAnchor(.leading) } .scrollPosition(id: $position) .frame(alignment: .topLeading) } So the hours on the side are in none of the scrollViews they are only modified through the .offset with the vertical scrollView position. My problem is that the .offset seems to be kind of slow and my app is slowed down is there a better modifed than .offset or do you know a more efficient way to do this ?
3
0
358
Jul ’24
SMS Reading and sending
Hello everyone ! I am trying to build a macOS app that would sync my sms messages on my android phone to my mac. So I would like to know if a macOS app can load a message history in the native macOS message app (like icloud does) and read all sent messages by the user on the message app. Do you know if it's possible ? My objective is to make my app act like icloud syncing all messages together.
0
1
732
Feb ’23