Commit ad207555 authored by Steven杜宇's avatar Steven杜宇

// lint

parent 97a6e55e
...@@ -84,7 +84,9 @@ extension YHAppleLoginManager: ASAuthorizationControllerDelegate, ASAuthorizatio ...@@ -84,7 +84,9 @@ extension YHAppleLoginManager: ASAuthorizationControllerDelegate, ASAuthorizatio
printLog("Apple login FAILED: \(error.localizedDescription)") printLog("Apple login FAILED: \(error.localizedDescription)")
isAppleLoginBtnEnabled = true isAppleLoginBtnEnabled = true
if error is ASAuthorizationError { if error is ASAuthorizationError {
let err = error as! ASAuthorizationError guard let err = error as? ASAuthorizationError else {
return
}
// 在这里处理 AuthenticationError // 在这里处理 AuthenticationError
handleAuthenticationError(err) handleAuthenticationError(err)
} }
......
...@@ -103,7 +103,7 @@ extension YHHomeInformationViewController: UICollectionViewDelegate, UICollectio ...@@ -103,7 +103,7 @@ extension YHHomeInformationViewController: UICollectionViewDelegate, UICollectio
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHHomeCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHHomeCollectionViewCell guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHHomeCollectionViewCell.cellReuseIdentifier, for: indexPath) as? YHHomeCollectionViewCell else { return UICollectionViewCell() }
cell.listModel = self.viewModel.arrHomeNewsData?[indexPath.row] cell.listModel = self.viewModel.arrHomeNewsData?[indexPath.row]
return cell return cell
} }
......
...@@ -502,7 +502,7 @@ extension YHHomePageViewController: UICollectionViewDelegate, UICollectionViewDa ...@@ -502,7 +502,7 @@ extension YHHomePageViewController: UICollectionViewDelegate, UICollectionViewDa
} }
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHHomeCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHHomeCollectionViewCell guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHHomeCollectionViewCell.cellReuseIdentifier, for: indexPath) as? YHHomeCollectionViewCell else { return UICollectionViewCell() }
cell.listModel = self.viewModel.arrHomeNewsData?[indexPath.row] cell.listModel = self.viewModel.arrHomeNewsData?[indexPath.row]
return cell return cell
} }
......
...@@ -150,9 +150,9 @@ class YHHomeWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationD ...@@ -150,9 +150,9 @@ class YHHomeWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationD
if !url.contains("yhid=") { if !url.contains("yhid=") {
let id = YHLoginManager.shared.userModel?.id ?? "" let id = YHLoginManager.shared.userModel?.id ?? ""
if url.contains("?") { if url.contains("?") {
url = url + "&yhid=\(id)" url += "&yhid=\(id)"
} else { } else {
url = url + "?yhid=\(id)" url += "?yhid=\(id)"
} }
} }
......
...@@ -98,7 +98,7 @@ extension YHOtherServiceListViewController: UICollectionViewDelegate, UICollecti ...@@ -98,7 +98,7 @@ extension YHOtherServiceListViewController: UICollectionViewDelegate, UICollecti
} }
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHHomeCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHHomeCollectionViewCell guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHHomeCollectionViewCell.cellReuseIdentifier, for: indexPath) as? YHHomeCollectionViewCell else { return UICollectionViewCell() }
cell.listModel = items[indexPath.row] cell.listModel = items[indexPath.row]
return cell return cell
......
...@@ -359,7 +359,7 @@ extension YHSearchInfomationVC: UITableViewDelegate, UITableViewDataSource { ...@@ -359,7 +359,7 @@ extension YHSearchInfomationVC: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHSearchInfoCell.cellReuseIdentifier, for: indexPath) as! YHSearchInfoCell gurad let cell = tableView.dequeueReusableCell(withIdentifier: YHSearchInfoCell.cellReuseIdentifier, for: indexPath) as? YHSearchInfoCell else { return UITableViewCell() }
if 0 <= indexPath.section && indexPath.section < items.count { if 0 <= indexPath.section && indexPath.section < items.count {
let item = items[indexPath.section] let item = items[indexPath.section]
......
...@@ -61,7 +61,7 @@ private extension YHStartPageViewController { ...@@ -61,7 +61,7 @@ private extension YHStartPageViewController {
} }
@objc func downTimerOp() { @objc func downTimerOp() {
MaxTime = MaxTime - 1 MaxTime -= 1
if MaxTime < 0 { if MaxTime < 0 {
cancelTimer() cancelTimer()
clickCancelBtn() clickCancelBtn()
......
...@@ -153,7 +153,7 @@ extension YHInvatationShareViewController { ...@@ -153,7 +153,7 @@ extension YHInvatationShareViewController {
@objc func saveBtnClick() { @objc func saveBtnClick() {
let currentPage = self.currentPage(collectionView: myCollectView) let currentPage = self.currentPage(collectionView: myCollectView)
if currentPage == 0 { if currentPage == 0 {
let cell = myCollectView.cellForItem(at: IndexPath(row: currentPage, section: 0)) as! YHShareOneCollectionViewCell guard let cell = myCollectView.cellForItem(at: IndexPath(row: currentPage, section: 0)) as? YHShareOneCollectionViewCell else { return }
guard let combinedImage = combinedImageFrom(imageView: cell.centerImageView) else { return } guard let combinedImage = combinedImageFrom(imageView: cell.centerImageView) else { return }
saveImageToPhotosAlbum(image: combinedImage) saveImageToPhotosAlbum(image: combinedImage)
} else { } else {
......
...@@ -35,7 +35,7 @@ class YHInvitationWithGiftsHeadView: UIView { ...@@ -35,7 +35,7 @@ class YHInvitationWithGiftsHeadView: UIView {
subMarqueeLabel.text = "\(nextModel.mobile) 已提现 \(nextModel.amount) 元" subMarqueeLabel.text = "\(nextModel.mobile) 已提现 \(nextModel.amount) 元"
timer = Timer.scheduledTimer(withTimeInterval: 2.0, repeats: true) { [weak self] _ in timer = Timer.scheduledTimer(withTimeInterval: 2.0, repeats: true) { [weak self] _ in
index = index + 1 index += 1
UIView.animate(withDuration: 0.5) { UIView.animate(withDuration: 0.5) {
self?.marqueeLabel.frame.origin.y = -30 self?.marqueeLabel.frame.origin.y = -30
self?.subMarqueeLabel.frame.origin.y = 0 self?.subMarqueeLabel.frame.origin.y = 0
......
...@@ -100,7 +100,6 @@ class YHInvitationWithGiftsSecondTableViewCell: UITableViewCell { ...@@ -100,7 +100,6 @@ class YHInvitationWithGiftsSecondTableViewCell: UITableViewCell {
make.right.equalTo(-12) make.right.equalTo(-12)
make.bottom.equalTo(-8) make.bottom.equalTo(-8)
} }
titleLeftImageView = { titleLeftImageView = {
let view = UIImageView() let view = UIImageView()
view.image = UIImage(named: "invitation_with_gifts_second_left") view.image = UIImage(named: "invitation_with_gifts_second_left")
...@@ -113,7 +112,6 @@ class YHInvitationWithGiftsSecondTableViewCell: UITableViewCell { ...@@ -113,7 +112,6 @@ class YHInvitationWithGiftsSecondTableViewCell: UITableViewCell {
make.width.equalTo(110) make.width.equalTo(110)
make.height.equalTo(20) make.height.equalTo(20)
} }
titleRightImageView = { titleRightImageView = {
let view = UIImageView() let view = UIImageView()
view.image = UIImage(named: "invitation_with_gifts_second_right") view.image = UIImage(named: "invitation_with_gifts_second_right")
......
...@@ -414,7 +414,7 @@ class YHInvitationWithGiftsSelectItemCell: UITableViewCell { ...@@ -414,7 +414,7 @@ class YHInvitationWithGiftsSelectItemCell: UITableViewCell {
make.top.equalTo(16) make.top.equalTo(16)
} }
x = x + Int(width) + 12 x = x + Int(width) + 12
index = index + 1 index += 1
} }
} }
......
...@@ -26,7 +26,9 @@ class YHInvitationWithGiftsViewModel: YHBaseViewModel { ...@@ -26,7 +26,9 @@ class YHInvitationWithGiftsViewModel: YHBaseViewModel {
callBackBlock(false, nil) callBackBlock(false, nil)
return return
} }
self.model = (result as! [YHShareCashOutModel]) if let result = result as? [YHShareCashOutModel] {
self.model = result
}
callBackBlock(true, nil) callBackBlock(true, nil)
} else { } else {
let error: YHErrorModel = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg) let error: YHErrorModel = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
......
...@@ -353,7 +353,9 @@ extension YHLifeDetailViewController: UIScrollViewDelegate { ...@@ -353,7 +353,9 @@ extension YHLifeDetailViewController: UIScrollViewDelegate {
extension YHLifeDetailViewController: UITableViewDataSource, UITableViewDelegate { extension YHLifeDetailViewController: UITableViewDataSource, UITableViewDelegate {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHHomeIdentityCell.cellReuseIdentifier, for: indexPath) as! YHHomeIdentityCell guard let cell = tableView.dequeueReusableCell(withIdentifier: YHHomeIdentityCell.cellReuseIdentifier, for: indexPath) as? YHHomeIdentityCell else {
return UITableViewCell()
}
if 0 <= indexPath.row, indexPath.row < self.imgItems.count { if 0 <= indexPath.row, indexPath.row < self.imgItems.count {
let item = self.imgItems[indexPath.row] let item = self.imgItems[indexPath.row]
cell.image = item.img cell.image = item.img
......
...@@ -267,10 +267,14 @@ extension YHLifeViewController: UICollectionViewDelegate, UICollectionViewDataSo ...@@ -267,10 +267,14 @@ extension YHLifeViewController: UICollectionViewDelegate, UICollectionViewDataSo
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
if self.viewModel.liveArr.count == 0 { if self.viewModel.liveArr.count == 0 {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHLookNodataCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHLookNodataCollectionViewCell guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHLookNodataCollectionViewCell.cellReuseIdentifier, for: indexPath) as? YHLookNodataCollectionViewCell else {
return UICollectionViewCell()
}
return cell return cell
} }
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHLookCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHLookCollectionViewCell guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHLookCollectionViewCell.cellReuseIdentifier, for: indexPath) as? YHLookCollectionViewCell else {
return UICollectionViewCell()
}
cell.dataSource = self.viewModel.liveArr[indexPath.row] cell.dataSource = self.viewModel.liveArr[indexPath.row]
return cell return cell
......
...@@ -81,7 +81,9 @@ extension YHLifeSectionView: UICollectionViewDelegate, UICollectionViewDataSourc ...@@ -81,7 +81,9 @@ extension YHLifeSectionView: UICollectionViewDelegate, UICollectionViewDataSourc
} }
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHLifeSectionCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHLifeSectionCollectionViewCell guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHLifeSectionCollectionViewCell.cellReuseIdentifier, for: indexPath) as? YHLifeSectionCollectionViewCell else {
return UICollectionViewCell()
}
cell.dataSource = items[indexPath.row] cell.dataSource = items[indexPath.row]
if indexPath.row == selectIndex { if indexPath.row == selectIndex {
......
...@@ -135,7 +135,9 @@ extension YHHomeBannerView: FSPagerViewDataSource, FSPagerViewDelegate { ...@@ -135,7 +135,9 @@ extension YHHomeBannerView: FSPagerViewDataSource, FSPagerViewDelegate {
} }
public func pagerView(_ pagerView: FSPagerView, cellForItemAt index: Int) -> FSPagerViewCell { public func pagerView(_ pagerView: FSPagerView, cellForItemAt index: Int) -> FSPagerViewCell {
let cell = pagerView.dequeueReusableCell(withReuseIdentifier: "cell", at: index) as! YHHomeBannerCollectionViewCell guard let cell = pagerView.dequeueReusableCell(withReuseIdentifier: "cell", at: index) as? YHHomeBannerCollectionViewCell else {
return FSPagerViewCell()
}
if index < dataArr.count { if index < dataArr.count {
cell.dataModel = dataArr[index] cell.dataModel = dataArr[index]
} }
......
...@@ -246,7 +246,7 @@ extension YHHomeCollectionViewCell { ...@@ -246,7 +246,7 @@ extension YHHomeCollectionViewCell {
if success { if success {
listModel.is_like = true listModel.is_like = true
listModel.like_count = listModel.like_count + 1 listModel.like_count += 1
self.numLable.text = listModel.like_count.string self.numLable.text = listModel.like_count.string
self.heartImageViewBtn.setImage(UIImage(named: ""), for: .selected) self.heartImageViewBtn.setImage(UIImage(named: ""), for: .selected)
......
...@@ -21,7 +21,7 @@ class YHHomeInfoSectionHeadView: UICollectionReusableView { ...@@ -21,7 +21,7 @@ class YHHomeInfoSectionHeadView: UICollectionReusableView {
self.collectView.reloadData() self.collectView.reloadData()
var row = items.count/3 var row = items.count/3
if items.count%3 != 0 { if items.count%3 != 0 {
row = row + 1 row += 1
} }
let totalHeight = Double(row) * kHomeItemHeight let totalHeight = Double(row) * kHomeItemHeight
self.collectView.snp.updateConstraints { make in self.collectView.snp.updateConstraints { make in
......
...@@ -19,8 +19,9 @@ class YHIdentityTabBar: UIView { ...@@ -19,8 +19,9 @@ class YHIdentityTabBar: UIView {
didSet { didSet {
for (index, item) in self.subviews.enumerated() { for (index, item) in self.subviews.enumerated() {
if item.isKind(of: UIButton.self) { if item.isKind(of: UIButton.self) {
let itemBtn = item as! UIButton if let itemBtn = item as? UIButton {
self.setButton(itemBtn, isSelected: index == self.selectIndex) self.setButton(itemBtn, isSelected: index == self.selectIndex)
}
} }
} }
if 0 <= self.selectIndex, self.selectIndex < self.items.count { if 0 <= self.selectIndex, self.selectIndex < self.items.count {
......
...@@ -127,7 +127,7 @@ extension YHSearchInfoHistoryView: UICollectionViewDelegate, UICollectionViewDat ...@@ -127,7 +127,7 @@ extension YHSearchInfoHistoryView: UICollectionViewDelegate, UICollectionViewDat
// 返回自定义单元格 // 返回自定义单元格
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHSearchInfoHistoryCell.cellReuseIdentifier, for: indexPath) as! YHSearchInfoHistoryCell guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHSearchInfoHistoryCell.cellReuseIdentifier, for: indexPath) as? YHSearchInfoHistoryCell else { return UICollectionViewCell() }
if 0 <= indexPath.item && indexPath.item < historyItems.count { if 0 <= indexPath.item && indexPath.item < historyItems.count {
cell.titleLabel.text = historyItems[indexPath.item] cell.titleLabel.text = historyItems[indexPath.item]
} }
......
...@@ -153,7 +153,7 @@ extension YHHomePageViewModel { ...@@ -153,7 +153,7 @@ extension YHHomePageViewModel {
self.arrHomeNewsData = result.data self.arrHomeNewsData = result.data
curPageIndex = 1 curPageIndex = 1
} else { } else {
curPageIndex = curPageIndex + 1 curPageIndex += 1
self.arrHomeNewsData?.append(contentsOf: result.data) self.arrHomeNewsData?.append(contentsOf: result.data)
} }
......
...@@ -314,7 +314,7 @@ class YHSelectLookTableViewCell: UITableViewCell { ...@@ -314,7 +314,7 @@ class YHSelectLookTableViewCell: UITableViewCell {
make.left.equalTo(view?.snp.right ?? 0).offset(4) make.left.equalTo(view?.snp.right ?? 0).offset(4)
} }
} }
i = i + 1 i += 1
} }
guard let url = URL(string: dataSource.image) else { return } guard let url = URL(string: dataSource.image) else { return }
self.centerImageView.kf.setImage(with: url) self.centerImageView.kf.setImage(with: url)
......
...@@ -195,7 +195,7 @@ extension YHSelectLookHeadView: UICollectionViewDelegate, UICollectionViewDataSo ...@@ -195,7 +195,7 @@ extension YHSelectLookHeadView: UICollectionViewDelegate, UICollectionViewDataSo
} }
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHSelectLookHeadViewCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHSelectLookHeadViewCollectionViewCell guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHSelectLookHeadViewCollectionViewCell.cellReuseIdentifier, for: indexPath) as? YHSelectLookHeadViewCollectionViewCell else { return UICollectionViewCell() }
cell.dataSource = items[indexPath.row] cell.dataSource = items[indexPath.row]
if indexPath.row == selectIndex { if indexPath.row == selectIndex {
......
...@@ -90,7 +90,7 @@ extension YHSelectLookView: UICollectionViewDelegate, UICollectionViewDataSource ...@@ -90,7 +90,7 @@ extension YHSelectLookView: UICollectionViewDelegate, UICollectionViewDataSource
} }
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHSelectLookViewCell.cellReuseIdentifier, for: indexPath) as! YHSelectLookViewCell guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHSelectLookViewCell.cellReuseIdentifier, for: indexPath) as? YHSelectLookViewCell else { return UICollectionViewCell() }
if indexPath.row < 5 { if indexPath.row < 5 {
cell.dataSource = items[indexPath.row] cell.dataSource = items[indexPath.row]
} else { } else {
......
...@@ -37,9 +37,9 @@ class YHInformationPerfectListVC: YHBaseViewController { ...@@ -37,9 +37,9 @@ class YHInformationPerfectListVC: YHBaseViewController {
} else { } else {
name = applicant.applicantName name = applicant.applicantName
if applicant.sex == 1 { if applicant.sex == 1 {
name = name + "先生" name += "先生"
} else if applicant.sex == 2 { } else if applicant.sex == 2 {
name = name + "女士" name += "女士"
} else { } else {
} }
......
...@@ -28,7 +28,9 @@ class YHOrderDetailViewController: YHBaseViewController { ...@@ -28,7 +28,9 @@ class YHOrderDetailViewController: YHBaseViewController {
getWhiteList() getWhiteList()
getData() getData()
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
let appDelegate = UIApplication.shared.delegate as! AppDelegate guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else {
return
}
appDelegate.window?.rootViewController?.setNeedsStatusBarAppearanceUpdate() appDelegate.window?.rootViewController?.setNeedsStatusBarAppearanceUpdate()
let orientation = UIInterfaceOrientation.landscapeLeft let orientation = UIInterfaceOrientation.landscapeLeft
......
...@@ -97,7 +97,7 @@ extension YHServiceBannerView: FSPagerViewDataSource, FSPagerViewDelegate { ...@@ -97,7 +97,7 @@ extension YHServiceBannerView: FSPagerViewDataSource, FSPagerViewDelegate {
} }
public func pagerView(_ pagerView: FSPagerView, cellForItemAt index: Int) -> FSPagerViewCell { public func pagerView(_ pagerView: FSPagerView, cellForItemAt index: Int) -> FSPagerViewCell {
let cell = pagerView.dequeueReusableCell(withReuseIdentifier: "cell", at: index) as! YHServiceBannerCollectionViewCell guard let cell = pagerView.dequeueReusableCell(withReuseIdentifier: "cell", at: index) as? YHServiceBannerCollectionViewCell else { return FSPagerViewCell() }
if index < dataArr.count { if index < dataArr.count {
cell.dataModel = dataArr[index] cell.dataModel = dataArr[index]
} }
......
...@@ -135,7 +135,9 @@ extension YHServiceCenterStepThreeTableHeadView: UICollectionViewDelegate, UICol ...@@ -135,7 +135,9 @@ extension YHServiceCenterStepThreeTableHeadView: UICollectionViewDelegate, UICol
} }
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHServiceSectionStepThreeCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHServiceSectionStepThreeCollectionViewCell guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHServiceSectionStepThreeCollectionViewCell.cellReuseIdentifier, for: indexPath) as? YHServiceSectionStepThreeCollectionViewCell else {
return UICollectionViewCell()
}
cell.dataSource = indexPath.row + 1 cell.dataSource = indexPath.row + 1
if indexPath.row == selectIndex { if indexPath.row == selectIndex {
cell.setSelectedStyle() cell.setSelectedStyle()
......
...@@ -208,7 +208,7 @@ private extension YHServiceOrderGuideTipsView { ...@@ -208,7 +208,7 @@ private extension YHServiceOrderGuideTipsView {
@objc func timerFired() { @objc func timerFired() {
// 定时器触发时执行的代码 // 定时器触发时执行的代码
print("Timer fired") print("Timer fired")
self.maxCount = self.maxCount - 1 self.maxCount -= 1
if self.maxCount < 1 { if self.maxCount < 1 {
self.stopTimer() self.stopTimer()
self.setButtonEnable(true) self.setButtonEnable(true)
......
...@@ -87,7 +87,7 @@ extension YHServiceSectionView: UICollectionViewDelegate, UICollectionViewDataSo ...@@ -87,7 +87,7 @@ extension YHServiceSectionView: UICollectionViewDelegate, UICollectionViewDataSo
} }
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHServiceSectionCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHServiceSectionCollectionViewCell guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHServiceSectionCollectionViewCell.cellReuseIdentifier, for: indexPath) as? YHServiceSectionCollectionViewCell else { return UICollectionViewCell() }
if type == 0 { if type == 0 {
cell.dataSource = items[indexPath.row] cell.dataSource = items[indexPath.row]
} else { } else {
......
...@@ -72,7 +72,7 @@ extension YHServiceTableFootView: UICollectionViewDelegate, UICollectionViewData ...@@ -72,7 +72,7 @@ extension YHServiceTableFootView: UICollectionViewDelegate, UICollectionViewData
} }
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHHomeCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHHomeCollectionViewCell guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHHomeCollectionViewCell.cellReuseIdentifier, for: indexPath) as? YHHomeCollectionViewCell else { return UICollectionViewCell() }
cell.listModel = items[indexPath.row] cell.listModel = items[indexPath.row]
return cell return cell
......
...@@ -456,7 +456,7 @@ extension YHServiceCenterMainViewModel { ...@@ -456,7 +456,7 @@ extension YHServiceCenterMainViewModel {
if let path = Bundle.main.path(forResource: "scoreOptionData", ofType: "plist") { if let path = Bundle.main.path(forResource: "scoreOptionData", ofType: "plist") {
if let plistData = FileManager.default.contents(atPath: path) { if let plistData = FileManager.default.contents(atPath: path) {
do { do {
let listDictionary = try PropertyListSerialization.propertyList(from: plistData, options: [], format: nil) as! [String: Any] guard let listDictionary = try PropertyListSerialization.propertyList(from: plistData, options: [], format: nil) as? [String: Any] else { return }
guard let model = YHScoreDataModel.deserialize(from: listDictionary) else { guard let model = YHScoreDataModel.deserialize(from: listDictionary) else {
localScoreData = nil localScoreData = nil
return return
......
...@@ -137,7 +137,7 @@ class YHAdopterNewPeopleViewController: YHBaseViewController { ...@@ -137,7 +137,7 @@ class YHAdopterNewPeopleViewController: YHBaseViewController {
make.height.equalTo(44) make.height.equalTo(44)
make.left.equalTo(bottom.saveButton.snp.right).offset(10) make.left.equalTo(bottom.saveButton.snp.right).offset(10)
} }
self.stepView.currentIndex = self.stepView.currentIndex + 1 self.stepView.currentIndex += 1
self.updateDataSource() self.updateDataSource()
if self.viewModel.mainModel.info.is_read_agreement == 0 && titleText == "新增子女" { if self.viewModel.mainModel.info.is_read_agreement == 0 && titleText == "新增子女" {
let view = YHAdopterCardOtherGuideView.sheetView() let view = YHAdopterCardOtherGuideView.sheetView()
......
...@@ -165,7 +165,7 @@ class YHAdopterAddNewTableViewCell: UITableViewCell { ...@@ -165,7 +165,7 @@ class YHAdopterAddNewTableViewCell: UITableViewCell {
make.right.equalTo(-18) make.right.equalTo(-18)
} }
} }
total = total + 1 total += 1
let itemView = YHAdopterItemView() let itemView = YHAdopterItemView()
itemView.clickBlock = {[weak self] model in itemView.clickBlock = {[weak self] model in
guard let self = self else { return } guard let self = self else { return }
......
...@@ -115,7 +115,7 @@ private extension YHAdopterCardOtherGuideView { ...@@ -115,7 +115,7 @@ private extension YHAdopterCardOtherGuideView {
@objc func timerFired() { @objc func timerFired() {
// 定时器触发时执行的代码 // 定时器触发时执行的代码
print("Timer fired") print("Timer fired")
self.maxCount = self.maxCount - 1 self.maxCount -= 1
if self.maxCount < 1 { if self.maxCount < 1 {
self.stopTimer() self.stopTimer()
self.setButtonEnable(true) self.setButtonEnable(true)
......
...@@ -82,7 +82,7 @@ extension YHAdopterOtherCardTableViewCell: UICollectionViewDelegate, UICollectio ...@@ -82,7 +82,7 @@ extension YHAdopterOtherCardTableViewCell: UICollectionViewDelegate, UICollectio
} }
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHAdopterOtherCardCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHAdopterOtherCardCollectionViewCell guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHAdopterOtherCardCollectionViewCell.cellReuseIdentifier, for: indexPath) as? YHAdopterOtherCardCollectionViewCell else { return UICollectionViewCell() }
cell.url = self.dataSource[indexPath.row] cell.url = self.dataSource[indexPath.row]
cell.index = indexPath.row + 1 cell.index = indexPath.row + 1
cell.state = state cell.state = state
......
...@@ -342,7 +342,7 @@ extension YHCertificateAppointViewController: UITableViewDelegate, UITableViewDa ...@@ -342,7 +342,7 @@ extension YHCertificateAppointViewController: UITableViewDelegate, UITableViewDa
let item = arr[indexPath.row] let item = arr[indexPath.row]
if item.type == .goHKMakeCertificate { if item.type == .goHKMakeCertificate {
// 赴港办证 // 赴港办证
let cell = tableView.dequeueReusableCell(withIdentifier: YHCertificateAppointOptionCell.cellReuseIdentifier, for: indexPath) as! YHCertificateAppointOptionCell guard let cell = tableView.dequeueReusableCell(withIdentifier: YHCertificateAppointOptionCell.cellReuseIdentifier, for: indexPath) as? YHCertificateAppointOptionCell else { return UITableViewCell() }
var isGoHK: Bool? var isGoHK: Bool?
if self.isNeedGoHK == 0 { if self.isNeedGoHK == 0 {
......
...@@ -140,12 +140,12 @@ extension YHReAppointViewController: UITableViewDelegate, UITableViewDataSource ...@@ -140,12 +140,12 @@ extension YHReAppointViewController: UITableViewDelegate, UITableViewDataSource
let item = items[indexPath.row] let item = items[indexPath.row]
if item.type == .warmTips { if item.type == .warmTips {
// 温馨提示 // 温馨提示
let cell = tableView.dequeueReusableCell(withIdentifier: YHAppointWarmTipsCell.cellReuseIdentifier, for: indexPath) as! YHAppointWarmTipsCell guard let cell = tableView.dequeueReusableCell(withIdentifier: YHAppointWarmTipsCell.cellReuseIdentifier, for: indexPath) as? YHAppointWarmTipsCell else { return UITableViewCell() }
return cell return cell
} }
if item.type == .confirmGoHKInfo { if item.type == .confirmGoHKInfo {
// 请您确认第X批赴港信息 // 请您确认第X批赴港信息
let cell = tableView.dequeueReusableCell(withIdentifier: YHSelectApplicantGroupCell.cellReuseIdentifier, for: indexPath) as! YHSelectApplicantGroupCell guard let cell = tableView.dequeueReusableCell(withIdentifier: YHSelectApplicantGroupCell.cellReuseIdentifier, for: indexPath) as? YHSelectApplicantGroupCell else { return UITableViewCell()}
cell.repointMembersNameLabel.text = self.getReAppointMemberNameText() cell.repointMembersNameLabel.text = self.getReAppointMemberNameText()
cell.dataModel = item cell.dataModel = item
cell.refreshBlock = { cell.refreshBlock = {
......
...@@ -16,7 +16,9 @@ extension Array where Element == YHHKMemberModel { ...@@ -16,7 +16,9 @@ extension Array where Element == YHHKMemberModel {
var results: [YHHKMemberModel] = [] var results: [YHHKMemberModel] = []
for item in self { for item in self {
let newItem = item.copy() let newItem = item.copy()
results.append(newItem as! YHHKMemberModel) if let a = newItem as? YHHKMemberModel {
results.append(a)
}
} }
return results return results
} }
......
...@@ -291,7 +291,7 @@ extension YHGrabNumberInfoItemView: UICollectionViewDelegate, UICollectionViewDa ...@@ -291,7 +291,7 @@ extension YHGrabNumberInfoItemView: UICollectionViewDelegate, UICollectionViewDa
// 返回自定义单元格 // 返回自定义单元格
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHGrabFileCell.cellReuseIdentifier, for: indexPath) as! YHGrabFileCell guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHGrabFileCell.cellReuseIdentifier, for: indexPath) as? YHGrabFileCell else { return UICollectionViewCell() }
if 0 <= indexPath.item && indexPath.item < item.files.count { if 0 <= indexPath.item && indexPath.item < item.files.count {
let url = item.files[indexPath.item] let url = item.files[indexPath.item]
if item.publicFiles.count == item.files.count { if item.publicFiles.count == item.files.count {
......
...@@ -382,7 +382,7 @@ extension YHSelectApplicantGroupCell: UICollectionViewDelegate, UICollectionView ...@@ -382,7 +382,7 @@ extension YHSelectApplicantGroupCell: UICollectionViewDelegate, UICollectionView
// 返回自定义单元格 // 返回自定义单元格
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHSelectApplicantCell.cellReuseIdentifier, for: indexPath) as! YHSelectApplicantCell guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHSelectApplicantCell.cellReuseIdentifier, for: indexPath) as? YHSelectApplicantCell else { return UICollectionViewCell() }
if let arr = dataModel?.model?.arr { if let arr = dataModel?.model?.arr {
if 0 <= indexPath.item && indexPath.item < arr.count { if 0 <= indexPath.item && indexPath.item < arr.count {
let applicant = arr[indexPath.item] let applicant = arr[indexPath.item]
......
...@@ -198,7 +198,7 @@ extension YHSelectHKPlaceListView: UITableViewDelegate, UITableViewDataSource { ...@@ -198,7 +198,7 @@ extension YHSelectHKPlaceListView: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHHKPlaceInfoCell.cellReuseIdentifier, for: indexPath) as! YHHKPlaceInfoCell guard let cell = tableView.dequeueReusableCell(withIdentifier: YHHKPlaceInfoCell.cellReuseIdentifier, for: indexPath) as? YHHKPlaceInfoCell else { return UITableViewCell() }
if 0 <= indexPath.row && indexPath.row < listArr.count { if 0 <= indexPath.row && indexPath.row < listArr.count {
let model = listArr[indexPath.row] let model = listArr[indexPath.row]
......
...@@ -233,7 +233,7 @@ extension YHServiceSelectAlertView: UICollectionViewDelegate, UICollectionViewDa ...@@ -233,7 +233,7 @@ extension YHServiceSelectAlertView: UICollectionViewDelegate, UICollectionViewDa
// 返回自定义单元格 // 返回自定义单元格
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHServiceItemCell.cellReuseIdentifier, for: indexPath) as! YHServiceItemCell guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHServiceItemCell.cellReuseIdentifier, for: indexPath) as? YHServiceItemCell else { return UICollectionViewCell() }
if 0 <= indexPath.item && indexPath.item < items.count { if 0 <= indexPath.item && indexPath.item < items.count {
let item = items[indexPath.item] let item = items[indexPath.item]
cell.updateItem(item) cell.updateItem(item)
......
...@@ -150,7 +150,7 @@ extension YHFamilyInfoConfirmViewController: UITableViewDelegate, UITableViewDat ...@@ -150,7 +150,7 @@ extension YHFamilyInfoConfirmViewController: UITableViewDelegate, UITableViewDat
return warningCell return warningCell
} }
if indexPath.section == 1 { if indexPath.section == 1 {
let approveCell = tableView.dequeueReusableCell(withIdentifier: YHApproverInfoVerifyCell.cellReuseIdentifier, for: indexPath) as! YHApproverInfoVerifyCell guard let approveCell = tableView.dequeueReusableCell(withIdentifier: YHApproverInfoVerifyCell.cellReuseIdentifier, for: indexPath) as? YHApproverInfoVerifyCell else { return UITableViewCell()}
approveCell.updateFamilyArr(self.familyArr, familyGroup: self.viewModel.familyInfo) approveCell.updateFamilyArr(self.familyArr, familyGroup: self.viewModel.familyInfo)
return approveCell return approveCell
} }
......
...@@ -215,7 +215,7 @@ extension YHFamilyInfoUpdateViewController: UITableViewDelegate, UITableViewData ...@@ -215,7 +215,7 @@ extension YHFamilyInfoUpdateViewController: UITableViewDelegate, UITableViewData
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHIFamilyInfoListCell.cellReuseIdentifier, for: indexPath) as! YHIFamilyInfoListCell guard let cell = tableView.dequeueReusableCell(withIdentifier: YHIFamilyInfoListCell.cellReuseIdentifier, for: indexPath) as? YHIFamilyInfoListCell else { return UITableViewCell() }
if indexPath.row == 0 { if indexPath.row == 0 {
// 标题 // 标题
......
...@@ -114,7 +114,7 @@ extension YHApproverInfoVerifyCell: UITableViewDelegate, UITableViewDataSource { ...@@ -114,7 +114,7 @@ extension YHApproverInfoVerifyCell: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFamilyMemberInfoCell.cellReuseIdentifier, for: indexPath) as! YHFamilyMemberInfoCell guard let cell = tableView.dequeueReusableCell(withIdentifier: YHFamilyMemberInfoCell.cellReuseIdentifier, for: indexPath) as? YHFamilyMemberInfoCell else { return UITableViewCell() }
if 0 <= indexPath.row && indexPath.row < familyArr.count { if 0 <= indexPath.row && indexPath.row < familyArr.count {
let model = familyArr[indexPath.row] let model = familyArr[indexPath.row]
......
...@@ -245,14 +245,15 @@ class YHIFamilyInfoListCell: UITableViewCell { ...@@ -245,14 +245,15 @@ class YHIFamilyInfoListCell: UITableViewCell {
for subView in self.itemsContentView.subviews { for subView in self.itemsContentView.subviews {
if subView is YHInfoItemView { if subView is YHInfoItemView {
let targetView = subView as! YHInfoItemView if let targetView = subView as? YHInfoItemView {
if targetView.item.id == .firstName { if targetView.item.id == .firstName {
targetView.item.value = self.familyInfo.familyName targetView.item.value = self.familyInfo.familyName
targetView.updateItem(targetView.item, familyInfo: self.familyInfo) targetView.updateItem(targetView.item, familyInfo: self.familyInfo)
} }
if targetView.item.id == .lastName { if targetView.item.id == .lastName {
targetView.item.value = self.familyInfo.givenName targetView.item.value = self.familyInfo.givenName
targetView.updateItem(targetView.item, familyInfo: self.familyInfo) targetView.updateItem(targetView.item, familyInfo: self.familyInfo)
}
} }
} }
} }
......
...@@ -99,11 +99,13 @@ extension YHMyTestViewController: UITableViewDelegate, UITableViewDataSource { ...@@ -99,11 +99,13 @@ extension YHMyTestViewController: UITableViewDelegate, UITableViewDataSource {
if indexPath.section == 3 { if indexPath.section == 3 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHTravelCertificateUploadCell.cellReuseIdentifier, for: indexPath) as! YHTravelCertificateUploadCell guard let cell = tableView.dequeueReusableCell(withIdentifier: YHTravelCertificateUploadCell.cellReuseIdentifier, for: indexPath) as? YHTravelCertificateUploadCell else { return UITableViewCell() }
return cell return cell
} }
let cell = tableView.dequeueReusableCell(withIdentifier: YHTravelCertificateTipsCell.cellReuseIdentifier, for: indexPath) as! YHTravelCertificateTipsCell guard let cell = tableView.dequeueReusableCell(withIdentifier: YHTravelCertificateTipsCell.cellReuseIdentifier, for: indexPath) as? YHTravelCertificateTipsCell else {
return UITableViewCell()
}
if 0 <= indexPath.section && indexPath.section < sectionItems.count { if 0 <= indexPath.section && indexPath.section < sectionItems.count {
let arr = sectionItems[indexPath.section] let arr = sectionItems[indexPath.section]
......
...@@ -96,7 +96,6 @@ extension YHMyNotifySettingVC: UITableViewDelegate, UITableViewDataSource { ...@@ -96,7 +96,6 @@ extension YHMyNotifySettingVC: UITableViewDelegate, UITableViewDataSource {
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: YHMyPermissionCell.cellReuseIdentifier, for: indexPath) as? YHMyPermissionCell else { return UITableViewCell() } guard let cell = tableView.dequeueReusableCell(withIdentifier: YHMyPermissionCell.cellReuseIdentifier, for: indexPath) as? YHMyPermissionCell else { return UITableViewCell() }
if 0 <= indexPath.row && indexPath.row < items.count { if 0 <= indexPath.row && indexPath.row < items.count {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment