Skip to content

Files

Latest commit

 

History

History
75 lines (52 loc) · 1023 Bytes

modifier_order.md

File metadata and controls

75 lines (52 loc) · 1023 Bytes

Pattern: Inconsistent modifier order

Issue: -

Description

Modifier order should be consistent.

Examples of correct code:

public class Foo { 
   public convenience required init() {} 
}


public class Foo { 
   public static let bar = 42 
}


public class Foo { 
   public static var bar: Int { 
       return 42   }}


public class Foo { 
   public class var bar: Int { 
       return 42 
   } 
}


public class Bar { 
   public class var foo: String { 
       return "foo" 
   } 
}

Examples of incorrect code:

class Foo { 
   convenience required public init() {} 
}


public class Foo { 
   static public let bar = 42 
}


public class Foo { 
   static public var bar: Int { 
       return 42 
   } 
} 


public class Foo { 
   class public var bar: Int { 
       return 42 
   } 
}


public class RootFoo { 
   class public var foo: String { 
       return "foo" 
   } 
}

Further Reading