This Xcode plugin makes @IBOutlet
s Optional
and private
in Xcode.
OptionalOutlets | |
---|---|
✅ | Supports weak and strong Outlets and Collections |
✨ | Super easy installation |
💪 | ImplicitlyUnwrappedOptional s are ugly, say goodbye to them! |
🙈 | Outlets should be private, now they are! |
You can install OptionalOutlets
using Alcatraz.
First, install Alcatraz using
curl -fsSL https://raw.githubusercontent.com/supermarin/Alcatraz/deploy/Scripts/install.sh | sh
- Restart Xcode
- Click on
Window
- Select
Package Manager
- Search and Install
OptionalOutlets
- Restart Xcode
You can also install the plugin manually by cloning this repository and building the project. It'll be installed on ~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/OptionalOutlets.xcplugin
.
You should restart Xcode after that.
The primary goal of this plugin is to make @IBOutlet
s Optional
. By default, Xcode uses ImplicitlyUnwrappedOptional
s, but that's dangerous and even though you can safely unwrap them most people don't. The secondary goal is to make your @IBOutlet
s private
. Using outlets outside a class is a code smell and seldom is needed. This plugin automatically makes your outlets Optional
and private
, simple as that! Don't worry, they are independent rules and you can disable them at any time.
🚀 Let's Make Xcode Great Again™
- @marcelofabri_ for his CocoaHeads talk about IBOutlint which gave me the motivation to write this and from which I've shamelessly copied most of the code.
- @chrisfsampaio for adding support to making outlets
private
, adding an example project, adding feature toggles, reporting bugs and a bunch of other stuff I probably forgot to mention. - @orta for blogging about his experience on building a Xcode plugin.
- @kattrali for providing a template for Xcode plugins.
- @gsampaio for telling me to throw the Swift version of this plugin away, copy Fabri's and save ~8Mb for all the users.
Please submit an issue on GitHub and provide information about your setup.
This project is licensed under the terms of the MIT license. See the LICENSE file.