import SwiftUI
import SimpleImagePicker
struct SimpleImagePickerTest: View {
@State private var showImagePicker: Bool = false
var body: some View {
Button(action: {
self.showImagePicker.toggle()
}, label: {
Text("GetImage")
})
.simpleImagePicker(showImagePicker: $showImagePicker) { result in
// result == [UIImage]
print(result)
}
}
}
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift
compiler.
Once you have your Swift package set up, adding SimpleImagePicker as a dependency is as easy as adding it to the dependencies
value of your Package.swift
.
dependencies: [
.package(url: "https://github.com/NuPlay/SimpleImagePicker.git", .upToNextMajor(from: "1.0.0"))
]
import SwiftUI
import SimpleImagePicker
struct SimpleImagePickerTest: View {
@State private var showImagePicker: Bool = false
var body: some View {
Button(action: {
self.showImagePicker.toggle()
}, label: {
Text("GetImage")
})
.simpleImagePicker(showImagePicker: $showImagePicker, maxCount: 5, presentType: .sheet) { result in
// result == [UIImage]
print(result)
}
}
}
Parameter | Default |
---|---|
showImagePicker: Binding<Bool> |
|
maxCount: Int |
5(0 means Unlimited Photos) |
presentType: ImagePickerPresentType(sheet, fullScreenCover) |
.sheet |
result: @escaping ([UIImage]) -> Void |