Skip to content

Commit

Permalink
[webview_flutter_wkwebview] Adds Swift Package Manager compatibility (#…
Browse files Browse the repository at this point in the history
…7091)

Adds Swift Package Manager support to `webview_flutter_wkwebview`.

This does not migrate the example app's Xcode project to use Swift Package Manager, that's tracked by flutter/flutter#148021.

Fixes flutter/flutter#146917
  • Loading branch information
loic-sharma committed Jul 10, 2024
1 parent c47614c commit 57d42e4
Show file tree
Hide file tree
Showing 59 changed files with 166 additions and 101 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.14.0

* Adds Swift Package Manager compatibility.

## 3.13.1

* Fixes `JSON.stringify()` cannot serialize cyclic structures.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ target 'Runner' do

target 'RunnerTests' do
inherit! :search_paths

# Matches test_spec dependency.
pod 'OCMock', '3.5'
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
1096EF442A6BD9DB000CBDF7 /* FWFScrollViewDelegateHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1096EF432A6BD9DB000CBDF7 /* FWFScrollViewDelegateHostApiTests.m */; };
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
4047B3FE2C3DEE8500A8BA05 /* OCMock in Frameworks */ = {isa = PBXBuildFile; productRef = 4047B3FD2C3DEE8500A8BA05 /* OCMock */; };
8F4FF949299ADC2D000A6586 /* FWFWebViewFlutterWKWebViewExternalAPITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F4FF948299ADC2D000A6586 /* FWFWebViewFlutterWKWebViewExternalAPITests.m */; };
8F4FF94B29AC223F000A6586 /* FWFURLTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F4FF94A29AC223F000A6586 /* FWFURLTests.m */; };
8F562F902A56C02D00C2BED6 /* FWFURLCredentialHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F562F8F2A56C02D00C2BED6 /* FWFURLCredentialHostApiTests.m */; };
Expand Down Expand Up @@ -124,6 +125,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
4047B3FE2C3DEE8500A8BA05 /* OCMock in Frameworks */,
D7587C3652F6906210B3AE88 /* libPods-RunnerTests.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -280,6 +282,9 @@
68BDCAEF23C3F7CB00D9C032 /* PBXTargetDependency */,
);
name = RunnerTests;
packageProductDependencies = (
4047B3FD2C3DEE8500A8BA05 /* OCMock */,
);
productName = webview_flutter_exampleTests;
productReference = 68BDCAE923C3F7CB00D9C032 /* RunnerTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
Expand Down Expand Up @@ -358,6 +363,9 @@
Base,
);
mainGroup = 97C146E51CF9000F007C117D;
packageReferences = (
4047B3FC2C3DEE8500A8BA05 /* XCRemoteSwiftPackageReference "ocmock" */,
);
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
projectDirPath = "";
projectRoot = "";
Expand Down Expand Up @@ -845,6 +853,25 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
4047B3FC2C3DEE8500A8BA05 /* XCRemoteSwiftPackageReference "ocmock" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/erikdoe/ocmock";
requirement = {
kind = revision;
revision = fe1661a3efed11831a6452f4b1a0c5e6ddc08c3d;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
4047B3FD2C3DEE8500A8BA05 /* OCMock */ = {
isa = XCSwiftPackageProductDependency;
package = 4047B3FC2C3DEE8500A8BA05 /* XCRemoteSwiftPackageReference "ocmock" */;
productName = OCMock;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
#import <XCTest/XCTest.h>

@import webview_flutter_wkwebview;
#if __has_include(<webview_flutter_wkwebview/webview-umbrella.h>)
@import webview_flutter_wkwebview.Test;
#endif

@interface FWFInstanceManagerTests : XCTestCase
@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
@import Flutter;
@import XCTest;
@import webview_flutter_wkwebview;
#if __has_include(<webview_flutter_wkwebview/webview-umbrella.h>)
@import webview_flutter_wkwebview.Test;
#endif

#import <OCMock/OCMock.h>

Expand Down
Empty file.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ Downloaded by pub (not CocoaPods).
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_wkwebview' }
s.documentation_url = 'https://pub.dev/packages/webview_flutter'
s.source_files = 'Classes/**/*.{h,m}'
s.public_header_files = 'Classes/**/*.h'
s.module_map = 'Classes/FlutterWebView.modulemap'
s.source_files = 'webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/**/*.{h,m}'
s.public_header_files = 'webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/include/**/*.h'
s.module_map = 'webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/include/FlutterWebView.modulemap'
s.dependency 'Flutter'

s.platform = :ios, '12.0'
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
s.resource_bundles = {'webview_flutter_wkwebview_privacy' => ['Resources/PrivacyInfo.xcprivacy']}
s.resource_bundles = {'webview_flutter_wkwebview_privacy' => ['webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/Resources/PrivacyInfo.xcprivacy']}
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// swift-tools-version: 5.9

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import PackageDescription

let package = Package(
name: "webview_flutter_wkwebview",
platforms: [
.iOS("12.0")
],
products: [
.library(name: "webview-flutter-wkwebview", targets: ["webview_flutter_wkwebview"])
],
dependencies: [],
targets: [
.target(
name: "webview_flutter_wkwebview",
dependencies: [],
exclude: ["include/FlutterWebView.modulemap", "include/webview-umbrella.h"],
resources: [
.process("Resources")
],
cSettings: [
.headerSearchPath("include/webview_flutter_wkwebview")
]
)
]
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "FLTWebViewFlutterPlugin.h"
#import "FWFGeneratedWebKitApis.h"
#import "FWFHTTPCookieStoreHostApi.h"
#import "FWFInstanceManager.h"
#import "FWFNavigationDelegateHostApi.h"
#import "FWFObjectHostApi.h"
#import "FWFPreferencesHostApi.h"
#import "FWFScriptMessageHandlerHostApi.h"
#import "FWFScrollViewDelegateHostApi.h"
#import "FWFScrollViewHostApi.h"
#import "FWFUIDelegateHostApi.h"
#import "FWFUIViewHostApi.h"
#import "FWFURLCredentialHostApi.h"
#import "FWFURLHostApi.h"
#import "FWFUserContentControllerHostApi.h"
#import "FWFWebViewConfigurationHostApi.h"
#import "FWFWebViewHostApi.h"
#import "FWFWebsiteDataStoreHostApi.h"
#import "./include/webview_flutter_wkwebview/FLTWebViewFlutterPlugin.h"
#import "./include/webview_flutter_wkwebview/FWFGeneratedWebKitApis.h"
#import "./include/webview_flutter_wkwebview/FWFHTTPCookieStoreHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFInstanceManager.h"
#import "./include/webview_flutter_wkwebview/FWFNavigationDelegateHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFObjectHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFPreferencesHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFScriptMessageHandlerHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFScrollViewDelegateHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFScrollViewHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFUIDelegateHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFUIViewHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFURLCredentialHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFURLHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFUserContentControllerHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFWebViewConfigurationHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFWebViewHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFWebsiteDataStoreHostApi.h"

@interface FWFWebViewFactory : NSObject <FlutterPlatformViewFactory>
@property(nonatomic, weak) FWFInstanceManager *instanceManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "FWFDataConverters.h"
#import "./include/webview_flutter_wkwebview/FWFDataConverters.h"

#import <Flutter/Flutter.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Autogenerated from Pigeon (v13.0.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon

#import "FWFGeneratedWebKitApis.h"
#import "./include/webview_flutter_wkwebview/FWFGeneratedWebKitApis.h"

#if TARGET_OS_OSX
#import <FlutterMacOS/FlutterMacOS.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "FWFHTTPCookieStoreHostApi.h"
#import "FWFDataConverters.h"
#import "FWFWebsiteDataStoreHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFHTTPCookieStoreHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFDataConverters.h"
#import "./include/webview_flutter_wkwebview/FWFWebsiteDataStoreHostApi.h"

@interface FWFHTTPCookieStoreHostApiImpl ()
// InstanceManager must be weak to prevent a circular reference with the object it stores.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "FWFInstanceManager.h"
#import "FWFInstanceManager_Test.h"
#import "./include/webview_flutter_wkwebview/FWFInstanceManager.h"
#import "./include/webview_flutter_wkwebview/FWFInstanceManager_Test.h"

#import <objc/runtime.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "FWFNavigationDelegateHostApi.h"
#import "FWFDataConverters.h"
#import "FWFURLAuthenticationChallengeHostApi.h"
#import "FWFWebViewConfigurationHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFNavigationDelegateHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFDataConverters.h"
#import "./include/webview_flutter_wkwebview/FWFURLAuthenticationChallengeHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFWebViewConfigurationHostApi.h"

@interface FWFNavigationDelegateFlutterApiImpl ()
// BinaryMessenger must be weak to prevent a circular reference with the host API it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "FWFObjectHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFObjectHostApi.h"
#import <objc/runtime.h>
#import "FWFDataConverters.h"
#import "FWFURLHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFDataConverters.h"
#import "./include/webview_flutter_wkwebview/FWFURLHostApi.h"

@interface FWFObjectFlutterApiImpl ()
// BinaryMessenger must be weak to prevent a circular reference with the host API it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "FWFPreferencesHostApi.h"
#import "FWFWebViewConfigurationHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFPreferencesHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFWebViewConfigurationHostApi.h"

@interface FWFPreferencesHostApiImpl ()
// InstanceManager must be weak to prevent a circular reference with the object it stores.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "FWFScriptMessageHandlerHostApi.h"
#import "FWFDataConverters.h"
#import "./include/webview_flutter_wkwebview/FWFScriptMessageHandlerHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFDataConverters.h"

@interface FWFScriptMessageHandlerFlutterApiImpl ()
// InstanceManager must be weak to prevent a circular reference with the object it stores.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "FWFScrollViewDelegateHostApi.h"
#import "FWFWebViewHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFScrollViewDelegateHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFWebViewHostApi.h"

@interface FWFScrollViewDelegateFlutterApiImpl ()
// BinaryMessenger must be weak to prevent a circular reference with the host API it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "FWFScrollViewHostApi.h"
#import "FWFScrollViewDelegateHostApi.h"
#import "FWFWebViewHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFScrollViewHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFScrollViewDelegateHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFWebViewHostApi.h"

@interface FWFScrollViewHostApiImpl ()
// BinaryMessenger must be weak to prevent a circular reference with the host API it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "FWFUIDelegateHostApi.h"
#import "FWFDataConverters.h"
#import "./include/webview_flutter_wkwebview/FWFUIDelegateHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFDataConverters.h"

@interface FWFUIDelegateFlutterApiImpl ()
// BinaryMessenger must be weak to prevent a circular reference with the host API it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "FWFUIViewHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFUIViewHostApi.h"

@interface FWFUIViewHostApiImpl ()
// InstanceManager must be weak to prevent a circular reference with the object it stores.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "FWFURLAuthenticationChallengeHostApi.h"
#import "FWFURLProtectionSpaceHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFURLAuthenticationChallengeHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFURLProtectionSpaceHostApi.h"

@interface FWFURLAuthenticationChallengeFlutterApiImpl ()
// BinaryMessenger must be weak to prevent a circular reference with the host API it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "FWFURLCredentialHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFURLCredentialHostApi.h"

@interface FWFURLCredentialHostApiImpl ()
// BinaryMessenger must be weak to prevent a circular reference with the host API it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "FWFURLHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFURLHostApi.h"

@interface FWFURLHostApiImpl ()
// BinaryMessenger must be weak to prevent a circular reference with the host API it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "FWFURLProtectionSpaceHostApi.h"
#import "./include/webview_flutter_wkwebview/FWFURLProtectionSpaceHostApi.h"

@interface FWFURLProtectionSpaceFlutterApiImpl ()
// InstanceManager must be weak to prevent a circular reference with the object it stores.
Expand Down
Loading

0 comments on commit 57d42e4

Please sign in to comment.