ImagePicker is a Swift Package to make it easy to pick images from the photo library.
- Swift 5.9+ (Xcode 15+)
- iOS 13+, macOS 10.15+
dependencies: [
.package(url: "https://github.com/0xWDG/ImagePicker.git", branch: "main"),
],
targets: [
.target(name: "MyTarget", dependencies: [
.product(name: "ImagePicker", package: "ImagePicker"),
]),
]
- In Xcode, open your project and navigate to File → Swift Packages → Add Package Dependency...
- Paste the repository URL (
https://github.com/0xWDG/ImagePicker
) and click Next. - Click Finish.
import SwiftUI
import ImagePicker
struct ContentView: View {
@State
private var image: Image?
var body: some View {
VStack {
ImagePicker(image: $image)
.frame(width: 150, height: 150)
}
.padding()
}
}
We can get in touch via Mastodon, Twitter/X, Discord, Email, Website.
Interested learning more about Swift? Check out my blog.