@geneg1 I got the simulator to work but I'm seeing a gazillion error messages as well. how did you separate instantiating the SFSpeechRecognizer and calling SFSpeechRecog nizer.requestAuthorization()? I'm performing both in the initialiser of the SpeechRecognizer actor and can't seem to separate them.
< init() {
recognizer = SFSpeechRecognizer()
guard recognizer != nil else {
transcribe(RecognizerError.nilRecognizer)
return
}
Task {
do {
guard await SFSpeechRecognizer.hasAuthorizationToRecognize() else {
throw RecognizerError.notAuthorizedToRecognize
}
guard await AVAudioSession.sharedInstance().hasPermissionToRecord() else {
throw RecognizerError.notPermittedToRecord
}
} catch {
transcribe(error)
}
}
} >
Post
Replies
Boosts
Views
Activity
struct MapView: View {
var coordinate: CLLocationCoordinate2D
var body: some View {
Map(initialPosition: initialPosition)
}
var initialPosition: MapCameraPosition {
let span = MKCoordinateSpan(latitudeDelta: 0.2, longitudeDelta: 0.2)
let region = MKCoordinateRegion(center: coordinate, span: span)
return .region(region)
}
}
struct MapView_Previews: PreviewProvider {
static var previews: some View {
MapView(coordinate: CLLocationCoordinate2D(latitude: 34.011_286, longitude: -116.166_868))
}
}