Skip to content

Files

Latest commit

 

History

History
59 lines (26 loc) · 959 Bytes

lower_acl_than_parent.md

File metadata and controls

59 lines (26 loc) · 959 Bytes

Pattern: Malformed ACL for parent-definition

Issue: -

Description

Ensure definitions have a lower Access Control Level than their enclosing parent

Examples of correct code:

public struct Foo { public func bar() {} }


internal struct Foo { func bar() {} }


struct Foo { func bar() {} }


open class Foo { public func bar() {} }


open class Foo { open func bar() {} }


fileprivate struct Foo { private func bar() {} }


private struct Foo { private func bar(id: String) }


extension Foo { public func bar() {} }


private struct Foo { fileprivate func bar() {} }


private func foo(id: String) {}

Examples of incorrect code:

struct Foo { public func bar() {} }


enum Foo { public func bar() {} }


public class Foo { open func bar() }


class Foo { public private(set) var bar: String? }

Further Reading