I have an app which have an Immersive Space view and it needs the user to have a button in the bottom which have a fixed place in front of the user head like a dashboard in game or so but when the user get too close to any3d object in the view it could cover the button and make it inaccessible and it mainly would prevent the app for being approved like that in appstoreconnect I was working before on SceneKit and there was something like camera view Znear and Zfar which decide when to hide the 3d model if it comes too close or gets too far and I wonder if there is something like that in realityView / RealityKit 4.
Here is My Code and the screenshots follows
import SwiftUI
import RealityKit
struct ContentView: View {
@State var myHead: Entity = {
let headAnchor = AnchorEntity(.head)
headAnchor.position = [-0.02, -0.023, -0.24]
return headAnchor
}()
@State var clicked = false
var body: some View {
RealityView { content, attachments in
// create a 3d box
let mainBox = ModelEntity(mesh: .generateBox(size: [0.1, 0.1, 0.1]))
mainBox.position = [0, 1.6, -0.3]
content.add(mainBox)
content.add(myHead)
guard let attachmentEntity = attachments.entity(for: "Dashboard") else {return}
myHead.addChild(attachmentEntity)
}
attachments: {
// SwiftUI Inside Immersivre View
Attachment(id: "Dashboard") {
VStack {
Spacer()
.frame(height: 300)
Button(action: {
goClicked()
}) {
Text(clicked ? "⏸️" : "▶️")
.frame(maxWidth: 48, maxHeight: 48, alignment: .center)
.font(.extraLargeTitle)
}
.buttonStyle(.plain)
}
}
}
}
func goClicked() {
clicked.toggle()
}
}
Delve into the world of graphics and game development. Discuss creating stunning visuals, optimizing game mechanics, and share resources for game developers.
Post
Replies
Boosts
Views
Activity
If I import a USDZ model with blendMode set to alpha, occlusion does not work on iPhone with iOS 18. How should transparent materials and occlusion be properly used in the new RealityKit? Additionally, new artifacts have appeared when working with transparent objects overlapping each other. The transparency results do not blend but rather parts of the model just not rendering.
In my project I need to do the following:
In runtime create metal Dynamic library from source.
In runtime create metal Executable library from source and Link it with my previous created Dynamic library.
Create compute pipeline using those two libraries created above.
But I get the following error at the third step:
Error Domain=AGXMetalG15X_M1 Code=2 "Undefined symbols:
_Z5noisev, referenced from: OnTheFlyKernel
" UserInfo={NSLocalizedDescription=Undefined symbols:
_Z5noisev, referenced from: OnTheFlyKernel
}
import Foundation
import Metal
class MetalShaderCompiler {
let device = MTLCreateSystemDefaultDevice()!
var pipeline: MTLComputePipelineState!
func compileDylib() -> MTLDynamicLibrary {
let source = """
#include <metal_stdlib>
using namespace metal;
half3 noise() {
return half3(1, 0, 1);
}
"""
let option = MTLCompileOptions()
option.libraryType = .dynamic
option.installName = "@executable_path/libFoundation.metallib"
let library = try! device.makeLibrary(source: source, options: option)
let dylib = try! device.makeDynamicLibrary(library: library)
return dylib
}
func compileExlib(dylib: MTLDynamicLibrary) -> MTLLibrary {
let source = """
#include <metal_stdlib>
using namespace metal;
extern half3 noise();
kernel void OnTheFlyKernel(texture2d<half, access::read> src [[texture(0)]],
texture2d<half, access::write> dst [[texture(1)]],
ushort2 gid [[thread_position_in_grid]]) {
half4 rgba = src.read(gid);
rgba.rgb += noise();
dst.write(rgba, gid);
}
"""
let option = MTLCompileOptions()
option.libraryType = .executable
option.libraries = [dylib]
let library = try! self.device.makeLibrary(source: source, options: option)
return library
}
func runtime() {
let dylib = self.compileDylib()
let exlib = self.compileExlib(dylib: dylib)
let pipelineDescriptor = MTLComputePipelineDescriptor()
pipelineDescriptor.computeFunction = exlib.makeFunction(name: "OnTheFlyKernel")
pipelineDescriptor.preloadedLibraries = [dylib]
pipeline = try! device.makeComputePipelineState(descriptor: pipelineDescriptor, options: .bindingInfo, reflection: nil)
}
}
The following code runs fine when compiled with Swift 5, but crashes when compiled with Swift 6 (stack trace below). In the draw method, commenting out the addCompletedHandler line fixes the problem. I'm testing on iOS 18.0 and see the same behavior in both the simulator and on a device. What's going on here?
import Metal
import MetalKit
import UIKit
class ViewController: UIViewController {
@IBOutlet var metalView: MTKView!
private var commandQueue: MTLCommandQueue?
override func viewDidLoad() {
super.viewDidLoad()
guard let device = MTLCreateSystemDefaultDevice() else {
fatalError("expected a Metal device")
}
self.commandQueue = device.makeCommandQueue()
metalView.device = device
metalView.enableSetNeedsDisplay = true
metalView.isPaused = true
metalView.delegate = self
}
}
extension ViewController: MTKViewDelegate {
func mtkView(_ view: MTKView, drawableSizeWillChange size: CGSize) {}
func draw(in view: MTKView) {
guard let commandQueue,
let commandBuffer = commandQueue.makeCommandBuffer()
else { return }
commandBuffer.addCompletedHandler { _ in } // works with Swift 5, crashes with Swift 6
commandBuffer.commit()
}
}
Here's the stack trace:
Thread 10 Queue : connection Queue (serial)
#0 0x000000010581c3f8 in _dispatch_assert_queue_fail ()
#1 0x000000010581c384 in dispatch_assert_queue ()
#2 0x00000002444c63e0 in swift_task_isCurrentExecutorImpl ()
#3 0x0000000104d71ec4 in closure #1 in ViewController.draw(in:) ()
#4 0x0000000104d71f58 in thunk for @escaping @callee_guaranteed (@guaranteed MTLCommandBuffer) -> () ()
#5 0x0000000105ef1950 in __47-[CaptureMTLCommandBuffer _preCommitWithIndex:]_block_invoke_2 ()
#6 0x00000001c50b35b0 in -[MTLToolsCommandBuffer invokeCompletedHandlers] ()
#7 0x000000019e94d444 in MTLDispatchListApply ()
#8 0x000000019e94f558 in -[_MTLCommandBuffer didCompleteWithStartTime:endTime:error:] ()
#9 0x000000019e95352c in -[_MTLCommandQueue commandBufferDidComplete:startTime:completionTime:error:] ()
#10 0x0000000226ef50b0 in handleMainConnectionReplies ()
#11 0x00000001800c9690 in _xpc_connection_call_event_handler ()
#12 0x00000001800cad90 in _xpc_connection_mach_event ()
#13 0x000000010581a86c in _dispatch_client_callout4 ()
#14 0x0000000105837950 in _dispatch_mach_msg_invoke ()
#15 0x0000000105822870 in _dispatch_lane_serial_drain ()
#16 0x0000000105838c10 in _dispatch_mach_invoke ()
#17 0x0000000105822870 in _dispatch_lane_serial_drain ()
#18 0x00000001058237b0 in _dispatch_lane_invoke ()
#19 0x00000001058301f0 in _dispatch_root_queue_drain_deferred_wlh ()
#20 0x000000010582f75c in _dispatch_workloop_worker_thread ()
#21 0x00000001050abb74 in _pthread_wqthread ()
Apple's own USDZ files from their website does not display properly both in OPReview and in Keynote when imported. It displays properly, however, in Reality Converter bit with this error:
"Invalid USD shader node in USD file
Shader nodes must have “id” as the implementationSource, with id values that begin with “Usd”. Also, shader inputs with connections must each have a single, valid connection source."
I tried importing other models from external sources and they work without any issue at all.
Is there any potential fix or workaround this?
Thanks in advance.
I have followed the documentation to download the UnityPlugins from https://github.com/apple/unityplugins. When I run through the quick guide to create the .tgz builds it builds all the packages except for the Apple.GameKit package, which is the one I need.
It looks like during the build process there is a build failure which is likely causing this issue I will post the code below. This is blocking me and I have tried multiple times to the same result. (I removed some of the code error because it was too long just showing start and finish)
Building Release GameKit native libraries for platform: iOS
Build command: xcodebuild -scheme iOS - Release -destination generic/platform=iOS clean build
** BUILD FAILED **
The following build commands failed:
SwiftCompile normal arm64 Compiling\ GKAchievementDescription.swift,\ GKLeaderboard.swift,\ GKTurnBasedMatchmakerViewControllerDelegate.swift,\ GKChallengeDelegate.swift,\ GKMatchDelegate.swift,\ GKMatchmakerViewControllerDelegate.swift,\ GKInvite.swift,\ GKChallenge.swift,\ DefaultHandlers.swift,\ GKTurnBasedParticipant.swift,\ GKLocalPlayerListener.swift,\ GKGameCenterViewController.swift,\ GKSavedGameDelegate.swift,\ GKAccessPoint.swift,\ GKBasePlayer.swift,\ GKAchievementChallenge.swift,\ GKLeaderboardEntry.swift,\ GKTurnBasedExchangeReply.swift,\ GKTurnBasedMatchmakerViewController.swift,\ AppleCoreRuntimeShared.swift,\ GKErrorCodeExtension.swift,\ GKMatchmaker.swift,\ GKTurnBasedExchange.swift,\ GKNotificationBanner.swift,\ GKScoreChallenge.swift,\ GKLocalPlayer.swift,\ GKLeaderboardSet.swift,\ GKSavedGame.swift,\ GKMatchRequest.swift,\ GKMatch.swift,\ GKAchievement.swift,\ GKVoiceChat.swift,\ GKTurnBasedMatchDelegate.swift,\ UiUtilities.swift,\ GKTurnBasedMatch.swift,\ GKMatchmakerViewController.swift,\ GameKitUIDelegateHandler.swift,\ GKPlayer.swift,\ GKInviteDelegate.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKAchievementDescription.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKLeaderboard.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKTurnBasedMatchmakerViewControllerDelegate.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKChallengeDelegate.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKMatchDelegate.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKMatchmakerViewControllerDelegate.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKInvite.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKChallenge.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/DefaultHandlers.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKTurnBasedParticipant.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKLocalPlayerListener.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKGameCenterViewController.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKSavedGameDelegate.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKAccessPoint.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKBasePlayer.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKAchievementChallenge.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKLeaderboardEntry.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKTurnBasedExchangeReply.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKTurnBasedMatchmakerViewController.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/AppleCoreRuntimeShared.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKErrorCodeExtension.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKMatchmaker.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKTurnBasedExchange.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKNotificationBanner.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKScoreChallenge.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKLocalPlayer.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKLeaderboardSet.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKSavedGame.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKMatchRequest.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKMatch.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKAchievement.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKVoiceChat.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKTurnBasedMatchDelegate.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/UiUtilities.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKTurnBasedMatch.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKMatchmakerViewController.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GameKitUIDelegateHandler.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKPlayer.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKInviteDelegate.swift (in target 'GameKitWrapper iOS' from project 'GameKitWrapper')
CompileSwift normal arm64 (in target 'GameKitWrapper iOS' from project 'GameKitWrapper')
(2 failures)
I'm really excited about the Object Capture APIs being moved to iOS, and the complex UI shown in the WWDC session.
I have a few unanswered questions:
Where is the sample code available from?
Are the new Object Capture APIs on iOS limited to certain devices?
Can we capture images from the front facing cameras?
Hello all,
I am building for visionOS with another engineer and using Reality Composer Pro to validate usd files.
The starting position of my animated usdz, its position when it's first loaded, is not the same as the first frame of the animation on the usdz file
For testing, I am using the AR Quick Look asset 'toy_biplane_idle.usdz' which demonstrates the same 'error' we're currently getting with our own usdz files.
When the usdz is loaded, it is on the ground plane -
But when the aniamtion is played, the plane 'snaps' to the position of the first frame of the animation -
This 'snapping' behavior is giving us problems. We want the user ot see this plane in its static 'load' position with the option to play the animation. But we dont want it to snap when the user presses play
Is it possible to load the .usdz in the position specified by the first frame of the animation? What is the best way to fix this issue.
Thanks!
I'm using the Apple RoomPlan sdk to generate a .usdz file, which works fine, and gives me a 3D scan of my room.
But when I try to use Model I/O's MDLAsset to convert that output into an .obj file, it comes out as a completely flat model shaped like a rectangle. Here is my Swift code:
let destinationURL = destinationFolderURL.appending(path: "Room.usdz")
do {
try FileManager.default.createDirectory(at: destinationFolderURL, withIntermediateDirectories: true)
try finalResults?.export(to: destinationURL, exportOptions: .model)
let newUsdz = destinationURL;
let asset = MDLAsset(url: newUsdz);
let obj = destinationFolderURL.appending(path: "Room.obj")
try asset.export(to: obj)
}
Not sure what's wrong here. According to MDLAsset documentation, .obj is a supported format and exporting from .usdz to the other formats like .stl and .ply works fine and retains the original 3D shape.
Some things I've tried:
changing "exportOptions" to parametric, mesh, or model.
simply changing the file extension of "destinationURL" (throws error)
Hi,
I am trying to use PhotogrammetrySample input sequence according to the WWDC video.
I modified only the following code in the sample:
var images = try FileManager.default.contentsOfDirectory(at: captureFolderManager.imagesFolder,
includingPropertiesForKeys: nil,
options: .skipsHiddenFiles)
let inputSequence = images.lazy.compactMap { file in
return self.loadSampleAndMask(file: file)
}
// Next line causes the exception
photogrammetrySession = try PhotogrammetrySession(
input: inputSequence,
configuration: configuration)
private func loadSampleAndMask(file: URL) -> PhotogrammetrySample? {
do {
var sample = try PhotogrammetrySample(contentsOf: file)
return sample
} catch {
return nil
}
}
I am getting following runtime error:
Thread 1: EXC_BREAKPOINT (code=1, subcode=0x240d88904)
Hello.
I have an application that exports a 3D object with vertex color to USDC. I'm using an MDLAsset and its functionality to export to USDC with [asset exportAssetToURL:[NSURL fileURLWithPath:filePath]]. In version 1.3 of the system, everything works correctly. But after updating to version 2.0, the exported object appears white (using the same code).
Any suggestions?
Thank you very much.
Hello,
I’m working with the GameKit API, and I am encountering an issue when submitting a player’s score to a leaderboard at the end of a game.
Goal:
After submitting the new score to a leaderboard, I want to immediately fetch and display the updated leaderboard that reflects the new score.
Problem:
After successfully submitting the player’s score, when I fetch the leaderboard, the entries are not updated right away. The fetched leaderboard still shows the outdated player score.
Is this delay in updating the leaderboard expected behavior, or am I missing something in my implementation?
Steps to Reproduce:
Submit the local player’s score to Leaderboard X.
On successful submission, fetch the leaderboard entries for Leaderboard X.
Expected Result:
The fetched leaderboard should reflect the updated player score immediately.
Actual Result:
The fetched leaderboard shows the outdated score, with no immediate update.
As a workaround, I update the leaderboard myself locally, that does the job, but is error-prone and require more efforts.
Hi there, I'm trying to test the "Drawing fully immersive content using Metal" , but when I select Language: Swift, it still shows Objective C code in some sample codes.
Please check and update the document Swift Code, thank you.
So I get JPEG data in my app. Previously I was using the higher level NSBitmapImageRep API and just feeding the JPEG data to it.
But now I've noticed on Sonoma If I get a JPEG in the CMYK color space the NSBitmapImageRep renders mostly black and is corrupted. So I'm trying to drop down to the lower level APIs. Specifically I grab a CGImageRef and and trying to use the Accelerate API to convert it to another format (to hopefully workaround the issue...
CGImageRef sourceCGImage = `CGImageCreateWithJPEGDataProvider(jpegDataProvider,`
NULL,
shouldInterpolate,
kCGRenderingIntentDefault);
Now I use vImageConverter_CreateWithCGImageFormat... with the following values for source and destination formats:
Source format: (derived from sourceCGImage)
bitsPerComponent = 8
bitsPerPixel = 32
colorSpace = (kCGColorSpaceICCBased; kCGColorSpaceModelCMYK; Generic CMYK Profile)
bitmapInfo = kCGBitmapByteOrderDefault
version = 0
decode = 0x000060000147f780
renderingIntent = kCGRenderingIntentDefault
Destination format:
bitsPerComponent = 8
bitsPerPixel = 24
colorSpace = (DeviceRBG)
bitmapInfo = 8197
version = 0
decode = 0x0000000000000000
renderingIntent = kCGRenderingIntentDefault
But vImageConverter_CreateWithCGImageFormat fails with kvImageInvalidImageFormat. Now if I change the destination format to use 32 bitsPerpixel and use alpha in the bitmap info the vImageConverter_CreateWithCGImageFormat does not return an error but I get a black image just like NSBitmapImageRep
I am trying to get a little game prototype up and running using Metal using the metal-cpp libraries where I run everything natively at 120Hz with a coupled renderer using Vsync turned on so that I have the absolute physically minimum input to photon latency possible.
// Create the metal view
SDL_MetalView metal_view = SDL_Metal_CreateView(window);
CA::MetalLayer *swap_chain = (CA::MetalLayer *)SDL_Metal_GetLayer(metal_view);
// Set up the Metal device
MTL::Device *device = MTL::CreateSystemDefaultDevice();
swap_chain->setDevice(device);
swap_chain->setPixelFormat(MTL::PixelFormat::PixelFormatBGRA8Unorm);
swap_chain->setDisplaySyncEnabled(true);
swap_chain->setMaximumDrawableCount(2);
I am using SDL3 just for creating the window. Now when I go through my game / render loop - I stall for a long time on getting the next drawable which is understandable - my app runs in about 2-3ms.
m_CurrentContext->m_Drawable = m_SwapChain->nextDrawable();
m_CurrentContext->m_CommandBuffer = m_CommandQueue->commandBuffer()->retain();
char frame_label[32];
snprintf(frame_label, sizeof(frame_label), "Frame %d", m_FrameIndex);
m_CurrentContext->m_CommandBuffer->setLabel(NS::String::string(frame_label, NS::UTF8StringEncoding));
m_CurrentContext->m_RenderPassDescriptor[ERenderPassTypeNormal] = MTL::RenderPassDescriptor::alloc()->init();
MTL::RenderPassColorAttachmentDescriptor* cd = m_CurrentContext->m_RenderPassDescriptor[ERenderPassTypeNormal]->colorAttachments()->object(0);
cd->setTexture(m_CurrentContext->m_Drawable->texture());
cd->setLoadAction(MTL::LoadActionClear);
cd->setClearColor(MTL::ClearColor( 0.53f, 0.81f, 0.98f, 1.0f ));
cd->setStoreAction(MTL::StoreActionStore);
However my ProMotion display does not reliably run at 120Hz when fullscreen and using the direct to display system - it seems to run faster when windowed in composite which is the opposite of what I would expect. The Metal HUD says 120Hz, but the delay to getting the next drawable and looking at what Instruments is saying tells otherwise.
When I profile it, the game loop has completed and is sitting there waiting for the next drawable, but the screen does not want to complete in 8.33ms, so the whole thing slows down for no discernible reason.
Also as a game developer it is very strange for the command buffer to actually need the drawable texture free to be allowed to encode commands - usually the command buffers and swapping the front and back render buffers are not directly dependent on each other. Usually you only actually need the render buffer texture free when you want to draw to it. I could give myself another drawable, but because I am completing in less than 3ms, all it would do would be to add another frame of latency.
I also looked at the FramePacing example and its behaviour is even worse at having high framerate with low latency - the direct to display is always rejected for some reason.
Is this just a flaw in the Metal API? Or am I missing something important? I hope someone can help - the behaviour of the display is baffling.
On macOS, system symbols displays in a SKTexture as expected, with the correct color and aspect ratio.
But on iOS they are always displayed in black, and sometimes with slightly wrong aspect ratio.
Is there a solution to this problem?
import SpriteKit
#if os(macOS)
import AppKit
#else
import UIKit
#endif
class GameScene: SKScene {
override func didMove(to view: SKView) {
let systemImage = "square.and.arrow.up"
let width = 400.0
#if os(macOS)
let image = NSImage(systemSymbolName: systemImage, accessibilityDescription: nil)!.withSymbolConfiguration(.init(hierarchicalColor: .white))!
let scale = NSScreen.main!.backingScaleFactor
image.size = CGSize(width: width * scale, height: width / image.size.width * image.size.height * scale)
#else
let image = UIImage(systemName: systemImage)!.applyingSymbolConfiguration(.init(pointSize: width))!.applyingSymbolConfiguration(.init(hierarchicalColor: .white))!
#endif
let texture = SKTexture(image: image)
print(image.size, texture.size(), image.size.width / image.size.height)
let size = CGSize(width: width, height: width / image.size.width * image.size.height)
addChild(SKSpriteNode(texture: texture, size: size))
}
}
I am sure others will agree with me on this. I personally don’t like the way the new reactions look. Too many different color for the reactions. I honestly prefer the old grey version for the reactions to text messages. The extra emoji thing is okay but the change in color for the heart, thumbs up and the other reactions are not the best. Auto correct is horrible in this new update by the way
I'll leave this here for anyone who's interested but it is possible to slightly use Windows VR on ARM Mac, right now it's just some demos but I am still working on solutions: https://www.youtube.com/watch?v=qbucnU0dpDo&t=431s&ab_channel=NightSightProductions
Hello,
I want to create a painting app for iOS and I saw many examples use a CAShapeLayer to draw a UIBezierPath.
As I understand CoreAnimation uses the GPU so I was wondering how is this implemented on the GPU? Or in other words, how would you do it with Metal or OpenGL?
I can only think of continuously updating a texture in response to the user's drawing but that would be a very resource intensive operation...
Thanks
In my app, I have an ARView that has cameraMode set to nonAR.
I occasionally hide the ARView when it is not needed and reveal it again later.
While the ARView is hidden, I'd like to pause the animation to save iPhone battery life. I'd also like to do this when I know that animation in my scene has paused and the contents of the view, although still visible, is static.
This was possible using SceneKit, but I can't seem to find an equivalent way to do it using RealityKit.
At least as of iOS 18, a hidden ARView with an empty scene appears to use approximately 30% of the CPU.
How can I pause ARView so that it won't use the battery unnecessarily?
Thank you for considering this question.