Post

Replies

Boosts

Views

Activity

Is it possible to loop a ScrollView to repeat infinitely?
I have a horizontal scroll view and a fixed array. I would like to loop it such that when I scroll left and get near the end, the array will add the items in the beginning to the end so that the user can continue to scroll. I would like this to happen when scrolling both left and right and to not have the current position of the user jump around. Here is my code. What am I missing? Would appreciate any and all help. import SwiftUI import Algorithms struct ContentView: View { @State private var timePosition = ScrollPosition(idType: Int.self, edge: .leading) @State private var times: [Int] = Array(0...23) var body: some View { ScrollView(.horizontal, showsIndicators: false) { LazyHStack(spacing: 0) { ForEach(times, id:\.self) { time in Text("\(time)") .font(.system(.callout, design: .monospaced, weight: .semibold)) .padding(8) .frame(width: 180, height: 110, alignment: .topLeading) .border(width: 1, edges: [.leading, .trailing], color: .primary.opacity(0.05)) .id(time) } } .scrollTargetLayout() } .frame(height: 110) .scrollPosition($timeScrollPosition, anchor: .center) .onScrollTargetVisibilityChange(idType: Int.self) { timeIDs in if let currentViewID = model.timeScrollPosition.viewID { if timeIDs.contains(times[times.count - 2]) { times.rotate(toStartAt: times.count - 1) } if timeIDs.contains(times[1]) { times.rotate(toStartAt: times.count-1) } print("New times: \(times)") timeScrollPosition.scrollTo(id: currentViewID) } } } }
0
0
263
Jun ’24
RealityKit - Adding Real World Textures
Hello! I want to build an app that lets devices with the LiDAR Scanner scan their environment and share their scans with one another. As of now, I can create the mesh using the LiDAR Scanner and export it as an OBJ file. However, I would like the ability to map textures and colors onto this model. How would one go on to get the real world texture and place it onto the OBJ model? Thank you!
0
0
803
Aug ’21
How would I go about building AR effects similar to the AR Spaces features in Clips?
Hello! I really want to make these immersive AR experiences with engaging graphics like the new AR Spaces feature in the Clips app. Is RealityKit the way to go for this? Or does it require some really lower level understanding and use of API’s like ARKit with Metal? Also, with RealityKit’s scene understanding, we can map a mesh of the scene the LIDAR device can see but I was wondering how would I switch that out with a custom mesh design like in the Clips app as well. Thank you!
1
0
862
Jun ’21
Error: Cannot find 'DataFrame' in scope
Hello! I've been trying to replicate the linear regressor tabular application as shown at the end of the WWDC 2021 session Build dynamic iOS apps with the Create ML framework. However, I keep getting the error Cannot find 'DataFrame' in scope and Cannot find 'Column' in scope. I was wondering if this is a bug with the current beta or if I have my code wrong. I am trying to run my application on an iPhone 12 Pro running iOS 15 Beta 1. I am using Xcode 13 on Monterey. Thank you!
1
0
1.2k
Jun ’21
How to detect the "Change Scene" action from Reality Composer in Xcode
I have a Reality Composer project that has two scenes. In the first scene, I post a notification from Xcode to trigger an animation and then change the scene to the next scene. This is done using the Change Scene in the Action Sequence. In the second scene, when the user taps on an object, it should send a notification to Xcode using the Notify action. How do I set the .onAction in Xcode for the second scene if I switch to the second scene using an Action Sequence from the first scene? Thanks!
1
0
1.2k
Dec ’20
Style Transfer Model Not Training
Hi! I am attempting to create a style transfer model for images. My content image folder has about 80,000 images. However, when I click train, the Create ML app displayed the “Processing” message for about a minute before I get the error: Could not create buffer with format ‘BGRA’ (-6662). Hope someone can help me with what this issue is! Is my training data too large or are their pictures in there that don’t conform to the right image format? Thank you!
1
0
1k
Jul ’20
Can On-Device Personalization Models be used with Cloud Deployment of ML Models?
I have a custom Core ML model built with Keras that has a couple of updatable layers. I was wondering if I switched this model to be deployed from the cloud rather than packaged with the app, would the on-device personalized changes transfer whenever I deploy a model over the cloud or would a user have to start with a fresh, new model every time? Similarly, do on-device personalized models work with model encryption? Thanks!
1
0
1.2k
Jun ’20