Skip to content

Commit

Permalink
chore: adds Swift Package Manager compatibility (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
jokerttu authored Nov 29, 2024
1 parent 1b6c72e commit e75258a
Show file tree
Hide file tree
Showing 35 changed files with 74 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Pods/
**/Flutter/flutter_assets/
ServiceDefinitions.json
xcuserdata/
.swiftpm/
.last_build_id

# Android
Expand Down
2 changes: 2 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/

# IntelliJ related
Expand Down
Empty file removed ios/Assets/.gitkeep
Empty file.
4 changes: 2 additions & 2 deletions ios/google_navigation_flutter.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A Google Maps Navigation Flutter plugin.
s.license = { :file => '../LICENSE' }
s.author = { 'Google Maps' => '[email protected]' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.source_files = 'google_navigation_flutter/Sources/google_navigation_flutter/**/*.swift'
s.dependency 'Flutter'
s.dependency 'GoogleNavigation', '9.1.2'
s.platform = :ios, '15.0'
Expand All @@ -22,5 +22,5 @@ A Google Maps Navigation Flutter plugin.
# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
s.swift_version = '5.0'
s.resource_bundles = {'google_navigation_flutter_privacy_info' => ['Resources/PrivacyInfo.xcprivacy']}
s.resource_bundles = {'google_navigation_flutter_privacy_info' => ['google_navigation_flutter/Sources/google_navigation_flutter/PrivacyInfo.xcprivacy']}
end
56 changes: 56 additions & 0 deletions ios/google_navigation_flutter/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import PackageDescription

let package = Package(
name: "google_navigation_flutter",
platforms: [
.iOS("15.0"),
],
products: [
.library(name: "google-navigation-flutter", targets: ["google_navigation_flutter"]),
],
dependencies: [
.package(
url: "https://github.com/googlemaps/ios-navigation-sdk",
exact: "9.1.2"
),
.package(
url: "https://github.com/googlemaps/ios-maps-sdk",
exact: "9.1.1"
),
],
targets: [
.target(
name: "google_navigation_flutter",
dependencies: [
.product(
name: "GoogleNavigation",
package: "ios-navigation-sdk"
),
.product(
name: "GoogleMaps",
package: "ios-maps-sdk"
),
],
resources: [
.process("PrivacyInfo.xcprivacy"),
]
),
]
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import Dispatch
import Foundation

class GoogleMapsNavigationViewRegistry {
private var views: [Int64: GoogleMapsNavigationView] = [:]
private var carPlayView: GoogleMapsNavigationView? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import Foundation
import UIKit

enum GoogleMapsImageRegistryError: Error {
case imageDecodingFailed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import Foundation
import UIKit

enum ImageResizer {
static func resize(image: UIImage, width: CGFloat) -> UIImage {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import Foundation
import UIKit

struct RegisteredImage {
let imageId: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import Foundation
import UIKit

extension String {
static var empty: String { "" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import UIKit

protocol ViewSettledDelegate: AnyObject {
func onViewSettled(_ view: UIView)
}
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ scripts:
--ignore "build/**" \
--ignore "**/GeneratedPluginRegistrant.*" \
--ignore "**/flutter_export_environment.sh" \
--ignore "**/FlutterGeneratedPluginSwiftPackage/**" \
.
description: Add a license header to all necessary files.

Expand All @@ -193,5 +194,6 @@ scripts:
--ignore "build/**" \
--ignore "**/GeneratedPluginRegistrant.*" \
--ignore "**/flutter_export_environment.sh" \
--ignore "**/FlutterGeneratedPluginSwiftPackage/**" \
.
description: Add a license header to all necessary files.
3 changes: 2 additions & 1 deletion pigeons/messages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import 'package:pigeon/pigeon.dart';
@ConfigurePigeon(
PigeonOptions(
input: 's/messages.dart',
swiftOut: 'ios/Classes/messages.g.swift',
swiftOut:
'ios/google_navigation_flutter/Sources/google_navigation_flutter/messages.g.swift',
kotlinOut:
'android/src/main/kotlin/com/google/maps/flutter/navigation/messages.g.kt',
kotlinOptions: KotlinOptions(package: 'com.google.maps.flutter.navigation'),
Expand Down

0 comments on commit e75258a

Please sign in to comment.