You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please describe the rule idea, format
this issue's title as Rule Request: [Rule Name] and describe:
Why should this rule be added? Share links to existing discussion about what
the community thinks about this.
This would prevent developers from using legacy NS types where swift versions of those types already exist. Apple outlines guidance on which types get bridged here:
Should the rule be configurable, if so what parameters should be configurable?
Unsure
Should the rule be opt-in or enabled by default? Why?
See README.md for guidelines on when to mark a rule as opt-in.
I think this rule should be opt-in. There is a lot of potential for flagging types that should be completely valid in normal Swift code, and in codebases where very particular Swift-ObjC is required.
The text was updated successfully, but these errors were encountered:
Here is a regex based rule that I implemented to identify these issues. I hope it helps!
custom_rules:
legacy_objc_type:
included: ".*.swift"name: "Legacy Obj-C Type"regex: "NSAffineTransform|NSArray|NSCalendar|NSCharacterSet|NSData|NSDateComponents|NSDateInterval|NSDate|NSDecimalNumber|NSDictionary|NSIndexPath|NSIndexSet|NSLocale|NSMeasurement|NSNotification|NSNumber|NSPersonNameComponents|NSSet|NSString|NSTimeZone|NSURL|NSURLComponents|NSURLQueryItem|NSURLRequest|NSUUID"message: "Avoid using Obj-C types when Swift types will suffice."severity: warningmatch_kinds:
- typeidentifier
New Issue Checklist
New rule request
Please describe the rule idea, format
this issue's title as
Rule Request: [Rule Name]
and describe:the community thinks about this.
This would prevent developers from using legacy NS types where swift versions of those types already exist. Apple outlines guidance on which types get bridged here:
https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/working_with_foundation_types
Bad
All of the below types have a Swift analogue and should not be used in Swift code
Ok
These types do not have a Swift analogue, so they should be allowed.
Unsure
See README.md for guidelines on when to mark a rule as opt-in.
I think this rule should be opt-in. There is a lot of potential for flagging types that should be completely valid in normal Swift code, and in codebases where very particular Swift-ObjC is required.
The text was updated successfully, but these errors were encountered: