Episode #154

xcconfig Files

13 minutes
Published on January 29, 2015

This video is only available to subscribers. Get access to this video and 586 others.

In this episode we extract all of the settings from a standard iPhone project and move them over to a .xcconfig file for Xcode to use as a base for our projects. Doing so can make our configuration a bit more explicit, allow us to add comments on why certain settings are necessary, and also to put them under version control to make it easy to spot changes.

Episode Links

Resulting Configuration Files

Debug.xcconfig:
objc
\#include "Shared.xcconfig"
ONLY\_ACTIVE\_ARCH = YES
COPY\_PHASE\_STRIP = NO
MTL\_ENABLE\_DEBUG\_INFO = YES
GCC\_PREPROCESSOR\_DEFINITIONS = DEBUG=1 $(inherited)

Release.xcconfig:
objc
\#include "Shared.xcconfig"
VALIDATE\_PRODUCT = YES
COPY\_PHASE\_STRIP = YES
MTL\_ENABLE\_DEBUG\_INFO = NO
ENABLE\_NS\_ASSERTIONS = NO

Shared.xcconfig:
objc
ASSETCATALOG\_COMPILER\_APPICON\_NAME = AppIcon
LD\_RUNPATH\_SEARCH\_PATHS = $(inherited) @executable\_path/Frameworks
INFOPLIST\_FILE = ConfigDemo/Info.plist
PRODUCT\_NAME = $(TARGET\_NAME)

Application.xcconfig:
```objc
SDKROOT = iphoneos
CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Developer
IPHONEOS_DEPLOYMENT_TARGET = 8.1

ALWAYS_SEARCH_USER_PATHS = NO
GCC_DYNAMIC_NO_PIC = NO
GCC_OPTIMIZATION_LEVEL = 0
GCC_SYMBOLS_PRIVATE_EXTERN = NO
GCC_C_LANGUAGE_STANDARD = gnu99
CLANG_CXX_LANGUAGE_STANDARD = gnu++0x
CLANG_CXX_LIBRARY = libc++
CLANG_ENABLE_MODULES = YES
CLANG_ENABLE_OBJC_ARC = YES
ENABLE_STRICT_OBJC_MSGSEND = YES
CLANG_WARN_EMPTY_BODY = YES
CLANG_WARN_BOOL_CONVERSION = YES
CLANG_WARN_CONSTANT_CONVERSION = YES
GCC_WARN_64_TO_32_BIT_CONVERSION = YES
CLANG_WARN_ENUM_CONVERSION = YES
CLANG_WARN_INT_CONVERSION = YES
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE
CLANG_WARN_UNREACHABLE_CODE = YES
GCC_WARN_UNUSED_FUNCTION = YES
GCC_WARN_UNUSED_VARIABLE = YES
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR
CLANG_WARN_DUPLICATE_METHOD_MATCH = YES
GCC_WARN_UNDECLARED_SELECTOR = YES
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR
```