Skip to content

Commit a4606f7

Browse files
committed
Update README.md
1 parent 651d0a5 commit a4606f7

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

README.md

+20-20
Original file line numberDiff line numberDiff line change
@@ -21,35 +21,35 @@ SwiftUI view that asynchronously loads and displays an OpenAI image from open AP
2121

2222
### 2. Override the default loader at Environment with you apiKey
2323
```swift
24-
@Environment(\.openAIDefaultLoader) var loader : OpenAIDefaultLoader
25-
26-
let apiKey = "*******************"
27-
let endpoint = OpenAIImageEndpoint.get(with: apiKey)
28-
let loader = OpenAIDefaultLoader(endpoint: endpoint)
29-
30-
ContentView()
31-
.environment(\.openAIDefaultLoader, loader)
24+
@Environment(\.openAIDefaultLoader) var loader : OpenAIDefaultLoader
25+
26+
let apiKey = "*******************"
27+
let endpoint = OpenAIImageEndpoint.get(with: apiKey)
28+
let loader = OpenAIDefaultLoader(endpoint: endpoint)
29+
30+
ContentView()
31+
.environment(\.openAIDefaultLoader, loader)
3232
```
3333

3434
### 3. Add **OpenAIAsyncImage** to your code
3535

3636
```swift
37-
OpenAIAsyncImage(prompt: .constant("sun"))
38-
.frame(width: 125, height: 125)
37+
OpenAIAsyncImage(prompt: .constant("sun"))
38+
.frame(width: 125, height: 125)
3939
```
4040
or with custom **ViewBuilder**
4141

4242
```swift
43-
OpenAIAsyncImage(prompt: $imageText, size: .dpi1024){ state in
44-
switch state{
45-
case .loaded(let image) :
46-
image
47-
.resizable()
48-
.scaledToFill()
49-
case .loadError(let error) : Text(error.localizedDescription)
50-
case .loading : ProgressView()
51-
}
52-
}
43+
OpenAIAsyncImage(prompt: $imageText, size: .dpi1024){ state in
44+
switch state{
45+
case .loaded(let image) :
46+
image
47+
.resizable()
48+
.scaledToFill()
49+
case .loadError(let error) : Text(error.localizedDescription)
50+
case .loading : ProgressView()
51+
}
52+
}
5353
```
5454

5555
| Param | Description |

0 commit comments

Comments
 (0)