tokenary/Encrypted Ink/Screens/ApproveViewController.swift
2021-06-13 10:01:19 +03:00

37 lines
953 B
Swift

// Copyright © 2021 Encrypted Ink. All rights reserved.
import Cocoa
class ApproveViewController: NSViewController {
@IBOutlet weak var titleLabel: NSTextField!
@IBOutlet var metaTextView: NSTextView!
var approveTitle: String!
var meta: String!
var completion: ((Bool) -> Void)!
static func with(title: String, meta: String, completion: @escaping (Bool) -> Void) -> ApproveViewController {
let new = instantiate(ApproveViewController.self)
new.completion = completion
new.meta = meta
new.approveTitle = title
return new
}
override func viewDidLoad() {
super.viewDidLoad()
titleLabel.stringValue = approveTitle
metaTextView.string = meta
}
@IBAction func actionButtonTapped(_ sender: Any) {
completion(true)
}
@IBAction func cancelButtonTapped(_ sender: NSButton) {
completion(false)
}
}