-
Notifications
You must be signed in to change notification settings - Fork 0
/
ContentView.swift
54 lines (43 loc) · 1.43 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
46
47
48
49
50
51
52
53
54
//
// ContentView.swift
// screenshots
//
// Created by Henrique Matheus Alves Pereira on 17/05/24.
//
import SwiftUI
struct ContentView: View {
@ObservedObject var viewModel: ScreenCaptureViewModel
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
ScrollView{
LazyVGrid(columns: [GridItem(.adaptive(minimum: 200, maximum: 300))]){
ForEach(viewModel.images, id: \.self) { image in
Image(nsImage: image)
.resizable()
.scaledToFit()
.onDrag({ NSItemProvider(object: image) })
.draggable(image)
}
}
}
HStack {
Button("Make a full screenshot") {
viewModel.takeScreenshot(for: .full)
}
Button("Make a window screenshot") {
viewModel.takeScreenshot(for: .window)
}
Button("Make an area screenshot") {
viewModel.takeScreenshot(for: .area)
}
}
}
.padding()
}
}
#Preview {
ContentView(viewModel: ScreenCaptureViewModel())
}