Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

Rev 8 | Ir a la última revisión | | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
//
2
//  PdfView.swift
3
//  twogetskills
4
//
5
//  Created by Efrain Yanez Recanatini on 4/26/22.
6
//
7
 
8
import Foundation
9
import SwiftUI
10
import PDFKit
11
 
12
 
13
struct PdfViewerView: View {
14
    @Environment(\.presentationMode)
15
       var presentationMode: Binding
16
 
17
    //@State private var backToGallery : Bool = false
18
    @State private var isCompleted : Bool = false
19
 
20
    private var url : URL?
21
 
22
    private var slideName : String;
23
 
24
 
25
 
26
    init(url : String, slideName : String)
27
    {
28
        self.url = URL(string: url)
29
 
30
 
31
        self.slideName = slideName
32
 
33
 
34
 
35
 
36
    }
37
 
38
    var body: some View {
39
        GeometryReader { geometry in
40
            VStack {
41
                PDFKitRepresentedView(url!).frame(
42
                    width: geometry.size.width,
43
                    height: geometry.size.height,
44
                    alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)
45
            }
46
            .background(Color("color_window_background"))
47
            .navigationBarBackButtonHidden(true)
48
            .navigationBarTitleDisplayMode(.inline)
49
            .navigationTitle(slideName)
50
            .toolbar {
51
                ToolbarItem(placement: .navigationBarLeading) {
52
                    Button(action: {
53
 
54
                        self.presentationMode.wrappedValue.dismiss()
55
 
56
 
57
                    }) {
58
                        HStack {
59
                            Image(systemName: "chevron.backward")
60
                                .aspectRatio(contentMode: .fit)
61
                                .foregroundColor(Color("color_app_bar_foreground"))
62
                                .background(Color("color_app_bar_background"))
63
                        }
64
                    }
65
 
66
                }
67
            }
68
 
69
        }
70
    }
71
 
72
 
73
 
74
 
75
}
76
 
77
 
78
struct PdfViewerView_Previews: PreviewProvider {
79
    static var previews: some View {
80
        PdfViewerView(
81
            url :  "https://cesams.com/wp-content/uploads/2021/11/Programa-Innovacion-Softskills-y-Habitos-de-Alto-Rendimiento-CESA-MS.pdf",
82
            slideName:  "")
83
    }
84
}
85
 
86
 
87