{"record":{"id":"cf5beb978065c8c6","repo":"tauri-apps/tauri","slug":"ios-folder-already-exists","errorCode":null,"errorMessage":"iOS folder already exists","messagePattern":"iOS folder already exists","errorType":"validation","errorClass":"tauri_cli::error::Error","httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/plugin/ios.rs","lineNumber":64,"sourceCode":"  /// Type of framework to use for the iOS project.\n  #[clap(long)]\n  #[clap(default_value_t = PluginIosFramework::default())]\n  ios_framework: PluginIosFramework,\n}\n\npub fn command(cli: Cli) -> Result<()> {\n  match cli.command {\n    Commands::Init(options) => {\n      let plugin_name = match options.plugin_name {\n        None => super::infer_plugin_name(\n          std::env::current_dir().context(\"failed to get current directory\")?,\n        )?,\n        Some(name) => name,\n      };\n\n      let out_dir = PathBuf::from(options.out_dir);\n      if out_dir.join(\"ios\").exists() {\n        crate::error::bail!(\"iOS folder already exists\");\n      }\n\n      let handlebars = Handlebars::new();\n\n      let mut data = BTreeMap::new();\n      super::init::plugin_name_data(&mut data, &plugin_name);\n\n      let ios_folder_name = match options.ios_framework {\n        PluginIosFramework::Spm => OsStr::new(\"ios-spm\"),\n        PluginIosFramework::Xcode => OsStr::new(\"ios-xcode\"),\n      };\n\n      let mut created_dirs = Vec::new();\n      template::render_with_generator(\n        &handlebars,\n        &data,\n        &super::init::TEMPLATE_DIR,\n        &out_dir,","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/plugin/ios.rs#L46-L82","documentation":"`tauri plugin ios init` performs the same guard as the Android variant: if an `ios` directory already exists in the output dir it aborts instead of overwriting. Note the check tests for `ios/` even though the framework choice (`--ios-framework spm|xcode`) scaffolds into `ios-spm/` or `ios-xcode/`.","triggerScenarios":"Running `tauri plugin ios init` in a plugin crate where an `ios/` directory already exists — a previous init with different options, a legacy layout from an older Tauri version, or a stray folder.","commonSituations":"Switching from the legacy `ios/` layout to `ios-spm`/`ios-xcode` layouts in Tauri 2; re-running init after a failed first attempt; monorepos where out-dir defaults collide.","solutions":["Delete or rename the existing `ios/` directory and re-run `tauri plugin ios init`.","Pick a different `--out-dir` if you want both layouts side by side.","If migrating from a legacy ios/ folder, port manual Swift changes into the new ios-spm/ios-xcode output after scaffolding."],"exampleFix":"# before\ntauri plugin ios init\n# error: iOS folder already exists\n\n# after\nmv ios ios-legacy\ntauri plugin ios init --ios-framework spm","handlingStrategy":"validation","validationCode":"test ! -e ios \\\n  && tauri plugin ios init \\\n  || echo \"ios/ already scaffolded - skipping init\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember init guards on `ios/` even though output goes to ios-spm/ or ios-xcode/.","Clean up failed scaffolding attempts before re-running init."],"tags":["tauri-cli","plugin","ios","init","scaffold"],"backgroundTag":"output-directory-exists","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}