Skip to content

Commit 38137e7

Browse files
author
crelies
committed
chore(example): added example app from separate repository
1 parent fb61051 commit 38137e7

File tree

14 files changed

+757
-0
lines changed

14 files changed

+757
-0
lines changed

Example/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Christian Elies
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Example/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# RemoteImage-SwiftUI
2+
3+
Remote Image view with error and loading state for **SwiftUI**
4+
5+
This repository contains a usage example of my Swift package for a remote **SwiftUI** `Image view` to show remote images.
6+
You can find the Swift package [here](https://github.com/crelies/RemoteImage).
7+
8+
## Motivation
9+
10+
I wanted to have a simple and extendable remote image view in **SwiftUI** which takes care of all the magic
11+
(image loading, caching, error and loading view). At my current employer we used a custom **UIKit** view for that.
12+
13+
## Preview
14+
15+
![Animated preview image](https://github.com/crelies/RemoteImage-SwiftUI/blob/master/RemoteImage.gif)
16+
17+
Code:
18+
19+
```swift
20+
let url = URL(string: "https://images.unsplash.com/photo-1524419986249-348e8fa6ad4a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1950&q=80")!
21+
22+
RemoteImage(type: .url(url), errorView: { error in
23+
Text(error.localizedDescription)
24+
}, image: { image in
25+
image
26+
.resizable()
27+
.aspectRatio(contentMode: .fit)
28+
}, loadingView: {
29+
Text("Loading ...")
30+
})
31+
```
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.app-sandbox</key>
6+
<true/>
7+
<key>com.apple.security.network.client</key>
8+
<true/>
9+
</dict>
10+
</plist>

0 commit comments

Comments
 (0)