# Build settings depending on Xcode version

DevFeed: [Build settings depending on Xcode version](<https://devfeed.tech/articles/build-settings-depending-on-xcode-version-21619.md>)

Original publisher: [Read original article](<http://miqu.me/blog/2017/01/29/temporary-build-settings/>)

Author: Miguel Angel Quiñones

Published: 2017-01-29T23:26:54Z

Content type: article

Language: en

Sources: [Miguel Quinones](<https://devfeed.tech/sources/miguel-quinones.md>)

Topics: [Xcode](<https://devfeed.tech/topics/xcode.md>), [configuration](<https://devfeed.tech/topics/configuration.md>), [Swift](<https://devfeed.tech/topics/swift.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [bridging](<https://devfeed.tech/tags/bridging.md>), [build](<https://devfeed.tech/tags/build.md>), [code](<https://devfeed.tech/tags/code.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [project](<https://devfeed.tech/tags/project.md>), [swift](<https://devfeed.tech/tags/swift.md>), [xcode](<https://devfeed.tech/tags/xcode.md>)

## AI overview

The article explains how to use xcconfig files and the XCODE_VERSION_MINOR build setting to apply different Swift build settings for different Xcode versions. Its example enables precompiled bridging headers in Xcode 8.3 beta while preserving compatibility with Xcode 8.2.1.

## Source excerpt

This weekend I wanted to setup Precompiled Bridging Headers for my project. This setting is available in the new Xcode 8.3 beta. Then building for latest official XCode (8.2.1) the code will not compile because the Swift compiler doesn't recognize it. How do we use different build settings for different Xcode versions? Only possible with xcconfig files. There's an undocumented build setting called XCODE_VERSION_MINOR that we can use here. And after some variable substitution we'll make it work. Here's the gist: 1 2 3 4 5 6 // Setting for last Xcode OTHER_SWIFT_FLAGS_XCODE_0820 = //<previous flags, if any> // Setting for Xcode Beta OTHER_SWIFT_FLAGS_XCODE_0830 = -enable-bridging-pch // Switch configuration based on Xcode version OTHER_SWIFT_FLAGS = $(OTHER_SWIFT_FLAGS_XCODE_$(XCODE_VERSION_MINOR)) Full credit to Samantha Marshall's excellent writeups of xcconfig files. Take a read, very useful to refer to.