ViewGenerator
ViewGenerator copied to clipboard
⚒ ViewGenerator generates view code from variable name automatically in iOS development
Overview
ViewGenerator generates view code from variable name automatically when you create view by code in iOS development
Download
Environment
- Xcode 10.3 or greater
- Swift 5.0 or greator
Demo
Install
-
Install ViewGenerator from AppStore
-
Enable ViewGenerator
System Preferences→Extensions- Switch on
Xcode Source Editorcheckbox
Usage
- Input variable name
⚠Important⚠ : variable name must be included class name withoutUIas suffix. (e.g.hogeView,hogeLabel, etc.)
Please check Support View List bellow - Select variable name
Editor→ViewGenerator→Generate View Code
- Generated⚒
Recommend
I strongly recommend that you register Generate View Code Command to shortcut
Xcode Preferences→KeyBindings- Input
ViewGeneratorin Search - Register shortcut
Usage Example
Multiple variables
| GIF | |
|---|---|
| select | ![]() |
Single Variable
| GIF | |
|---|---|
| not_select | ![]() |
| select | ![]() |
Supplement
Default access modifier is private . if you change access modifier, open viewgenerator app and then select access modifier that you want to select
Example
For example, if variable name prefix is hoge, it is generated as bellow
hogeView
private let hogeView: UIView = {
let hogeView = UIView(frame: .zero)
hogeView.translatesAutoresizingMaskIntoConstraints = false
return hogeView
}()
hogeButton
private let hogeButton: UIButton = {
let hogeButton = UIButton(frame: .zero)
hogeButton.translatesAutoresizingMaskIntoConstraints = false
return hogeButton
}()
hogeTableView
private let hogeTableView: UITableView = {
let hogeTableView = UITableView(frame: .zero)
hogeTableView.translatesAutoresizingMaskIntoConstraints = false
return hogeTableView
}()
hogehoge
private let hogehoge: _InputTypeName_ = {
let hogehoge = _InputTypeName_(frame: .zero)
hogehoge.translatesAutoresizingMaskIntoConstraints = false
return hogehoge
}()
Support View List
| View |
|---|
UISwitch |
UIActivityIndicatorView |
UIButton |
UICollectionView |
UIControl |
UIDatePicker |
UIImageView |
UILabel |
UINavigationBar |
UIPageControl |
UIPickerView |
UIProgressView |
UIScrollView |
UISearchBar |
UISegmentedControl |
UISlider |
UIStackView |
UIStepper |
UITabBar |
UITableView |
UITextField |
UITextView |
UIToolbar |
UIView |
UIVisualEffectView |
If you input variable name that doesn't correspond to the support view list, type name is input as _InputTypeName_ automatically.
Contact
If you discover problem or have opinions, please let me know through Github issues💁♂️
Author
funzin
- mail: [email protected]
License
ViewGenerator is available under the MIT license. See the LICENSE file for more info.

