Abandoned because: SwiftUI
Outletgen Xcode Script
- No more drag & dropping @IBOutlets 🙌
- No more clutter in ViewControllers 🗑
- Type safe, no more mystical crashes due to missing @IBOutlets ✨
This script will automatically generate view outlets for you! The views are generated as VC extensions and are stored by object association ⚡️
Features:
- Storyboard/XIB support
- Outlets for subviews
- Outlets for subviews in cells storyboard prototypes
- Outlets for constraints
- Outlets for UIBarButtonItems
Early version, may be buggy, feel free to test and contribute
Installation
- Add
pod 'Outletgen'
to your Podfile - Add
"$PODS_ROOT/Outletgen/Outletgen --module $PRODUCT_MODULE_NAME"
to to your Run Scripts in Xcode. Drag it above the Compile Sources phase. - Build and add generated
Outletgen.swift
to your project. Deselect Copy files if needed.
Adding Outletgen.swift
to .gitignore
is recommended.
or:
Manual Installation
- Drag & Drop
Outletgen
to your project folder. - Add
"$SRCROOT/Outletgen --module $PRODUCT_MODULE_NAME"
to your Run Scripts in Xcode. Drag it above the Compile Sources phase.is - Build and add generated
Outletgen.swift
to your project. Deselect Copy files if needed.
Using
Just add an "Outlet identifier" (outletIdentifier
) to your views, constraints in XIBs/Storyboards and Outletgen will auto generate code for you to use.
Before
class MyVc: UIViewController {
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!
@IBOutlet weak var emptyView: UIScrollView!
@IBOutlet weak var searchBar: UISearchBar!
override func viewDidLoad() {
tableView.isHidden = true
activityIndicator.isHidden = true
emptyView.isHidden = true
searchBar.isHidden = true
}
After
No drag & dropping. Just add an "Outlet identifier" in your views and references will be auto-generated for you:
class MyVc: UIViewController {
// Aaah, no more clutter!
override func viewDidLoad() {
// These are auto generated in an extension of MyVc
tableView.isHidden = true
activityIndicator.isHidden = true
emptyView.isHidden = true
searchBar.isHidden = true
}
Contributing
Just make a PR! There are some issues to solve in the "Issues" section.
Thanks for contributing!
kacperd <3