This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ViewController.swift | |
// . . . | |
// MARK: Conforming to WKScriptMessageHandler protocol | |
extension ViewController: WKScriptMessageHandler { | |
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { | |
print(#function) | |
if message.name == "callback", let messageBody = message.body as? String, let messageBodyData = messageBody.data(using: .utf8) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// AuthenticationResponse.swift | |
import Foundation | |
/** | |
Container for JSON callbacks expected from the authentication endpoint. | |
*/ | |
struct AuthenticationResponse: Codable { | |
struct Callback: Codable { | |
let type: String? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WebViewController.js | |
(function () { | |
if (window.webkit) { | |
var response = { | |
"authId": "authId", | |
"callbacks": [ | |
{ | |
"type": "Code", | |
"input": [], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ViewController.swift | |
// . . . | |
import WebKit | |
// . . . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ViewController.swift | |
// . . . | |
class ViewController: UIViewController { | |
// . . . | |
/** | |
App Group name. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ViewController.swift | |
import UIKit | |
class ViewController: UIViewController { | |
var webViewController: WebViewController! | |
// . . . | |
/** |
NewerOlder