[swift-corelibs-dev] NSAttributedString attributesAtIndex return an optional.

James Lee james at jelee.co.uk
Tue Dec 8 06:23:19 CST 2015


Hi all,

Been playing around with NSAttributedString and cannot decide on the best way to implement the (attributesAtIndex: effectiveRange) and other methods with similar functionality.

In the ObjC world I would expect an empty NSDictionary even in cases where the location is greater than the length of the string.

In the swift world, I am of the leaning that the functions should return optionals and in the aforementioned scenario 'nil' would be returned.

Wanted to get other people's thoughts on this.


More information about the swift-corelibs-dev mailing list