Skip to content

Commit

Permalink
Add Swift Package Manager Support (#2019)
Browse files Browse the repository at this point in the history
* chore: added swift package manager support

* chore: fixed issues with cocoapods

* chore: updated stripe_ios changelog

* chore: updated stripe_ios pubspec version
  • Loading branch information
alejandro-all-win-software authored Jan 13, 2025
1 parent b76793a commit f1a8ad2
Show file tree
Hide file tree
Showing 50 changed files with 254 additions and 57 deletions.
36 changes: 28 additions & 8 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
C1C00DE1D4D140D43FF1F838 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0319CE3D006F4355FEBFB2E6 /* Pods_Runner.framework */; };
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; };

Check warning on line 19 in example/ios/Runner.xcodeproj/project.pbxproj

View workflow job for this annotation

GitHub Actions / Typo CI

isa

"isa" is a typo. Did you mean "is"?
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -81,6 +82,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */,
C1C00DE1D4D140D43FF1F838 /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -189,6 +191,9 @@
productType = "com.apple.product-type.bundle.unit-test";
};
97C146ED1CF9000F007C117D /* Runner */ = {
packageProductDependencies = (
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */,
);
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
Expand All @@ -214,6 +219,9 @@

/* Begin PBXProject section */
97C146E61CF9000F007C117D /* Project object */ = {
packageReferences = (
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */,
);
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1510;
Expand Down Expand Up @@ -453,7 +461,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand All @@ -473,7 +481,7 @@
DEVELOPMENT_TEAM = 87RQQPQ85J;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -502,7 +510,7 @@
CURRENT_PROJECT_VERSION = 1;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -535,7 +543,7 @@
CURRENT_PROJECT_VERSION = 1;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -567,7 +575,7 @@
CURRENT_PROJECT_VERSION = 1;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -630,7 +638,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -679,7 +687,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -728,7 +736,7 @@
DEVELOPMENT_TEAM = 87RQQPQ85J;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -775,6 +783,18 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
/* Begin XCLocalSwiftPackageReference section */
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = {
isa = XCLocalSwiftPackageReference;

Check warning on line 788 in example/ios/Runner.xcodeproj/project.pbxproj

View workflow job for this annotation

GitHub Actions / Typo CI

isa

"isa" is a typo. Did you mean "is"?
relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage;
};
/* End XCLocalSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = {
isa = XCSwiftPackageProductDependency;

Check warning on line 794 in example/ios/Runner.xcodeproj/project.pbxproj

View workflow job for this annotation

GitHub Actions / Typo CI

isa

"isa" is a typo. Did you mean "is"?
productName = FlutterGeneratedPluginSwiftPackage;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{

Check warning on line 1 in example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

View workflow job for this annotation

GitHub Actions / Typo CI

Filename: example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

"xcshareddata" in the filename is a typo. Did you mean "sharecropped"?
"originHash" : "d75e1870e24786a8f3168abef93b2bf5b3c10211210817b12d64ec80e264c360",
"pins" : [
{
"identity" : "stripe-ios-spm",

Check warning on line 5 in example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

View workflow job for this annotation

GitHub Actions / Typo CI

stripe-ios-spm

"stripe-ios-spm" is a typo. Did you mean "stripe-ios-som"?
"kind" : "remoteSourceControl",
"location" : "https://github.com/stripe/stripe-ios-spm",

Check warning on line 7 in example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

View workflow job for this annotation

GitHub Actions / Typo CI

stripe-ios-spm

"stripe-ios-spm" is a typo. Did you mean "stripe-ios-som"?
"state" : {
"revision" : "653fc8cfc40b33740401f9bd9faa8588f9a53e5f",
"version" : "23.32.0"
}
}
],
"version" : 3
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<PreActions>
<ExecutionAction
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Run Prepare Flutter Framework Script"
scriptText = "/bin/sh &quot;$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh&quot; prepare&#10;">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PreActions>
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{

Check warning on line 1 in example/ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved

View workflow job for this annotation

GitHub Actions / Typo CI

Filename: example/ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved

"xcshareddata" in the filename is a typo. Did you mean "sharecropped"?
"originHash" : "d75e1870e24786a8f3168abef93b2bf5b3c10211210817b12d64ec80e264c360",
"pins" : [
{
"identity" : "stripe-ios-spm",

Check warning on line 5 in example/ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved

View workflow job for this annotation

GitHub Actions / Typo CI

stripe-ios-spm

"stripe-ios-spm" is a typo. Did you mean "stripe-ios-som"?
"kind" : "remoteSourceControl",
"location" : "https://github.com/stripe/stripe-ios-spm",

Check warning on line 7 in example/ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved

View workflow job for this annotation

GitHub Actions / Typo CI

stripe-ios-spm

"stripe-ios-spm" is a typo. Did you mean "stripe-ios-som"?
"state" : {
"revision" : "653fc8cfc40b33740401f9bd9faa8588f9a53e5f",
"version" : "23.32.0"
}
}
],
"version" : 3
}
2 changes: 1 addition & 1 deletion example/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7

COCOAPODS: 1.12.1
COCOAPODS: 1.16.2
6 changes: 5 additions & 1 deletion example/macos/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import Cocoa
import FlutterMacOS

@NSApplicationMain
@main
class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
}

override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
return true
}
}
5 changes: 5 additions & 0 deletions packages/stripe_ios/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 11.3.1

**Features**
- Adds support for Swift Package Manager for compatibility with new projects.

## 11.3.0
Align with Stripe React Native [0.39.0](https://github.com/stripe/stripe-react-native/releases/tag/v0.39.0):
**Features**
Expand Down
Empty file.
8 changes: 0 additions & 8 deletions packages/stripe_ios/ios/Classes/StripeIosPlugin.h

This file was deleted.

22 changes: 0 additions & 22 deletions packages/stripe_ios/ios/Classes/StripeIosPlugin.m

This file was deleted.

12 changes: 11 additions & 1 deletion packages/stripe_ios/ios/stripe_ios.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,24 @@ A new flutter plugin project.
s.license = { :file => '../LICENSE' }
s.author = { 'Your Company' => '[email protected]' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
s.dependency 'Stripe', stripe_version
s.dependency 'StripePaymentSheet', stripe_version
s.dependency 'StripePayments', stripe_version
s.dependency 'StripePaymentsUI', stripe_version
s.dependency 'StripeApplePay', stripe_version
s.dependency 'StripeFinancialConnections', stripe_version

s.subspec 'stripe_objc' do |ss|
ss.source_files = 'stripe_ios/Sources/**/*.{m,h}'
ss.public_header_files = 'stripe_ios/Sources/stripe_objc/include/**/*.h'
end

s.subspec 'stripe_ios' do |ss|
ss.source_files = 'stripe_ios/Sources/**/*.{swift}'
ss.dependency 'stripe_ios/stripe_objc'
end

s.platform = :ios, '13.0'

# Flutter.framework does not contain a i386 slice.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions packages/stripe_ios/ios/stripe_ios/Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"pins" : [
{
"identity" : "stripe-ios-spm",

Check warning on line 4 in packages/stripe_ios/ios/stripe_ios/Package.resolved

View workflow job for this annotation

GitHub Actions / Typo CI

stripe-ios-spm

"stripe-ios-spm" is a typo. Did you mean "stripe-ios-som"?
"kind" : "remoteSourceControl",
"location" : "https://github.com/stripe/stripe-ios-spm",

Check warning on line 6 in packages/stripe_ios/ios/stripe_ios/Package.resolved

View workflow job for this annotation

GitHub Actions / Typo CI

stripe-ios-spm

"stripe-ios-spm" is a typo. Did you mean "stripe-ios-som"?
"state" : {
"revision" : "653fc8cfc40b33740401f9bd9faa8588f9a53e5f",
"version" : "23.32.0"
}
}
],
"version" : 2
}
40 changes: 40 additions & 0 deletions packages/stripe_ios/ios/stripe_ios/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// 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: "stripe_ios",
platforms: [
.iOS("13.0")
],
products: [
.library(name: "stripe-ios", targets: ["stripe_ios"])
],
dependencies: [
.package(url: "https://github.com/stripe/stripe-ios-spm", .upToNextMajor(from: "23.30.0"))

Check warning on line 15 in packages/stripe_ios/ios/stripe_ios/Package.swift

View workflow job for this annotation

GitHub Actions / Typo CI

stripe-ios-spm

"stripe-ios-spm" is a typo. Did you mean "stripe-ios-som"?
],
targets: [
.target(
name: "stripe_ios",
dependencies: [
.product(name: "Stripe", package: "stripe-ios-spm"),

Check warning on line 21 in packages/stripe_ios/ios/stripe_ios/Package.swift

View workflow job for this annotation

GitHub Actions / Typo CI

stripe-ios-spm

"stripe-ios-spm" is a typo. Did you mean "stripe-ios-som"?
.product(name: "StripePayments", package: "stripe-ios-spm"),

Check warning on line 22 in packages/stripe_ios/ios/stripe_ios/Package.swift

View workflow job for this annotation

GitHub Actions / Typo CI

stripe-ios-spm

"stripe-ios-spm" is a typo. Did you mean "stripe-ios-som"?
.product(name: "StripePaymentsUI", package: "stripe-ios-spm"),

Check warning on line 23 in packages/stripe_ios/ios/stripe_ios/Package.swift

View workflow job for this annotation

GitHub Actions / Typo CI

stripe-ios-spm

"stripe-ios-spm" is a typo. Did you mean "stripe-ios-som"?
.product(name: "StripePaymentSheet", package: "stripe-ios-spm"),

Check warning on line 24 in packages/stripe_ios/ios/stripe_ios/Package.swift

View workflow job for this annotation

GitHub Actions / Typo CI

stripe-ios-spm

"stripe-ios-spm" is a typo. Did you mean "stripe-ios-som"?
.product(name: "StripeApplePay", package: "stripe-ios-spm"),

Check warning on line 25 in packages/stripe_ios/ios/stripe_ios/Package.swift

View workflow job for this annotation

GitHub Actions / Typo CI

stripe-ios-spm

"stripe-ios-spm" is a typo. Did you mean "stripe-ios-som"?
.product(name: "StripeFinancialConnections", package: "stripe-ios-spm"),

Check warning on line 26 in packages/stripe_ios/ios/stripe_ios/Package.swift

View workflow job for this annotation

GitHub Actions / Typo CI

stripe-ios-spm

"stripe-ios-spm" is a typo. Did you mean "stripe-ios-som"?
"stripe_objc"
],
resources: []
),
.target(
name: "stripe_objc",
dependencies: [],
resources: [],
cSettings: [
.headerSearchPath("include/stripe_objc")
]
)
]
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
// Created by Jaime Blasco on 9/8/21.
//

import Flutter
import Foundation


public class AddToWalletButtonFactory: NSObject, FlutterPlatformViewFactory {

private var messenger: FlutterBinaryMessenger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

import Flutter
import UIKit
import PassKit
#if canImport(stripe_objc)
import stripe_objc
#endif

class ApplePayButtonViewFactory: NSObject, FlutterPlatformViewFactory {
private var messenger: FlutterBinaryMessenger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
// Created by Jaime Blasco on 9/8/21.
//

import Flutter
import Foundation

import UIKit

public class AuBECSDebitFormFactory: NSObject, FlutterPlatformViewFactory {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Created by Jaime Blasco on 7/3/21.
//

import Flutter
import Foundation
import UIKit
import Stripe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
// Created by Jaime Blasco on 9/8/21.
//

import Flutter
import Foundation
import Stripe
import UIKit

public class CardFormFactory: NSObject, FlutterPlatformViewFactory {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
// Created by Jaime Blasco on 4/4/21.
//

import Flutter
import Foundation
import UIKit

typealias FlutterMap = Dictionary<String, AnyObject>

Expand Down
Loading

0 comments on commit f1a8ad2

Please sign in to comment.