Skip to content

Commit

Permalink
Paywalls: RevenueCatUI CocoaPods support (#3368)
Browse files Browse the repository at this point in the history
Fixes #3152.
  • Loading branch information
NachoSoto authored Nov 1, 2023
1 parent 4344ea9 commit a465e99
Show file tree
Hide file tree
Showing 12 changed files with 495 additions and 34 deletions.
24 changes: 20 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -710,15 +710,26 @@ jobs:
command: bundle exec fastlane release
no_output_timeout: 30m

push-pods:
push-revenuecat-pod:
<<: *base-job
steps:
- checkout
- install-bundle-dependencies
- trust-github-key
- run:
name: Deploy new version
command: bundle exec fastlane push_pods
command: bundle exec fastlane push_revenuecat_pod
no_output_timeout: 30m

push-revenuecatui-pod:
<<: *base-job
steps:
- checkout
- install-bundle-dependencies
- trust-github-key
- run:
name: Deploy new version
command: bundle exec fastlane push_revenuecatui_pod
no_output_timeout: 30m

prepare-next-version:
Expand Down Expand Up @@ -1080,11 +1091,16 @@ workflows:
- make-release:
xcode_version: '14.3.0'
<<: *release-tags
- push-pods:
# This runs as its own job until https://github.com/CocoaPods/CocoaPods/issues/11621 is fixed.
- push-revenuecat-pod:
xcode_version: '14.3.0'
requires:
- make-release
<<: *release-tags
- push-revenuecatui-pod:
xcode_version: '14.3.0'
requires:
- make-release
- push-revenuecat-pod
<<: *release-tags
- docs-deploy:
xcode_version: '14.3.0'
Expand Down
1 change: 1 addition & 0 deletions Contributing/UpdatingRequirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ If these requirements change, there are several places that need to be updated:
- https://www.revenuecat.com/docs/getting-started
- Xcode `Project` build settings (at the project level; targets inherit these settings)
- `RevenueCat.podspec`
- `RevenueCatUI.podspec`
- `Package.swift`
- `SwiftVersionCheck.swift`

Expand Down
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ let package = Package(
dependencies: ["RevenueCat"],
path: "RevenueCatUI",
resources: [
// Note: these have to match the values in RevenueCatUI.podspec
.copy("Resources/background.jpg"),
.process("Resources/icons.xcassets")
]),
Expand Down
2 changes: 1 addition & 1 deletion RevenueCat.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Pod::Spec.new do |s|
s.documentation_url = "https://docs.revenuecat.com/"

s.framework = 'StoreKit'
s.swift_version = '5.5'
s.swift_version = '5.7'

s.ios.deployment_target = '11.0'
s.watchos.deployment_target = '6.2'
Expand Down
35 changes: 35 additions & 0 deletions RevenueCatUI.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Pod::Spec.new do |s|
s.name = "RevenueCatUI"
s.version = "4.30.0-SNAPSHOT"
s.summary = "UI library for RevenueCat paywalls."

s.description = <<-DESC
Save yourself the hassle of implementing a subscriptions backend. Use RevenueCat instead https://www.revenuecat.com/
DESC

s.homepage = "https://www.revenuecat.com/"
s.license = { :type => 'MIT' }
s.author = { "RevenueCat, Inc." => "[email protected]" }
s.source = { :git => "https://github.com/revenuecat/purchases-ios.git", :tag => s.version.to_s }
s.documentation_url = "https://docs.revenuecat.com/"

s.framework = 'SwiftUI'
s.swift_version = '5.7'

s.ios.deployment_target = '15.0'

s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }

s.source_files = 'RevenueCatUI/**/*.swift'

s.dependency 'RevenueCat', s.version.to_s

s.resource_bundles = {
'RevenueCat_RevenueCatUI' => [
# Note: these have to match the values in Package.swift
'RevenueCatUI/Resources/background.jpg',
'RevenueCatUI/Resources/icons.xcassets',
]
}

end
44 changes: 44 additions & 0 deletions RevenueCatUI/Helpers/Bundle+Extensions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// Copyright RevenueCat Inc. All Rights Reserved.
//
// Licensed under the MIT License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/MIT
//
// Bundle+Extensions.swift
//
// Created by Nacho Soto on 10/31/23.
//

import Foundation

#if COCOAPODS

extension Bundle {

static let module: Bundle = {
let candidates = [
Bundle.main.resourceURL,
Bundle(for: BundleToken.self).resourceURL
]

// Generated by CocoaPods
let bundleName = "RevenueCat_RevenueCatUI"

for candidate in candidates {
let bundlePath = candidate?.appendingPathComponent(bundleName + ".bundle")
if let bundle = bundlePath.flatMap(Bundle.init(url:)) {
return bundle
}
}

return Bundle(for: BundleToken.self)
}()

}

private final class BundleToken {}

#endif
Loading

0 comments on commit a465e99

Please sign in to comment.