Not sure if I did something wrong or if this is a bug with Xcode Playgrounds. I ran this code and it always breaks in a playground but works fine in a project.
struct Reminder {
var url: URL? = nil
var urlComponent: URLComponents? = nil
var string: String? = nil
}
var reminder = Reminder() //error: Execution was interrupted, reason: EXC_BAD_ACCESS (code=1, address=0x7ffee5fd8990).The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.
It won't let me set any optional URL or URLCompenents to nil. Optional String works for some reason.
I tested this here in my office (Xcode 12.3 on macOS 10.15.7 with a macOS > Blank playground). The only change I made to your code was to add an import Foundation at the top. It didn’t fail.
I don’t think there’s anything fundamentally broken about the code you posted, so the failure you’re seeing is definitely bugworthy. When you file the bug, make sure to include version information because clearly this isn’t happening everywhere.