I tried animating the scrollTo() like so, as described in the docs. - https://developer.apple.com/documentation/swiftui/scrollviewreader
swift
withAnimation {
scrollProxy.scrollTo(index, anchor: .center)
}
the result is the same as if I do
swift
withAnimation(Animation.easeIn(duration: 20)) {
scrollProxy.scrollTo(progress.currentIndex, anchor: .center)
}
I tried this using the example from the ScrollViewReader docs.
With the result that up and down scrolling has exactly the same animation.
struct ScrollingView: View {
@Namespace var topID
@Namespace var bottomID
var body: some View {
ScrollViewReader { proxy in
ScrollView {
Button("Scroll to Bottom") {
withAnimation {
proxy.scrollTo(bottomID)
}
}
.id(topID)
VStack(spacing: 0) {
ForEach(0..100) { i in
color(fraction: Double(i) / 100)
.frame(height: 32)
}
}
Button("Top") {
withAnimation(Animation.linear(duration: 20)) {
proxy.scrollTo(topID)
}
}
.id(bottomID)
}
}
}
func color(fraction: Double) - Color {
Color(red: fraction, green: 1 - fraction, blue: 0.5)
}
}
struct ScrollingView_Previews: PreviewProvider {
static var previews: some View {
ScrollingView()
}
}
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
So experimenting with the new SpeechTranscriber, if I do:
let transcriber = SpeechTranscriber(
locale: locale,
transcriptionOptions: [],
reportingOptions: [.volatileResults],
attributeOptions: [.audioTimeRange]
)
only the final result has audio time ranges, not the volatile results.
Is this a performance consideration? If there is no performance problem, it would be nice to have the option to also get speech time ranges for volatile responses.
I'm not presenting the volatile text at all in the UI, I was just trying to keep statistics about the non-speech and the speech noise level, this way I can determine when the noise level falls under the noisefloor for a while.
The goal here was to finalize the recording automatically, when the noise level indicate that the user has finished speaking.
Is there any standard way of efficiently showing a MTLTexture on a RealityKit Entity?
I can't find anything proper on how to , for example, generate a LowLevelTexture out of a MTLTexture. Closest match was this two year old thread.
In the old SceneKit app, we would just do
guard let material = someNode.geometry?.materials.first else { return }
material.diffuse.contents = mtlTexture
Our flow is as follows (for visualizing the currently detected object):
Camera-Stream -> CoreML Segmentation -> Send the relevant part of the MLShapedArray-Tensor to a MTLComputeShader that returns a MTLTexture -> Show the resulting texture on a 3D object to the user
In courses like Compose interactive 3D content in Reality Composer Pro Realitykit Engineers recommended working with Reality Composer Pro to create RealityKit packages to embed in our Realitykit Xcode projects.
And, comparing the workflow to Unity/Unreal, I can see the reasoning since it is nice to prepare scenes/materials/assets visually.
Now when we also want to run a Xcode Cloud CI/CD pipeline this seems to come into conflict:
When adding a basic *.usdz to the RealityKitContent.rkassets folder, every build we run on Xcode cloud fails with:
Compile Reality Asset RealityKitContent.rkassets
❌realitytool requires Metal for this operation and it is not available in this build environment
I have also found this related forum post here but it was specifically about compiling a *.skybox.
So, our app imports CoreML and loads the CoreML models when starting up.
Locally all tests succeed consistently.
Running Tests on Xcode Cloud, they all fail with (UI and Unit Tests)
App (6846) encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted. (Underlying Error: Test crashed with signal ill before establishing connection.))
the test instance is busy for 35min and then just aborts, with all tests failing.
This sounds to me like the simulator is maybe showing some exception or is stuck?
Or is it possible that xcode server runs in a special environment that gets stuck on loading CoreML models?
So, I've been following along the video on "Distribute binary frameworks as Swift packages" - https://developer.apple.com/videos/play/wwdc2020/10147/, but now I'm sort of stuck.
I have my Swift Package that works fine when used as a source package, which I want to ship as a binary now.
The video says, I'm supposed to add a target:
swift
import PackageDescription
let package = Package(
name: "Test",
defaultLocalization: "de",
platforms: [
.iOS(.v13)
],
products: [
.library(
name: "Test",
targets: ["Test"]
),
],
dependencies: [
],
targets: [
// .target(name: "Test")
.binaryTarget(
name: "Test",
url: "https://static.looc.io/Test/Test-1.0.0.xcframework.zip",
checksum: "9848327892347324789432478923478"
)
]
)
but, the xcframework is what I am trying to build, don't have an xcframework yet?
With the above, if I run:
bash
[konrad@iMac-2 Source]$ xcodebuild archive -workspace Test -scheme Test \archivePath "tmp/iOS" \
destination "generic/platform=iOS" \
SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
I get the error
bash
xcodebuild: error: Could not resolve package dependencies:
artifact of binary target 'Test' failed download: invalid status code 403
Most models are only available as glb or fbx, so I usually reexport them into usdz using Blender.
When I import them into Reality Composer Pro, Mesh, Textures etc look great, but in the Animation Library subsection all I can see is one default subtree animation.
In Blender I can see all available animations and play them individually. The default subtree animation just plays the default idle animation.
In fact when I open the nonlinear animation view in Blender and select a different animation as the default animation, the exported usdz shows the newly selected animation as default subtree animation.
I can see in the Apple sample apps models can have multiple animations in their Animation Library.
I'm using the latest Blender 4.5 and the usdz exporter should be working properly?
Is there any way to render a RealityView to an Image/UIImage like we used to be able to do using SCNView.snapshot() ?
ImageRenderer doesn't work because it renders a SwiftUI view hierarchy, and I need the currently presented RealityView with camera background and 3D scene content the way the user sees it
I tried UIHostingController and UIGraphicsImageRenderer like
extension View {
func snapshot() -> UIImage {
let controller = UIHostingController(rootView: self)
let view = controller.view
let targetSize = controller.view.intrinsicContentSize
view?.bounds = CGRect(origin: .zero, size: targetSize)
view?.backgroundColor = .clear
let renderer = UIGraphicsImageRenderer(size: targetSize)
return renderer.image { _ in
view?.drawHierarchy(in: view!.bounds, afterScreenUpdates: true)
}
}
}
but that leads to the app freezing and sending an infinite loop of
[CAMetalLayer nextDrawable] returning nil because allocation failed.
Same thing happens when I try
return renderer.image { ctx in
view.layer.render(in: ctx.cgContext)
}
Now that SceneKit is deprecated, I didn't want to start a new app using deprecated APIs.
Hey there,
When I run the following 50 lines of code in release mode, or turn Optimization on in Build-Settings Swift Compiler - Code Generation I will get the following crash.
Anyone any idea why that happens? (Xcode 13.4.1, happens on Device as well as simulator on iOS 15.5 and 15.6)
Example Project: https://github.com/Bersaelor/ResourceCrashMinimalDemo
#0 0x000000010265dd58 in assignWithCopy for Resource ()
#1 0x000000010265d73c in outlined init with copy of Resource<VoidPayload, String> ()
#2 0x000000010265d5dc in specialized Resource<>.init(url:method:query:authToken:headers:) [inlined] at /Users/konradfeiler/Source/ResourceCrashMinimalDemo/ResourceCrashMinimalDemo/ContentView.swift:51
#3 0x000000010265d584 in specialized ContentView.crash() at /Users/konradfeiler/Source/ResourceCrashMinimalDemo/ResourceCrashMinimalDemo/ContentView.swift:18
Code needed:
import SwiftUI
struct ContentView: View {
var body: some View {
Button(action: { crash() }, label: { Text("Create Resouce") })
}
/// crashes in `outlined init with copy of Resource<VoidPayload, String>`
func crash() {
let testURL = URL(string: "https://www.google.com")!
let r = Resource<VoidPayload, String>(url: testURL, method: .get, authToken: nil)
print("r: \(r)")
}
}
struct VoidPayload {}
enum HTTPMethod<Payload> {
case get
case post(Payload)
case patch(Payload)
}
struct Resource<Payload, Response> {
let url: URL
let method: HTTPMethod<Payload>
let query: [(String, String)]
let authToken: String?
let parse: (Data) throws -> Response
}
extension Resource where Response: Decodable {
init(
url: URL,
method: HTTPMethod<Payload>,
query: [(String, String)] = [],
authToken: String?,
headers: [String: String] = [:]
) {
self.url = url
self.method = method
self.query = query
self.authToken = authToken
self.parse = {
return try JSONDecoder().decode(Response.self, from: $0)
}
}
}
So,
I've been wondering how fast a an offline STT -> ML Prompt -> TTS roundtrip would be.
Interestingly, for many tests, the SpeechTranscriber (STT) takes the bulk of the time, compared to generating a FoundationModel response and creating the Audio using TTS.
E.g.
InteractionStatistics:
- listeningStarted: 21:24:23 4480 2423
- timeTillFirstAboveNoiseFloor: 01.794
- timeTillLastNoiseAboveFloor: 02.383
- timeTillFirstSpeechDetected: 02.399
- timeTillTranscriptFinalized: 04.510
- timeTillFirstMLModelResponse: 04.938
- timeTillMLModelResponse: 05.379
- timeTillTTSStarted: 04.962
- timeTillTTSFinished: 11.016
- speechLength: 06.054
- timeToResponse: 02.578
- transcript: This is a test.
- mlModelResponse: Sure! I'm ready to help with your test. What do you need help with?
Here, between my audio input ending and the Text-2-Speech starting top play (using AVSpeechUtterance) the total response time was 2.5s.
Of that time, it took the SpeechAnalyzer 2.1s to get the transcript finalized, FoundationModel only took 0.4s to respond (and TTS started playing nearly instantly).
I'm already using reportingOptions: [.volatileResults, .fastResults] so it's probably as fast as possible right now?
I'm just surprised the STT takes so much longer compared to the other parts (all being CoreML based, aren't they?)
In an app with multiple AVPlayers (think TikTok UX for example), where:
• one video is currently streaming
• other videos , that users will move to next, have already been loaded into an AVPlayer for prebuffering
Is there an API to give the currently playing Stream higher priority than the pre-buffering ones that are not on screen?
It's nice to have instant play while scrolling but we also don't want to starve the currently playing player of bandwidth.
Aloha Quick Lookers,
I'm using the usdzconvert preview 0.64 to create *.usdz files, which I then edit in ascii *.usda format, and then recipe them as *.usdz.
This way I was able to fix the scale (the original gltf's usually are in m=1, while the usdzconvert 0.64 always sets the result to m=0.01).
Now I was trying to follow the docs
to anchor my Glasses prim on the users face and whatever I try, it will only ever place it on my tables surface.
If I import my *.usdz file into Reality Composer and export it to usdz It does get anchored to the face correctly.
Now when I open the Reality-Composer-Export-usdz it really doesn't look so different from my manually edited usdz (it just wraps the Geometry in another layer, I assume because the import-export through Reality-Composer).
What am I doing wrong?
Here's the Reality Composer generated usda:
#usda 1.0
(
autoPlay = false
customLayerData = {
string creator = "com.apple.RCFoundation Version 1.5 (171.5)"
string identifier = "9AAF5C5D-68AB-4034-8037-9BBE6848D8E5"
}
defaultPrim = "Root"
metersPerUnit = 1
timeCodesPerSecond = 60
upAxis = "Y"
)
def Xform "Root"
{
def Scope "Scenes" (
kind = "sceneLibrary"
)
{
def Xform "Scene" (
customData = {
bool preliminary_collidesWithEnvironment = 0
string sceneName = "Scene"
}
sceneName = "Scene"
)
{
token preliminary:anchoring:type = "face"
quatf xformOp:orient = (0.70710677, 0.70710677, 0, 0)
double3 xformOp:scale = (1, 1, 1)
double3 xformOp:translate = (0, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:orient", "xformOp:scale"]
// ...
and here is my own , minimal, usdz with the same face-anchoring-token:
#usda 1.0
(
autoPlay = false
customLayerData = {
string creator = "usdzconvert preview 0.64"
}
defaultPrim = "lupetto_local"
metersPerUnit = 1
timeCodesPerSecond = 60
upAxis = "Y"
)
def Xform "lupetto_local" (
assetInfo = {
string name = "lupetto_local"
}
kind = "component"
)
{
def Scope "Geom"
{
def Xform "Glasses"
{
token preliminary:anchoring:type = "face"
double3 xformOp:translate = (0, 0.01799999736249447, 0.04600000008940697)
uniform token[] xformOpOrder = ["xformOp:translate"]
// ...
I'd add the full files, but they are 2Mb of size and the max file size is 200kb. I could create a minimal example file with less geometry in case the above code is not enough.
I added a basic Hello World SwiftUI view to an existing UIKit project, yet I can not get the preview to work.
Usual error is:
MessageSendFailure: Message send failure for send render message to agent
==================================
| RemoteHumanReadableError: Could not connect to agent
|
| Bootstrap timeout after 8.0s waiting for connection from 'Identity(pid: 30286, sceneIdentifier: Optional("XcodePreviews-30286-133-static"))' on service com.apple.dt.uv.agent-preview-service
Neither this nor the generated report is very helpful.
I also created a new Xcode project to see if the same View works in a new test project, which it does.
If my project compiles without warnings and errors, but SwiftUI preview fails, what are the options I have left? (My deployment target is IOS14, my Xcode is the fresh Xcode 13.0)
Working with a M1 Macbook Air, macos 12.4.
Anytime I open a new terminal window or just a new tab, it takes a really long time till I can type.
I have commented out my entire ~/.zshrc and when run
for i in $(seq 1 10); do /usr/bin/time $SHELL -i -c exit; done
directly in an open terminal window it says it finished in 0.1s.
So it must be something macos is doing before zsh is even starting.
PS: In the activity monitor I can only see a spike in kernel_task cpu usage when opening a new terminal
So, we use ARFaceTrackingConfiguration and ARKit for a magic mirror like experience in our apps, augmenting users faces with digital content.
On the iPad Pro 5gen customers are complaining that the camera image is too wide, I'm assuming that is because of the new wide-angle camera necessary for Apples center-stage Facetime calls?
I have looked through Tracking and Visualizing Faces and the WWDC 2021 videos, but I must have missed any API's that allow us to disable the wide-angle feature on the new iPads programmatically?