Morgan Morgan - 7 months ago 1245
Swift Question

No '|' candidates produce the expected contextual result type 'NSTextStorageEditActions'

I went through the Text Kit Tutorial on raywenderlich.com and the line

edited(.EditedCharacters | .EditedAttributes, range: range, changeInLength: (str as NSString).length - range.length)


produces the following error:

No '|' candidates produce the expected contextual result type 'NSTextStorageEditActions'


The error goes away when I change the first argument to:

edited(.EditedCharacters, range: range, changeInLength: (str as NSString).length - range.length)


I also tried using "OR" and "||" without any success.

Swift 2.2 and iOS 9.2

Answer

@dfri is correct. To illustrate another example of using the pipe, "|", is when doing the autoResizingMask for UIImageView as follows:

imageView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight, ...]

Of course you'd replace the ... with other UIViewAutoresizing options.

Good luck!