Skip to content

Instantly share code, notes, and snippets.

@keith keith/exclusivity.md
Last active Nov 30, 2019

Embed
What would you like to do?
The matrix of Xcode build settings to compiler flags for Swift memory exclusivity
  • Compiler flag: -enforce-exclusivity=<value>
  • Build setting: SWIFT_ENFORCE_EXCLUSIVE_ACCESS

Xcode 10.1 & Swift 4.2

  • Compiler default for non optimized builds if you pass no argument is the same as if you passed checked
  • Compiler default for optimized builds if you pass no argument is the same as if you passed unchecked
Configuration Compiler Flag Value Build Setting Description Build Setting Value Notes
Debug checked Full Enforcement (Run-time Checks in All Builds) on
Debug checked Full Enforcement (Run-time Checks in Debug Builds Only) debug-only default
Debug unchecked Compile-time Enforcement compile-time
Debug none No Enforcement none
Release checked Full Enforcement (Run-time Checks in All Builds) on
Release no flag passed Full Enforcement (Run-time Checks in Debug Builds Only) debug-only default
Release unchecked Compile-time Enforcement compile-time
Release none No Enforcement none

Xcode 10.2 (beta 3) & Swift 5

  • Compiler default if you pass no argument is the same as if you passed checked
Configuration Compiler Flag Value Build Setting Description Build Setting Value Notes
Debug checked Full Enforcement (Run-time Checks in All Builds) on default
Debug checked Full Enforcement (Run-time Checks in Debug Builds Only) debug-only
Debug unchecked Compile-time Enforcement Only off
Release checked Full Enforcement (Run-time Checks in All Builds) on default
Release unchecked Full Enforcement (Run-time Checks in Debug Builds Only) debug-only
Release unchecked Compile-time Enforcement Only off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.