Skip to main content

spm_swift_package/utils/
xcode.rs

1use std::process::Command;
2
3/// Opens the generated Package.swift in Xcode using a shell command
4pub fn open_xcode(project_name: &str) -> Result<(), String> {
5	let command = format!("cd {} && open Package.swift", project_name);
6
7	Command::new("sh")
8		.arg("-c")
9		.arg(&command)
10		.spawn()
11		.and_then(|mut child| child.wait())
12		.map_err(|e| format!("Failed to launch Xcode: {e}"))?;
13
14	Ok(())
15}