Xcode 13.2 SwiftUI Preview Crashes - xcode

I am learning SwiftUI on 100 Days of SwiftUI on Hacking with Swift. My Xcode SwiftUI Preview crashes and I don't know why. Running on Simulator works though. I tried to completely reinstall Xcode (deleting the app, preferences, libraries etc), but it still doesn't work. I am using Xcode 13.2.1 on iMac 2019 i9 9900K 64GB RAM.
Here is the problem details. (cannot contain full report because of 30000 word limit)
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: SIGNAL 4 Illegal instruction: 4
Terminating Process: exc handler [4180]
Triggered by Thread: 0
Application Specific Information:
CoreSimulator 783.5 - Device: iPod touch (7th generation) (B14B5709-F815-4854-ADB6-E7102668056B) - Runtime: iOS 15.2 (19C51) - DeviceType: iPod touch (7th generation)
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/minsoochoo/Library/Developer/Xcode/DerivedData/WeSplit-ctmzuorhwkvroxgikiijvbbbfwyq/Build/Intermediates.noindex/Previews/WeSplit/Products/Debug-iphonesimulator DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot//System/Library/PrivateFrameworks/PreviewsInjection.framework/PreviewsInjection DYLD_FRAMEWORK_PATH=/Users/minsoochoo/Library/Developer/Xcode/DerivedData/WeSplit-ctmzuorhwkvroxgikiijvbbbfwyq/Build/Intermediates.noindex/Previews/WeSplit/Products/Debug-iphonesimulator
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/minsoochoo/Library/Developer/Xcode/DerivedData/WeSplit-ctmzuorhwkvroxgikiijvbbbfwyq/Build/Intermediates.noindex/Previews/WeSplit/Products/Debug-iphonesimulator DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot//System/Library/PrivateFrameworks/PreviewsInjection.framework/PreviewsInjection DYLD_FRAMEWORK_PATH=/Users/minsoochoo/Library/Developer/Xcode/DerivedData/WeSplit-ctmzuorhwkvroxgikiijvbbbfwyq/Build/Intermediates.noindex/Previews/WeSplit/Products/Debug-iphonesimulator
Thread 0 Crashed:: Dispatch queue: BSXPCCnx:com.apple.dt.xcode-previews.systemservices (BSCnx:client:com.apple.dt.uv.agent-preview-nonui-service)
0 SwiftUI 0x7fff5c970f89 static FocusState._makeProperty<A>(in:container:fieldOffset:inputs:) + 160
1 SwiftUI 0x7fff5c97141e protocol witness for static DynamicProperty._makeProperty<A>(in:container:fieldOffset:inputs:) in conformance FocusState<A> + 25
2 SwiftUI 0x7fff5d17717c _DynamicPropertyBuffer.addFields<A>(_:container:inputs:baseOffset:) + 131
3 SwiftUI 0x7fff5d17709a _DynamicPropertyBuffer.init<A>(fields:container:inputs:baseOffset:) + 111
4 SwiftUI 0x7fff5ce5d24c project #1 <A><A1>(flags:) in closure #1 in BodyAccessor.makeBody(container:inputs:fields:) + 413
5 SwiftUI 0x7fff5ce5d0a4 closure #1 in BodyAccessor.makeBody(container:inputs:fields:) + 113
6 SwiftUI 0x7fff5ce5ebf1 partial apply for closure #1 in BodyAccessor.makeBody(container:inputs:fields:) + 54
7 SwiftUI 0x7fff5ce5ec12 partial apply for thunk for #callee_guaranteed (#unowned UnsafeMutablePointer<_GraphInputs>) -> (#out _GraphValue<A.BodyAccessor.Body>, #out _DynamicPropertyBuffer?, #error #owned Error) + 27
8 libswiftCore.dylib 0x7fff3083190c withUnsafePointer<A, B>(to:_:) + 12
9 libswiftCore.dylib 0x7fff309f2259 withUnsafeMutablePointer<A, B>(to:_:) + 9
10 SwiftUI 0x7fff5ce5c68a BodyAccessor.makeBody(container:inputs:fields:) + 286
11 SwiftUI 0x7fff5c94b39e static View.makeBody(view:inputs:fields:) + 160
12 SwiftUI 0x7fff5c94b0f6 static View.makeViewList(view:inputs:) + 342
13 SwiftUI 0x7fff5c94a5f4 static View._makeViewList(view:inputs:) + 104
14 WeSplit 0x102730029 protocol witness for static View._makeViewList(view:inputs:) in conformance ContentView + 9
15 SwiftUI 0x7fff5ce641cb AnyViewStorage.makeViewList(view:inputs:) + 550
16 SwiftUI 0x7fff5ce6526a closure #2 in AnyViewList.updateValue() + 587
17 SwiftUI 0x7fff5ce64e76 AnyViewList.updateValue() + 976
18 SwiftUI 0x7fff5c83af29 partial apply for specialized implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 15
19 AttributeGraph 0x7fff4ff9b37b AG::Graph::UpdateStack::update() + 553
20 AttributeGraph 0x7fff4ff9b971 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 411
21 AttributeGraph 0x7fff4ffa1656 AG::Graph::value_ref(AG::AttributeID, AGSwiftMetadata const*, unsigned char&) + 128
22 AttributeGraph 0x7fff4ffb877a AGGraphGetValue + 291
23 SwiftUI 0x7fff5c8b67bd TestableViewContent.list.getter + 47
24 SwiftUI 0x7fff5c8b64a6 TestableViewContent.children.getter + 41
25 SwiftUI 0x7fff5c8b61f2 View.withChildrenForTest<A>(environment:options:body:) + 181
26 SwiftUI 0x7fff5cc7de3f View._allPreviews.getter + 88
27 SwiftUI 0x7fff5cc7ddbe MakePreviews.visit<A>(type:) + 128
28 SwiftUI 0x7fff5d1a5afc _callVisitViewType2 + 34
29 SwiftUI 0x7fff5cc7dd18 static _PreviewProvider._allPreviews.getter + 165
30 PreviewsInjection 0x102ae7f6f 0x102ac4000 + 147311
31 PreviewsInjection 0x102ae7ea3 0x102ac4000 + 147107
32 PreviewsInjection 0x102ae04b6 0x102ac4000 + 115894
33 PreviewsInjection 0x102adc85d 0x102ac4000 + 100445
34 PreviewsInjection 0x102adc265 0x102ac4000 + 98917
35 PreviewsInjection 0x102adc519 0x102ac4000 + 99609
36 BoardServices 0x7fff261a2c1c +[BSXPCServiceConnectionProxy invokeMethod:onTarget:withMessage:forConnection:] + 1596
37 BoardServices 0x7fff261b0884 __63-[BSXPCServiceConnectionEventHandler connection:handleMessage:]_block_invoke + 562
38 BoardServices 0x7fff261d9879 BSXPCServiceConnectionExecuteCallOut + 325
39 BoardServices 0x7fff261b04cf -[BSXPCServiceConnectionEventHandler connection:handleMessage:] + 172
40 BoardServices 0x7fff261d8bd7 -[BSXPCServiceConnection _connection_handleMessage:fromPeer:withHandoff:] + 679
41 libdispatch.dylib 0x7fff2011265a _dispatch_call_block_and_release + 12
42 libdispatch.dylib 0x7fff2011383a _dispatch_client_callout + 8
43 libdispatch.dylib 0x7fff20119e0c _dispatch_lane_serial_drain + 743
44 libdispatch.dylib 0x7fff2011aa07 _dispatch_lane_invoke + 455
45 libdispatch.dylib 0x7fff20120ba5 _dispatch_main_queue_callback_4CF + 848
46 CoreFoundation 0x7fff2036c84d __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
47 CoreFoundation 0x7fff203670aa __CFRunLoopRun + 2772
48 CoreFoundation 0x7fff203660f3 CFRunLoopRunSpecific + 567
49 GraphicsServices 0x7fff2c995cd3 GSEventRunModal + 139
50 UIKitCore 0x7fff25059f42 -[UIApplication _run] + 928
51 UIKitCore 0x7fff2505eb5e UIApplicationMain + 101
52 SwiftUI 0x7fff5d0d5dcf closure #1 in KitRendererCommon(_:) + 196
53 SwiftUI 0x7fff5d0d5d09 runApp<A>(_:) + 148
54 SwiftUI 0x7fff5cabdbad static App.main() + 61
55 WeSplit 0x102732a08 static WeSplitApp.$main() + 72 (WeSplitApp.swift:10)
56 WeSplit 0x102732ab3 main + 67
57 dyld_sim 0x102969ee9 start_sim + 10
58 dyld 0x108ced4fe start + 462
Thread 1:
0 libsystem_pthread.dylib 0x7fff6da2dfec start_wqthread + 0
Thread 2:: Dispatch queue: com.apple.root.utility-qos
0 dyld_sim 0x102973a78 bool SwiftHashTable::equal<SwiftTypeProtocolConformanceLocationKey, SwiftTypeProtocolConformanceLocationKey>(SwiftTypeProtocolConformanceLocationKey const&, SwiftTypeProtocolConformanceLocationKey const&, unsigned char const*) const + 4
1 dyld_sim 0x102985e3a unsigned int SwiftHashTable::getIndex<SwiftTypeProtocolConformanceLocationKey, SwiftTypeProtocolConformanceLocationKey>(SwiftTypeProtocolConformanceLocationKey const&, unsigned char const*) const + 126
2 dyld_sim 0x102985d86 unsigned int SwiftHashTable::getPotentialTarget<SwiftTypeProtocolConformanceLocationKey, SwiftTypeProtocolConformanceLocationKey>(SwiftTypeProtocolConformanceLocationKey const&, unsigned char const*) const + 14
3 dyld_sim 0x102984ebe dyld4::APIs::_dyld_find_protocol_conformance(void const*, void const*, void const*) const + 168
4 libswiftCore.dylib 0x7fff30a40b9f swift_conformsToProtocolMaybeInstantiateSuperclasses(swift::TargetMetadata<swift::InProcess> const*, swift::TargetProtocolDescriptor<swift::InProcess> const*, bool) + 191
5 libswiftCore.dylib 0x7fff30a408ce swift_conformsToProtocol + 78
6 libswiftCore.dylib 0x7fff30a00cea swift::_conformsToProtocol(swift::OpaqueValue const*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetProtocolDescriptorRef<swift::InProcess>, swift::TargetWitnessTable<swift::InProcess> const**) + 42
7 libswiftCore.dylib 0x7fff30a3ff3f swift::_checkGenericRequirements(__swift::__runtime::llvm::ArrayRef<swift::TargetGenericRequirementDescriptor<swift::InProcess> >, __swift::__runtime::llvm::SmallVectorImpl<void const*>&, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, unsigned int)>, std::__1::function<swift::TargetWitnessTable<swift::InProcess> const* (swift::TargetMetadata<swift::InProcess> const*, unsigned int)>) + 1839
8 libswiftCore.dylib 0x7fff30a3f742 swift::TargetProtocolConformanceDescriptor<swift::InProcess>::getWitnessTable(swift::TargetMetadata<swift::InProcess> const*) const + 290
9 libswiftCore.dylib 0x7fff30a41391 swift_conformsToProtocolMaybeInstantiateSuperclasses(swift::TargetMetadata<swift::InProcess> const*, swift::TargetProtocolDescriptor<swift::InProcess> const*, bool) + 2225
10 libswiftCore.dylib 0x7fff30a408ce swift_conformsToProtocol + 78
11 AttributeGraph 0x7fff4ffaa1e8 AG::LayoutDescriptor::Builder::visit_element(AG::swift::metadata const*, AG::swift::metadata::ref_kind, unsigned long) + 102
12 AttributeGraph 0x7fff4ff98ea7 AG::swift::metadata_visitor::visit_field(AG::swift::metadata const*, AG::swift::field_record const&, unsigned long) + 79
13 AttributeGraph 0x7fff4ff986b8 AG::swift::metadata::visit(AG::swift::metadata_visitor&) const + 648
14 AttributeGraph 0x7fff4ffaa2a4 AG::LayoutDescriptor::Builder::visit_element(AG::swift::metadata const*, AG::swift::metadata::ref_kind, unsigned long) + 290
15 AttributeGraph 0x7fff4ff98ea7 AG::swift::metadata_visitor::visit_field(AG::swift::metadata const*, AG::swift::field_record const&, unsigned long) + 79
16 AttributeGraph 0x7fff4ff986b8 AG::swift::metadata::visit(AG::swift::metadata_visitor&) const + 648
17 AttributeGraph 0x7fff4ffab04b AG::LayoutDescriptor::make_layout(AG::swift::metadata const*, AGComparisonMode, AG::LayoutDescriptor::HeapMode) + 474
18 AttributeGraph 0x7fff4ffac36c AG::(anonymous namespace)::LayoutCache::drain_queue(void*) + 142
19 libdispatch.dylib 0x7fff2011383a _dispatch_client_callout + 8
20 libdispatch.dylib 0x7fff20124077 _dispatch_root_queue_drain + 788
21 libdispatch.dylib 0x7fff20124867 _dispatch_worker_thread2 + 155
22 libsystem_pthread.dylib 0x7fff6da2f02e _pthread_wqthread + 256
23 libsystem_pthread.dylib 0x7fff6da2dffb start_wqthread + 15
Thread 3:
0 libsystem_pthread.dylib 0x7fff6da2dfec start_wqthread + 0
Thread 4:
0 libsystem_pthread.dylib 0x7fff6da2dfec start_wqthread + 0
Thread 5:
0 libsystem_pthread.dylib 0x7fff6da2dfec start_wqthread + 0
Thread 6:: com.apple.uikit.eventfetch-thread
0 libsystem_kernel.dylib 0x7fff6d9d4aba mach_msg_trap + 10
1 libsystem_kernel.dylib 0x7fff6d9d4e2b mach_msg + 59
2 CoreFoundation 0x7fff2036c440 __CFRunLoopServiceMachPort + 319
3 CoreFoundation 0x7fff20366ae3 __CFRunLoopRun + 1293
4 CoreFoundation 0x7fff203660f3 CFRunLoopRunSpecific + 567
5 Foundation 0x7fff2081c754 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 213
6 Foundation 0x7fff2081c9cb -[NSRunLoop(NSRunLoop) runUntilDate:] + 72
7 UIKitCore 0x7fff2511a2d1 -[UIEventFetcher threadMain] + 491
8 Foundation 0x7fff20845550 __NSThread__start__ + 1025
9 libsystem_pthread.dylib 0x7fff6da324f4 _pthread_start + 125
10 libsystem_pthread.dylib 0x7fff6da2e00f thread_start + 15
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000002 rbx: 0x0000000000000000 rcx: 0x00007fff4ffc4b50 rdx: 0x0001000000000028
rdi: 0x0000000000000000 rsi: 0x00007fff8b43c050 rbp: 0x00007ff7bd7d2fb0 rsp: 0x00007ff7bd7d2f70
r8: 0x00007fff5d231685 r9: 0x00007fff86bdd330 r10: 0x0000000000000004 r11: 0x0000000000000072
r12: 0x0000000000000002 r13: 0x00007ff7bd7d30a0 r14: 0x0000000000000040 r15: 0x00007fff8a918d88
rip: 0x00007fff5c970f89 rfl: 0x0000000000010246 cr2: 0x00007fff5d2316b7
Logical CPU: 0
Error Code: 0x00000000
Trap Number: 6
Binary Images:
0x7fff5c697000 - 0x7fff5d4f2fff com.apple.SwiftUI (3.2.5.0.100) <c680d16f-a317-3c6e-87fa-141c22a715da> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/SwiftUI.framework/SwiftUI
0x7fff30710000 - 0x7fff30acffff libswiftCore.dylib (*) <6013ecdd-c54d-3948-8b7c-e9f5613107f6> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/libswiftCore.dylib
0x102728000 - 0x102733fff me.choo.minsoo.WeSplit (1.0) <d0012a27-d11a-39a0-b4eb-f874af3b5857> /Users/USER/Library/Developer/Xcode/UserData/Previews/Simulator Devices/B14B5709-F815-4854-ADB6-E7102668056B/data/Containers/Bundle/Application/BA738B59-7D89-47AA-8012-6234AA6E65B0/WeSplit.app/WeSplit
0x7fff4ff96000 - 0x7fff4ffcafff com.apple.AttributeGraph (3.2.1) <20c3feeb-4d9b-3501-be47-de9ae60ae297> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AttributeGraph.framework/AttributeGraph
0x102ac4000 - 0x102af5fff com.apple.dt.PreviewsInjection (13.0) <385f7334-89cd-3998-bc1b-54dd898b38ad> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/PreviewsInjection.framework/PreviewsInjection
0x7fff2619e000 - 0x7fff261edfff com.apple.BoardServices (1.0) <d4742ff1-1051-348e-afb4-dcb3bc434c50> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/BoardServices.framework/BoardServices
0x7fff20110000 - 0x7fff20157fff libdispatch.dylib (*) <20999e62-bcc2-377e-8ce7-afda271eb914> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib
0x7fff202ec000 - 0x7fff2068bfff com.apple.CoreFoundation (6.9) <c6308add-135b-3a70-9b81-1ce4d994c215> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x7fff2c992000 - 0x7fff2c99afff com.apple.GraphicsServices (1.0) <adea8ae1-c723-351b-ac2e-22fd2c861c30> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x7fff2438c000 - 0x7fff25934fff com.apple.UIKitCore (1.0) <3ef2c381-8193-3e3c-801f-925bd1050bd7> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
0x102968000 - 0x1029b5fff dyld_sim (*) <3f15c197-2d43-3490-98ff-de85f18dadf2> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/dyld_sim
0x108ce8000 - 0x108d53fff dyld (*) <7de33963-bbc5-3996-ba6e-f1d562c17c95> /usr/lib/dyld
0x7fff6da2c000 - 0x7fff6da37fff libsystem_pthread.dylib (*) <ee564342-d8f2-396d-b642-40092cf34d82> /usr/lib/system/libsystem_pthread.dylib
0x7fff6d9d4000 - 0x7fff6da0afff libsystem_kernel.dylib (*) <c1d58a50-5a4d-3bcb-a1fc-ec0902ce34d3> /usr/lib/system/libsystem_kernel.dylib
0x7fff206fa000 - 0x7fff209b0fff com.apple.Foundation (6.9) <61dcc68e-1236-3624-bb6d-a3a850adf63a> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Foundation
EOF
And the diagnostics:
MessageSendFailure: Message send failure for update
==================================
| MessageError: Connection interrupted
Code:
ContentView.swift
import SwiftUI
struct ContentView: View {
#State private var checkAmount = 0.0
#State private var numberOfPeople = 2
#State private var tipPercentage = 20
let tipPercentages = 0..<101
var totalPerPerson: Double {
let peopleCount = Double(numberOfPeople + 2)
let tipSelection = Double(tipPercentage)
let tipValue = checkAmount / 100 * tipSelection
let grandTotal = checkAmount + tipValue
let amountPerPerson = grandTotal / peopleCount
return amountPerPerson
}
var total: Double {
checkAmount + checkAmount / 100 * Double(tipPercentage)
}
#FocusState private var amountIsFocused: Bool
var body: some View {
NavigationView {
Form {
Section {
TextField("Amount", value: $checkAmount, format: .currency(code: Locale.current.currencyCode ?? "USD"))
.keyboardType(.decimalPad)
.focused($amountIsFocused)
Picker("Number of People", selection: $numberOfPeople) {
ForEach(2..<100) {
Text("\($0) people")
}
}
}
Section {
Picker("Tip Percentage", selection: $tipPercentage) {
ForEach(tipPercentages, id: \.self) {
Text($0, format: .percent)
}
}
} header: {
Text("How much tip do you want to leave?")
}
Section {
Text(totalPerPerson, format: .currency(code: Locale.current.currencyCode ?? "USD"))
} header: {
Text("Amount per person")
}
Section {
Text(total, format: .currency(code: Locale.current.currencyCode ?? "USD"))
}
}
.navigationTitle("WeSplit")
}
.toolbar {
ToolbarItemGroup(placement: .keyboard) {
Spacer()
Button("Done") {
amountIsFocused = false
}
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
WeSplitApp.swift
import SwiftUI
#main
struct WeSplitApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}

Solved by adding ZStack in Preview struct solved it.. This is maybe a bug.
Solution
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ZStack {
ContentView()
}
}
}

Related

Xamarin Forms (iOS): This application is modifying the autolayout engine

Since I added translations between two ContentViews (to go from one to the other one nicely), I have the following logs:
This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. This can lead to engine corruption and weird crashes.
Stack:(
0 Foundation 0x0000000110da2ec6 _AssertAutolayoutOnAllowedThreadsOnly + 77
1 Foundation 0x0000000110da2b89 -[NSISEngine _optimizeWithoutRebuilding] + 61
2 Foundation 0x0000000110bb1ebb -[NSISEngine optimize] + 108
3 Foundation 0x0000000110da00ac -[NSISEngine performPendingChangeNotifications] + 84
4 UIKit 0x00000001116f89f9 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2211
5 QuartzCore 0x00000001138a63ee -[CALayer layoutSublayers] + 153
6 QuartzCore 0x00000001138aa4dd _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 401
7 QuartzCore 0x0000000113832ded _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 365
8 QuartzCore 0x000000011385e704 _ZN2CA11Transaction6commitEv + 500
9 MyProject.iOS 0x000000010f6bbd39 xamarin_dyn_objc_msgSend + 217
10 ??? 0x000000012f8e9462 0x0 + 5092840546
11 ??? 0x000000013025827c 0x0 + 5102731900
12 MyProject.iOS 0x000000010f5272c9 mono_jit_runtime_invoke + 1273
13 MyProject.iOS 0x000000010f5dbaa8 do_runtime_invoke + 88
14 MyProject.iOS 0x000000010f61bf9e start_wrapper + 718
15 libsystem_pthread.dylib 0x0000000117fe06c1 _pthread_body + 340
16 libsystem_pthread.dylib 0x0000000117fe056d _pthread_body + 0
17 libsystem_pthread.dylib 0x0000000117fdfc5d thread_start + 13
)
This is my code:
Device.BeginInvokeOnMainThread(async () =>
{
DetailContentView.Children.Insert(0, masterDetailContentView);
await DetailContentView.Children[1].TranslateTo(App.ScreenWidth - 100, 0, 250);
await DetailContentView.Children[1].TranslateTo(App.ScreenWidth, 0, 50);
DetailContentView.Children.RemoveAt(1);
});
where DetailContentView is a Grid, masterDetailContentView is the ContentView that will appear and DetailContentView.Children[1] is the ContentView that will disappear.
This piece of code works but I want to remove the logs.
Thanks!

Got "valueForUndefinedKey: this class is not key value coding-compliant for the key error" when use NSArrayController

I'm working for NSCollectionView by using Swift. When I use a NSArrayController object as content of NSCollectionView. I got follow error:
An uncaught exception was raised
[ valueForUndefinedKey:]: this class is not key value coding-compliant for the key plugName .
I have no idea why. I create a model named NHPlug and a NSArrayController as follow, here's my code. :
/* Class NHAppController */
import Cocoa
class NHAppController: NSObject {
#IBOutlet weak var arrayController: NSArrayController?
var plugs: NSMutableArray?
override func awakeFromNib() {
var t = NHPlug(plugID: 1, plugName: "test")
plugs = NSMutableArray()
arrayController?.addObject(t)
}
}
/* Class NSPlug */
import Cocoa
class NHPlug: NSObject {
var plugID : Int
var plugName : String
init(plugID: Int, plugName: String) {
self.plugID = plugID
self.plugName = plugName;
}
}
If anybody could help, very appreciate for that!
And here if crash stack:
-01-21 19:47:07.347 Notifyhub[58369:598950] An uncaught exception was raised 2015-01-21 19:47:07.347 Notifyhub[58369:598950]
[ valueForUndefinedKey:]: this class
is not key value coding-compliant for the key plugName . 2015-01-21
19:47:07.348 Notifyhub[58369:598950] ( 0 CoreFoundation
0x00007fff9220b64c __exceptionPreprocess + 172 1 libobjc.A.dylib
0x00007fff950966de objc_exception_throw + 43 2 CoreFoundation
0x00007fff9220b1e9 -[NSException raise] + 9 3 Foundation
0x00007fff8bd6c5ed -[NSObject(NSKeyValueCoding) valueForUndefinedKey:]
+ 226 4 Foundation 0x00007fff8bc89e68 -[NSObject(NSKeyValueCoding) valueForKey:] + 385 5 Foundation 0x00007fff8bca28e3 -[NSObject(NSKeyValueCoding) valueForKeyPath:] +
324 6 Foundation 0x00007fff8bca28af
-[NSObject(NSKeyValueCoding) valueForKeyPath:] + 272 7 AppKit 0x00007fff8975c8bf -[NSBinder
valueForBinding:resolveMarkersToPlaceholders:] + 164 8 AppKit
0x00007fff89760700 -[NSValueBinder
_adjustObject:mode:observedController:observedKeyPath:context:editableState:adjustState:]
+ 302 9 AppKit 0x00007fff8976053b -[NSValueBinder _observeValueForKeyPath:ofObject:context:] + 276 10 AppKit 0x00007fff897603ab
-[NSTextValueBinder _observeValueForKeyPath:ofObject:context:] + 43 11 Foundation 0x00007fff8bc63c73
NSKeyValueNotifyObserver + 382 12 Foundation
0x00007fff8bc62e48 NSKeyValueDidChange + 463 13 Foundation
0x00007fff8bc679ad -[NSObject(NSKeyValueObserverNotification)
didChangeValueForKey:] + 118 14 AppKit
0x00007fff89eb5e83 -[NSCollectionView newItemForRepresentedObject:] +
87 15 AppKit 0x00007fff89ebce03
-[NSCollectionView _getItemsToDisplay] + 1168 16 AppKit 0x00007fff89eb5595 -[NSCollectionView setContent:] + 217 17 AppKit
0x00007fff89e8e965 -[NSCollectionViewBinder _updateContent] + 93 18
AppKit 0x00007fff89e8e9f0
-[NSCollectionViewBinder _observeValueForKeyPath:ofObject:context:] + 84 19 Foundation 0x00007fff8bc63c73
NSKeyValueNotifyObserver + 382 20 Foundation
0x00007fff8bca22a6 -[NSObject(NSKeyValueObservingPrivate)
_notifyObserversForKeyPath:change:] + 1142 21 AppKit 0x00007fff897533ba -[NSController _notifyObserversForKeyPath:change:]
+ 206 22 AppKit 0x00007fff8984f126 -[NSArrayController didChangeValuesForArrangedKeys:objectKeys:indexKeys:] + 54 23 AppKit
0x00007fff89a1dbd0 -[NSArrayController
_insertObject:atArrangedObjectIndex:objectHandler:] + 514 24 AppKit 0x00007fff89a1d82c -[NSArrayController addObject:] + 153 25
Notifyhub 0x000000010000166a
_TFC9Notifyhub15NHAppController12awakeFromNibfS0_FT_T_ + 362 26 Notifyhub 0x00000001000016d2
_TToFC9Notifyhub15NHAppController12awakeFromNibfS0_FT_T_ + 34 27 CoreFoundation 0x00007fff9211983f -[NSSet
makeObjectsPerformSelector:] + 223 28 AppKit
0x00007fff89ba2ffd -[NSIBObjectData
nibInstantiateWithOwner:options:topLevelObjects:] + 1216 29 AppKit
0x00007fff89c22122 -[NSNib
_instantiateNibWithExternalNameTable:options:] + 677 30 AppKit 0x00007fff89c22236 -[NSNib
_instantiateWithOwner:options:topLevelObjects:] + 143 31 AppKit 0x00007fff89d5f36c -[NSStoryboard
instantiateControllerWithIdentifier:] + 181 32 AppKit
0x00007fff896afef4 NSApplicationMain + 840 33 Notifyhub
0x00000001000011c2 top_level_code + 34 34 Notifyhub
0x00000001000011fa main + 42 35 libdyld.dyli
Got the answer myself. Post here to help any poor new guy for Swift.
In Swift KVO is not default support any more, when you declare a variable must set "dynamic" as follow:
dynamic var plugID : Int
dynamic var plugName : String

Adding text container to NSLayoutManager results in exception

In my cocoa application (written in Swift), I am trying to make a pagination system, where each page is an instance of CASTextView (a subclass of NSTextView). Additionally, each CASTextView retains an instance of CASTextContainer (a subclass of NSTextContainer). In order to accomplish pagination, I have made all instances of CASTextView share the same NSLayoutManager instance via a singleton pattern.
I have implemented the method - (void)layoutManager:(NSLayoutManager *)aLayoutManager didCompleteLayoutForTextContainer:(NSTextContainer *)aTextContainer atEnd:(BOOL)flag as follows:
func layoutManager(layoutManager: NSLayoutManager!,
didCompleteLayoutForTextContainer textContainer: NSTextContainer!,
atEnd layoutFinishedFlag: Bool)
{
let containers = layoutManager.textContainers
if !layoutFinishedFlag || !textContainer {
let lastContainer = containers[containers.count - 1] as NSTextContainer
if !textContainer || textContainer == lastContainer {
if layoutManager.glyphRangeForTextContainer(lastContainer).length > 0 {
addPage(nil)
}
}
}
}
Here is the code to receive the singleton instance of NSLayoutManager (CASTextView.sharedLayoutManager):
class var sharedLayoutManager: NSLayoutManager {
struct Singleton {
static let instance = NSLayoutManager()
}
return Singleton.instance // All text containers share the same layout manager.
}
The method addPage initializes a text view, replaces the text container with one of type CASTextContainer, and then replaces the layout manager with the shared layout manager, as follows:
func addPage(sender: NSNotification?) {
let midpoint = NSWidth(mainView.frame) / 2
let firstEndpoint = midpoint - 500
var rect: NSRect = NSZeroRect
let yValue: CGFloat = 50 + 1425 * CGFloat(pages.count)
mainView.frame.size = NSMakeSize(NSWidth(mainView.frame), yValue + 1675) // extend the scrolling size to account for new subview.
let origin = NSMakePoint(firstEndpoint, yValue)
let size = NSMakeSize(1000, 1375)
rect.origin = origin
rect.size = size
var nextView = CASTextView(frame: rect)
var nextContainer = CASTextContainer(containerSize: containerSize)
nextContainer.mainView = nextView
nextView.replaceTextContainer(nextContainer)
nextContainer.replaceLayoutManager(CASTextView.sharedLayoutManager)
nextView.autoresizingMask = NSAutoresizingMaskOptions.ViewNotSizable
nextView.delegate = nextView
nextView.usesFindPanel = true
mainView.addSubview(nextView)
pages.append(nextView)
for var i = 0; i < pages.count - 1; ++i {
pages[i].nextPage = pages[i + 1] // reset nextPage variable
}
}
Each CASTextView retains a reference to the next page (also of type CASTextView), and the last CASTextView is to have this reference (called nextPage) set to nil. The variable 'pages' is an array of all of the pages retained by the NSLayoutManagerDelegate (a subclass of NSViewController).
The problem: The call to addPage is executing exactly when it is intended to (when one page's text container can no longer fit all of the text), but is causing an exception to occur in the following method:
-[NSBigMutableString _getBlockStart:end:contentsEnd:forRange:stopAtLineSeparators:]: Range {0, 98} out of bounds; string length 0
I cannot find documentation on this method anywhere; the leading underscore seems to imply that it is a private method of NSString, but the stack trace shows that it is being called by -[NSString paragraphRangeForRange:] . Interestingly, the stack trace does not show that the addPage method is on the stack. Here is the stack trace:
0 CoreFoundation 0x00007fff90ef3f1c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff869b274e objc_exception_throw + 43
2 CoreFoundation 0x00007fff90ef3dcd +[NSException raise:format:] + 205
3 Foundation 0x00007fff8d480b5c -[NSString _getBlockStart:end:contentsEnd:forRange:stopAtLineSeparators:] + 239
4 Foundation 0x00007fff8d4a699c -[NSString paragraphRangeForRange:] + 57
5 AppKit 0x00007fff8ea8a7fe -[NSTextView _markTextEditedForRange:] + 1405
6 AppKit 0x00007fff8ea852a0 -[NSTextView insertText:replacementRange:] + 2800
7 AppKit 0x00007fff8eaba451 -[NSTextView insertText:] + 318
8 AppKit 0x00007fff8eade292 -[NSTextView(NSKeyBindingCommands) insertNewline:] + 239
9 AppKit 0x00007fff8ea8f544 -[NSTextView doCommandBySelector:] + 195
10 AppKit 0x00007fff8f0b6a71 -[NSTextInputContext(NSInputContext_WithCompletion) doCommandBySelector:completionHandler:] + 118
11 AppKit 0x00007fff8ea64c9b -[NSKeyBindingManager(NSKeyBindingManager_MultiClients) interpretEventAsCommand:forClient:] + 1899
12 AppKit 0x00007fff8f0b54a2 __61-[NSTextInputContext _handleEvent:options:completionHandler:]_block_invoke968 + 335
13 AppKit 0x00007fff8f0b6edf -[NSTextInputContext(NSInputContext_WithCompletion) hasMarkedTextWithCompletionHandler:] + 76
14 AppKit 0x00007fff8f0b52c3 __61-[NSTextInputContext _handleEvent:options:completionHandler:]_block_invoke_3 + 95
15 AppKit 0x00007fff8f0b45d8 -[NSTextInputContext tryHandleEvent_HasMarkedText_withDispatchCondition:dispatchWork:continuation:] + 101
16 AppKit 0x00007fff8f0b5234 __61-[NSTextInputContext _handleEvent:options:completionHandler:]_block_invoke956 + 321
17 HIToolbox 0x00007fff8e0e204f __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_5 + 70
18 AppKit 0x00007fff8f0ae056 __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke174 + 2387
19 AppKit 0x00007fff8f0b6edf -[NSTextInputContext(NSInputContext_WithCompletion) hasMarkedTextWithCompletionHandler:] + 76
20 AppKit 0x00007fff8f0ad674 __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke_2 + 95
21 AppKit 0x00007fff8f0ab3c8 -[NSTextInputContext tryHandleTSMEvent_HasMarkedText_withDispatchCondition:dispatchWork:continuation:] + 101
22 AppKit 0x00007fff8f0ad3d0 -[NSTextInputContext handleTSMEvent:completionHandler:] + 3293
23 AppKit 0x00007fff8ea8410e _NSTSMEventHandler + 324
24 HIToolbox 0x00007fff8decd6c8 _ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 1128
25 HIToolbox 0x00007fff8deccb8e _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 386
26 HIToolbox 0x00007fff8decca02 SendEventToEventTargetWithOptions + 43
27 HIToolbox 0x00007fff8e0db37c SendTSMEvent_WithCompletionHandler + 417
28 HIToolbox 0x00007fff8e0db87c __SendUnicodeTextAEToUnicodeDoc_WithCompletionHandler_block_invoke + 400
29 HIToolbox 0x00007fff8e0dbb36 __SendFilterTextEvent_WithCompletionHandler_block_invoke + 189
30 HIToolbox 0x00007fff8e0db3d0 SendTSMEvent_WithCompletionHandler + 501
31 HIToolbox 0x00007fff8e0db6bf SendFilterTextEvent_WithCompletionHandler + 236
32 HIToolbox 0x00007fff8e0d8a31 SendUnicodeTextAEToUnicodeDoc_WithCompletionHandler + 295
33 HIToolbox 0x00007fff8e0dd329 __utDeliverTSMEvent_WithCompletionHandler_block_invoke_2 + 296
34 HIToolbox 0x00007fff8e0dd1f8 __utDeliverTSMEvent_WithCompletionHandler_block_invoke + 437
35 HIToolbox 0x00007fff8e0d84ad TSMKeyEvent_WithCompletionHandler + 701
36 HIToolbox 0x00007fff8e0e1fd0 __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_4 + 251
37 HIToolbox 0x00007fff8e0e1ec6 __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_3 + 330
38 HIToolbox 0x00007fff8e0e1d02 __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_2 + 259
39 HIToolbox 0x00007fff8e0e1b85 __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke + 251
40 HIToolbox 0x00007fff8e0e198f TSMProcessRawKeyEventWithOptionsAndCompletionHandler + 3068
41 AppKit 0x00007fff8f0b5046 __61-[NSTextInputContext _handleEvent:options:completionHandler:]_block_invoke945 + 131
42 AppKit 0x00007fff8f0b4502 -[NSTextInputContext tryTSMProcessRawKeyEvent:dispatchCondition:setupForDispatch:furtherCondition:dispatchWork:continuation:] + 127
43 AppKit 0x00007fff8f0b4b35 -[NSTextInputContext _handleEvent:options:completionHandler:] + 1266
44 AppKit 0x00007fff8ea8394e -[NSTextInputContext handleEvent:] + 109
45 AppKit 0x00007fff8ea63368 -[NSView interpretKeyEvents:] + 207
46 AppKit 0x00007fff8ea837cd -[NSTextView keyDown:] + 695
47 AppKit 0x00007fff8efa2d7b -[NSWindow _reallySendEvent:] + 1959
48 AppKit 0x00007fff8ea337bc -[NSWindow sendEvent:] + 368
49 AppKit 0x00007fff8e9e5dc0 -[NSApplication sendEvent:] + 4008
50 AppKit 0x00007fff8e871b48 -[NSApplication run] + 711
51 AppKit 0x00007fff8e85d2de NSApplicationMain + 1778
52 Application 0x000000010000e2a5 top_level_code + 37
53 Application 0x000000010000e2da main + 42
54 libdyld.dylib 0x00007fff9422d5c9 start + 1
55 ??? 0x0000000000000003 0x0 + 3
)
The error was occurring as a result of my call to replaceLayoutManager. I altered the way that I initialize the text view. Rather than using the init(frame: frameRect) constructor, I utilized the designated initializer by separately initializing a text container as such:
var nextContainer = CASTextContainer(containerSize: containerSize)
var nextView = CASTextView(frame: rect, textContainer: nextContainer)
I then proceeded to call mainView.addSubview(nextView), and after the subview was added, I called the following:
CASTextView.sharedLayoutManager.addTextContainer(nextContainer)
which then allowed for the pagination effect to take place.

NSWindow base() constructor crashing with NSInternalInconsistencyException on Monodevelop

I am trying to run on Monodevelop (latest Git) a solution that runs fine on Xamarin.Mac
It crashes at the base() line:
public class SetupWindow : NSWindow {
public List <NSButton> Buttons = new List <NSButton> ();
public string Header;
public string Description;
private NSImage side_splash;
private NSImageView side_splash_view;
private NSTextField header_text_field;
private NSTextField description_text_field;
public SetupWindow () : base ()
{
SetFrame (new RectangleF (0, 0, 640, 420), true);
With this output:
2014-02-06 18:05:28.567 mono[8564:507] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1000) creating CGSWindow on line 263'
*** Call stack at first throw:
(
0 CoreFoundation 0x927956b1 __raiseError + 193
1 libobjc.A.dylib 0x96f38091 objc_exception_throw + 162
2 CoreFoundation 0x927955cb +[NSException raise:format:] + 139
3 AppKit 0x97f434b3 _NSCreateWindowWithOpaqueShape2 + 1718
4 AppKit 0x97f41f3a -[NSWindow _commonAwake] + 4391
5 AppKit 0x97e167fb -[NSWindow _commonInitFrame:styleMask:backing:defer:] + 864
6 AppKit 0x97e15de3 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1090
7 AppKit 0x97e1599a -[NSWindow initWithContentRect:styleMask:backing:defer:] + 70
8 AppKit 0x9860919a -[NSWindow init] + 107
9 ??? 0x02a01d22 0x0 + 44047650
10 ??? 0x04095ebc 0x0 + 67722940
11 ??? 0x04095108 0x0 + 67719432
12 ??? 0x02a02c34 0x0 + 44051508
13 ??? 0x029fec8c 0x0 + 44035212
14 ??? 0x02296b84 0x0 + 36268932
15 ??? 0x02296e9f 0x0 + 36269727
16 mono 0x0007b2ee mono_jit_runtime_invoke + 798
17 mono 0x0023500e mono_runtime_invoke + 126
18 mono 0x002395c4 mono_runtime_exec_main + 420
19 mono 0x00239935 mono_runtime_run_main + 725
20 mono 0x000e68d5 mono_jit_exec + 149
21 mono 0x000e8f12 mono_main + 9778
22 mono 0x0006e9fe main + 558
23 mono 0x0006e7c5 start + 53
Any idea what is going wrong?
Because of another problem, I commented out the lines that set images for NSApplication.SharedApplication.ApplicationIconImage and NSWorkspace.SharedWorkspace.SetIconforFile, could that be the problem?
A colleague tried on his brand new Mac, and gets the exact same problem.
The problem was fixed by adding these two lines before instantiating SetupWindow:
NSApplication.SharedApplication.ApplicationIconImage = image;
SetFolderIcon ();
Now the application runs fine.

"Segmentation fault: 11" when using Derelict and OpenGL

I'm trying to run this on OSX 10.7:
/**
* simple.d
*/
import std.stdio;
import derelict.sdl.sdl;
import derelict.sdl.macinit.SDLMain;
import derelict.opengl.gl;
pragma(lib, "/usr/local/src/Derelict2/lib/libDerelictUtil.a");
pragma(lib, "/usr/local/src/Derelict2/lib/libDerelictSDL.a");
pragma(lib, "/usr/local/src/Derelict2/lib/libDerelictGL.a");
int main(string[] args) {
// Load Derelict
writeln("Loading SDL...");
DerelictSDL.load();
// Initialise SDL
if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 ) {
throw new Exception("SDL initialization failed");
}
// Enable Double Buffering
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
// Set up the screen
SDL_Surface* screen = SDL_SetVideoMode(640, 480, 0, SDL_OPENGL);
if (screen == null) {
throw new Exception("Screen is null");
}
SDL_WM_SetCaption("Simple", "Simple");
// Print OpenGL and GLSL version
writeln("Version Info");
writeln("OpenGL:\t", glGetString(GL_VERSION));
writeln("GLSL:\t", glGetString(GL_SHADING_LANGUAGE_VERSION));
// Execute frame update
SDL_GL_SwapBuffers();
// Quit SDL; SDL_Quit() takes care of freeing the screen surface
writeln("Quitting SDL...");
SDL_Quit();
writeln("Bye!");
return 0;
}
It compiles fine, but when I try to run it I get:
$ ./simple
Loading SDL...
Version Info
Segmentation fault: 11
Here's the thread output:
Thread 0:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff8376282a __kill + 10
1 libsystem_c.dylib 0x00007fff8e965cfa _sigtramp + 26
2 ??? 000000000000000000 0 + 0
3 simple 0x000000010d299db9 D2rt6dmain24mainUiPPaZi7runMainMFZv + 29
4 simple 0x000000010d29976e D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv + 38
5 simple 0x000000010d299e06 D2rt6dmain24mainUiPPaZi6runAllMFZv + 58
6 simple 0x000000010d29976e D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv + 38
7 simple 0x000000010d2996f9 main + 237
8 simple 0x000000010d24a554 start + 52
Thread 1 Crashed:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x00007fff837637e6 kevent + 10
1 libdispatch.dylib 0x00007fff896b378a _dispatch_mgr_invoke + 923
2 libdispatch.dylib 0x00007fff896b231a _dispatch_mgr_thread + 54
Now if I try to compile both Derelict and simple.d in 32bit mode (-m32) I get this output instead:
$ ./simple
Loading SDL...
Version Info
Bus error: 10
Thread output:
Thread 0:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x93107332 __kill + 10
1 libsystem_kernel.dylib 0x93106932 kill$UNIX2003 + 32
2 libsystem_c.dylib 0x943f175e raise + 26
3 libsystem_c.dylib 0x9447d59b _sigtramp + 43
4 ??? 0xffffffff 0 + 4294967295
5 SDL 0x01bb7108 SDL_Error + 275
6 simple 0x000760ab D2rt6dmain24mainUiPPaZi7runMainMFZv + 23
7 simple 0x00075a6c D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv + 24
8 simple 0x000760f3 D2rt6dmain24mainUiPPaZi6runAllMFZv + 59
9 simple 0x00075a6c D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv + 24
10 simple 0x00075a0c main + 184
11 simple 0x00035bb5 start + 53
Thread 1 Crashed:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x9310890a kevent + 10
1 libdispatch.dylib 0x96a74e10 _dispatch_mgr_invoke + 969
2 libdispatch.dylib 0x96a7385f _dispatch_mgr_thread + 53
I've tried other gl... functions like glClearColor() and they yield the same results.
You didn't load the gl function pointers.
DerelictGL.load();

Resources