Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Custom Attributes #26

Merged
merged 2 commits into from
Apr 27, 2018
Merged

Support for Custom Attributes #26

merged 2 commits into from
Apr 27, 2018

Conversation

eddiekaiger
Copy link
Owner

Introduces a new enum case for Attribute that allows for custom attributes:

Attribute.custom(String, Any)

You can also use this with extensions, like so:

"Hello".withCustomAttribute(named: "Foo", value: 42)

Background:
The Apple Docs state the following with regards to attributed strings:

You can assign any attribute name-value pair you wish to a range of characters, in addition to the standard attributes.

Hence, it makes sense for SwiftyAttributes to support any attribute names, not just the standard ones created by Apple.

Solves #25.

@codecov-io
Copy link

codecov-io commented Apr 25, 2018

Codecov Report

Merging #26 into master will increase coverage by 0.28%.
The diff coverage is 96.96%.

@@            Coverage Diff            @@
##           master     #26      +/-   ##
=========================================
+ Coverage   99.22%   99.5%   +0.28%     
=========================================
  Files          10      10              
  Lines         516     408     -108     
  Branches      121       0     -121     
=========================================
- Hits          512     406     -106     
  Misses          2       2              
+ Partials        2       0       -2

@eddiekaiger eddiekaiger merged commit 31affe4 into master Apr 27, 2018
@eddiekaiger eddiekaiger deleted the custom-attributes branch April 27, 2018 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants