Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #50 from jinSasaki/support-swift-package-manager
Browse files Browse the repository at this point in the history
Supported Swift PM
  • Loading branch information
jinSasaki authored Feb 12, 2021
2 parents c2f31f1 + 88ff267 commit 907760f
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,5 @@ fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output

.DS_Store
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2
5.3.2
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
language: objective-c
xcode_project: InAppPurchase.xcodeproj
xcode_scheme: InAppPurchaseTests
osx_image: xcode10.2
osx_image: xcode12.2
xcode_sdk: iphonesimulator

before_install:
- brew update && brew bundle
- SIMULATOR_UUID_9=`xcrun simctl create "iPhone 4s" com.apple.CoreSimulator.SimDeviceType.iPhone-4s com.apple.CoreSimulator.SimRuntime.iOS-9-3`
- SIMULATOR_UUID_12=`xcrun simctl create "iPhone Xs" com.apple.CoreSimulator.SimDeviceType.iPhone-XS com.apple.CoreSimulator.SimRuntime.iOS-12-2`
- SIMULATOR_UUID_14=`xcrun simctl create "iPhone Xs" com.apple.CoreSimulator.SimDeviceType.iPhone-XS com.apple.CoreSimulator.SimRuntime.iOS-14-2`
script:
- set -o pipefail
- xcodebuild build-for-testing test-without-building -scheme InAppPurchaseTests -configuration Debug -sdk iphonesimulator -destination "id=$SIMULATOR_UUID_9" ENABLE_TESTABILITY=YES | xcpretty
- xcodebuild build-for-testing test-without-building -scheme InAppPurchaseTests -configuration Debug -sdk iphonesimulator -destination "id=$SIMULATOR_UUID_12" ENABLE_TESTABILITY=YES | xcpretty
- xcodebuild build-for-testing test-without-building -scheme InAppPurchaseTests -configuration Debug -sdk iphonesimulator -destination "id=$SIMULATOR_UUID_14" ENABLE_TESTABILITY=YES | xcpretty
after_success:
- bash <(curl -s https://codecov.io/bash)
48 changes: 24 additions & 24 deletions InAppPurchase.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
930FAD861FEA89D3003181D8 /* InAppPurchaseIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 930FAD851FEA89D3003181D8 /* InAppPurchaseIntegrationTests.swift */; };
93396ACC25820F8B006ABE59 /* ReceiptRefreshProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93396ACB25820F8B006ABE59 /* ReceiptRefreshProvider.swift */; };
93396AD0258217BF006ABE59 /* ReceiptRefreshProviderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93396ACF258217BF006ABE59 /* ReceiptRefreshProviderTests.swift */; };
93396AD225821808006ABE59 /* StubReceiptRefreshRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93396AD125821808006ABE59 /* StubReceiptRefreshRequest.swift */; };
93396AD42582191A006ABE59 /* StubReceiptRefreshProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93396AD32582191A006ABE59 /* StubReceiptRefreshProvider.swift */; };
93396AEA25825467006ABE59 /* InAppPurchaseStubs.h in Headers */ = {isa = PBXBuildFile; fileRef = 93396ADC25825467006ABE59 /* InAppPurchaseStubs.h */; settings = {ATTRIBUTES = (Public, ); }; };
93396AF225825585006ABE59 /* InAppPurchase.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 938BFA701F5E8411006A4C2A /* InAppPurchase.framework */; };
93396AF325825585006ABE59 /* InAppPurchase.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 938BFA701F5E8411006A4C2A /* InAppPurchase.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
Expand All @@ -37,8 +35,10 @@
938BFA9B1F5E856D006A4C2A /* InAppPurchase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 938BFA971F5E856D006A4C2A /* InAppPurchase.swift */; };
938BFAA01F5E8697006A4C2A /* PaymentProviderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 938BFA9D1F5E8697006A4C2A /* PaymentProviderTests.swift */; };
938BFAA11F5E8697006A4C2A /* ProductProviderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 938BFA9E1F5E8697006A4C2A /* ProductProviderTests.swift */; };
938BFAAD1F5E86ED006A4C2A /* StubPaymentProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 938BFAA51F5E86ED006A4C2A /* StubPaymentProvider.swift */; };
938BFAB11F5E86ED006A4C2A /* StubProductProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 938BFAA91F5E86ED006A4C2A /* StubProductProvider.swift */; };
93BCD5B325CA4B590072EEB1 /* StubProductProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BCD5AF25CA4B590072EEB1 /* StubProductProvider.swift */; };
93BCD5B425CA4B590072EEB1 /* StubPaymentProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BCD5B025CA4B590072EEB1 /* StubPaymentProvider.swift */; };
93BCD5B525CA4B590072EEB1 /* StubReceiptRefreshProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BCD5B125CA4B590072EEB1 /* StubReceiptRefreshProvider.swift */; };
93BCD5B625CA4B590072EEB1 /* StubReceiptRefreshRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BCD5B225CA4B590072EEB1 /* StubReceiptRefreshRequest.swift */; };
93C329721F5E8D0800F7A5E7 /* ProductTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93C329711F5E8D0800F7A5E7 /* ProductTests.swift */; };
93C329741F5E8D1D00F7A5E7 /* PaymentTransactionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93C329731F5E8D1D00F7A5E7 /* PaymentTransactionTests.swift */; };
93C329761F5E8D6100F7A5E7 /* Product.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93C329751F5E8D6100F7A5E7 /* Product.swift */; };
Expand Down Expand Up @@ -84,8 +84,6 @@
930FAD851FEA89D3003181D8 /* InAppPurchaseIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InAppPurchaseIntegrationTests.swift; sourceTree = "<group>"; };
93396ACB25820F8B006ABE59 /* ReceiptRefreshProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReceiptRefreshProvider.swift; sourceTree = "<group>"; };
93396ACF258217BF006ABE59 /* ReceiptRefreshProviderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReceiptRefreshProviderTests.swift; sourceTree = "<group>"; };
93396AD125821808006ABE59 /* StubReceiptRefreshRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StubReceiptRefreshRequest.swift; sourceTree = "<group>"; };
93396AD32582191A006ABE59 /* StubReceiptRefreshProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StubReceiptRefreshProvider.swift; sourceTree = "<group>"; };
93396ADA25825467006ABE59 /* InAppPurchaseStubs.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = InAppPurchaseStubs.framework; sourceTree = BUILT_PRODUCTS_DIR; };
93396ADC25825467006ABE59 /* InAppPurchaseStubs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InAppPurchaseStubs.h; sourceTree = "<group>"; };
93396ADD25825467006ABE59 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand All @@ -104,13 +102,15 @@
938BFA9D1F5E8697006A4C2A /* PaymentProviderTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PaymentProviderTests.swift; sourceTree = "<group>"; };
938BFA9E1F5E8697006A4C2A /* ProductProviderTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProductProviderTests.swift; sourceTree = "<group>"; };
938BFAA41F5E86ED006A4C2A /* StubPayment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StubPayment.swift; sourceTree = "<group>"; };
938BFAA51F5E86ED006A4C2A /* StubPaymentProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StubPaymentProvider.swift; sourceTree = "<group>"; };
938BFAA61F5E86ED006A4C2A /* StubPaymentQueue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StubPaymentQueue.swift; sourceTree = "<group>"; };
938BFAA71F5E86ED006A4C2A /* StubPaymentTransaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StubPaymentTransaction.swift; sourceTree = "<group>"; };
938BFAA81F5E86ED006A4C2A /* StubProduct.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StubProduct.swift; sourceTree = "<group>"; };
938BFAA91F5E86ED006A4C2A /* StubProductProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StubProductProvider.swift; sourceTree = "<group>"; };
938BFAAA1F5E86ED006A4C2A /* StubProductsRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StubProductsRequest.swift; sourceTree = "<group>"; };
938BFAAB1F5E86ED006A4C2A /* StubProductsResponse.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StubProductsResponse.swift; sourceTree = "<group>"; };
93BCD5AF25CA4B590072EEB1 /* StubProductProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StubProductProvider.swift; sourceTree = "<group>"; };
93BCD5B025CA4B590072EEB1 /* StubPaymentProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StubPaymentProvider.swift; sourceTree = "<group>"; };
93BCD5B125CA4B590072EEB1 /* StubReceiptRefreshProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StubReceiptRefreshProvider.swift; sourceTree = "<group>"; };
93BCD5B225CA4B590072EEB1 /* StubReceiptRefreshRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StubReceiptRefreshRequest.swift; sourceTree = "<group>"; };
93C329711F5E8D0800F7A5E7 /* ProductTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProductTests.swift; sourceTree = "<group>"; };
93C329731F5E8D1D00F7A5E7 /* PaymentTransactionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PaymentTransactionTests.swift; sourceTree = "<group>"; };
93C329751F5E8D6100F7A5E7 /* Product.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Product.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -177,17 +177,6 @@
name = Frameworks;
sourceTree = "<group>";
};
93396AF7258255EF006ABE59 /* InternalStubs */ = {
isa = PBXGroup;
children = (
938BFAA51F5E86ED006A4C2A /* StubPaymentProvider.swift */,
938BFAA91F5E86ED006A4C2A /* StubProductProvider.swift */,
93396AD32582191A006ABE59 /* StubReceiptRefreshProvider.swift */,
93396AD125821808006ABE59 /* StubReceiptRefreshRequest.swift */,
);
path = InternalStubs;
sourceTree = "<group>";
};
938BFA661F5E8411006A4C2A = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -222,7 +211,6 @@
938BFA7D1F5E8411006A4C2A /* InAppPurchaseTests */ = {
isa = PBXGroup;
children = (
93396AF7258255EF006ABE59 /* InternalStubs */,
938BFA9C1F5E8697006A4C2A /* Tests */,
938BFA801F5E8411006A4C2A /* Info.plist */,
);
Expand All @@ -245,6 +233,7 @@
938BFA9C1F5E8697006A4C2A /* Tests */ = {
isa = PBXGroup;
children = (
93BCD5AE25CA4B590072EEB1 /* InternalStubs */,
930FAD851FEA89D3003181D8 /* InAppPurchaseIntegrationTests.swift */,
93C329791F5E8E0C00F7A5E7 /* InAppPurchaseTests.swift */,
938BFA9D1F5E8697006A4C2A /* PaymentProviderTests.swift */,
Expand Down Expand Up @@ -272,6 +261,17 @@
path = Stubs;
sourceTree = "<group>";
};
93BCD5AE25CA4B590072EEB1 /* InternalStubs */ = {
isa = PBXGroup;
children = (
93BCD5AF25CA4B590072EEB1 /* StubProductProvider.swift */,
93BCD5B025CA4B590072EEB1 /* StubPaymentProvider.swift */,
93BCD5B125CA4B590072EEB1 /* StubReceiptRefreshProvider.swift */,
93BCD5B225CA4B590072EEB1 /* StubReceiptRefreshRequest.swift */,
);
path = InternalStubs;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
Expand Down Expand Up @@ -492,17 +492,17 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
93BCD5B625CA4B590072EEB1 /* StubReceiptRefreshRequest.swift in Sources */,
93BCD5B525CA4B590072EEB1 /* StubReceiptRefreshProvider.swift in Sources */,
930FAD861FEA89D3003181D8 /* InAppPurchaseIntegrationTests.swift in Sources */,
93BCD5B425CA4B590072EEB1 /* StubPaymentProvider.swift in Sources */,
93C3297A1F5E8E0C00F7A5E7 /* InAppPurchaseTests.swift in Sources */,
938BFAA01F5E8697006A4C2A /* PaymentProviderTests.swift in Sources */,
93C329741F5E8D1D00F7A5E7 /* PaymentTransactionTests.swift in Sources */,
938BFAA11F5E8697006A4C2A /* ProductProviderTests.swift in Sources */,
93C329721F5E8D0800F7A5E7 /* ProductTests.swift in Sources */,
93BCD5B325CA4B590072EEB1 /* StubProductProvider.swift in Sources */,
93396AD0258217BF006ABE59 /* ReceiptRefreshProviderTests.swift in Sources */,
938BFAAD1F5E86ED006A4C2A /* StubPaymentProvider.swift in Sources */,
938BFAB11F5E86ED006A4C2A /* StubProductProvider.swift in Sources */,
93396AD42582191A006ABE59 /* StubReceiptRefreshProvider.swift in Sources */,
93396AD225821808006ABE59 /* StubReceiptRefreshRequest.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
21 changes: 21 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription

let package = Package(
name: "InAppPurchase",
platforms: [
.iOS(.v9),
.macOS(.v10_15)
],
products: [
.library(name: "InAppPurchase", targets: ["InAppPurchase"]),
.library(name: "InAppPurchaseStubs", targets: ["InAppPurchaseStubs"]),
],
targets: [
.target(name: "InAppPurchase", path: "Sources"),
.target(name: "InAppPurchaseStubs", dependencies: ["InAppPurchase"], path: "InAppPurchaseStubs"),
.testTarget(name: "InAppPurchaseTests", dependencies: ["InAppPurchase", "InAppPurchaseStubs"], path: "Tests"),
],
swiftLanguageVersions: [.v5]
)
1 change: 1 addition & 0 deletions Sources/Internal/Internal+InAppPurchase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2018年 Jin Sasaki. All rights reserved.
//

import Foundation
import StoreKit

internal typealias ProductHandler = (_ result: Result<[SKProduct], InAppPurchase.Error>) -> Void
Expand Down
1 change: 1 addition & 0 deletions Sources/Internal/Internal+Product.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2018年 Jin Sasaki. All rights reserved.
//

import Foundation
import StoreKit

extension Internal {
Expand Down
1 change: 1 addition & 0 deletions Sources/PaymentTransaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2017年 Jin Sasaki. All rights reserved.
//

import Foundation
import StoreKit

public typealias TransactionState = SKPaymentTransactionState
Expand Down
2 changes: 2 additions & 0 deletions Sources/Product.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// Copyright © 2017年 Jin Sasaki. All rights reserved.
//

import Foundation

public protocol Product {
var productIdentifier: String { get }
var price: Decimal { get }
Expand Down

0 comments on commit 907760f

Please sign in to comment.