SwiftUI Preview will not render for WatchOS with `HumanReadableNSError: The run destination iPhone 12 Pro Max is not valid for Running the scheme 'WatchOCalculator'. IDEFoundationErrorDomain (1):`

Issue

My SwiftUI Views will not render with the error HumanReadableNSError: The run destination iPhone 12 Pro Max is not valid for Running the scheme 'WatchOCalculator'. IDEFoundationErrorDomain (1):

What I did to attempt to fix it


I created a whole new SwiftUI file with a new view and preview I get an error from the Preview saying
consecutive statements on a line must be separated by ';'
CompileDylibError: Failed to build Extentions.swift Compiling failed: consecutive statements on a line must be separated by ';' /Users/ian/Documents/github/OCalculator/Shared/Extentions.swift:28:4: error: consecutive statements on a line must be separated by ';'                 }#sourceLocation()                  ^                  ; ==================================

All of my code compiles and my extensions file at line 28 looks like this:
Code Block
extension String{
func matchesForRegexInText(regex: String!) -> [String] {
do {
let regex = try NSRegularExpression(pattern: regex, options: [])
let nsString = self as NSString
let results = regex.matches(in: self,
options: [], range: NSMakeRange(0, nsString.length))
return results.map { nsString.substring(with: $0.range)}
} catch let error as NSError {
print("invalid regex: \(error.localizedDescription)")
return []
}}
}

(The above code is from this Stack Overflow question I just modified it to be a string extension.)

Has anyone else experienced this trying to make a Multiplatform app? The SwiftUI previews seem to stop working pretty quickly into development.
Sorry to hear you are having problems getting previews working. Best next step will be to file a feedback with diagnostics.
We will need the diagnostics Xcode Previews generates in order to make sure we understand the error the previews system is encountering.
  1. When you get an error in Xcode Previews, an error banner appears in the canvas

  2. Click the "Diagnostics" button in that banner

  3. In the sheet that appears, click "Generate Report" in the bottom left of the sheet

  4. Attach (or make from the folder) the resulting zip file to the bug (will be named something like previews-diagnostics-0123456789.zip)

Should I post the diagnostic file here? I can't seem to attach it. Sorry just saw you wanted me to submit to Feedback.
SwiftUI Preview will not render for WatchOS with `HumanReadableNSError: The run destination iPhone 12 Pro Max is not valid for Running the scheme 'WatchOCalculator'. IDEFoundationErrorDomain (1):`
 
 
Q