Skip to content

Commit 45a4573

Browse files
[file_selector] Add support for SPM (#6672)
Adjusts the structure of the iOS and macOS implementations to match SPM layout conventions, adds the SPM package specifications, and updates the podspecs to reflect the new paths to keep compatibility with Cocoapods. Does not include any Xcode project updates, in order to preserve compatibility with stable. Fixes flutter/flutter#146903
1 parent ca01168 commit 45a4573

File tree

22 files changed

+88
-12
lines changed

22 files changed

+88
-12
lines changed

packages/file_selector/file_selector_ios/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.5.2
2+
3+
* Adds Swift Package Manager compatibility.
4+
15
## 0.5.1+9
26

37
* Adjusts implementation for testabiity.

packages/file_selector/file_selector_ios/ios/Assets/.gitkeep

Whitespace-only changes.

packages/file_selector/file_selector_ios/ios/file_selector_ios.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ Displays the native iOS document picker.
1313
s.license = { :type => 'BSD', :file => '../LICENSE' }
1414
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
1515
s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_ios' }
16-
s.source_files = 'Classes/**/*.{h,m}'
17-
s.module_map = 'Classes/FileSelectorPlugin.modulemap'
16+
s.source_files = 'file_selector_ios/Sources/file_selector_ios/**/*.{h,m}'
17+
s.module_map = 'file_selector_ios/Sources/file_selector_ios/include/cocoapods_file_selector_ios.modulemap'
1818
s.dependency 'Flutter'
1919
s.platform = :ios, '12.0'
2020
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
2121
s.swift_version = '5.0'
22-
s.resource_bundles = {'file_selector_ios_privacy' => ['Resources/PrivacyInfo.xcprivacy']}
22+
s.resource_bundles = {'file_selector_ios_privacy' => ['file_selector_ios/Sources/file_selector_ios/Resources/PrivacyInfo.xcprivacy']}
2323
end
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// swift-tools-version: 5.9
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
// Copyright 2013 The Flutter Authors. All rights reserved.
5+
// Use of this source code is governed by a BSD-style license that can be
6+
// found in the LICENSE file.
7+
8+
import PackageDescription
9+
10+
let package = Package(
11+
name: "file_selector_ios",
12+
platforms: [
13+
.iOS("12.0")
14+
],
15+
products: [
16+
.library(name: "file-selector-ios", targets: ["file_selector_ios"])
17+
],
18+
dependencies: [],
19+
targets: [
20+
.target(
21+
name: "file_selector_ios",
22+
dependencies: [],
23+
exclude: ["include/cocoapods_file_selector_ios.modulemap"],
24+
resources: [
25+
.process("Resources")
26+
],
27+
cSettings: [
28+
.headerSearchPath("include/file_selector_ios")
29+
]
30+
)
31+
]
32+
)

packages/file_selector/file_selector_ios/ios/Classes/FFSFileSelectorPlugin.m renamed to packages/file_selector/file_selector_ios/ios/file_selector_ios/Sources/file_selector_ios/FFSFileSelectorPlugin.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
// found in the LICENSE file.
44

55
#import "FFSFileSelectorPlugin.h"
6+
7+
#import "./include/file_selector_ios/messages.g.h"
68
#import "FFSFileSelectorPlugin_Test.h"
7-
#import "messages.g.h"
89

910
#import <objc/runtime.h>
1011

0 commit comments

Comments
 (0)