Skip to content

Commit 5b0f3fd

Browse files
committed
Updated documentation index
1 parent b9e2c65 commit 5b0f3fd

File tree

1 file changed

+16
-36
lines changed

1 file changed

+16
-36
lines changed

README.md

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,19 @@
1010
SwiftRichString is a lightweight library which allows to create and manipulate attributed strings easily both in iOS, macOS, tvOS and even watchOS.
1111
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.
1212

13-
It even support **iOS 11's Dynamic Type**!
13+
## Main Features
1414

15-
If you manipulate `NSAttributedString` in Swift, SwiftRichString allows you to keep your code manteniable, readable and easy to evolve.
15+
| | Features Highlights |
16+
|--- |--------------------------------------------------------------------------------- |
17+
| 🦄 | Easy styling with declarative syntax |
18+
| 🏞 | Attach local and remote images inside text |
19+
| 🧬 | Fast & high customizable XML/HTML tagged string rendering |
20+
| 🌟 | Apply text transforms within styles |
21+
| 📐 | Native support for iOS 11 Dynamic Type |
22+
|| Compact code base with no external dependencies. |
23+
| 🐦 | Fully made in Swift 5 from Swift ❥ lovers |
1624

17-
## Features Highlights
18-
19-
Want to know what SwiftRichString can do in your app? Lets take a look to these feature highlights!
20-
21-
### 1. Easy Styling
22-
The main concept behind this lib is the `Style`: a style is just a collection of text attributes you can apply to a string. The following example show how to create a style an produce an attributed string with it:
25+
### Easy Styling
2326

2427
```swift
2528
let style = Style {
@@ -31,20 +34,7 @@ let style = Style {
3134
let attributedText = "Hello World!".set(style: style) // et voilà!
3235
```
3336

34-
### 2. Global Styles & Interface Builder Integration
35-
Styles can be also registered globally and reused in your app.
36-
Just define your own style and register using `Styles.register()` function:
37-
38-
```swift
39-
let myStyle = Style { // define style's attributes... }
40-
Styles.register("MyStyle", style: style)
41-
```
42-
43-
Now you can reuse it everything in your app; SwiftRichString exposes a `styleName` property for the most common text containers and you can set it directly in Interface Builder:
44-
45-
<img src="Documentation_Assests/image_1.png" alt="" style="width: 250px;"/>
46-
47-
### 3. Complex Rendering with tag-based strings
37+
### 3. Complex XML/HTML based rendering
4838
SwiftRichString allows you to render complex strings by parsing text's tags: each style will be identified by an unique name (used inside the tag) and you can create a `StyleGroup` which allows you to encapsulate all of them and reuse as you need (clearly you can register it globally).
4939

5040
```swift
@@ -64,10 +54,7 @@ let italic = normal.byAdding {
6454
$0.traitVariants = .italic
6555
}
6656

67-
// Create a group which contains your style, each identified by a tag.
6857
let myGroup = StyleGroup(base: normal, ["bold": bold, "italic": italic])
69-
70-
// Use tags in your plain string
7158
let str = "Hello <bold>Daniele!</bold>. You're ready to <italic>play with us!</italic>"
7259
self.label?.attributedText = str.set(style: myGroup)
7360
```
@@ -80,13 +67,6 @@ That's the result!
8067

8168
## Documentation
8269

83-
**Are you using SwiftRichString 1.x in your project? Don't miss to take a look at [Migration section of the documentation](#migration).**
84-
You can still use the 1.x release by using tagged version 1.1.0.
85-
86-
**Table Of Contents**
87-
88-
Full changelog is available in [CHANGELOG.md](CHANGELOG.md) file.
89-
9070
- [Introduction to `Style`, `StyleGroup` & `StyleRegEx`](#stylestylegroup)
9171
- [Introduction](#introduction)
9272
- [String & Attributed String concatenation](#concatenation)
@@ -96,8 +76,8 @@ Full changelog is available in [CHANGELOG.md](CHANGELOG.md) file.
9676
- [Support Dynamic Type](#dynamictype)
9777
- [Render XML tagged strings](#customizexmlstrings)
9878
- [Customize XML rendering: react to tag's attributes and unknown tags](#xmlstrings)
99-
- [Custom Text Transforms](#texttransforms)
100-
- [Local & Remote Images in text](#images)
79+
- [Custom text transforms](#texttransforms)
80+
- [Local & Remote Images inside text](#images)
10181
- [The `StyleManager`](#stylemanager)
10282
- [Register globally available styles](#globalregister)
10383
- [Defer style creation on demand](#defer)
@@ -516,7 +496,7 @@ All text transforms are applied in the same ordered you set in `textTransform` p
516496

517497
<a name="images"/>
518498

519-
### Local & Remote Images in text
499+
### Local & Remote Images inside text
520500

521501
SwiftRichString supports local and remote attached images along with attributed text.
522502
You can create an attributed string with an image with a single line:
@@ -549,7 +529,7 @@ self.textView?.attributedText = taggedText.set(style: ...)
549529

550530
This is the result:
551531

552-
<img src="Documentation_Assests/image_6.png" alt="" style="width: 120px;"/>
532+
<img src="Documentation_Assests/image_6.png" alt="" style="width: 100px;"/>
553533

554534
<a name="stylemanager"/>
555535

0 commit comments

Comments
 (0)