mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-24 09:48:21 +00:00
45 lines
1.2 KiB
Swift
45 lines
1.2 KiB
Swift
|
|
/*
|
||
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
|
|
*
|
||
|
|
* This source code is licensed under the MIT license found in the
|
||
|
|
* LICENSE file in the root directory of this source tree.
|
||
|
|
*/
|
||
|
|
|
||
|
|
import UIKit
|
||
|
|
|
||
|
|
final class LoadingCell: UICollectionViewCell {
|
||
|
|
|
||
|
|
private let activityIndicator: UIActivityIndicatorView = {
|
||
|
|
let indicator = UIActivityIndicatorView(style: .medium)
|
||
|
|
indicator.translatesAutoresizingMaskIntoConstraints = false
|
||
|
|
indicator.color = .darkGray
|
||
|
|
indicator.hidesWhenStopped = false
|
||
|
|
return indicator
|
||
|
|
}()
|
||
|
|
|
||
|
|
override init(frame: CGRect) {
|
||
|
|
super.init(frame: frame)
|
||
|
|
setupViews()
|
||
|
|
}
|
||
|
|
|
||
|
|
required init?(coder: NSCoder) {
|
||
|
|
fatalError("init(coder:) has not been implemented")
|
||
|
|
}
|
||
|
|
|
||
|
|
private func setupViews() {
|
||
|
|
contentView.addSubview(activityIndicator)
|
||
|
|
|
||
|
|
NSLayoutConstraint.activate([
|
||
|
|
activityIndicator.centerXAnchor.constraint(equalTo: contentView.centerXAnchor),
|
||
|
|
activityIndicator.centerYAnchor.constraint(equalTo: contentView.centerYAnchor)
|
||
|
|
])
|
||
|
|
|
||
|
|
activityIndicator.startAnimating()
|
||
|
|
}
|
||
|
|
|
||
|
|
override func prepareForReuse() {
|
||
|
|
super.prepareForReuse()
|
||
|
|
activityIndicator.startAnimating()
|
||
|
|
}
|
||
|
|
}
|