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.