54 lines
1.3 KiB
Swift
54 lines
1.3 KiB
Swift
//
|
|
// GroupIconListVC.swift
|
|
// QuickLocation
|
|
//
|
|
// Created by 八条 on 2026/6/2.
|
|
//
|
|
|
|
import UIKit
|
|
import RxSwift
|
|
import RxCocoa
|
|
|
|
class GroupIconListVC: BaseViewController {
|
|
|
|
fileprivate var rootView: GroupIconListView!
|
|
|
|
override func loadView() {
|
|
rootView = GroupIconListView(frame: UIScreen.main.bounds)
|
|
view = rootView
|
|
}
|
|
|
|
private var iconIndex: String
|
|
var onSelectIcon: ((Int) -> Void)?
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
rootView.selectedIndex = iconIndex.integer
|
|
rootView.iconCollectionView.delegate = self
|
|
|
|
rootView.doneBtn.rx.tap.subscribe(onNext: { _ in
|
|
if let onSelectIcon = self.onSelectIcon {
|
|
onSelectIcon(self.rootView.selectedIndex)
|
|
AppRouter.shared.popOrDismiss()
|
|
}
|
|
}).disposed(by: disposeBag)
|
|
}
|
|
|
|
// MARK: - Init
|
|
init(iconIndex: String) {
|
|
self.iconIndex = iconIndex
|
|
super.init(nibName: nil, bundle: nil)
|
|
}
|
|
|
|
required init?(coder: NSCoder) {
|
|
fatalError("init(coder:) has not been implemented")
|
|
}
|
|
}
|
|
|
|
extension GroupIconListVC: UICollectionViewDelegate {
|
|
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
|
rootView.selectedIndex = indexPath.row + 1
|
|
onSelectIcon?(rootView.selectedIndex)
|
|
}
|
|
}
|