Post

Replies

Boosts

Views

Activity

Reply to troubleshooting SwiftUI crashes
@Claude31. I got the same problem (Xcode12) ContentView.swift: import SwiftUI struct ContentView: View {     @State var isSideBarPresented = true     @State var node = Node3D()     var body: some View {         VStack {             Button("Toggle") { isSideBarPresented.toggle() }             HSplitView {                 Color.white.frame(                     minWidth: 100,                     maxWidth: .infinity,                     minHeight: 0,                     maxHeight: .infinity                 )                 if isSideBarPresented {                     Node3DConfigurationView(node: $node)                 }             }         }.frame(             minWidth: 0,             maxWidth: .infinity,             minHeight: 0,             maxHeight: .infinity         )     } } Node3DConfigurationView.swift: import simd import SwiftUI struct Node3D {     var pivot: simd_float3 = .zero     var position: simd_float3 = .zero     var rotation: simd_float3 = .zero     var scale: simd_float3 = .zero } /* not sure if needed, but I randomly got some error without it */ fileprivate func wrap(_ binding: Binding<Float>) -> Binding<NSNumber> {     Binding(         get: { NSNumber(value: binding.wrappedValue) },         set: { binding.wrappedValue = $0.floatValue }     ) } struct Node3DConfigurationView: View {     @Binding var node: Node3D     var body: some View {         ScrollView(.vertical) {             Group {                 makeSection("Pivot", value: $node.pivot)                 makeSection("Position", value: $node.position)                 makeSection("Rotation", value: $node.rotation)                 makeSection("Scale", value: $node.scale)             }             .textFieldStyle(RoundedBorderTextFieldStyle())         }     }          func makeSection(_ headerTitle: String, value: Binding<simd_float3>) -> some View {         Section(header: makeHeader(headerTitle)) {             HStack {                 HStack {                     Text("x")                     TextField("\(headerTitle)X", value: wrap(value.x), formatter: NumberFormatter())                 }                 .frame(minWidth: 50)                 HStack {                     Text("y")                     TextField("\(headerTitle)Y", value: wrap(value.y), formatter: NumberFormatter())                 }                 .frame(minWidth: 50)                 HStack {                     Text("z")                     TextField("\(headerTitle)Z", value: wrap(value.z), formatter: NumberFormatter())                 }                 .frame(minWidth: 50)             }.padding()         }     }     func makeHeader(_ title: String) -> some View {         Text(title).frame(maxWidth: .infinity, alignment: .leading)     } } AppDelegate.swift (Default, generated by Xcode): import Cocoa import SwiftUI @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate {     var window: NSWindow!     func applicationDidFinishLaunching(_ aNotification: Notification) {         let contentView = ContentView()         window = NSWindow(             contentRect: NSRect(x: 0, y: 0, width: 480, height: 300),             styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView],             backing: .buffered, defer: false         )         window.isReleasedWhenClosed = false         window.center()         window.setFrameAutosaveName("Main Window")         window.contentView = NSHostingView(rootView: contentView)         window.makeKeyAndOrderFront(nil)     } }
Oct ’20
Reply to Xcode not responding
Same problem with Xcode 13.beta.2 on MBP 2018 i5 8GB 256GB. Some projects are working fine (one, that have been struggling from spm resolution so I couldn't build it on Xcode 12.5, works perfectly on Xcode 13+), but the one I'm paid for is not responding at all after package resolution (sometimes it crashes, sometimes just not responding), the same is valid for all my colleagues 🤡 Removing devices and simulators doesn't help.
Oct ’21
Reply to Xcode 15 beta 5 External macro implementation type 'ObservationMacros.ObservableMacro' could not be found for macro 'Observable()
I'm experiencing both a warning and a couple of errors in my case (a custom package with a macro). The errors are "Undefined symbols" and "Linker command failed with exit code 1". These issues only occur locally, initially on Xcode15-beta6 and persist even after the Xcode15 public release. However, when I compile the same source code on CI, it builds successfully (https://github.com/capturecontext/swift-foundation-extensions/tree/swift-macros).
Sep ’23
Reply to Swift Macro: Missing package product 'MyMacroApple'
Facing the same issue On Xcode 15/15.2-beta, https://github.com/capturecontext/swift-cocoa-extensions compiles in isolation, but not when it's imported as a dependency (both remote or local) to another package... I tried compiling for macOS and force disabled macro validation with defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES but nothing helps...
Dec ’23