Skip to content

Swift support

Compare
Choose a tag to compare
@zacwest zacwest released this 14 Dec 03:43
· 30 commits to master since this release

Swift support! You will need to add the ZSWTaggedString/Swift dependency for this. This provides a cleaner API for setting attributes for tags, for example:

options["a"] = .Static([
    NSForegroundColorAttributeName: UIColor.whiteColor()
])

options["b"] = .Dynamic({ tagName, tagAttributes, existingAttributes in
    if tagAttributes["white"] != nil {
        return [
            NSForegroundColorAttributeName: UIColor.whiteColor()
        ]
    } else {
        return [
            NSForegroundColorAttributeName: UIColor.redColor()
        ]
    }
})

This release also fixes ZSWTaggedString initialization methods init(string:) and init(format:...) under Swift.

Incompatibility notes:

  • ZSWTaggedString no longer accepts nil input; it will convert any nil input into @"".
  • ZSWTaggedStringOptions.returnEmptyStringForNil flag has been removed.