This project is a test project that invokes JavaScript
from native Swift
code. WKWebKit
is used to invoke JavaScript
. Initially JavaScript
is loaded from a web url in String
form and evaluated using WKWebView
instance. Operation
enum represents a single operation which will be created using JS function startOperation
. 4 different operations are created and 4 different progress UI elements are used to represent each operation. Progress UI elements are custom UIView's (HorizontalProgressBar
and CircularProgressBar
). A MessageHandler (jumbo
here) is added to WKWebViewConfiguration's
userContentController
which receives the messages posted on the handler through WKScriptMessageHandler's
delegate method didReceive
. Upon receiving a new message, it is identified which operation this message belongs to and that operation's UI progress is updated accordingly using handleMessage
(inside VaccineTrialViewController
).
There are 4 unit tests added JavaScriptTests