Post

Replies

Boosts

Views

Activity

Reply to How to build clang modules to work with Swift/C++ interop
I have C++ Xcode projects and Swift projects. These only work right now with a c-style bridging header. Apple doesn’t have any sample apps that build clang modules sinice they were released many years ago. Watched the WWDC on explicit modules, but then read these don’t work with Swift interop. Have a modulemap file, -fmodules defined, but Swift still can’t see the C++ sources. one of the strengths of Apple development was ease of interop between ObjC++ and C++. Have had to wait until Swift 5/6 for something not under a C-wrapper. My code is on Swift 5 if that matters. But switching to Swift 6 is a concurrency warning flood.
Topic: Programming Languages SubTopic: Swift Tags:
Nov ’24
Reply to SwiftUI Lists down arrow handling broken
I have a profiler names alecazam/kram kram-profile. It's a SwiftUI app that does build analysis. It's not doing anything exotic with the List. The List was just broken. I finally got that app ported from Swift 5 to Swift 6, and that seems to have fixed the VStack { List } case. I can't port the other app to Swift 6 due to so many concurrency warnings. Not sure if this link will send, but this is the usage. But it's working now. I didn't change any code, just ported to Swift 6. But the tagged build isn't yet updated. https://github.com/alecazam/kram/blob/main/kram-profile/kram-profile/kram_profileApp.swift
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’24
Reply to How to build clang modules to work with Swift/C++ interop
I’m presuming that last bit was meant to be “Swift Xcode projects”. Yes, it's all Xcode. In a workspace, with separate swift and C++ code. The C++ is vector math and a texture encoder/decoder. The Swift is visionOS stuff, a build profiler, etc. Mostly forced into Swift use by Swift-only frameworks like SwiftUI and RealityKit. I'd like to move code off Swift and onto C++. This would primarily be Swift calling C++, and avoiding writing a bridging header. So I think I have modules for C++ building, but then get errors trying to import them into Swift. c++ module vectormath234 { // All headers are pulled in by this. requires cplusplus20 // This defaults to namespace simdk header "vectormath234.h" } Swift import vectormath234 module.modulemap:1:8 Module 'vectormath234' requires feature 'cplusplus20' MathHelpers.swift:6:8 Could not build Objective-C module 'vectormath234' I have -fmodules and -fcxx-modules set on the compile line. Thanks Quinn if you have time to address this. I really appreciate your great dev support.
Topic: Programming Languages SubTopic: Swift Tags:
Nov ’24
Reply to How to build clang modules to work with Swift/C++ interop
Also wondering how to interop one C++ lib with another via clang modules. This document says there is no syntax for that, and that only ObjC has the "@import module" syntax. Given that it's over 4 years since C++20, and still no C++ 20 module support, I've resigned to just use clang modules. But it's unclear what they do or don't support. The docs below state that C++ is possible, and just need the "requires cplusplus" designator, but see above errrors. https://prereleases.llvm.org/18.1.0/rc3/tools/clang/docs/Modules.html
Topic: Programming Languages SubTopic: Swift Tags:
Nov ’24
Reply to Metal texture allocated size versus actual image data size
So it turns out that ASTC is tied to a multiple of blocks. Say the block minimum is 16x16, that means a 512x512 @ 6x6 is not a perfect multiple of 16 blocks in either dimensions. So you get 96x96 instead of 86x86 blocks. Then carry this down the mip chain. 512x512 @ 4x4 x 16B = 128x128x16B = 262144B = 8bpp actual (16x16 tiles): 512x512 @ 6x6 x 16B = 96x96x16B = 147456B = 4.5bpp expected: 512x512 @ 6x6 x 16B = 86x86x16B = 118336B = 3.6bpp
Topic: Graphics & Games SubTopic: Metal Tags:
Mar ’25
Reply to PSVR2 controllers don't report anything in snapshot
There also seems to be an adaptive trigger class on the PS5 controller, but I don't see anyway to get at that for AVP. Having the AVP take over those triggers for pinch needs an obvious override for a game. These are supposed to take in input to provide feedback. #import <GameController/GCDualSenseGamepad.h> // ps5 @property (nonatomic, readonly) GCDualSenseAdaptiveTrigger *leftTrigger; @property (nonatomic, readonly) GCDualSenseAdaptiveTrigger *rightTrigger;
Topic: Graphics & Games SubTopic: GameKit Tags:
Sep ’25
Reply to How to build clang modules to work with Swift/C++ interop
I have C++ Xcode projects and Swift projects. These only work right now with a c-style bridging header. Apple doesn’t have any sample apps that build clang modules sinice they were released many years ago. Watched the WWDC on explicit modules, but then read these don’t work with Swift interop. Have a modulemap file, -fmodules defined, but Swift still can’t see the C++ sources. one of the strengths of Apple development was ease of interop between ObjC++ and C++. Have had to wait until Swift 5/6 for something not under a C-wrapper. My code is on Swift 5 if that matters. But switching to Swift 6 is a concurrency warning flood.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’24
Reply to How to build clang modules to work with Swift/C++ interop
Also when I have Swift 5 set in Xcode 16, is that 5.xx (f.e. 5.9 has interop) or 5.0?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’24
Reply to How to receive keyboard/mouse on VisionOS?
Looks like the GC calls do work for mouse/keyboard. I just need the shorter notification names. notifications.addObserver(forName: .GCKeyboardDidConnect, object: nil, queue: .main) { [weak self] note in if let controller = note.object as? GCKeyboard { self?.addKeyboard(controller) } }
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
Nov ’24
Reply to SwiftUI Lists down arrow handling broken
I have a profiler names alecazam/kram kram-profile. It's a SwiftUI app that does build analysis. It's not doing anything exotic with the List. The List was just broken. I finally got that app ported from Swift 5 to Swift 6, and that seems to have fixed the VStack { List } case. I can't port the other app to Swift 6 due to so many concurrency warnings. Not sure if this link will send, but this is the usage. But it's working now. I didn't change any code, just ported to Swift 6. But the tagged build isn't yet updated. https://github.com/alecazam/kram/blob/main/kram-profile/kram-profile/kram_profileApp.swift
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’24
Reply to How to build clang modules to work with Swift/C++ interop
I’m presuming that last bit was meant to be “Swift Xcode projects”. Yes, it's all Xcode. In a workspace, with separate swift and C++ code. The C++ is vector math and a texture encoder/decoder. The Swift is visionOS stuff, a build profiler, etc. Mostly forced into Swift use by Swift-only frameworks like SwiftUI and RealityKit. I'd like to move code off Swift and onto C++. This would primarily be Swift calling C++, and avoiding writing a bridging header. So I think I have modules for C++ building, but then get errors trying to import them into Swift. c++ module vectormath234 { // All headers are pulled in by this. requires cplusplus20 // This defaults to namespace simdk header "vectormath234.h" } Swift import vectormath234 module.modulemap:1:8 Module 'vectormath234' requires feature 'cplusplus20' MathHelpers.swift:6:8 Could not build Objective-C module 'vectormath234' I have -fmodules and -fcxx-modules set on the compile line. Thanks Quinn if you have time to address this. I really appreciate your great dev support.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’24
Reply to How to build clang modules to work with Swift/C++ interop
Also wondering how to interop one C++ lib with another via clang modules. This document says there is no syntax for that, and that only ObjC has the "@import module" syntax. Given that it's over 4 years since C++20, and still no C++ 20 module support, I've resigned to just use clang modules. But it's unclear what they do or don't support. The docs below state that C++ is possible, and just need the "requires cplusplus" designator, but see above errrors. https://prereleases.llvm.org/18.1.0/rc3/tools/clang/docs/Modules.html
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’24
Reply to How to build clang modules to work with Swift/C++ interop
I also found this setting in Xcode, so set that for C++/Obj-C++ itnerop. That seems to change the errors that I get about ObjC. Will have more time to revisit this later. SWIFT_OBJC_INTEROP_MODE = objcxx
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’24
Reply to clang multiarch doens't work with precompiled headers
As I stated already, that doesn’t work with setting valid arch to one platform. So really need multi arch to work. Now you also have 2 .o files, so then two libs, and then two more exe that have to be lipo-ed together. And now 2 targets. So it’s a bad cascade.
Replies
Boosts
Views
Activity
Nov ’24
Reply to How to build clang modules to work with Swift/C++ interop
Thanks Quinn! I'll get back to the interop soon. The bridging header feels like cheating, but it's interesting that Xcode allowed you to include a C++ header there. Mine only contain ObjC and C. But with that new Interoperability setting, that does seem to change things.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’24
Reply to Metal texture allocated size versus actual image data size
So it turns out that ASTC is tied to a multiple of blocks. Say the block minimum is 16x16, that means a 512x512 @ 6x6 is not a perfect multiple of 16 blocks in either dimensions. So you get 96x96 instead of 86x86 blocks. Then carry this down the mip chain. 512x512 @ 4x4 x 16B = 128x128x16B = 262144B = 8bpp actual (16x16 tiles): 512x512 @ 6x6 x 16B = 96x96x16B = 147456B = 4.5bpp expected: 512x512 @ 6x6 x 16B = 86x86x16B = 118336B = 3.6bpp
Topic: Graphics & Games SubTopic: Metal Tags:
Replies
Boosts
Views
Activity
Mar ’25
Reply to Why can't Xcode projects be opened in multiple workspaces
Workspace build fails to build with: "/foo/bar.xcodeproj Couldn't load bar.xcodeproj because it is already opened from another project or workspace"
Replies
Boosts
Views
Activity
Jun ’25
Reply to PSVR2 controllers don't report anything in snapshot
I have that since I was already getting extendedGamepad. I had to break up and use a different controller path. I was snap shooting the controller, but now snapshot the input. These come in as split controllers with very different buttons to query from the extendedGamepad.
Topic: Graphics & Games SubTopic: GameKit Tags:
Replies
Boosts
Views
Activity
Sep ’25
Reply to PSVR2 controllers don't report anything in snapshot
There also seems to be an adaptive trigger class on the PS5 controller, but I don't see anyway to get at that for AVP. Having the AVP take over those triggers for pinch needs an obvious override for a game. These are supposed to take in input to provide feedback. #import <GameController/GCDualSenseGamepad.h> // ps5 @property (nonatomic, readonly) GCDualSenseAdaptiveTrigger *leftTrigger; @property (nonatomic, readonly) GCDualSenseAdaptiveTrigger *rightTrigger;
Topic: Graphics & Games SubTopic: GameKit Tags:
Replies
Boosts
Views
Activity
Sep ’25
Reply to Incorrect menu consistency warnings logged in Tahoe for NSStatusItem, performance issues related?
Getting a flurry of these warnings at the top of my macOS/Xcode 26.0 and 26.1 builds (200 lines). These did not occur prior. These are Apple system menus that are in the Storyboard that have been there forever.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Nov ’25
Reply to RealityKit and USDZ: Winding Order Issue with Negatively Scaled Meshes
RealityKit would need to identify mirrored geometry (1 or 3 negative scales), and then submit those separately with the winding flipped.
Topic: Graphics & Games SubTopic: RealityKit Tags:
Replies
Boosts
Views
Activity
Nov ’25