mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-08-17 03:40:23 +03:00
feat(plugin): add option to use a Xcode project for iOS (#9843)
* wip * add option to use xcode project * configuration * clear env * add change file * remove xcuserdatad * delete xcuserstate
This commit is contained in:
parent
51b5d581b5
commit
8a1ae2deaf
9
.changes/plugin-ios-xcode-project.md
Normal file
9
.changes/plugin-ios-xcode-project.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
"tauri-cli": patch:feat
|
||||||
|
"@tauri-apps/cli": patch:feat
|
||||||
|
"tauri-plugin": patch:feat
|
||||||
|
"tauri-utils": patch:feat
|
||||||
|
"tauri": patch:feat
|
||||||
|
---
|
||||||
|
|
||||||
|
Added an option to use a Xcode project for the iOS plugin instead of a plain SwiftPM project.
|
@ -90,7 +90,7 @@ pub(crate) fn setup(
|
|||||||
&[".build", "Package.resolved", "Tests"],
|
&[".build", "Package.resolved", "Tests"],
|
||||||
)
|
)
|
||||||
.context("failed to copy tauri-api to the plugin project")?;
|
.context("failed to copy tauri-api to the plugin project")?;
|
||||||
tauri_utils::build::link_swift_library(
|
tauri_utils::build::link_apple_library(
|
||||||
&std::env::var("CARGO_PKG_NAME").unwrap(),
|
&std::env::var("CARGO_PKG_NAME").unwrap(),
|
||||||
manifest_dir.join(path),
|
manifest_dir.join(path),
|
||||||
);
|
);
|
||||||
|
@ -6,7 +6,17 @@
|
|||||||
|
|
||||||
/// Link a Swift library.
|
/// Link a Swift library.
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
pub fn link_swift_library(name: &str, source: impl AsRef<std::path::Path>) {
|
pub fn link_apple_library(name: &str, source: impl AsRef<std::path::Path>) {
|
||||||
|
if source.as_ref().join("Package.swift").exists() {
|
||||||
|
link_swift_library(name, source);
|
||||||
|
} else {
|
||||||
|
link_xcode_library(name, source);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Link a Swift library.
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
fn link_swift_library(name: &str, source: impl AsRef<std::path::Path>) {
|
||||||
let source = source.as_ref();
|
let source = source.as_ref();
|
||||||
|
|
||||||
let sdk_root = std::env::var_os("SDKROOT");
|
let sdk_root = std::env::var_os("SDKROOT");
|
||||||
@ -23,3 +33,59 @@ pub fn link_swift_library(name: &str, source: impl AsRef<std::path::Path>) {
|
|||||||
std::env::set_var("SDKROOT", root);
|
std::env::set_var("SDKROOT", root);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Link a Xcode library.
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
fn link_xcode_library(name: &str, source: impl AsRef<std::path::Path>) {
|
||||||
|
use std::{path::PathBuf, process::Command};
|
||||||
|
|
||||||
|
let source = source.as_ref();
|
||||||
|
let configuration = if std::env::var("DEBUG")
|
||||||
|
.map(|v| v == "true")
|
||||||
|
.unwrap_or_default()
|
||||||
|
{
|
||||||
|
"Debug"
|
||||||
|
} else {
|
||||||
|
"Release"
|
||||||
|
};
|
||||||
|
|
||||||
|
let (sdk, arch) = match std::env::var("TARGET").unwrap().as_str() {
|
||||||
|
"aarch64-apple-ios" => ("iphoneos", "arm64"),
|
||||||
|
"aarch64-apple-ios-sim" => ("iphonesimulator", "arm64"),
|
||||||
|
"x86_64-apple-ios" => ("iphonesimulator", "x86_64"),
|
||||||
|
_ => return,
|
||||||
|
};
|
||||||
|
|
||||||
|
let out_dir = std::env::var_os("OUT_DIR").map(PathBuf::from).unwrap();
|
||||||
|
let derived_data_path = out_dir.join(format!("derivedData-{name}"));
|
||||||
|
|
||||||
|
let status = Command::new("xcodebuild")
|
||||||
|
.arg("build")
|
||||||
|
.arg("-scheme")
|
||||||
|
.arg(name)
|
||||||
|
.arg("-configuration")
|
||||||
|
.arg(configuration)
|
||||||
|
.arg("-sdk")
|
||||||
|
.arg(sdk)
|
||||||
|
.arg("-arch")
|
||||||
|
.arg(arch)
|
||||||
|
.arg("-derivedDataPath")
|
||||||
|
.arg(&derived_data_path)
|
||||||
|
.arg("BUILD_LIBRARY_FOR_DISTRIBUTION=YES")
|
||||||
|
.arg("OTHER_SWIFT_FLAGS=-no-verify-emitted-module-interface")
|
||||||
|
.current_dir(source)
|
||||||
|
.env_clear()
|
||||||
|
.status()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert!(status.success());
|
||||||
|
|
||||||
|
let lib_out_dir = derived_data_path
|
||||||
|
.join("Build")
|
||||||
|
.join("Products")
|
||||||
|
.join(format!("{configuration}-{sdk}"));
|
||||||
|
|
||||||
|
println!("cargo:rerun-if-changed={}", source.display());
|
||||||
|
println!("cargo:rustc-link-search=native={}", lib_out_dir.display());
|
||||||
|
println!("cargo:rustc-link-lib=static={name}");
|
||||||
|
}
|
||||||
|
@ -312,7 +312,7 @@ fn main() {
|
|||||||
if target_os == "ios" {
|
if target_os == "ios" {
|
||||||
let lib_path =
|
let lib_path =
|
||||||
PathBuf::from(std::env::var_os("CARGO_MANIFEST_DIR").unwrap()).join("mobile/ios-api");
|
PathBuf::from(std::env::var_os("CARGO_MANIFEST_DIR").unwrap()).join("mobile/ios-api");
|
||||||
tauri_utils::build::link_swift_library("Tauri", &lib_path);
|
tauri_utils::build::link_apple_library("Tauri", &lib_path);
|
||||||
println!("cargo:ios_library_path={}", lib_path.display());
|
println!("cargo:ios_library_path={}", lib_path.display());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,35 +6,35 @@
|
|||||||
import PackageDescription
|
import PackageDescription
|
||||||
|
|
||||||
let package = Package(
|
let package = Package(
|
||||||
name: "Tauri",
|
name: "Tauri",
|
||||||
platforms: [
|
platforms: [
|
||||||
.macOS(.v10_13),
|
.macOS(.v10_13),
|
||||||
.iOS(.v11),
|
.iOS(.v11),
|
||||||
],
|
],
|
||||||
products: [
|
products: [
|
||||||
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
||||||
.library(
|
.library(
|
||||||
name: "Tauri",
|
name: "Tauri",
|
||||||
type: .static,
|
type: .static,
|
||||||
targets: ["Tauri"]),
|
targets: ["Tauri"])
|
||||||
],
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
// Dependencies declare other packages that this package depends on.
|
// Dependencies declare other packages that this package depends on.
|
||||||
.package(name: "SwiftRs", url: "https://github.com/Brendonovich/swift-rs", from: "1.0.0"),
|
.package(name: "SwiftRs", url: "https://github.com/Brendonovich/swift-rs", from: "1.0.0")
|
||||||
],
|
],
|
||||||
targets: [
|
targets: [
|
||||||
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||||
// Targets can depend on other targets in this package, and on products in packages this package depends on.
|
// Targets can depend on other targets in this package, and on products in packages this package depends on.
|
||||||
.target(
|
.target(
|
||||||
name: "Tauri",
|
name: "Tauri",
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.byName(name: "SwiftRs"),
|
.byName(name: "SwiftRs")
|
||||||
],
|
],
|
||||||
path: "Sources"
|
path: "Sources"
|
||||||
),
|
),
|
||||||
.testTarget(
|
.testTarget(
|
||||||
name: "TauriTests",
|
name: "TauriTests",
|
||||||
dependencies: ["Tauri"]
|
dependencies: ["Tauri"]
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
11
examples/api/src-tauri/Cargo.lock
generated
11
examples/api/src-tauri/Cargo.lock
generated
@ -107,6 +107,7 @@ dependencies = [
|
|||||||
"tauri",
|
"tauri",
|
||||||
"tauri-build",
|
"tauri-build",
|
||||||
"tauri-plugin-sample",
|
"tauri-plugin-sample",
|
||||||
|
"tauri-plugin-xcode",
|
||||||
"tiny_http",
|
"tiny_http",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -3139,6 +3140,16 @@ dependencies = [
|
|||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tauri-plugin-xcode"
|
||||||
|
version = "0.0.0"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
"tauri",
|
||||||
|
"tauri-plugin",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-runtime"
|
name = "tauri-runtime"
|
||||||
version = "2.0.0-beta.16"
|
version = "2.0.0-beta.16"
|
||||||
|
@ -11,11 +11,14 @@ name = "api_lib"
|
|||||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
tauri-build = { path = "../../../core/tauri-build", features = ["codegen", "isolation"] }
|
tauri-build = { path = "../../../core/tauri-build", features = [
|
||||||
|
"codegen",
|
||||||
|
"isolation",
|
||||||
|
] }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
serde = { version = "1.0", features = [ "derive" ] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
tiny_http = "0.11"
|
tiny_http = "0.11"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
tauri-plugin-sample = { path = "./tauri-plugin-sample/" }
|
tauri-plugin-sample = { path = "./tauri-plugin-sample/" }
|
||||||
@ -28,7 +31,7 @@ features = [
|
|||||||
"image-png",
|
"image-png",
|
||||||
"isolation",
|
"isolation",
|
||||||
"macos-private-api",
|
"macos-private-api",
|
||||||
"tray-icon"
|
"tray-icon",
|
||||||
]
|
]
|
||||||
|
|
||||||
[dev-dependencies.tauri]
|
[dev-dependencies.tauri]
|
||||||
@ -36,7 +39,7 @@ path = "../../../core/tauri"
|
|||||||
features = ["test"]
|
features = ["test"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
prod = [ "tauri/custom-protocol" ]
|
prod = ["tauri/custom-protocol"]
|
||||||
|
|
||||||
# default to small, optimized release binaries
|
# default to small, optimized release binaries
|
||||||
[profile.release]
|
[profile.release]
|
||||||
|
@ -234,7 +234,7 @@ fn run_dev(
|
|||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
crate::dev::kill_before_dev_process();
|
crate::dev::kill_before_dev_process();
|
||||||
Err(e.into())
|
Err(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -9,7 +9,7 @@ use crate::{
|
|||||||
VersionMetadata,
|
VersionMetadata,
|
||||||
};
|
};
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use clap::Parser;
|
use clap::{Parser, ValueEnum};
|
||||||
use handlebars::{to_json, Handlebars};
|
use handlebars::{to_json, Handlebars};
|
||||||
use heck::{ToKebabCase, ToPascalCase, ToSnakeCase};
|
use heck::{ToKebabCase, ToPascalCase, ToSnakeCase};
|
||||||
use include_dir::{include_dir, Dir};
|
use include_dir::{include_dir, Dir};
|
||||||
@ -53,6 +53,17 @@ pub struct Options {
|
|||||||
/// Whether to initialize Android and iOS projects for the plugin.
|
/// Whether to initialize Android and iOS projects for the plugin.
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
pub(crate) mobile: bool,
|
pub(crate) mobile: bool,
|
||||||
|
/// Type of framework to use for the iOS project.
|
||||||
|
#[clap(long)]
|
||||||
|
pub(crate) ios_framework: Option<IosFrameworkKind>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, ValueEnum)]
|
||||||
|
pub enum IosFrameworkKind {
|
||||||
|
/// Swift Package Manager project
|
||||||
|
Spm,
|
||||||
|
/// Xcode project
|
||||||
|
Xcode,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Options {
|
impl Options {
|
||||||
@ -155,6 +166,8 @@ pub fn command(mut options: Options) -> Result<()> {
|
|||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let ios_framework = options.ios_framework.unwrap_or(IosFrameworkKind::Spm);
|
||||||
|
|
||||||
let mut created_dirs = Vec::new();
|
let mut created_dirs = Vec::new();
|
||||||
template::render_with_generator(
|
template::render_with_generator(
|
||||||
&handlebars,
|
&handlebars,
|
||||||
@ -193,7 +206,18 @@ pub fn command(mut options: Options) -> Result<()> {
|
|||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"ios" if !(options.ios || options.mobile) => return Ok(None),
|
"ios-spm" | "ios-xcode" if !(options.ios || options.mobile) => return Ok(None),
|
||||||
|
"ios-spm" if !matches!(ios_framework, IosFrameworkKind::Spm) => return Ok(None),
|
||||||
|
"ios-xcode" if !matches!(ios_framework, IosFrameworkKind::Xcode) => return Ok(None),
|
||||||
|
"ios-spm" | "ios-xcode" => {
|
||||||
|
let folder_name = components.next().unwrap().as_os_str().to_string_lossy();
|
||||||
|
|
||||||
|
path = Path::new("ios")
|
||||||
|
.join(Component::Normal(&std::ffi::OsString::from(
|
||||||
|
&folder_name.replace("{{ plugin_name }}", &plugin_name),
|
||||||
|
)))
|
||||||
|
.join(components.collect::<PathBuf>());
|
||||||
|
}
|
||||||
"guest-js" | "rollup.config.js" | "tsconfig.json" | "package.json"
|
"guest-js" | "rollup.config.js" | "tsconfig.json" | "package.json"
|
||||||
if options.no_api =>
|
if options.no_api =>
|
||||||
{
|
{
|
||||||
|
@ -35,6 +35,9 @@ pub struct Options {
|
|||||||
/// Whether to initialize Android and iOS projects for the plugin.
|
/// Whether to initialize Android and iOS projects for the plugin.
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
mobile: bool,
|
mobile: bool,
|
||||||
|
/// Type of framework to use for the iOS project.
|
||||||
|
#[clap(long)]
|
||||||
|
pub(crate) ios_framework: Option<super::init::IosFrameworkKind>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Options> for super::init::Options {
|
impl From<Options> for super::init::Options {
|
||||||
@ -49,6 +52,7 @@ impl From<Options> for super::init::Options {
|
|||||||
android: o.android,
|
android: o.android,
|
||||||
ios: o.ios,
|
ios: o.ios,
|
||||||
mobile: o.mobile,
|
mobile: o.mobile,
|
||||||
|
ios_framework: o.ios_framework,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,319 @@
|
|||||||
|
// !$*UTF8*$!
|
||||||
|
{
|
||||||
|
archiveVersion = 1;
|
||||||
|
classes = {
|
||||||
|
};
|
||||||
|
objectVersion = 60;
|
||||||
|
objects = {
|
||||||
|
|
||||||
|
/* Begin PBXBuildFile section */
|
||||||
|
A0E2115A2BF552D2003BCF4D /* ExamplePlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0E211592BF552D2003BCF4D /* ExamplePlugin.swift */; };
|
||||||
|
A0E211622BF55305003BCF4D /* Tauri in Frameworks */ = {isa = PBXBuildFile; productRef = A0E211612BF55305003BCF4D /* Tauri */; };
|
||||||
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
|
/* Begin PBXCopyFilesBuildPhase section */
|
||||||
|
A0E211542BF552D2003BCF4D /* CopyFiles */ = {
|
||||||
|
isa = PBXCopyFilesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
dstPath = "include/$(PRODUCT_NAME)";
|
||||||
|
dstSubfolderSpec = 16;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXFileReference section */
|
||||||
|
A0E211562BF552D2003BCF4D /* libtauri-plugin-{{ plugin_name }}.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libtauri-plugin-{{ plugin_name }}.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
A0E211592BF552D2003BCF4D /* ExamplePlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExamplePlugin.swift; sourceTree = "<group>"; };
|
||||||
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
A0E211532BF552D2003BCF4D /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
A0E211622BF55305003BCF4D /* Tauri in Frameworks */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXGroup section */
|
||||||
|
A0E2114D2BF552D2003BCF4D = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
A0E211582BF552D2003BCF4D /* tauri-plugin-{{ plugin_name }} */,
|
||||||
|
A0E211572BF552D2003BCF4D /* Products */,
|
||||||
|
);
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
A0E211572BF552D2003BCF4D /* Products */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
A0E211562BF552D2003BCF4D /* libtauri-plugin-{{ plugin_name }}.a */,
|
||||||
|
);
|
||||||
|
name = Products;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
A0E211582BF552D2003BCF4D /* tauri-plugin-{{ plugin_name }} */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
A0E211592BF552D2003BCF4D /* ExamplePlugin.swift */,
|
||||||
|
);
|
||||||
|
path = "tauri-plugin-{{ plugin_name }}";
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
/* End PBXGroup section */
|
||||||
|
|
||||||
|
/* Begin PBXNativeTarget section */
|
||||||
|
A0E211552BF552D2003BCF4D /* tauri-plugin-{{ plugin_name }} */ = {
|
||||||
|
isa = PBXNativeTarget;
|
||||||
|
buildConfigurationList = A0E2115D2BF552D2003BCF4D /* Build configuration list for PBXNativeTarget "tauri-plugin-{{ plugin_name }}" */;
|
||||||
|
buildPhases = (
|
||||||
|
A0E211522BF552D2003BCF4D /* Sources */,
|
||||||
|
A0E211532BF552D2003BCF4D /* Frameworks */,
|
||||||
|
A0E211542BF552D2003BCF4D /* CopyFiles */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
);
|
||||||
|
name = "tauri-plugin-{{ plugin_name }}";
|
||||||
|
packageProductDependencies = (
|
||||||
|
A0E211612BF55305003BCF4D /* Tauri */,
|
||||||
|
);
|
||||||
|
productName = "tauri-plugin-{{ plugin_name }}";
|
||||||
|
productReference = A0E211562BF552D2003BCF4D /* libtauri-plugin-{{ plugin_name }}.a */;
|
||||||
|
productType = "com.apple.product-type.library.static";
|
||||||
|
};
|
||||||
|
/* End PBXNativeTarget section */
|
||||||
|
|
||||||
|
/* Begin PBXProject section */
|
||||||
|
A0E2114E2BF552D2003BCF4D /* Project object */ = {
|
||||||
|
isa = PBXProject;
|
||||||
|
attributes = {
|
||||||
|
BuildIndependentTargetsInParallel = 1;
|
||||||
|
LastSwiftUpdateCheck = 1540;
|
||||||
|
LastUpgradeCheck = 1540;
|
||||||
|
TargetAttributes = {
|
||||||
|
A0E211552BF552D2003BCF4D = {
|
||||||
|
CreatedOnToolsVersion = 15.4;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
buildConfigurationList = A0E211512BF552D2003BCF4D /* Build configuration list for PBXProject "tauri-plugin-{{ plugin_name }}" */;
|
||||||
|
compatibilityVersion = "Xcode 14.0";
|
||||||
|
developmentRegion = en;
|
||||||
|
hasScannedForEncodings = 0;
|
||||||
|
knownRegions = (
|
||||||
|
en,
|
||||||
|
Base,
|
||||||
|
);
|
||||||
|
mainGroup = A0E2114D2BF552D2003BCF4D;
|
||||||
|
packageReferences = (
|
||||||
|
A0E211602BF55305003BCF4D /* XCLocalSwiftPackageReference "../.tauri/tauri-api" */,
|
||||||
|
);
|
||||||
|
productRefGroup = A0E211572BF552D2003BCF4D /* Products */;
|
||||||
|
projectDirPath = "";
|
||||||
|
projectRoot = "";
|
||||||
|
targets = (
|
||||||
|
A0E211552BF552D2003BCF4D /* tauri-plugin-{{ plugin_name }} */,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
/* End PBXProject section */
|
||||||
|
|
||||||
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
|
A0E211522BF552D2003BCF4D /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
A0E2115A2BF552D2003BCF4D /* ExamplePlugin.swift in Sources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXSourcesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin XCBuildConfiguration section */
|
||||||
|
A0E2115B2BF552D2003BCF4D /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||||
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_COMMA = YES;
|
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
|
COPY_PHASE_STRIP = NO;
|
||||||
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
ENABLE_TESTABILITY = YES;
|
||||||
|
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||||
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
|
"DEBUG=1",
|
||||||
|
"$(inherited)",
|
||||||
|
);
|
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 17.5;
|
||||||
|
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
|
MTL_FAST_MATH = YES;
|
||||||
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
|
SDKROOT = iphoneos;
|
||||||
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
A0E2115C2BF552D2003BCF4D /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||||
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_COMMA = YES;
|
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
|
COPY_PHASE_STRIP = NO;
|
||||||
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
|
ENABLE_NS_ASSERTIONS = NO;
|
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 17.5;
|
||||||
|
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
|
MTL_FAST_MATH = YES;
|
||||||
|
SDKROOT = iphoneos;
|
||||||
|
SWIFT_COMPILATION_MODE = wholemodule;
|
||||||
|
VALIDATE_PRODUCT = YES;
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
A0E2115E2BF552D2003BCF4D /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
OTHER_LDFLAGS = "-ObjC";
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
A0E2115F2BF552D2003BCF4D /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
OTHER_LDFLAGS = "-ObjC";
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
/* End XCBuildConfiguration section */
|
||||||
|
|
||||||
|
/* Begin XCConfigurationList section */
|
||||||
|
A0E211512BF552D2003BCF4D /* Build configuration list for PBXProject "tauri-plugin-{{ plugin_name }}" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
A0E2115B2BF552D2003BCF4D /* Debug */,
|
||||||
|
A0E2115C2BF552D2003BCF4D /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
|
A0E2115D2BF552D2003BCF4D /* Build configuration list for PBXNativeTarget "tauri-plugin-{{ plugin_name }}" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
A0E2115E2BF552D2003BCF4D /* Debug */,
|
||||||
|
A0E2115F2BF552D2003BCF4D /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
|
/* End XCConfigurationList section */
|
||||||
|
|
||||||
|
/* Begin XCLocalSwiftPackageReference section */
|
||||||
|
A0E211602BF55305003BCF4D /* XCLocalSwiftPackageReference "../.tauri/tauri-api" */ = {
|
||||||
|
isa = XCLocalSwiftPackageReference;
|
||||||
|
relativePath = "../.tauri/tauri-api";
|
||||||
|
};
|
||||||
|
/* End XCLocalSwiftPackageReference section */
|
||||||
|
|
||||||
|
/* Begin XCSwiftPackageProductDependency section */
|
||||||
|
A0E211612BF55305003BCF4D /* Tauri */ = {
|
||||||
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
productName = Tauri;
|
||||||
|
};
|
||||||
|
/* End XCSwiftPackageProductDependency section */
|
||||||
|
};
|
||||||
|
rootObject = A0E2114E2BF552D2003BCF4D /* Project object */;
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Workspace
|
||||||
|
version = "1.0">
|
||||||
|
<FileRef
|
||||||
|
location = "self:">
|
||||||
|
</FileRef>
|
||||||
|
</Workspace>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>IDEDidComputeMac32BitWarning</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
@ -0,0 +1,20 @@
|
|||||||
|
import SwiftRs
|
||||||
|
import Tauri
|
||||||
|
import UIKit
|
||||||
|
import WebKit
|
||||||
|
|
||||||
|
class PingArgs: Decodable {
|
||||||
|
let value: String?
|
||||||
|
}
|
||||||
|
|
||||||
|
class ExamplePlugin: Plugin {
|
||||||
|
@objc public func ping(_ invoke: Invoke) throws {
|
||||||
|
let args = try invoke.parseArgs(PingArgs.self)
|
||||||
|
invoke.resolve(["value": args.value ?? ""])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@_cdecl("init_plugin_{{ plugin_name_snake_case }}")
|
||||||
|
func initPlugin() -> Plugin {
|
||||||
|
return ExamplePlugin()
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user