I've been working on an iOS project for the iPhone and would like to support running it on macOS computers with Apple Silicon. In the Targets / Supported Destinations we added "Mac (Designed for iPhone)" but experienced Thread 1: EXC_BAD_ACCESS crashes immediately when we tried to run it.
We've isolated it down to Stepper UI elements in our view. Starting a new project and just trying to present a single Stepper in the ContentView, we get the same crash.
Here is code that presents the issue:
// ContentView.swift
import SwiftUI
struct ContentView: View {
@State var someValue = 5
var body: some View {
VStack {
Stepper("Stepper", value: $someValue, in: 0...10)
}
}
}
When run from Xcode on an iOS device or the simulator, it runs fine.
Trying to run it on the Mac, it crashes here:
// Stepper_01App.swift
import SwiftUI
@main // <-- Thread 1: EXC_BAD_ACCESS (code=2, address=0x16a643f70)
struct Stepper_01App: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
Xcode 14.3 (14E222b), MacOS Ventura 13.3.1 (a), Mac mini M2. Target: Mac (Designed for iPhone)
We have verified that the same code crashes on all the Apple Silicon Macs we have access to. Searching the Internet and Apple Developer forums I dont find other reports, so I kind of feel there must be some level of either user error or system/project misconfiguration going on?
If any iOS app that used Steppers was just crashing when trying to run on a Mac, it seems like this would be a big deal.
If anyone has input or can point out what we need to do differently, it would be appreciated!