Skip to content

Commit

Permalink
Add SPM support
Browse files Browse the repository at this point in the history
  • Loading branch information
aeharding committed Dec 20, 2024
1 parent ddb1719 commit cf0c5fd
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 43 deletions.
2 changes: 1 addition & 1 deletion CapacitorCommunityAppIcon.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.swift_version = '5.1'
Expand Down
28 changes: 28 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// swift-tools-version: 5.9
import PackageDescription

let package = Package(
name: "CapacitorCommunityAppIcon",
platforms: [.iOS(.v13)],
products: [
.library(
name: "CapacitorCommunityAppIcon",
targets: ["AppIconPlugin"])
],
dependencies: [
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", branch: "6.0.0")
],
targets: [
.target(
name: "AppIconPlugin",
dependencies: [
.product(name: "Capacitor", package: "capacitor-swift-pm"),
.product(name: "Cordova", package: "capacitor-swift-pm")
],
path: "ios/Sources/AppIconPlugin"),
.testTarget(
name: "AppIconPluginTests",
dependencies: ["AppIconPlugin"],
path: "ios/Tests/AppIconPluginTests")
]
)
10 changes: 0 additions & 10 deletions ios/Plugin/Plugin.h

This file was deleted.

12 changes: 0 additions & 12 deletions ios/Plugin/Plugin.m

This file was deleted.

16 changes: 0 additions & 16 deletions ios/Podfile

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import Foundation
import Capacitor

@objc(AppIcon)
public class AppIcon: CAPPlugin {
@objc(AppIconPlugin)
public class AppIconPlugin: CAPPlugin, CAPBridgedPlugin {
public let identifier = "AppIconPlugin"
public let jsName = "AppIcon"
public let pluginMethods: [CAPPluginMethod] = [
CAPPluginMethod(name: "isSupported", returnType: CAPPluginReturnPromise),
CAPPluginMethod(name: "appIconBadgeNumber", returnType: CAPPluginReturnPromise),
CAPPluginMethod(name: "getName", returnType: CAPPluginReturnPromise),
CAPPluginMethod(name: "change", returnType: CAPPluginReturnPromise),
CAPPluginMethod(name: "reset", returnType: CAPPluginReturnPromise),
]

@objc func isSupported(_ call: CAPPluginCall) {
DispatchQueue.main.sync {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import XCTest
import Capacitor
@testable import Plugin
@testable import AppIconPlugin

class PluginTests: XCTestCase {
class AppIconPluginTests: XCTestCase {

override func setUp() {
super.setUp()
Expand Down
File renamed without changes.

0 comments on commit cf0c5fd

Please sign in to comment.