大佬教程收集整理的这篇文章主要介绍了ios – 类型中未找到枚举大小写开关,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我有以下公开枚举
public enum OfferViewRow { case Candidates case Expiration case Description case Timing case Money case Payment }
和以下mutableProperty:
private let rows = MutableProperty<[OfferViewRow]>([OfferViewRow]())
在我的init文件中,我使用一些reactiveCocoa来设置我的MutableProperty:
rows <~ application.producer .map { response in if response?.application.status == .Applied { return [.Candidates,.Description,.Timing,.Money,.Payment] } else { return [.Candidates,.Expiration,.Payment] } }
但现在的问题是,当我尝试在我的行内获取我的枚举的值时,它会抛出错误.请看下面的代码.
func cellviewmodelForRowATindexPath(indexPath: NSIndexPath) -> viewmodel { guard let row = rows.value[indexPath.row],let response = self.application.value else { fatalError("") } switch row { case .Candidates: // Do something case .Expiration: // Do something case .Description: // Do something case .Timing: // Do something case .Money: // Do something case .Payment: // Do something } }
它抛出一个错误:Enum case’some’没有找到类型’OfferViewRow在行let row = rows.value [indexPath.row]
并且在每个switch语句中都会抛出:Enum case’Candidates’not found in type’< Error type>>
有人可以帮我弄这个吗?
以上是大佬教程为你收集整理的ios – 类型中未找到枚举大小写开关全部内容,希望文章能够帮你解决ios – 类型中未找到枚举大小写开关所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。