Closed mycroftcanner closed 4 years ago
This will select the profile picture url that has the highest quality:
public var avatar: URL? {
return rawResponse.hdProfilePicVersions
.array?.sorted(
by: {
guard case .number(let lhs) = $0["width"], case .number(let rhs) = $1["width"] else { return false }
return lhs.intValue > rhs.intValue
}
).first?["url"].url
It does, you're right 💪
I was under the impression avatars were sorted like generic Media
by size, but apparently they're not.
Definitely fixing it in #96.
avatar arbitrarily picks the first available entry in hdProfilePicVersions
The main issue is that it can be the lowest available quality :