Skip to content

feat(ios): add support for SPM #285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@ node_modules
# iOS files
Pods
Podfile.lock
Package.resolved
Build
xcuserdata
/.build
/Packages
xcuserdata/
DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc

# macOS files
.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion CapacitorCommunityGenericOAuth2.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Pod::Spec.new do |s|
s.homepage = package['repository']['url']
s.author = package['author']
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
s.ios.deployment_target = '13.0'
s.dependency 'Capacitor'
s.dependency 'OAuthSwift', '2.2.0'
Expand Down
32 changes: 32 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// swift-tools-version: 5.9
import PackageDescription

let package = Package(
name: "CapacitorCommunityGenericOauth2",
platforms: [.iOS(.v13)],
products: [
.library(
name: "CapacitorCommunityGenericOauth2",
targets: ["GenericOAuth2Plugin"])
],
dependencies: [
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "6.0.0"),
.package(url: "https://github.com/OAuthSwift/OAuthSwift.git", from: "2.2.0")
],
targets: [
.target(
name: "GenericOAuth2Plugin",
dependencies: [
.product(name: "Capacitor", package: "capacitor-swift-pm"),
.product(name: "Cordova", package: "capacitor-swift-pm"),
.product(name: "OAuthSwift", package: "OAuthSwift")
],
path: "ios/Sources"
),
.testTarget(
name: "GenericOAuth2PluginTests",
dependencies: ["GenericOAuth2Plugin"],
path: "ios/Tests"
)
]
)
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ These parameters are overrideable in every platform

| parameter | default | required | description | since |
| ------------------ | ------- | -------- | ---------------------------------------------------------------------------------------------- | ----- |
| customHandlerClass | | | Provide a class name implementing `CapacitorCommunityGenericOauth2.OAuth2CustomHandler` | |
| customHandlerClass | | | Provide a class name implementing `GenericOAuth2Plugin.OAuth2CustomHandler` | |
| siwaUseScope | | | SiWA default scope is `name email` if you want to use the configured one set this param `true` | 2.1.0 |

#### refreshToken()
Expand Down Expand Up @@ -410,7 +410,7 @@ This plugin should be as generic as possible, so I don't want to include provide

Therefore, I created a mechanism which let developers integrate custom SDK features in this plugin.
Simply configure the class name in the option property `ios.customHandlerClass`.
This class has to implement `CapacitorCommunityGenericOauth2.OAuth2CustomHandler`.
This class has to implement `GenericOAuth2Plugin.OAuth2CustomHandler`.

Refer to the [Facebook example below](#facebook) for a reference implementation.

Expand Down Expand Up @@ -1080,7 +1080,7 @@ import Foundation
import FacebookCore
import FacebookLogin
import Capacitor
import CapacitorCommunityGenericOauth2
import GenericOAuth2Plugin

@objc class YourIOsFacebookOAuth2Handler: NSObject, OAuth2CustomHandler {

Expand Down
Loading