34 lines
897 B
Swift
34 lines
897 B
Swift
|
//
|
||
|
// MenuController.swift
|
||
|
// Tusker
|
||
|
//
|
||
|
// Created by Shadowfacts on 11/14/20.
|
||
|
// Copyright © 2020 Shadowfacts. All rights reserved.
|
||
|
//
|
||
|
|
||
|
import UIKit
|
||
|
|
||
|
struct MenuController {
|
||
|
|
||
|
static func refreshCommand(discoverabilityTitle: String?) -> UIKeyCommand {
|
||
|
return UIKeyCommand(title: "Refresh", action: #selector(RefreshableViewController.refresh), input: "r", modifierFlags: .command, discoverabilityTitle: discoverabilityTitle)
|
||
|
}
|
||
|
|
||
|
static func buildMainMenu(builder: UIMenuBuilder) {
|
||
|
builder.insertChild(buildViewMenu(), atEndOfMenu: .view)
|
||
|
}
|
||
|
|
||
|
private static func buildViewMenu() -> UIMenu {
|
||
|
return UIMenu(
|
||
|
title: "",
|
||
|
image: nil,
|
||
|
identifier: nil,
|
||
|
options: .displayInline,
|
||
|
children: [
|
||
|
refreshCommand(discoverabilityTitle: nil),
|
||
|
]
|
||
|
)
|
||
|
}
|
||
|
|
||
|
}
|