Private over Fileprivate
Prefer private
over fileprivate
declarations
- Identifier:
private_over_fileprivate
- Enabled by default: Yes
- Supports autocorrection: Yes
- Kind: idiomatic
- Analyzer rule: No
- Minimum Swift compiler version: 5.0.0
- Default configuration:
Key Value severity warning validate_extensions false
Non Triggering Examples
extension String {}
private extension String {}
public protocol P {}
open extension
String {}
internal extension String {}
package typealias P = Int
extension String {
fileprivate func Something(){}
}
class MyClass {
fileprivate let myInt = 4
}
actor MyActor {
fileprivate let myInt = 4
}
class MyClass {
fileprivate(set) var myInt = 4
}
struct Outer {
struct Inter {
fileprivate struct Inner {}
}
}
Triggering Examples
↓fileprivate enum MyEnum {}
↓fileprivate class MyClass {
fileprivate(set) var myInt = 4
}
↓fileprivate actor MyActor {
fileprivate let myInt = 4
}
↓fileprivate func f() {}
↓fileprivate var x = 0