LoginSignup
8
4

More than 5 years have passed since last update.

SwiftLintの直し方がよくわからなかったルールまとめるとこ

Last updated at Posted at 2016-12-27

Xcode 8.2, Swift 3.0

Legacy Constructor Violation: Swift constructors are preferred over legacy convenience functions. (legacy_constructor)

// ×
flowLayout.sectionInset = UIEdgeInsetsMake(0, 8, 8, 8)

// ◯
flowLayout.sectionInset = UIEdgeInsets(top: 0.0, left: 8.0, bottom: 8.0, right: 8.0)

別のインスタンス化方法があるのにレガシーな方法を使っている

Implicit Getter Violation: Computed read-only properties should avoid using the get keyword. (implicit_getter)

// ×
var hoge: String {
    get {
        return "fuga"
    }
}

// ◯
var hoge: String {
    return "fuga"
}

参考 http://stackoverflow.com/questions/40327125/in-swift-3-uiedgeinsetsmake-is-available

8
4
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
8
4