This page contains links to blogposts that contain extensions for predefined Swift types.
String extensions
fixIndexThis extension introduces an operation to rebase a String.Index if the originating string of an index variable has changed. This is important when changing a string's length because the indexes before the string update are still using the older string endIndex.
isLowercaseCharacterAtIndex
isUppercaseCharacterAtIndex
These two extensions check if a UTF16 character at the given String.Index is present in the NSCharacterSet lowercase resp uppercase.
replaceCharacterAtIndex:with
Only available for mutable strings, this extension replaces a character in the string with a given character.
changeCaseOfCharacterAtIndex
Only available for mutable strings, this extension works only on lowercase or uppercase characters and reverses it case.
Array extensions
removeObjectThis extension reintroduces the removeObject operation (from the NSArray) to the Swift array type.
NSEventModifierFlags extensions
NSEventModifierFlags extensions: isSet and isNotSetThese functions make working with the even modifier flags more readable.
UInt8 extensions
Bit access for a the UInt8Accessing the bits as a set of 8 Bools in a tuple.
OptionSetType extensions
Factory methodA clean looking factory constructor when creating an option with multiple selections (OR-ing)
Comparable extension
Limiting functionsSome functions that can clip the value of a Comparable to either a maximum or minimum limit (or both).
No comments:
Post a Comment