Skip to content

Commit 9307cfe

Browse files
committed
#45 Documentation link
1 parent 2408ed9 commit 9307cfe

File tree

1 file changed

+40
-38
lines changed

1 file changed

+40
-38
lines changed

README.md

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Created by <b>Daniele Margutti</b> - <a href="http://www.danielemargutti.com">da
1414

1515
SwiftRichString is a lightweight library which allows to create and manipulate attributed strings easily both in iOS, macOS, tvOS and even watchOS.
1616
It provides convenient way to store styles you can reuse in your app's UI elements, allows complex tag-based strings rendering and also includes integration with Interface Builder.
17+
It even support iOS 11's Dynamic Type!
1718

1819
If you manipulate `NSAttributedString` in Swift, SwiftRichString allows you to keep your code manteniable, readable and easy to evolve.
1920

@@ -79,24 +80,6 @@ That's the result!
7980

8081
<img src="Documentation_Assests/image_2.png" alt="" style="width: 300px;"/>
8182

82-
--
83-
84-
## Other Libraries You May Like
85-
86-
I'm also working on several other projects you may like.
87-
Take a look below:
88-
89-
90-
| Library | Description |
91-
|-----------------|--------------------------------------------------|
92-
| [**SwiftDate**](https://github.com/malcommac/SwiftDate) | The best way to manage date/timezones in Swift |
93-
| [**Hydra**](https://github.com/malcommac/Hydra) | Write better async code: async/await & promises |
94-
| [**FlowKit**](https://github.com/malcommac/FlowKit) | A new declarative approach to table/collection managment. Forget datasource & delegates. |
95-
| [**SwiftRichString**](https://github.com/malcommac/SwiftRichString) | Elegant & Painless NSAttributedString in Swift |
96-
| [**SwiftLocation**](https://github.com/malcommac/SwiftLocation) | Efficient location manager |
97-
| [**SwiftMsgPack**](https://github.com/malcommac/SwiftMsgPack) | Fast/efficient msgPack encoder/decoder |
98-
</p>
99-
10083
--
10184

10285
## Documentation
@@ -115,7 +98,8 @@ Full changelog is available in [CHANGELOG.md](CHANGELOG.md) file.
11598
- [Apply styles to `String` & `Attributed String`](#manualstyling)
11699
- [Fonts & Colors in `Style`](#fontscolors)
117100
- [Derivating a `Style`](#derivatingstyle)
118-
- [Conforming to `Dynamic Type`](#dynamictype)
101+
- [Support iOS's `Dynamic Type`](#dynamictype)
102+
- [Dynamic Attributes from Tag's Params](#dynamicattributes)
119103
- [The `StyleManager`](#stylemanager)
120104
- [Register globally available styles](#globalregister)
121105
- [Defer style creation on demand](#defer)
@@ -207,25 +191,6 @@ The result is this:
207191

208192
<a name="concatenation"/>
209193

210-
### Dynamic Attributes from Source Text
211-
212-
SwiftRichString also support some dynamic element in style applied by reading specific attributes from html-tagged string.
213-
The following example render the `linkURL` property by reading the value from the source string inside `href` tag (like in real HTML text):
214-
215-
```
216-
let normal = Style {
217-
$0.color = UIColor.black
218-
}
219-
let link = Style {
220-
$0.color = UIColor.red
221-
$0.linkURL = URLRepresentable.tagAttribute("href")
222-
}
223-
let group = StyleGroup.init(base: normal, ["a" : link])
224-
225-
let bodyHTML = "Go to <a href=\"http://www.apple.com\">Apple</a> web site!"
226-
self.textView?.attributedText = bodyHTML.set(style: group)
227-
```
228-
229194
### String & Attributed String concatenation
230195
SwiftRichString allows you to simplify string concatenation by providing custom `+` operator between `String`,`AttributedString` (typealias of `NSMutableAttributedString`) and `Style`.
231196

@@ -399,6 +364,27 @@ let style = Style {
399364
}
400365
```
401366

367+
<a name="dynamicattributes"/>
368+
369+
### Dynamic Attributes from Tag's Params
370+
371+
SwiftRichString also support some dynamic elements in style applied by reading specific tag parameter's value.
372+
The following example render the `linkURL` property by reading the value from the source string inside `href` tag (like in real HTML text):
373+
374+
```
375+
let normal = Style {
376+
$0.color = UIColor.black
377+
}
378+
let link = Style {
379+
$0.color = UIColor.red
380+
$0.linkURL = URLRepresentable.tagAttribute("href")
381+
}
382+
let group = StyleGroup.init(base: normal, ["a" : link])
383+
384+
let bodyHTML = "Go to <a href=\"http://www.apple.com\">Apple</a> web site!"
385+
self.textView?.attributedText = bodyHTML.set(style: group)
386+
```
387+
402388
<a name="stylemanager"/>
403389

404390
## The `StyleManager`
@@ -658,4 +644,20 @@ SwiftRichString is available under the MIT license. See the LICENSE file for mor
658644

659645
Daniele Margutti: [hello@danielemargutti.com](mailto:hello@danielemargutti.com), [@danielemargutti](https://twitter.com/danielemargutti)
660646

647+
## Other Libraries You May Like
648+
649+
I'm also working on several other projects you may like.
650+
Take a look below:
651+
652+
653+
| Library | Description |
654+
|-----------------|--------------------------------------------------|
655+
| [**SwiftDate**](https://github.com/malcommac/SwiftDate) | The best way to manage date/timezones in Swift |
656+
| [**Hydra**](https://github.com/malcommac/Hydra) | Write better async code: async/await & promises |
657+
| [**FlowKit**](https://github.com/malcommac/FlowKit) | A new declarative approach to table/collection managment. Forget datasource & delegates. |
658+
| [**SwiftRichString**](https://github.com/malcommac/SwiftRichString) | Elegant & Painless NSAttributedString in Swift |
659+
| [**SwiftLocation**](https://github.com/malcommac/SwiftLocation) | Efficient location manager |
660+
| [**SwiftMsgPack**](https://github.com/malcommac/SwiftMsgPack) | Fast/efficient msgPack encoder/decoder |
661+
</p>
662+
661663

0 commit comments

Comments
 (0)