You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Xcode 9.3中切换至Swift 4.0?当前仅显示3.3或未指定选项

How to Switch to Swift 4.0 in Xcode 9.3

Hey there! Let me walk you through how to get Swift 4.0 working in Xcode 9.3—since I’ve run into this exact confusion before. First off, let’s clarify: Xcode 9.3 does support Swift 4.0 (it ships with Swift 4.1 by default, but you can target older Swift versions for your project). The issue you’re seeing where only 3.3 or "Unspecified" show up is likely a project-level setting quirk, not a limitation of Xcode itself. Here’s how to fix it:

1. Update Your Project’s Root Build Setting

  • Open your project in Xcode 9.3, then select the top-level project file in the Project Navigator.
  • Switch to the Build Settings tab, and use the search bar to look for Swift Language Version.
  • If the dropdown only shows 3.3 or "Unspecified", don’t stress—you can manually type 4.0 directly into the field. Xcode will recognize the version and apply the setting automatically.

2. Sync Target-Level Settings

Sometimes the project-level setting is correct, but individual targets might still be stuck on an older Swift version:

  • Select each target under your project in the Project Navigator one by one.
  • Repeat the step above: navigate to Build Settings, search for Swift Language Version, and set it to 4.0 if it’s not already matching the project setting.

3. Handle Mixed Swift Version Files (If Needed)

If your project has legacy Swift 3.x files you want to keep using alongside Swift 4.0 code:

  • Select the specific Swift 3.x file in the Project Navigator.
  • Open the File Inspector (right-hand sidebar, the page-shaped icon).
  • Scroll to the Swift Compiler - Language section, then set Swift Version to 3.3 for that file. This lets Xcode compile it with the older version while the rest of your project runs on 4.0.

A Quick Side Note

Just so you know—Xcode 9.3 comes with Swift 4.1, which is a backwards-compatible minor update to 4.0. If you don’t have a strict requirement to use 4.0 specifically, you could also type 4.1 into the version field. It includes all 4.0 features plus some handy improvements.


内容的提问来源于stack exchange,提问作者Vladyslav Zavalykhatko

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 08:05:06