Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

OpenAI Swift async text to image for SwiftUI app using openai api, diffusion model, example, swift image chat gpt generator chat gpt async image, asyncimage from openai url, ios, macos, dalle generate, client generater AI图片生成 AI图像生成

License

NotificationsYou must be signed in to change notification settings

swiftuiux/openai-async-image-swiftui

Repository files navigation

SwiftUI view that asynchronously loads and displays an OpenAI image from open APIYou just type in any your idea and AI will give you an art solution

Features

  • Multiplatform iOS, macOS, watchOS and tvOS
  • Customizable in term of SwiftUI Image specs [renderingMode, resizable, antialiased...]
  • Customizable in term of the transport layer [Loader]
  • Based on interfaces not implementations

OpenAI AsyncImage SwiftUI

How to use

1. Get your API key from OpenAI

Where do I find my Secret API Key?

2. Override the default loader at Environment with you apiKey

letapiKey="your API KEY"letendpoint=OpenAIImageEndpoint.get(with: apiKey)letloader=OpenAIDefaultLoader(endpoint: endpoint)OpenAIDefaultLoaderKey.defaultValue= loader

3. AddOpenAIAsyncImage to your code

OpenAIAsyncImage(prompt:.constant("sun")).frame(width:125, height:125)

or with customViewBuilder

OpenAIAsyncImage(prompt: $imageText, size:.dpi1024){ stateinswitch state{case.loaded(let image):        image.resizable().scaledToFill()case.loadError(let error):Text(error.localizedDescription)case.loading:ProgressView()}}
ParamDescription
promptA text description of the desired image(s). The maximum length is 1000 characters
sizeThe size of the generated images. Must be one of 256x256, 512x512, or 1024x1024
tplCustom view builder tpl
loaderCustom loader if you need something specific

OpenAI AsyncImage SwiftUI

Documentation(API)

  • You need to have Xcode 13 installed in order to have access to Documentation Compiler (DocC)
  • Go to Product > Build Documentation or⌃⇧⌘ D

SwiftUI example for the package

OpenAI AsyncImage SwiftUI example

OpenAI AsyncImage SwiftUI

About

OpenAI Swift async text to image for SwiftUI app using openai api, diffusion model, example, swift image chat gpt generator chat gpt async image, asyncimage from openai url, ios, macos, dalle generate, client generater AI图片生成 AI图像生成

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp