Skip to content

Commit

Permalink
fix(ios): Match CapApp-SPM iOS version with project version (#7556)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Jul 12, 2024
1 parent cfb9ce1 commit df4dc9a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions cli/src/util/spm.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { existsSync, writeFileSync } from '@ionic/utils-fs';
import { relative, resolve } from 'path';
import { existsSync, readFileSync, writeFileSync } from '@ionic/utils-fs';
import { join, relative, resolve } from 'path';

import type { Config } from '../definitions';
import { logger } from '../log';
Expand Down Expand Up @@ -46,13 +46,23 @@ export async function generatePackageFile(
}

function generatePackageText(config: Config, plugins: Plugin[]): string {
const pbx = readFileSync(
join(config.ios.nativeXcodeProjDirAbs, 'project.pbxproj'),
'utf-8',
);
const searchString = 'IPHONEOS_DEPLOYMENT_TARGET = ';
const iosVersion = pbx.substring(
pbx.indexOf(searchString) + searchString.length,
pbx.indexOf(searchString) + searchString.length + 2,
);

let packageSwiftText = `// swift-tools-version: 5.9
import PackageDescription
// DO NOT MODIFY THIS FILE - managed by Capacitor CLI commands
let package = Package(
name: "CapApp-SPM",
platforms: [.iOS(.v13)],
platforms: [.iOS(.v${iosVersion})],
products: [
.library(
name: "CapApp-SPM",
Expand Down

0 comments on commit df4dc9a

Please sign in to comment.