I am trying to swizzle NSAttributedString but getting a compile error:
extension NSAttribtuedString {
@objc convenience init(swizzledString: String, attributes: [NSAttributedString.Key : Any?] {
.....
}
}
Error
Method cannot be marked @objc because type of parameter 2 cannot be represented in Objective C
The error makes sense. Any way we can solve this to keep the function signature and swizzle the init function?
You get the error, because swift's dictionary type does not exist in objective-c. You would have to use NSDictionary: