I have a swift class defined like this:
@objcMembers
public class MyURL: NSObject {
func concat(_ components: String...) -> MyURL {
concat(components)
}
/// Concat the specified components one by one.
func concat(_ components: [String]) -> MyURL {
components.forEach { let _ = value?.appendingPathComponent($0) }
return self
}
// All the other methods which are available for objc.
}
There are many methods inside which are available for objective-c, so I use the @objcMembers
for class prefix directly, then swift compiler starts to complaint this:
Method 'concat' with Objective-C selector 'concat:' conflicts with previous declaration with the same Objective-C selector
They are exactly have the same function signature, but the latter one is only available for swift even if exposed. Now I'm looking for some compile flags to mark the latter concat
method as swift only to tell the compiler to ignore the conflict error.
@objc
and @objcMembers
do that explicitly, so how to do it reverse?