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
//  HtmlView.swift
3
//  twogetskills
4
//
5
//  Created by Efrain Yanez Recanatini on 4/26/22.
6
//
7
 
8
import Foundation
9
 
10
import Foundation
11
import SwiftUI
12
import PDFKit
13
 
14
 
15
struct WebViewerView: View {
16
    @EnvironmentObject var appNavigation : AppNavigation
17
    @State private var isCompleted : Bool = false
18
 
19
    private let appData : AppData = AppData.sharedInstance
20
 
21
    private var content : String
22
 
23
    private var slideName : String;
24
 
25
 
26
    init(content : String, slideName : String)
27
    {
28
        self.content = content
29
 
30
 
31
        self.slideName = slideName
32
 
33
 
34
 
35
 
36
    }
37
 
38
    var body: some View {
39
        VStack(spacing: 0)
40
        {
41
            HStack {
42
                Button(action: {
43
                    appData.topicUuidActive = ""
44
                    appData.capsuleUuidActive = ""
45
                    appData.save()
46
 
47
 
48
                    appNavigation.subpageActive = .topics
49
 
50
 
51
                }, label: {
52
 
53
 
54
                    Image(systemName: "chevron.backward")
55
                    .frame(width: 32, height: 32, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)
56
                    .aspectRatio(contentMode: .fit)
57
                    .foregroundColor(Color("color_app_bar_foreground"))
58
                })
59
                .padding(.leading, 16)
60
 
61
                Text(slideName)
62
                .font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_APP_BAR_HEAD1 ))
63
                .foregroundColor(Color("color_app_bar_foreground"))
64
                    .padding(.leading, 4)
65
 
66
                Spacer()
67
            }
68
            .background(Color("color_app_bar_background"))
69
            .edgesIgnoringSafeArea(.top)
70
            .frame(height: 50)
71
            Divider()
72
        ScrollView {
73
            TextHtmlView(content: content)
74
                .padding(10)
75
        }
76
        }.background(Color("color_window_background"))
77
    }
78
}
79
 
80
 
81
struct WebViewerView_Previews: PreviewProvider {
82
    static var previews: some View {
83
        WebViewerView(
84
            content :  "<html><head></head><body><h1>Test</h1></body></html>",
85
            slideName:  "")
86
    }
87
}
88
 
89
 
90
 
91