A small menubar app that allows you to switch between R versions quickly (if you have multiple versions of R framework installed). https://rud.is/rswitch
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.0 KiB

//
// RStudioServerSession.swift
// RSwitch
//
// Created by hrbrmstr on 9/5/19.
// Copyright © 2019 Bob Rudis. All rights reserved.
//
import Foundation
import Cocoa
5 years ago
class RStudioServerSession : Codable {
var url : String
var menuTitle : String
5 years ago
var wk : ToolbarWebViewController?
var wv : RstudioServerSessionWebViewController?
5 years ago
private enum CodingKeys: String, CodingKey {
case url
case menuTitle
}
init(url: String, title: String) {
self.url = url
self.menuTitle = title
5 years ago
self.wk = nil
self.wv = nil
}
func show() {
if (wk == nil) {
5 years ago
wk = NSStoryboard(name: "Main", bundle: nil).instantiateController(withIdentifier: "windowWithWkViewAndToolbar") as? ToolbarWebViewController
wk?.nicknname.stringValue = menuTitle
wk?.url.stringValue = url
wv = (wk?.contentViewController as! RstudioServerSessionWebViewController)
}
5 years ago
wk?.showWindow(self)
wv?.loadWebView(urlIn: url)
NSApp.activate(ignoringOtherApps: true)
}
}