An xcconfig (Xcode configuration) file for easily turning on a boatload of warnings in your project or its targets.

Overview

Warnings

This is an xcconfig file to make it easy for you to turn on a large suite of useful warnings in your Xcode project. These warnings catch bugs, so turning them on may identify bugs you can fix now and having them on will prevent bugs later.

If you have an existing project you've developed without these warnings turned on, you probably will have a number of warnings after turning them on. These are bugs in your code, newly revealed—fixing the warnings is fixing bugs.

The file also turns on Treat Warnings as Errors—so you can't just ignore warnings; you must fix them in order to be able to build—and the setting to run the Clang Static Analyzer in every build, which will find even more bugs (mostly leaks and crashers).

If you are new to Objective-C, you may find that you encounter build errors more frequently when using these settings. That is correct, expected, and good—the errors are bugs that would otherwise have gone undetected! Use these settings to identify your bad habits and things you don't fully understand, and take the opportunities to learn. You will learn better and faster with these warnings enabled.

The xcconfig file

Usage

  1. Copy it to your own project's root directory (the directory containing the .xcodeproj package).
  2. Add it to the project. In a modern project, it should be at the top level, either at the top of the list or below all of the per-target groups.
  3. Edit the project object (the very topmost item in the Project Navigator).
  4. Select the project, not any target.
  5. Select the Info tab.
  6. Under Configurations, expand both/all of the configurations.
  7. For each configuration, set the pop-up menu for the project to “Warnings” (which is the xcconfig file you just added).

What if you're already using an xcconfig file?

Xcode supports preprocessor directives in xcconfig files, so you can #include the Warnings file from your existing xcconfig file.

The test project

WarningsTest is an Xcode project containing a unit test bundle target. The project uses the xcconfig file, and the tests demonstrate the kinds of bugs that the file tells the compiler to warn about.

Usage

Open it in Xcode, hold down on the verb button (the one that says Run by default) and choose Test. This will attempt to build the unit test bundle and run the tests.

It will fail, because the tests are all written to demonstrate the warnings, not to test other code. (There is no code under test.) Because of all the warnings and the Treat Warnings as Errors setting, the build will never succeed.

Credits

You might also like...
Find common xib and storyboard-related problems without running your app or writing unit tests.
Find common xib and storyboard-related problems without running your app or writing unit tests.

IBAnalyzer Find common xib and storyboard-related problems without running your app or writing unit tests. Usage Pass a path to your project to ibanal

Crafter - Xcode project configuration CLI made easy.

How do you setup your Cocoa projects? Do you always set same warnings, clone configurations and do bunch of other stuff? Or maybe you work in a big co

LinkedLog is a Xcode plugin that includes a Xcode PCH header file template that adds the macros `LLog` and `LLogF` and parses their output to link from the console to the corresponding file and line.
LinkedLog is a Xcode plugin that includes a Xcode PCH header file template that adds the macros `LLog` and `LLogF` and parses their output to link from the console to the corresponding file and line.

LinkedLog Xcode Plugin LinkedLog is a Xcode plugin that includes a Xcode PCH file template that adds the macros LLog and LLogF. The LLog macro will wo

This project will add done button on TexField and TextViews by just turning on from storyboard.

RTDoneKeyboard Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Installation RTD

Dixie, turning chaos to your advantage.
Dixie, turning chaos to your advantage.

Dixie Dixie is an open source Objective-C testing framework for altering object behaviours. Test your app through creating chaos in the inner systems.

🐝 Draw Xcode targets and dependencies tree
🐝 Draw Xcode targets and dependencies tree

🐝 Bee Draw Xcode targets and dependencies tree.

Capacitor File Opener. The plugin is able to open a file given the mimeType and the file uri
Capacitor File Opener. The plugin is able to open a file given the mimeType and the file uri

Capacitor File Opener. The plugin is able to open a file given the mimeType and the file uri. This plugin is similar to cordova-plugin-file-opener2 without installation support.

Turning on a VPN is always a painful experience on an iOS device due to the deep nested menus.
Turning on a VPN is always a painful experience on an iOS device due to the deep nested menus.

VPN On Turning on a VPN is always a painful experience on an iOS device due to the deep nested menus. This App installs a Today Widget into Notificati

Demo Swift Lint Two Warnings

DemoSwiftLintTwoWarnings Supports: iOS 10.0 and above Branches: master - stable app releases develop - development branch, merge your feature branches

Skredvarsel app - an iOS, iPadOS, and macOS application that provides daily avalanche warnings from the Norwegian Avalanche Warning Service API
Skredvarsel app - an iOS, iPadOS, and macOS application that provides daily avalanche warnings from the Norwegian Avalanche Warning Service API

Skredvarsel (Avalanche warning) app is an iOS, iPadOS, and macOS application that provides daily avalanche warnings from the Norwegian Avalanche Warning Service API

Throw common warnings of ViewController presentation as error.

SafePresentation Throw common warnings of ViewController presentation as error. Usage Replace present(_:_:_:) to throwingPresent(_:_:_:). let vc = Chi

UIView subclass that bends its edges when its position changes.

AHKBendableView BendableView is a UIView subclass that bends its edges when its position change is animated. Internally, BendableView contains CAShape

A UISwitch that infects its superview with its tint color.
A UISwitch that infects its superview with its tint color.

UISwitch subclass that 'infects' the parent view with the onTintColor when the switch is turned on. Inspired by this Dribble by Ramotion. Screenshot I

An Integer type that clamps its value to its minimum and maximum instead of over- or underflowing.

ClampedInteger An Integer type that clamps its value to its minimum and maximum instead of over- or underflowing. Examples let big = ClampedIntege

Enables developers to write code that interacts with CloudKit in targets that don't support the CloudKit Framework directly

CloudKit Web Services This package enables developers to write code that interac

Enables developers to write code that interacts with CloudKit in targets that don't support the CloudKit Framework directly

CloudKit Web Services This package enables developers to write code that interac

Demonstration of Cocoapod test targets failing to build when integrated with TestingExtensions 0.2.11.

TestingExtensions0_2_11-Bug Symptoms Open project, hit test (Command+U), TestingExtensions fails to compile with a list of errors appearing to be rela

UIPredicateEditor aims to be come a drop-in replacement of NSPredicateEditor for iOS, iPadOS and Mac Catalyst targets.

UIPredicateEditor UIPredicateEditor aims to be come a drop-in replacement of NSPredicateEditor for iOS, iPadOS and Mac Catalyst targets. The plan is t

Synx - A command-line tool that reorganizes your Xcode project folder to match your Xcode groups
Synx - A command-line tool that reorganizes your Xcode project folder to match your Xcode groups

A command-line tool that reorganizes your Xcode project folder to match your Xcode groups. Xcode Finder Installation $ gem install synx Usage Basic ⚠

Comments
  • Documentation error

    Documentation error

    The second paragraph in the README.md file starts, "If you have an existing project you've developed with these warnings enabled, . . . " Should "enabled" be "disabled"?

    opened by Mr-Berna 1
  • Enable warnings for Swift

    Enable warnings for Swift

    I've followed the direction in the README to attach warnings.xconfig to the project: image

    Then I've done some things to specifically test that some of these errors are thrown:

    // empty loop
    for _ in 0..<3 { } 
    
    // shadowed variable
    var index = 0
    func another(){
      var index = 3 
    }
    

    I can build and run with no problem, however, and the errors aren't shown either as warnings or build blockers. Do I have this configured wrong? I'm probably doing something basic and silly, I'm very new to iOS, just want to start with guard rails.

    opened by SimplGy 1
An Xcode formatter plug-in to format your swift code.

Swimat Swimat is an Xcode plug-in to format your Swift code. Preview Installation There are three way to install. Install via homebrew-cask # Homebrew

Jintin 1.6k Jan 7, 2023
A Swift micro-framework to easily deal with weak references to self inside closures

WeakableSelf Context Closures are one of Swift must-have features, and Swift developers are aware of how tricky they can be when they capture the refe

Vincent Pradeilles 72 Sep 1, 2022
decoupling between modules in your iOS Project. iOS模块化过程中模块间解耦方案

DecouplingKit 中文readme Podfile platform :ios, '7.0' pod 'DecouplingKit', '~> 0.0.2' DecouplingKit, decoupling between modules in your iOS Project. D

coderyi 139 Aug 23, 2022
A command-line tool and Xcode Extension for formatting Swift code

Table of Contents What? Why? How? Command-line tool Xcode source editor extension Xcode build phase Via Applescript VSCode plugin Sublime Text plugin

Nick Lockwood 6.3k Jan 8, 2023
Measure Swift code metrics and get reports in Xcode, Jenkins and other CI platforms.

Taylor ⚠️ Taylor is DEPRECATED. Use SwiftLint instead. A tool aimed to increase Swift code quality, by checking for conformance to code metrics. Taylo

YOPESO 301 Dec 24, 2022
iOS project bootstrap aimed at high quality coding.

iOS Project bootstrap How do you setup your iOS projects? Since we are approaching 2015 I’m working on refreshing my project bootstrap. I’ve decided t

Krzysztof Zabłocki 2k Dec 23, 2022
The project used in the iOS Architect Crash Course lectures

iOS Architect Crash Course • August 2nd-8th • EssentialDeveloper.com https://www.essentialdeveloper.com/ios-architect-crash-course/aug-2021-a5220 It's

Aleksei Korolev 1 Jul 20, 2022
Asserts on roids, test all your assumptions with ease.

KZAsserts - Asserts on roids, test all your assumptions with ease. There are many ways in which we can improve quality of our code-base, Assertions ar

Krzysztof Zabłocki 101 Jul 1, 2022
Find memory leaks in your iOS app at develop time.

中文介绍 | FAQ中文 MLeaksFinder MLeaksFinder helps you find memory leaks in your iOS apps at develop time. It can automatically find leaks in UIView and UIV

Tencent 5.3k Dec 22, 2022
Find memory issues & leaks in your iOS app without instruments

HeapInspector Find memory issues & leaks in your iOS app HeapInspector is a debug tool that monitors the memory heap with backtrace recording in your

Christian Menschel 1.8k Nov 24, 2022