tokenary/Encrypted Ink/Screens/ApproveViewController.swift

38 lines
996 B
Swift
Raw Normal View History

2021-06-13 04:41:04 +03:00
// Copyright © 2021 Encrypted Ink. All rights reserved.
import Cocoa
class ApproveViewController: NSViewController {
2021-06-13 07:01:01 +03:00
@IBOutlet weak var titleLabel: NSTextField!
@IBOutlet var metaTextView: NSTextView!
2021-06-19 12:06:13 +03:00
@IBOutlet weak var okButton: NSButton!
2021-06-13 07:01:01 +03:00
2021-06-13 09:32:07 +03:00
var approveTitle: String!
var meta: String!
var completion: ((Bool) -> Void)!
2021-06-13 09:32:07 +03:00
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
}
2021-06-13 07:01:01 +03:00
override func viewDidLoad() {
super.viewDidLoad()
2021-06-13 09:32:07 +03:00
titleLabel.stringValue = approveTitle
metaTextView.string = meta
2021-06-13 07:01:01 +03:00
}
@IBAction func actionButtonTapped(_ sender: Any) {
completion(true)
2021-06-13 07:01:01 +03:00
}
@IBAction func cancelButtonTapped(_ sender: NSButton) {
completion(false)
2021-06-13 07:01:01 +03:00
}
2021-06-13 04:41:04 +03:00
}