-
Notifications
You must be signed in to change notification settings - Fork 1
/
ContentView.swift
45 lines (40 loc) · 1.1 KB
/
ContentView.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//
// ContentView.swift
// JustPhotoPickerSwiftUI
//
// Created by Igor Belov on 24.08.2022.
//
import SwiftUI
import JustPhotoPicker
struct ContentView: View {
@State private var showingPicker: Bool = false
private var pickerConfig: JustPhotoPickerConfiguration {
var config = JustPhotoPickerConfiguration()
config.accentColor = .systemPink
config.selectionLimit = 2
config.isSelectionRequired = true
config.overlayTintColor = .systemPurple
return config
}
var body: some View {
VStack {
Button("Select photo") {
showingPicker = true
}
}
.sheet(isPresented: $showingPicker) {
JustPhotoPickerView(configuration: pickerConfig)
.onFinish { images in
print("Selected \(images.count) images")
}
.onCancel {
print("Did not select any images")
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}