Skip to content

Files

Latest commit

 

History

History
64 lines (37 loc) · 786 Bytes

private_over_fileprivate.md

File metadata and controls

64 lines (37 loc) · 786 Bytes

Pattern: Use of fileprivate declaration

Issue: -

Description

Prefer private over fileprivate declarations.

Examples of correct code:

extension String {}


private extension String {}


public 
 enum MyEnum {}


open extension 
 String {}


internal extension String {}


extension String {
fileprivate func Something(){}
}


class MyClass {
fileprivate let myInt = 4
}


class MyClass {
fileprivate(set) var myInt = 4
}


struct Outter {
struct Inter {
fileprivate struct Inner {}
}
}

Examples of incorrect code:

fileprivate enum MyEnum {}


fileprivate class MyClass {
fileprivate(set) var myInt = 4
}

Further Reading