diff --git a/ios-swiftui/SherpaOnnx/SherpaOnnx.xcodeproj/project.pbxproj b/ios-swiftui/SherpaOnnx/SherpaOnnx.xcodeproj/project.pbxproj index bc9dc93fb..37c0cb263 100644 --- a/ios-swiftui/SherpaOnnx/SherpaOnnx.xcodeproj/project.pbxproj +++ b/ios-swiftui/SherpaOnnx/SherpaOnnx.xcodeproj/project.pbxproj @@ -57,6 +57,7 @@ C924F35F29DDB05D00A440A5 /* onnxruntime.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = onnxruntime.xcframework; path = "../../build-ios/ios-onnxruntime/onnxruntime.xcframework"; sourceTree = ""; }; C924F36129DDB15D00A440A5 /* Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Extension.swift; sourceTree = ""; }; C924F36329DDB1D500A440A5 /* SherpaOnnxViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SherpaOnnxViewModel.swift; sourceTree = ""; }; + DEFC34EE2BBA8AD100E174E9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -110,6 +111,7 @@ C924F32C29DDAC0B00A440A5 /* SherpaOnnx */ = { isa = PBXGroup; children = ( + DEFC34EE2BBA8AD100E174E9 /* Info.plist */, C924F36329DDB1D500A440A5 /* SherpaOnnxViewModel.swift */, C924F36129DDB15D00A440A5 /* Extension.swift */, C924F35D29DDAE8200A440A5 /* Model.swift */, @@ -451,9 +453,12 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"SherpaOnnx/Preview Content\""; + DEVELOPMENT_TEAM = ""; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; HEADER_SEARCH_PATHS = "${PROJECT_DIR}/../../build-ios/sherpa-onnx.xcframework/Headers/"; + INFOPLIST_FILE = SherpaOnnx/Info.plist; + INFOPLIST_KEY_NSMicrophoneUsageDescription = "Use microphone to record voice"; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; @@ -482,9 +487,12 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"SherpaOnnx/Preview Content\""; + DEVELOPMENT_TEAM = ""; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; HEADER_SEARCH_PATHS = "${PROJECT_DIR}/../../build-ios/sherpa-onnx.xcframework/Headers/"; + INFOPLIST_FILE = SherpaOnnx/Info.plist; + INFOPLIST_KEY_NSMicrophoneUsageDescription = "Use microphone to record voice"; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; diff --git a/ios-swiftui/SherpaOnnx/SherpaOnnx/Info.plist b/ios-swiftui/SherpaOnnx/SherpaOnnx/Info.plist new file mode 100644 index 000000000..0c67376eb --- /dev/null +++ b/ios-swiftui/SherpaOnnx/SherpaOnnx/Info.plist @@ -0,0 +1,5 @@ + + + + + diff --git a/ios-swiftui/SherpaOnnx/SherpaOnnx/SherpaOnnxViewModel.swift b/ios-swiftui/SherpaOnnx/SherpaOnnx/SherpaOnnxViewModel.swift index 529121376..6db7dabc0 100644 --- a/ios-swiftui/SherpaOnnx/SherpaOnnx/SherpaOnnxViewModel.swift +++ b/ios-swiftui/SherpaOnnx/SherpaOnnx/SherpaOnnxViewModel.swift @@ -13,6 +13,7 @@ enum Status { case recording } +@MainActor class SherpaOnnxViewModel: ObservableObject { @Published var status: Status = .stop @Published var subtitles: String = "" @@ -44,9 +45,7 @@ class SherpaOnnxViewModel: ObservableObject { } func updateLabel() { - DispatchQueue.main.async { - self.subtitles = self.results - } + self.subtitles = self.results } init() {