Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(connectivity_plus): Add Swift Package Manager support #3173

Merged
merged 7 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.

This file was deleted.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would removing this code cause an issue on older apps still using Obj-C?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure on 99% it won't. Example project works without changing anything, support for swift in plugin was here already.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,12 @@ Downloaded by pub (not CocoaPods).
s.author = { 'Flutter Community Team' => '[email protected]' }
s.source = { :http => 'https://github.com/fluttercommunity/plus_plugins/tree/main/packages/connectivity_plus' }
s.documentation_url = 'https://pub.dev/packages/connectivity_plus'
s.source_files = [
'Classes/**/*'
]
s.public_header_files = [
'Classes/**/*.h'
]
s.source_files = 'connectivity_plus/Sources/connectivity_plus/**/*.swift'
s.ios.dependency 'Flutter'
s.osx.dependency 'FlutterMacOS'
s.ios.deployment_target = '12.0'
s.osx.deployment_target = '10.14'
s.swift_version = '5.0'
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
s.ios.resource_bundles = {'connectivity_plus_privacy' => ['PrivacyInfo.xcprivacy']}
s.ios.resource_bundles = {'connectivity_plus_privacy' => ['connectivity_plus/Sources/connectivity_plus/PrivacyInfo.xcprivacy']}
end
Original file line number Diff line number Diff line change
@@ -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: "connectivity_plus",
platforms: [
.iOS("12.0"),
.macOS("10.14")
],
products: [
.library(name: "connectivity-plus", targets: ["connectivity_plus"])
],
dependencies: [],
targets: [
.target(
name: "connectivity_plus",
dependencies: [],
resources: [
.process("PrivacyInfo.xcprivacy"),
]
)
]
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Cocoa
import FlutterMacOS
#endif

public class SwiftConnectivityPlusPlugin: NSObject, FlutterPlugin, FlutterStreamHandler {
public class ConnectivityPlusPlugin: NSObject, FlutterPlugin, FlutterStreamHandler {
private let connectivityProvider: ConnectivityProvider
private var eventSink: FlutterEventSink?

Expand All @@ -35,7 +35,7 @@ public class SwiftConnectivityPlusPlugin: NSObject, FlutterPlugin, FlutterStream
binaryMessenger: binaryMessenger)

let connectivityProvider = PathMonitorConnectivityProvider()
let instance = SwiftConnectivityPlusPlugin(connectivityProvider: connectivityProvider)
let instance = ConnectivityPlusPlugin(connectivityProvider: connectivityProvider)
streamChannel.setStreamHandler(instance)

registrar.addMethodCallDelegate(instance, channel: channel)
Expand Down
Loading