Skip to content

Commit a6d0f10

Browse files
committed
Update demo project with inline images
1 parent 538b2ff commit a6d0f10

File tree

4 files changed

+34
-10
lines changed

4 files changed

+34
-10
lines changed
1.16 KB
Loading
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "237-30x40.jpg",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
}
12+
}

Examples/Demo/Demo/ImageProvidersView.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,23 @@ struct ImageProvidersView: View {
1313
"""
1414

1515
private let otherContent = """
16-
You can use the built-in `AssetImageProvider` to load images from image assets.
16+
You can use the built-in `AssetImageProvider` and `AssetInlineImageProvider`
17+
to load images from image assets.
1718
1819
```swift
1920
Markdown {
2021
"![A dog](dog)"
22+
"A ![dog](smallDog) within a line of text."
2123
"― Photo by André Spieker"
2224
}
2325
.markdownImageProvider(.asset)
26+
.markdownInlineImageProvider(.asset)
2427
```
2528
2629
![A dog](dog)
2730
31+
A ![dog](smallDog) within a line of text.
32+
2833
― Photo by André Spieker
2934
"""
3035

@@ -36,6 +41,7 @@ struct ImageProvidersView: View {
3641
Section("Image Assets") {
3742
Markdown(self.otherContent)
3843
.markdownImageProvider(.asset)
44+
.markdownInlineImageProvider(.asset)
3945
}
4046
}
4147
}

Examples/Demo/Demo/ImagesView.swift

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,31 @@ struct ImagesView: View {
1515
― Photo by Jennifer Trovato
1616
"""
1717

18-
private let assetContent = """
19-
You can configure a `Markdown` view to load images from the asset catalog.
18+
private let inlineImageContent = """
19+
You can also insert images in a line of text, such as
20+
![](https://picsum.photos/id/237/50/25) or
21+
![](https://picsum.photos/id/433/50/25).
2022
21-
```swift
22-
Markdown {
23-
"![This is an image](237-200x300)"
24-
}
25-
.markdownImageProvider(.asset)
23+
```
24+
You can also insert images in a line of text, such as
25+
![](https://picsum.photos/id/237/50/25) or
26+
![](https://picsum.photos/id/433/50/25).
2627
```
2728
28-
![This is an image](dog)
29+
Note that MarkdownUI does not apply any styling to inline
30+
images.
2931
30-
Photo by André Spieker
32+
Photos by André Spieker and Thomas Lefebvre
3133
"""
3234

3335
var body: some View {
3436
DemoView {
3537
Markdown(self.content)
3638

39+
Section("Inline images") {
40+
Markdown(self.inlineImageContent)
41+
}
42+
3743
Section("Customization Example") {
3844
Markdown(self.content)
3945
}

0 commit comments

Comments
 (0)