Skip to content

Commit 064fb27

Browse files
initial commit
1 parent ec11950 commit 064fb27

File tree

8 files changed

+564
-0
lines changed

8 files changed

+564
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

enagage_webview.xcodeproj/project.pbxproj

Lines changed: 461 additions & 0 deletions
Large diffs are not rendered by default.

enagage_webview.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

enagage_webview/.DS_Store

6 KB
Binary file not shown.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//
2+
// EngageWebview.swift
3+
// enagage_webview
4+
//
5+
// Created by admin on 8/3/23.
6+
//
7+
8+
import UIKit
9+
import Foundation
10+
11+
public class EngageWebview{
12+
public init() {}
13+
14+
public static func getEngageWebviewViewController(webURL : String, titleText : String) -> UIViewController{
15+
let bundle = Bundle(for: EngageWebviewController.self)
16+
let vc = EngageWebviewController(nibName: "EngageWebviewController", bundle: bundle)
17+
vc.titleText = titleText
18+
vc.webviewURL = webURL
19+
return vc
20+
}
21+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
//
2+
// EngageWebviewController.swift
3+
// enagage_webview
4+
//
5+
// Created by admin on 8/3/23.
6+
//
7+
8+
import Foundation
9+
import WebKit
10+
11+
class EngageWebviewController : UIViewController, WKUIDelegate {
12+
var webView: WKWebView!
13+
var titleText = ""
14+
var webviewURL = ""
15+
16+
override func viewDidLoad() {
17+
super.viewDidLoad()
18+
19+
view.backgroundColor = .white
20+
navigationItem.title = titleText.uppercased()
21+
22+
let myURL = URL(string:webviewURL)
23+
let myRequest = URLRequest(url: myURL!)
24+
webView.load(myRequest)
25+
}
26+
27+
28+
override func loadView() {
29+
let webConfiguration = WKWebViewConfiguration()
30+
webConfiguration.websiteDataStore = WKWebsiteDataStore.default()
31+
webConfiguration.preferences.javaScriptCanOpenWindowsAutomatically = true
32+
webConfiguration.allowsInlineMediaPlayback = true
33+
34+
webConfiguration.preferences.setValue(true, forKey: "javaScriptEnabled")
35+
webConfiguration.preferences.setValue(true, forKey: "loadsImagesAutomatically")
36+
webConfiguration.preferences.setValue(true, forKey: "allowFileAccessFromFileURLs")
37+
if #available(iOS 14.0, *) {
38+
webConfiguration.defaultWebpagePreferences.allowsContentJavaScript = true
39+
} else {
40+
webConfiguration.preferences.javaScriptEnabled = true
41+
}
42+
webView = WKWebView(frame: .zero, configuration: webConfiguration)
43+
44+
webView.uiDelegate = self
45+
view = webView
46+
}
47+
}
48+
49+

enagage_webview/enagage_webview.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// enagage_webview.h
3+
// enagage_webview
4+
//
5+
// Created by admin on 8/2/23.
6+
//
7+
8+
#import <Foundation/Foundation.h>
9+
10+
//! Project version number for enagage_webview.
11+
FOUNDATION_EXPORT double enagage_webviewVersionNumber;
12+
13+
//! Project version string for enagage_webview.
14+
FOUNDATION_EXPORT const unsigned char enagage_webviewVersionString[];
15+
16+
// In this header, you should import all the public headers of your framework using statements like #import <enagage_webview/PublicHeader.h>
17+
18+

0 commit comments

Comments
 (0)