1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

XcodeプラグインのXAlignを使う

Last updated at Posted at 2016-06-04

Xcodeに「XAlign」というプラグインを入れてみましたよ

GitHubはこちら => XAlign

導入

CURLがあるなら、インストールはターミナルでこれを叩いて

curl -fsSL http://qfi.sh/XAlign/build/install.sh | sh

Xcodeを再起動するだけ

効果

let label = UILabel()
label.text = "hoge"
label.textColor = UIColor.darkTextColor()
label.font = UIFont.systemFontOfSize(12.0)
label.textAlignment = .Right

プロパティ設定してるところをマウスで選択してcommand + shift + xすると

let label = UILabel()
label.text          = "hoge"
label.textColor     = UIColor.darkTextColor()
label.font          = UIFont.systemFontOfSize(12.0)
label.textAlignment = .Right

イコールで綺麗に揃いました
見やすさアップ!

ちなみにショートカットで揃えてくれるのはイコールのときのようなので
下記のような場合

@IBOutlet private weak var headerView: UIView!
@IBOutlet private weak var headerLabel: UILabel!
@IBOutlet private weak var footerView: UIView!
@IBOutlet private weak var selectButton: UIButton!
@IBOutlet private weak var deleteButton: UIButton!
@IBOutlet private weak var collectionView: UICollectionView!

Xcodeの Edit > XAlign > Variables Group を選ぶことで

@IBOutlet private weak var headerView:     UIView!
@IBOutlet private weak var headerLabel:    UILabel!
@IBOutlet private weak var footerView:     UIView!
@IBOutlet private weak var selectButton:   UIButton!
@IBOutlet private weak var deleteButton:   UIButton!
@IBOutlet private weak var collectionView: UICollectionView!

という感じに揃います

まとめ

綺麗なソースコード。大事!

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?