我正在使用以下方法来获取关注者列表。
Client.shared.flatFeed(feedSlug: "user")?.followers(completion: { (result) in
if let followers = try? result.get() {
let list = followers.results
for follower in list {
}
} else if let error = result.error {
print("get error in fetching followers: \(error.localizedDescription)")
}
})
此方法的问题是它返回[Follower]。 以下是关注者模型
public struct Follower: Decodable {
private enum CodingKeys: String, CodingKey {
case feedId = "feed_id"
case targetFeedId = "target_id"
case created = "created_at"
case updated = "updated_at"
}
/// A feed id.
public let feedId: FeedId
/// A target feed id.
public let targetFeedId: FeedId
/// A created date.
public let created: Date
/// An updated date.
public let updated: Date?
}
但是我需要[用户]以便可以在屏幕上显示列表。 使用这种方法,我必须为所有feedID击getUser方法。 getStream还有其他更好的解决方案吗?