From ecc04d45efb695fcad8f5c44aeb9cd43ca154683 Mon Sep 17 00:00:00 2001 From: Ihor Shevchuk Date: Thu, 28 Mar 2024 16:20:25 -0600 Subject: [PATCH] Added sample code for RHVoiceObjC project --- Samples/RHVoiceObjC/README.md | 14 + .../Sample.xcodeproj/project.pbxproj | 426 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../xcshareddata/swiftpm/Package.resolved | 14 + .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 63 +++ .../Sample/Assets.xcassets/Contents.json | 6 + Samples/RHVoiceObjC/Sample/ContentView.swift | 35 ++ .../Preview Assets.xcassets/Contents.json | 6 + Samples/RHVoiceObjC/Sample/RHVoice.json | 8 + .../RHVoiceObjC/Sample/Sample.entitlements | 10 + Samples/RHVoiceObjC/Sample/SampleApp.swift | 17 + Sources/Plugins/PackData/PackDataPlugin.swift | 2 +- .../RHVoiceSwift/RHSpeechSynthesizer.swift | 13 +- 15 files changed, 632 insertions(+), 8 deletions(-) create mode 100644 Samples/RHVoiceObjC/README.md create mode 100644 Samples/RHVoiceObjC/Sample.xcodeproj/project.pbxproj create mode 100644 Samples/RHVoiceObjC/Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 Samples/RHVoiceObjC/Sample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 Samples/RHVoiceObjC/Sample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved create mode 100644 Samples/RHVoiceObjC/Sample/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 Samples/RHVoiceObjC/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 Samples/RHVoiceObjC/Sample/Assets.xcassets/Contents.json create mode 100644 Samples/RHVoiceObjC/Sample/ContentView.swift create mode 100644 Samples/RHVoiceObjC/Sample/Preview Content/Preview Assets.xcassets/Contents.json create mode 100644 Samples/RHVoiceObjC/Sample/RHVoice.json create mode 100644 Samples/RHVoiceObjC/Sample/Sample.entitlements create mode 100644 Samples/RHVoiceObjC/Sample/SampleApp.swift diff --git a/Samples/RHVoiceObjC/README.md b/Samples/RHVoiceObjC/README.md new file mode 100644 index 0000000..e674b28 --- /dev/null +++ b/Samples/RHVoiceObjC/README.md @@ -0,0 +1,14 @@ +# Sample + +This folder contains Sample of RHVoice usage on iOS and macOS apps + +Main code is located in [ContentView.swift](Sample/ContentView.swift) file +Also please pay attention to [RHVoice.json](Sample/RHVoice.json) file and PackDataPlugin in Build Phases +Please find the full list of [Languages](https://github.com/RHVoice/RHVoice/tree/1.14.0/data/languages) and [Voices](https://github.com/RHVoice/RHVoice/tree/1.14.0/data/voices) by respective links. + +## Build & Run Instruction + +1. Open `Sample.xcodeproj` +1. Select destination +1. Fix signing issues if needed +1. Run \ No newline at end of file diff --git a/Samples/RHVoiceObjC/Sample.xcodeproj/project.pbxproj b/Samples/RHVoiceObjC/Sample.xcodeproj/project.pbxproj new file mode 100644 index 0000000..65b98d1 --- /dev/null +++ b/Samples/RHVoiceObjC/Sample.xcodeproj/project.pbxproj @@ -0,0 +1,426 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 55; + objects = { + +/* Begin PBXBuildFile section */ + 013C642B2BB61387003145F9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 013C642A2BB61387003145F9 /* Assets.xcassets */; }; + 013C642F2BB61387003145F9 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 013C642E2BB61387003145F9 /* Preview Assets.xcassets */; }; + 013C64362BB613E8003145F9 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 013C64342BB613E8003145F9 /* ContentView.swift */; }; + 013C64372BB613E8003145F9 /* SampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 013C64352BB613E8003145F9 /* SampleApp.swift */; }; + 013C64392BB6143E003145F9 /* RHVoiceObjC in Frameworks */ = {isa = PBXBuildFile; productRef = 013C64382BB6143E003145F9 /* RHVoiceObjC */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 013C64242BB61386003145F9 /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 013C642A2BB61387003145F9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 013C642C2BB61387003145F9 /* Sample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Sample.entitlements; sourceTree = ""; }; + 013C642E2BB61387003145F9 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 013C64342BB613E8003145F9 /* ContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 013C64352BB613E8003145F9 /* SampleApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SampleApp.swift; sourceTree = ""; }; + 019D7D5329B0906400B4094C /* RHVoice.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = RHVoice.json; sourceTree = ""; }; + 01CDEDAF299D6057001D8662 /* RHVoice */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = RHVoice; path = ../..; sourceTree = ""; }; + 01CDEDB3299D61ED001D8662 /* libapple_nghttp2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libapple_nghttp2.tbd; path = usr/lib/libapple_nghttp2.tbd; sourceTree = SDKROOT; }; + 01CDEDB4299D653A001D8662 /* libcurl.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libcurl.tbd; path = usr/lib/libcurl.tbd; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 013C64212BB61386003145F9 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 013C64392BB6143E003145F9 /* RHVoiceObjC in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 013C64252BB61386003145F9 /* Sample */ = { + isa = PBXGroup; + children = ( + 013C64342BB613E8003145F9 /* ContentView.swift */, + 013C64352BB613E8003145F9 /* SampleApp.swift */, + 013C642A2BB61387003145F9 /* Assets.xcassets */, + 019D7D5329B0906400B4094C /* RHVoice.json */, + 013C642C2BB61387003145F9 /* Sample.entitlements */, + 013C642D2BB61387003145F9 /* Preview Content */, + ); + path = Sample; + sourceTree = ""; + }; + 013C642D2BB61387003145F9 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 013C642E2BB61387003145F9 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + 01BE5AC9283978510086E9EF = { + isa = PBXGroup; + children = ( + 01CDEDAE299D6057001D8662 /* Packages */, + 013C64252BB61386003145F9 /* Sample */, + 01BE5AD3283978510086E9EF /* Products */, + 01CDEDB0299D611B001D8662 /* Frameworks */, + ); + sourceTree = ""; + }; + 01BE5AD3283978510086E9EF /* Products */ = { + isa = PBXGroup; + children = ( + 013C64242BB61386003145F9 /* Sample.app */, + ); + name = Products; + sourceTree = ""; + }; + 01CDEDAE299D6057001D8662 /* Packages */ = { + isa = PBXGroup; + children = ( + 01CDEDAF299D6057001D8662 /* RHVoice */, + ); + name = Packages; + sourceTree = ""; + }; + 01CDEDB0299D611B001D8662 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 01CDEDB4299D653A001D8662 /* libcurl.tbd */, + 01CDEDB3299D61ED001D8662 /* libapple_nghttp2.tbd */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 013C64232BB61386003145F9 /* Sample */ = { + isa = PBXNativeTarget; + buildConfigurationList = 013C64302BB61387003145F9 /* Build configuration list for PBXNativeTarget "Sample" */; + buildPhases = ( + 013C64202BB61386003145F9 /* Sources */, + 013C64212BB61386003145F9 /* Frameworks */, + 013C64222BB61386003145F9 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 013C643B2BB621D5003145F9 /* PBXTargetDependency */, + ); + name = Sample; + packageProductDependencies = ( + 013C64382BB6143E003145F9 /* RHVoiceObjC */, + ); + productName = Sample; + productReference = 013C64242BB61386003145F9 /* Sample.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 01BE5ACA283978510086E9EF /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1530; + LastUpgradeCheck = 1330; + TargetAttributes = { + 013C64232BB61386003145F9 = { + CreatedOnToolsVersion = 15.3; + LastSwiftMigration = 1530; + }; + }; + }; + buildConfigurationList = 01BE5ACD283978510086E9EF /* Build configuration list for PBXProject "Sample" */; + compatibilityVersion = "Xcode 13.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 01BE5AC9283978510086E9EF; + productRefGroup = 01BE5AD3283978510086E9EF /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 013C64232BB61386003145F9 /* Sample */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 013C64222BB61386003145F9 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 013C642F2BB61387003145F9 /* Preview Assets.xcassets in Resources */, + 013C642B2BB61387003145F9 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 013C64202BB61386003145F9 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 013C64362BB613E8003145F9 /* ContentView.swift in Sources */, + 013C64372BB613E8003145F9 /* SampleApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 013C643B2BB621D5003145F9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + productRef = 013C643A2BB621D5003145F9 /* PackDataPlugin */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 013C64312BB61387003145F9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Sample/Sample.entitlements; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"Sample/Preview Content\""; + DEVELOPMENT_TEAM = XTNZ55VU44; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_PREVIEWS = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault; + "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 17.4; + LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; + "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACOSX_DEPLOYMENT_TARGET = 14.4; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.ihorshevchuk.Sample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 013C64322BB61387003145F9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Sample/Sample.entitlements; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"Sample/Preview Content\""; + DEVELOPMENT_TEAM = XTNZ55VU44; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_PREVIEWS = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault; + "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 17.4; + LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; + "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACOSX_DEPLOYMENT_TARGET = 14.4; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.ihorshevchuk.Sample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 01BE5ADF283978520086E9EF /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 11.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 01BE5AE0283978520086E9EF /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 11.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 013C64302BB61387003145F9 /* Build configuration list for PBXNativeTarget "Sample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 013C64312BB61387003145F9 /* Debug */, + 013C64322BB61387003145F9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 01BE5ACD283978510086E9EF /* Build configuration list for PBXProject "Sample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 01BE5ADF283978520086E9EF /* Debug */, + 01BE5AE0283978520086E9EF /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCSwiftPackageProductDependency section */ + 013C64382BB6143E003145F9 /* RHVoiceObjC */ = { + isa = XCSwiftPackageProductDependency; + productName = RHVoiceObjC; + }; + 013C643A2BB621D5003145F9 /* PackDataPlugin */ = { + isa = XCSwiftPackageProductDependency; + productName = "plugin:PackDataPlugin"; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = 01BE5ACA283978510086E9EF /* Project object */; +} diff --git a/Samples/RHVoiceObjC/Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Samples/RHVoiceObjC/Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Samples/RHVoiceObjC/Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Samples/RHVoiceObjC/Sample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Samples/RHVoiceObjC/Sample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Samples/RHVoiceObjC/Sample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Samples/RHVoiceObjC/Sample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Samples/RHVoiceObjC/Sample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..898715b --- /dev/null +++ b/Samples/RHVoiceObjC/Sample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,14 @@ +{ + "pins" : [ + { + "identity" : "swift-argument-parser", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-argument-parser", + "state" : { + "revision" : "46989693916f56d1186bd59ac15124caef896560", + "version" : "1.3.1" + } + } + ], + "version" : 2 +} diff --git a/Samples/RHVoiceObjC/Sample/Assets.xcassets/AccentColor.colorset/Contents.json b/Samples/RHVoiceObjC/Sample/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/Samples/RHVoiceObjC/Sample/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Samples/RHVoiceObjC/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json b/Samples/RHVoiceObjC/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..532cd72 --- /dev/null +++ b/Samples/RHVoiceObjC/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,63 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Samples/RHVoiceObjC/Sample/Assets.xcassets/Contents.json b/Samples/RHVoiceObjC/Sample/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Samples/RHVoiceObjC/Sample/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Samples/RHVoiceObjC/Sample/ContentView.swift b/Samples/RHVoiceObjC/Sample/ContentView.swift new file mode 100644 index 0000000..97c92eb --- /dev/null +++ b/Samples/RHVoiceObjC/Sample/ContentView.swift @@ -0,0 +1,35 @@ +// +// ContentView.swift +// Sample +// +// Created by Ihor Shevchuk on 28.03.2024. +// + +import RHVoiceObjC +import SwiftUI + +struct ContentView: View { + + let synthesizer = RHSpeechSynthesizer() + + var body: some View { + VStack { + Button { + let voice = RHSpeechSynthesisVoice.speechVoices().first + + let utterance = RHSpeechUtterance(text: "Sample Text") + if let voice = voice { + utterance.voice = voice + } + synthesizer.speak(utterance) + } label: { + Text("Play Sample") + } + } + .padding() + } +} + +#Preview { + ContentView() +} diff --git a/Samples/RHVoiceObjC/Sample/Preview Content/Preview Assets.xcassets/Contents.json b/Samples/RHVoiceObjC/Sample/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Samples/RHVoiceObjC/Sample/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Samples/RHVoiceObjC/Sample/RHVoice.json b/Samples/RHVoiceObjC/Sample/RHVoice.json new file mode 100644 index 0000000..c743bac --- /dev/null +++ b/Samples/RHVoiceObjC/Sample/RHVoice.json @@ -0,0 +1,8 @@ +{ + "languages":[ + "English" + ], + "voices":[ + "alan" + ] +} diff --git a/Samples/RHVoiceObjC/Sample/Sample.entitlements b/Samples/RHVoiceObjC/Sample/Sample.entitlements new file mode 100644 index 0000000..f2ef3ae --- /dev/null +++ b/Samples/RHVoiceObjC/Sample/Sample.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/Samples/RHVoiceObjC/Sample/SampleApp.swift b/Samples/RHVoiceObjC/Sample/SampleApp.swift new file mode 100644 index 0000000..010d23d --- /dev/null +++ b/Samples/RHVoiceObjC/Sample/SampleApp.swift @@ -0,0 +1,17 @@ +// +// SampleApp.swift +// Sample +// +// Created by Ihor Shevchuk on 28.03.2024. +// + +import SwiftUI + +@main +struct SampleApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} diff --git a/Sources/Plugins/PackData/PackDataPlugin.swift b/Sources/Plugins/PackData/PackDataPlugin.swift index e755250..53ca3f5 100644 --- a/Sources/Plugins/PackData/PackDataPlugin.swift +++ b/Sources/Plugins/PackData/PackDataPlugin.swift @@ -61,7 +61,7 @@ struct PackDataPlugin: BuildToolPlugin { let jsonData = try Data(contentsOf: inputURL) let jsonInfo = try JSONDecoder().decode(JSONFormat.self, from: jsonData) - let inputDataFolder = packageRoot + "/RHVoice/data" + let inputDataFolder = packageRoot + "/RHVoice/RHVoice/data" return [ .buildCommand( diff --git a/Sources/RHVoiceSwift/RHSpeechSynthesizer.swift b/Sources/RHVoiceSwift/RHSpeechSynthesizer.swift index f189892..30b5f58 100644 --- a/Sources/RHVoiceSwift/RHSpeechSynthesizer.swift +++ b/Sources/RHVoiceSwift/RHSpeechSynthesizer.swift @@ -16,24 +16,23 @@ import AVFoundation public class RHSpeechSynthesizer { public struct Params { // TODO: have logger protocol(RHVoiceLoggerProtocol) and add variable of it's type here - public var dataPath: String? - public var configPath: String? + public var dataPath: String + public var configPath: String public static var `default`: Params = { var pathToData = Bundle.main.path(forResource: "RHVoiceData", ofType: nil) if pathToData == nil || pathToData?.isEmpty == true { let rhVoiceBundle = Bundle(path: Bundle.main.path(forResource: "RHVoice_RHVoice", ofType: "bundle") ?? "") pathToData = rhVoiceBundle?.path(forResource: "data", ofType: nil) } - return Params(dataPath: pathToData, - // TODO: use FileManager.default.currentDirectoryPath here - configPath: "") + return Params(dataPath: pathToData ?? "", + configPath: FileManager.default.currentDirectoryPath + "/") }() var rhVoiceParam: RHVoice_init_params { var result = RHVoice_init_params() - result.data_path = dataPath?.toPointer() - result.config_path = configPath?.toPointer() + result.data_path = dataPath.toPointer() + result.config_path = configPath.toPointer() return result } }