diff --git a/CHANGELOG.md b/CHANGELOG.md index 869bc3da..47e8846f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # ChangeLog +## 4.3.0 + +* Adds Swift Package Manager support for iOS and macOS. The iOS plugin is now + implemented purely in Swift (the Objective-C registration shim has been removed). + Both platforms can be built with either Swift Package Manager or CocoaPods. + ## 4.2.5 ### Fixes diff --git a/ios/Classes/FlutterTtsPlugin.h b/ios/Classes/FlutterTtsPlugin.h deleted file mode 100644 index 13e3a21a..00000000 --- a/ios/Classes/FlutterTtsPlugin.h +++ /dev/null @@ -1,4 +0,0 @@ -#import - -@interface FlutterTtsPlugin : NSObject -@end diff --git a/ios/Classes/FlutterTtsPlugin.m b/ios/Classes/FlutterTtsPlugin.m deleted file mode 100644 index 3fc014ff..00000000 --- a/ios/Classes/FlutterTtsPlugin.m +++ /dev/null @@ -1,15 +0,0 @@ -#import "FlutterTtsPlugin.h" -#if __has_include() -#import -#else -// Support project import fallback if the generated compatibility header -// is not copied when this plugin is created as a library. -// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816 -#import "flutter_tts-Swift.h" -#endif - -@implementation FlutterTtsPlugin -+ (void)registerWithRegistrar:(NSObject*)registrar { - [SwiftFlutterTtsPlugin registerWithRegistrar:registrar]; -} -@end diff --git a/ios/flutter_tts.podspec b/ios/flutter_tts.podspec index e46c3810..7338fb22 100644 --- a/ios/flutter_tts.podspec +++ b/ios/flutter_tts.podspec @@ -12,10 +12,9 @@ A flutter text to speech plugin s.license = { :file => '../LICENSE' } s.author = { 'eyedeadevelopment' => 'eyedea32@gmail.com' } s.source = { :path => '.' } - s.source_files = 'Classes/**/*' - s.public_header_files = 'Classes/**/*.h' + s.source_files = 'flutter_tts/Sources/flutter_tts/**/*.swift' s.dependency 'Flutter' - s.ios.deployment_target = '8.0' + s.ios.deployment_target = '12.0' s.swift_version = '4.2' s.static_framework = true end diff --git a/ios/flutter_tts/Package.swift b/ios/flutter_tts/Package.swift new file mode 100644 index 00000000..4983a603 --- /dev/null +++ b/ios/flutter_tts/Package.swift @@ -0,0 +1,25 @@ +// swift-tools-version: 5.9 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "flutter_tts", + platforms: [ + .iOS("12.0") + ], + products: [ + .library(name: "flutter-tts", targets: ["flutter_tts"]) + ], + dependencies: [ + .package(name: "FlutterFramework", path: "../FlutterFramework") + ], + targets: [ + .target( + name: "flutter_tts", + dependencies: [ + .product(name: "FlutterFramework", package: "FlutterFramework") + ] + ) + ] +) diff --git a/ios/Classes/AudioCategory.swift b/ios/flutter_tts/Sources/flutter_tts/AudioCategory.swift similarity index 100% rename from ios/Classes/AudioCategory.swift rename to ios/flutter_tts/Sources/flutter_tts/AudioCategory.swift diff --git a/ios/Classes/AudioCategoryOptions.swift b/ios/flutter_tts/Sources/flutter_tts/AudioCategoryOptions.swift similarity index 100% rename from ios/Classes/AudioCategoryOptions.swift rename to ios/flutter_tts/Sources/flutter_tts/AudioCategoryOptions.swift diff --git a/ios/Classes/AudioModes.swift b/ios/flutter_tts/Sources/flutter_tts/AudioModes.swift similarity index 100% rename from ios/Classes/AudioModes.swift rename to ios/flutter_tts/Sources/flutter_tts/AudioModes.swift diff --git a/ios/Classes/SwiftFlutterTtsPlugin.swift b/ios/flutter_tts/Sources/flutter_tts/FlutterTtsPlugin.swift similarity index 99% rename from ios/Classes/SwiftFlutterTtsPlugin.swift rename to ios/flutter_tts/Sources/flutter_tts/FlutterTtsPlugin.swift index 7b18a353..e514af46 100644 --- a/ios/Classes/SwiftFlutterTtsPlugin.swift +++ b/ios/flutter_tts/Sources/flutter_tts/FlutterTtsPlugin.swift @@ -2,7 +2,7 @@ import Flutter import UIKit import AVFoundation -public class SwiftFlutterTtsPlugin: NSObject, FlutterPlugin, AVSpeechSynthesizerDelegate { +public class FlutterTtsPlugin: NSObject, FlutterPlugin, AVSpeechSynthesizerDelegate { let iosAudioCategoryKey = "iosAudioCategoryKey" let iosAudioCategoryOptionsKey = "iosAudioCategoryOptionsKey" let iosAudioModeKey = "iosAudioModeKey" @@ -36,7 +36,7 @@ public class SwiftFlutterTtsPlugin: NSObject, FlutterPlugin, AVSpeechSynthesizer public static func register(with registrar: FlutterPluginRegistrar) { let channel = FlutterMethodChannel(name: "flutter_tts", binaryMessenger: registrar.messenger()) - let instance = SwiftFlutterTtsPlugin(channel: channel) + let instance = FlutterTtsPlugin(channel: channel) registrar.addMethodCallDelegate(instance, channel: channel) } diff --git a/macos/flutter_tts.podspec b/macos/flutter_tts.podspec index 2838eb07..85d637c3 100644 --- a/macos/flutter_tts.podspec +++ b/macos/flutter_tts.podspec @@ -12,7 +12,7 @@ Pod::Spec.new do |s| s.license = { :file => '../LICENSE' } s.author = { 'Daniel Lutton' => 'eyedea32@gmail.com' } s.source = { :path => '.' } - s.source_files = 'Classes/**/*' + s.source_files = 'flutter_tts/Sources/flutter_tts/**/*.swift' s.dependency 'FlutterMacOS' s.platform = :osx, '10.15' diff --git a/macos/flutter_tts/Package.swift b/macos/flutter_tts/Package.swift new file mode 100644 index 00000000..acd36922 --- /dev/null +++ b/macos/flutter_tts/Package.swift @@ -0,0 +1,25 @@ +// swift-tools-version: 5.9 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "flutter_tts", + platforms: [ + .macOS("10.15") + ], + products: [ + .library(name: "flutter-tts", targets: ["flutter_tts"]) + ], + dependencies: [ + .package(name: "FlutterFramework", path: "../FlutterFramework") + ], + targets: [ + .target( + name: "flutter_tts", + dependencies: [ + .product(name: "FlutterFramework", package: "FlutterFramework") + ] + ) + ] +) diff --git a/macos/Classes/FlutterTtsPlugin.swift b/macos/flutter_tts/Sources/flutter_tts/FlutterTtsPlugin.swift similarity index 100% rename from macos/Classes/FlutterTtsPlugin.swift rename to macos/flutter_tts/Sources/flutter_tts/FlutterTtsPlugin.swift diff --git a/pubspec.yaml b/pubspec.yaml index f9da5647..f2d34a53 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_tts description: A flutter plugin for Text to Speech. This plugin is supported on iOS, macOS, Android, Web, & Windows. -version: 4.2.5 +version: 4.3.0 homepage: https://github.com/dlutton/flutter_tts dependencies: