LeonardoCardoso / SwiftLinkPreview

It makes a preview from an URL, grabbing all the information such as title, relevant texts and images.
https://leocardz.com/swift-link-preview-5a9860c7756f
MIT License
1.37k stars 196 forks source link

Fixes the NSRange to use a String defined range instead of inferring length from the count property #125

Closed adamwulf closed 3 years ago

adamwulf commented 3 years ago

Fixed

String.count shouldn't be used to create NSRange. See the comment on https://stackoverflow.com/questions/27880650/swift-extract-regex-matches#comment110787889_54900097

Be careful with above solution: NSMakeRange(0, self.count) is not correct, because self is a String (=UTF8) and not an NSString (=UTF16). So the self.count is not necessarily the same as nsString.length (as used in other solutions). You can replace the range calculation with NSRange(self.startIndex..., in: self) – pd95 Jun 29 at 22:27

Thanks for the great repo!

ghost commented 3 years ago
1 Error
:no_entry_sign: Please include a CHANGELOG entry.
You can find it at CHANGELOG.md.

Generated by :no_entry_sign: Danger

LeonardoCardoso commented 3 years ago

Thanks, @adamwulf.