You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But basically, it doesn't seem as there's any way to write a StringList class in Obj-C that can be iterated in swift with for-in syntax:
letlist = StringList()
fory: Stringinlist {
...
}
It seems if I derive from NSEnumerator<NSString *>, then for-in works except the generic type is lost, and so declaring y as String gives a "'NSFastEnumerationIterator.Element' (aka 'Any') is not convertible to 'String'" error.
The text was updated successfully, but these errors were encountered:
I guess the importer can't do it automatically, but we could derive Sequence from NSFastEnumeration instead of making people write the makeIterator call with NSFastEnumerationIterator explicitly.
Additional Detail from JIRA
md5: 9396e06997f092bc2380dacf6f4911a9
Issue Description:
See http://stackoverflow.com/questions/39757563/how-do-i-implement-sequence-to-allow-swifts-for-in-syntax-from-objective-c for details.
But basically, it doesn't seem as there's any way to write a StringList class in Obj-C that can be iterated in swift with for-in syntax:
It seems if I derive from NSEnumerator<NSString *>, then for-in works except the generic type is lost, and so declaring y as String gives a "'NSFastEnumerationIterator.Element' (aka 'Any') is not convertible to 'String'" error.
The text was updated successfully, but these errors were encountered: