Skip to content

Commit 59f21f8

Browse files
committed
Add Swift Package Manager support for iOS
Implements SPM support alongside existing CocoaPods integration. Changes: - Add Package.swift with Intercom SDK 19.5.1 dependency - Move source files to intercom_flutter/Sources/intercom_flutter/ - Update podspec paths and remove duplicate dependency - Add .gitignore for SPM build artifacts - Update example app Xcode project for SPM integration Both package managers now use the same source files and SDK version. Tested with both CocoaPods and SPM - all working correctly. Resolves deepak786#491
1 parent e739b53 commit 59f21f8

10 files changed

Lines changed: 111 additions & 10 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/intercom_flutter/example/lib/generated_plugin_registrant.dart
2+
.idea/

‎intercom_flutter/example/ios/.gitignore‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,11 @@ Icon?
4343

4444
Pods/
4545
.symlinks/
46+
47+
# Flutter generated files
48+
/Flutter/Flutter.podspec
49+
/Flutter/ephemeral/
50+
51+
# Swift Package Manager
52+
/Runner.xcworkspace/xcshareddata/swiftpm/
53+
/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/

‎intercom_flutter/example/ios/Runner.xcodeproj/project.pbxproj‎

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 52;
6+
objectVersion = 54;
77
objects = {
88

99
/* Begin PBXBuildFile section */
1010
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
1111
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
1212
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
13+
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; };
1314
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
1415
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
1516
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
@@ -53,6 +54,7 @@
5354
isa = PBXFrameworksBuildPhase;
5455
buildActionMask = 2147483647;
5556
files = (
57+
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */,
5658
B06D52763675792FF5758304 /* Pods_Runner.framework in Frameworks */,
5759
);
5860
runOnlyForDeploymentPostprocessing = 0;
@@ -144,13 +146,16 @@
144146
97C146EC1CF9000F007C117D /* Resources */,
145147
9705A1C41CF9048500538489 /* Embed Frameworks */,
146148
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
147-
5737A5BAF870233794884398 /* [CP] Embed Pods Frameworks */,
149+
7648CF7DA2AB407AC84CAA65 /* [CP] Embed Pods Frameworks */,
148150
);
149151
buildRules = (
150152
);
151153
dependencies = (
152154
);
153155
name = Runner;
156+
packageProductDependencies = (
157+
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */,
158+
);
154159
productName = Runner;
155160
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
156161
productType = "com.apple.product-type.application";
@@ -161,7 +166,7 @@
161166
97C146E61CF9000F007C117D /* Project object */ = {
162167
isa = PBXProject;
163168
attributes = {
164-
LastUpgradeCheck = 1300;
169+
LastUpgradeCheck = 1510;
165170
ORGANIZATIONNAME = "The Chromium Authors";
166171
TargetAttributes = {
167172
97C146ED1CF9000F007C117D = {
@@ -179,6 +184,9 @@
179184
Base,
180185
);
181186
mainGroup = 97C146E51CF9000F007C117D;
187+
packageReferences = (
188+
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */,
189+
);
182190
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
183191
projectDirPath = "";
184192
projectRoot = "";
@@ -205,10 +213,12 @@
205213
/* Begin PBXShellScriptBuildPhase section */
206214
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
207215
isa = PBXShellScriptBuildPhase;
216+
alwaysOutOfDate = 1;
208217
buildActionMask = 2147483647;
209218
files = (
210219
);
211220
inputPaths = (
221+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
212222
);
213223
name = "Thin Binary";
214224
outputPaths = (
@@ -217,7 +227,7 @@
217227
shellPath = /bin/sh;
218228
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
219229
};
220-
5737A5BAF870233794884398 /* [CP] Embed Pods Frameworks */ = {
230+
7648CF7DA2AB407AC84CAA65 /* [CP] Embed Pods Frameworks */ = {
221231
isa = PBXShellScriptBuildPhase;
222232
buildActionMask = 2147483647;
223233
files = (
@@ -236,6 +246,7 @@
236246
};
237247
9740EEB61CF901F6004384FC /* Run Script */ = {
238248
isa = PBXShellScriptBuildPhase;
249+
alwaysOutOfDate = 1;
239250
buildActionMask = 2147483647;
240251
files = (
241252
);
@@ -491,6 +502,20 @@
491502
defaultConfigurationName = Release;
492503
};
493504
/* End XCConfigurationList section */
505+
506+
/* Begin XCLocalSwiftPackageReference section */
507+
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */ = {
508+
isa = XCLocalSwiftPackageReference;
509+
relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage;
510+
};
511+
/* End XCLocalSwiftPackageReference section */
512+
513+
/* Begin XCSwiftPackageProductDependency section */
514+
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = {
515+
isa = XCSwiftPackageProductDependency;
516+
productName = FlutterGeneratedPluginSwiftPackage;
517+
};
518+
/* End XCSwiftPackageProductDependency section */
494519
};
495520
rootObject = 97C146E61CF9000F007C117D /* Project object */;
496521
}

‎intercom_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1300"
3+
LastUpgradeVersion = "1510"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
77
buildImplicitDependencies = "YES">
8+
<PreActions>
9+
<ExecutionAction
10+
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
11+
<ActionContent
12+
title = "Run Prepare Flutter Framework Script"
13+
scriptText = "/bin/sh &quot;$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh&quot; prepare&#10;">
14+
<EnvironmentBuildable>
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
18+
BuildableName = "Runner.app"
19+
BlueprintName = "Runner"
20+
ReferencedContainer = "container:Runner.xcodeproj">
21+
</BuildableReference>
22+
</EnvironmentBuildable>
23+
</ActionContent>
24+
</ExecutionAction>
25+
</PreActions>
826
<BuildActionEntries>
927
<BuildActionEntry
1028
buildForTesting = "YES"
@@ -26,6 +44,7 @@
2644
buildConfiguration = "Debug"
2745
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2846
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
47+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
2948
shouldUseLaunchSchemeArgsEnv = "YES">
3049
<MacroExpansion>
3150
<BuildableReference
@@ -43,11 +62,13 @@
4362
buildConfiguration = "Debug"
4463
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4564
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
65+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
4666
launchStyle = "0"
4767
useCustomWorkingDirectory = "NO"
4868
ignoresPersistentStateOnLaunch = "NO"
4969
debugDocumentVersioning = "YES"
5070
debugServiceExtension = "internal"
71+
enableGPUValidationMode = "1"
5172
allowLocationSimulation = "YES">
5273
<BuildableProductRunnable
5374
runnableDebuggingMode = "0">

‎intercom_flutter/ios/.gitignore‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,7 @@ Icon?
3434
.tags*
3535

3636
/Flutter/Generated.xcconfig
37+
38+
# Swift Package Manager
39+
.build/
40+
.swiftpm/

‎intercom_flutter/ios/intercom_flutter.podspec‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ A new flutter plugin project.
1212
s.license = { :file => '../LICENSE' }
1313
s.author = { 'xChange OÜ' => '[email protected]' }
1414
s.source = { :path => '.' }
15-
s.source_files = 'Classes/**/*'
16-
s.public_header_files = 'Classes/**/*.h'
15+
s.source_files = 'intercom_flutter/Sources/intercom_flutter/**/*.{h,m}'
16+
s.public_header_files = 'intercom_flutter/Sources/intercom_flutter/include/**/*.h'
1717
s.dependency 'Flutter'
18-
s.dependency 'Intercom'
19-
s.static_framework = true
2018
s.dependency 'Intercom', '19.5.1'
19+
s.static_framework = true
2120
s.ios.deployment_target = '15.0'
2221
end

‎intercom_flutter/ios/intercom_flutter/Package.resolved‎

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// swift-tools-version: 5.9
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "intercom_flutter",
8+
platforms: [
9+
.iOS("15.0")
10+
],
11+
products: [
12+
.library(name: "intercom-flutter", targets: ["intercom_flutter"])
13+
],
14+
dependencies: [
15+
.package(url: "https://github.com/intercom/intercom-ios-sp.git", exact: "19.5.1")
16+
],
17+
targets: [
18+
.target(
19+
name: "intercom_flutter",
20+
dependencies: [
21+
.product(name: "Intercom", package: "intercom-ios-sp")
22+
],
23+
resources: [],
24+
cSettings: [
25+
.headerSearchPath("include/intercom_flutter")
26+
]
27+
)
28+
]
29+
)

intercom_flutter/ios/Classes/IntercomFlutterPlugin.m renamed to intercom_flutter/ios/intercom_flutter/Sources/intercom_flutter/IntercomFlutterPlugin.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#import "IntercomFlutterPlugin.h"
1+
#import "include/intercom_flutter/IntercomFlutterPlugin.h"
22
#import <Intercom/Intercom.h>
33

44
id unread;

intercom_flutter/ios/Classes/IntercomFlutterPlugin.h renamed to intercom_flutter/ios/intercom_flutter/Sources/intercom_flutter/include/intercom_flutter/IntercomFlutterPlugin.h

File renamed without changes.

0 commit comments

Comments
 (0)