⚒ ViewGenerator generates view code from variable name automatically in iOS development
ViewGenerator generates view code from variable name automatically when you create view by code in iOS development
Install ViewGenerator from AppStore
Enable ViewGenerator
System Preferences
→ Extensions
Xcode Source Editor
checkboxUI
as suffix. (e.g. hogeView
, hogeLabel
, etc.) Editor
→ViewGenerator
→Generate View Code
I strongly recommend that you register Generate View Code
Command to shortcut
Xcode Preferences
→ KeyBindings
ViewGenerator
in SearchGIF | |
---|---|
select |
GIF | |
---|---|
not_select | |
select |
Default access modifier is private . if you change access modifier, open viewgenerator app and then select access modifier that you want to select
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
}()
private let hogeTableView: UITableView = {
let hogeTableView = UITableView(frame: .zero)
hogeTableView.translatesAutoresizingMaskIntoConstraints = false
return hogeTableView
}()
private let hogehoge: _InputTypeName_ = {
let hogehoge = _InputTypeName_(frame: .zero)
hogehoge.translatesAutoresizingMaskIntoConstraints = false
return hogehoge
}()
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.
If you discover problem or have opinions, please let me know through Github issues💁♂️
funzin
ViewGenerator is available under the MIT license. See the LICENSE file for more info.