2021-04-01 14:54:57 +02:00
|
|
|
//
|
|
|
|
// RecommendAccountSection.swift
|
|
|
|
// Mastodon
|
|
|
|
//
|
|
|
|
// Created by sxiaojian on 2021/4/1.
|
|
|
|
//
|
|
|
|
|
2021-04-09 13:39:35 +02:00
|
|
|
import CoreData
|
|
|
|
import CoreDataStack
|
2021-04-01 14:54:57 +02:00
|
|
|
import Foundation
|
|
|
|
import MastodonSDK
|
|
|
|
import UIKit
|
|
|
|
|
|
|
|
enum RecommendAccountSection: Equatable, Hashable {
|
|
|
|
case main
|
|
|
|
}
|
|
|
|
|
|
|
|
extension RecommendAccountSection {
|
|
|
|
static func collectionViewDiffableDataSource(
|
2021-04-09 07:09:30 +02:00
|
|
|
for collectionView: UICollectionView,
|
2021-04-09 13:39:35 +02:00
|
|
|
delegate: SearchRecommendAccountsCollectionViewCellDelegate,
|
|
|
|
managedObjectContext: NSManagedObjectContext
|
2021-04-09 07:09:30 +02:00
|
|
|
) -> UICollectionViewDiffableDataSource<RecommendAccountSection, NSManagedObjectID> {
|
2021-04-09 13:39:35 +02:00
|
|
|
UICollectionViewDiffableDataSource(collectionView: collectionView) { [weak delegate] collectionView, indexPath, objectID -> UICollectionViewCell? in
|
2021-04-01 14:54:57 +02:00
|
|
|
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: String(describing: SearchRecommendAccountsCollectionViewCell.self), for: indexPath) as! SearchRecommendAccountsCollectionViewCell
|
2021-04-09 13:39:35 +02:00
|
|
|
let user = managedObjectContext.object(with: objectID) as! MastodonUser
|
|
|
|
cell.delegate = delegate
|
2021-04-09 07:59:33 +02:00
|
|
|
cell.config(with: user)
|
2021-04-01 14:54:57 +02:00
|
|
|
return cell
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|