Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift returns error 'Binary operator == cannot be applied to two EKSourceType operands'

Tags:

ios

swift

ios8

I have code like this in Xcode 6.3:

let store = EKEventStore()

for source in store.sources() {
    let st: EKSourceType = source.sourceType!
    if st == EKSourceTypeLocal {
        localSource = source;
    }
}

The fifth line (if st..) gives the complier error: 'Binary operator == cannot be applied to two EKSourceType operands'

How can I check if the source is local or not (in Swift) and get this to compile?

like image 664
Adam Knights Avatar asked Apr 22 '15 14:04

Adam Knights


1 Answers

Like this:

if st.value == EKSourceTypeLocal.value
like image 185
matt Avatar answered Oct 25 '22 17:10

matt