Skip to content

Commit

Permalink
ios stage
Browse files Browse the repository at this point in the history
  • Loading branch information
laves committed Nov 22, 2023
1 parent 70e2f8d commit 7c8a55e
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 53 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ios-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ jobs:
device: [ios-perf]
include:
- device: ios-perf
initPerformanceThresholdSec: 1.5
procPerformanceThresholdSec: 0.2
initPerformanceThresholdSec: 2.5
procPerformanceThresholdSec: 0.5

steps:
- name: Checkout
Expand Down
6 changes: 3 additions & 3 deletions binding/ios/Cheetah-iOS.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Pod::Spec.new do |s|
s.version = '2.0.0'
s.license = {:type => 'Apache 2.0'}
s.summary = 'iOS SDK for Picovoice\'s Cheetah speech-to-text engine.'
s.description =
s.description =
<<-DESC
Cheetah is an on-device streaming speech-to-text engine.
Cheetah is:
- Private, all voice processing runs locally.
- Accurate
Expand All @@ -23,7 +23,7 @@ Pod::Spec.new do |s|
DESC
s.homepage = 'https://github.com/Picovoice/cheetah/tree/master/binding/ios'
s.author = { 'Picovoice' => '[email protected]' }
s.source = { :git => "https://github.com/Picovoice/cheetah.git", :tag => "Leopard-iOS-v2.0.0" }
s.source = { :git => "https://github.com/Picovoice/cheetah.git", :tag => "Cheetah-iOS-v2.0.0" }
s.ios.deployment_target = '13.0'
s.swift_version = '5.0'
s.vendored_frameworks = 'lib/ios/PvCheetah.xcframework'
Expand Down
24 changes: 16 additions & 8 deletions binding/ios/Cheetah.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2022 Picovoice Inc.
// Copyright 2022-2023 Picovoice Inc.
// You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE"
// file accompanying this source.
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
Expand All @@ -23,6 +23,12 @@ public class Cheetah {
/// Current Cheetah version.
public static let version = String(cString: pv_cheetah_version())

private static var sdk = "ios"

public static func setSdk(sdk: String) {
self.sdk = sdk
}

/// Constructor.
///
/// - Parameters:
Expand Down Expand Up @@ -52,6 +58,8 @@ public class Cheetah {
throw CheetahInvalidArgumentError("EndpointDuration must be a non-negative number.")
}

pv_set_sdk(Cheetah.sdk)

let status = pv_cheetah_init(
accessKey,
modelPathArg,
Expand Down Expand Up @@ -116,8 +124,8 @@ public class Cheetah {

if pcm.count != Cheetah.frameLength {
throw CheetahInvalidArgumentError(
"Frame of audio data must contain \(Cheetah.frameLength) samples
- given frame contained \(pcm.count)")
"Frame of audio data must contain \(Cheetah.frameLength) samples" +
" - given frame contained \(pcm.count)")
}

var cPartialTranscript: UnsafeMutablePointer<Int8>?
Expand All @@ -129,7 +137,7 @@ public class Cheetah {
}

let transcript = String(cString: cPartialTranscript!)
cPartialTranscript?.deallocate()
pv_cheetah_transcript_delete(cPartialTranscript!)

return (transcript, endPoint)
}
Expand All @@ -151,7 +159,7 @@ public class Cheetah {
}

let transcript = String(cString: cFinalTranscript!)
cFinalTranscript?.deallocate()
pv_cheetah_transcript_delete(cFinalTranscript!)

return transcript
}
Expand All @@ -170,12 +178,12 @@ public class Cheetah {
}

throw CheetahIOError(
"Could not find file at path '\(filePath)'. If this is a packaged asset,
ensure you have added it to your xcode project."
"Could not find file at path '\(filePath)'. If this is a packaged asset, " +
"ensure you have added it to your xcode project."
)
}

private func checkStatus(
private func pvStatusToCheetahError(
_ status: pv_status_t,
_ message: String,
_ messageStack: [String] = []) -> CheetahError {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -601,7 +601,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
Expand All @@ -626,7 +626,7 @@
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -656,7 +656,7 @@
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
10 changes: 2 additions & 8 deletions binding/ios/CheetahAppTest/CheetahAppTest/ViewController.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2022 Picovoice Inc.
// Copyright 2022-2023 Picovoice Inc.
// You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE"
// file accompanying this source.
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
Expand All @@ -9,10 +9,4 @@

import UIKit

class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
}

}
class ViewController: UIViewController { }
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ class CheetahDemoUITests: XCTestCase {

let modelURL = Bundle(for: CheetahDemoUITests.self).url(forResource: "cheetah_params", withExtension: "pv")!

override func setUp() {
super.setUp()
}

override func tearDown() {
super.tearDown()
}

override func setUpWithError() throws {
continueAfterFailure = true
}
Expand Down
8 changes: 4 additions & 4 deletions binding/ios/CheetahAppTest/Podfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
source 'https://cdn.cocoapods.org/'
platform :ios, '9.0'
platform :ios, '13.0'

target 'CheetahAppTest' do
pod 'Cheetah-iOS', '~> 1.1.0'
pod 'Cheetah-iOS', :podspec => 'https://raw.githubusercontent.com/Picovoice/cheetah/v2.0-ios/binding/ios/Cheetah-iOS.podspec'
end

target 'CheetahAppTestUITests' do
pod 'Cheetah-iOS', '~> 1.1.0'
pod 'Cheetah-iOS', :podspec => 'https://raw.githubusercontent.com/Picovoice/cheetah/v2.0-ios/binding/ios/Cheetah-iOS.podspec'
end

target 'PerformanceTest' do
pod 'Cheetah-iOS', '~> 1.1.0'
pod 'Cheetah-iOS', :podspec => 'https://raw.githubusercontent.com/Picovoice/cheetah/v2.0-ios/binding/ios/Cheetah-iOS.podspec'
end
16 changes: 8 additions & 8 deletions binding/ios/CheetahAppTest/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
PODS:
- Cheetah-iOS (1.1.0)
- Cheetah-iOS (2.0.0)

DEPENDENCIES:
- Cheetah-iOS (~> 1.1.0)
- Cheetah-iOS (from `https://raw.githubusercontent.com/Picovoice/cheetah/v2.0-ios/binding/ios/Cheetah-iOS.podspec`)

SPEC REPOS:
trunk:
- Cheetah-iOS
EXTERNAL SOURCES:
Cheetah-iOS:
:podspec: https://raw.githubusercontent.com/Picovoice/cheetah/v2.0-ios/binding/ios/Cheetah-iOS.podspec

SPEC CHECKSUMS:
Cheetah-iOS: 6fb7be693878f5b1dec0ea5b6534fbba30954afc
Cheetah-iOS: d98a5edcbf3b74dda6027aeac6a8c0f5997a47a2

PODFILE CHECKSUM: be70602bbfa54a30183877dfe83545b7f63d2887
PODFILE CHECKSUM: 813d31bb6f15922d6ea3eef044c962b3c3c8dfbe

COCOAPODS: 1.11.2
COCOAPODS: 1.11.3
2 changes: 1 addition & 1 deletion demo/ios/CheetahDemo/CheetahDemo/ViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ViewModel: ObservableObject {

state = UIState.READY
} catch let error as CheetahInvalidArgumentError {
errorMessage = "\(error.localizedDescription)\nEnsure your AccessKey '\(ACCESS_KEY)' is valid."
errorMessage = "\(error.localizedDescription)"
} catch is CheetahActivationError {
errorMessage = "ACCESS_KEY activation error"
} catch is CheetahActivationRefusedError {
Expand Down
4 changes: 2 additions & 2 deletions demo/ios/CheetahDemo/Podfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://cdn.cocoapods.org/'
platform :ios, '11.0'
platform :ios, '13.0'

target 'CheetahDemo' do
pod 'Cheetah-iOS', '~> 1.1.0'
pod 'Cheetah-iOS', :podspec => 'https://raw.githubusercontent.com/Picovoice/cheetah/v2.0-ios/binding/ios/Cheetah-iOS.podspec'
pod 'ios-voice-processor', '~> 1.1.0'
end
13 changes: 8 additions & 5 deletions demo/ios/CheetahDemo/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
PODS:
- Cheetah-iOS (1.1.0)
- Cheetah-iOS (2.0.0)
- ios-voice-processor (1.1.0)

DEPENDENCIES:
- Cheetah-iOS (~> 1.1.0)
- Cheetah-iOS (from `https://raw.githubusercontent.com/Picovoice/cheetah/v2.0-ios/binding/ios/Cheetah-iOS.podspec`)
- ios-voice-processor (~> 1.1.0)

SPEC REPOS:
trunk:
- Cheetah-iOS
- ios-voice-processor

EXTERNAL SOURCES:
Cheetah-iOS:
:podspec: https://raw.githubusercontent.com/Picovoice/cheetah/v2.0-ios/binding/ios/Cheetah-iOS.podspec

SPEC CHECKSUMS:
Cheetah-iOS: 6fb7be693878f5b1dec0ea5b6534fbba30954afc
Cheetah-iOS: d98a5edcbf3b74dda6027aeac6a8c0f5997a47a2
ios-voice-processor: 8e32d7f980a06d392d128ef1cd19cf6ddcaca3c1

PODFILE CHECKSUM: 9b9aa7cee64517773071f86ed45a3b16f8ffddad
PODFILE CHECKSUM: e162593f02a8dbab3949d69a3a9888de0e155a29

COCOAPODS: 1.11.3
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ PV_API pv_status_t pv_get_error_stack(
*/
PV_API void pv_free_error_stack(char **message_stack);

PV_API void pv_set_sdk(const char *sdk);

#ifdef __cplusplus
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ PV_API pv_status_t pv_get_error_stack(
*/
PV_API void pv_free_error_stack(char **message_stack);

PV_API void pv_set_sdk(const char *sdk);

#ifdef __cplusplus
}

Expand Down

0 comments on commit 7c8a55e

Please sign in to comment.